如何批准在Sushiswap上的Bentobox转移?
我具有与sushiswap互动的这种坚固性功能:
function swapSingleParamswhitPool(
uint256 amountIn,
uint256 amountOutMinimum,
address pool,
address tokenIn,
bytes memory data) public payable {
ITridentRouter.ExactInputSingleParams memory exactInputSingleParams = ITridentRouter.ExactInputSingleParams(amountIn, amountOutMinimum, pool, tokenIn, data);
tridentRouter.exactInputSingle{ value: msg.value }(exactInputSingleParams);
}
如果我运行此功能,我总是会出现错误:
{“代码”:3,“消息”:“ rececution drected:bentobox:bentobox:转移未批准”,“ data”: “ 0x08C379A00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Y000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000来; 000000000000000000000000000000000000000000000000000000001F42656E746F426F783A205472616E736666666572206E6E6F742061707070726F766656400 }
我将Bentobox上的Masternarts设置为批准,也试图手动批准,但没有任何效果。谁能帮我吗?非常感谢。
I have this solidity function for interacting with Sushiswap:
function swapSingleParamswhitPool(
uint256 amountIn,
uint256 amountOutMinimum,
address pool,
address tokenIn,
bytes memory data) public payable {
ITridentRouter.ExactInputSingleParams memory exactInputSingleParams = ITridentRouter.ExactInputSingleParams(amountIn, amountOutMinimum, pool, tokenIn, data);
tridentRouter.exactInputSingle{ value: msg.value }(exactInputSingleParams);
}
If I run this function, I always got error:
{ "code": 3, "message": "execution reverted: BentoBox: Transfer not approved", "data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001f42656e746f426f783a205472616e73666572206e6f7420617070726f76656400" }
I set masterContract on BentoBox to approved, tried to approve manually too, but nothing works. Can anyone help me with this? Thank You very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我目前遇到了这个问题并以这种方式解决了:
Tranfer代币从用户到您的合同(如上所述的可选元素)
i currently faced this issue and solved it in this way:
Tranfer the tokens from the user to your contract (optional as mentioned above)
Approve the allowance for the tokens to move from the contract/user wallet to the bento box