我对区块链开发有点陌生,我正在尝试学习与其他合约的合约交互,比如 UniswapV2、PancakeSwap 路由器等......
在这里,我想删除我在本地创建的池的流动性,我使用moralis 和安全帽分叉了 bsc 主网存档。
添加流动性后,我试图像这样消除流动性:
function removeLiquidity(
address tokenA,
address tokenB
) external {
address pair = IApeFactory(FACTORY).getPair(tokenA, tokenB);
uint liquidity = IERC20(pair).balanceOf(address(this));
IERC20(pair).approve(ROUTER, liquidity);
console.log(liquidity);
(uint amountA, uint amountB) = apeRouter.removeLiquidity(
tokenA,
tokenB,
liquidity,
1,
1,
address(this),
block.timestamp + 10300
);
}
这就是我的测试的样子......
`it("Should remove liquidity BANANA/BFT", async function () {
const BANANA_BFT_tx = await apeRouter.connect(Owner).removeLiquidity(
bananaContract.address,
bftContract.address
);
await BANANA_BFT_tx.wait();
console.log(BANANA_BFT_tx);
});`
调用 2 个令牌的 removeLiquidity 后得到的是 INSUFFICIENT_LIQUIDITY_BURNED 错误?
任何想法都会帮助我,谢谢!