微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

web3 encodeFunctionCall不起作用在1个事务中一起2个特定的函数调用不起作用

如何解决web3 encodeFunctionCall不起作用在1个事务中一起2个特定的函数调用不起作用

我正在尝试使用web3 encodefunctionCall在同一事务中从deposit执行withdrawyDAI (yearn.finance)函数deposit函数有效,但是withdraw函数失败。但是,如果我单独执行withdraw函数,那么它将起作用。

let abi1 = web3.eth.abi.encodefunctionCall( { "name": "deposit","type": "function","inputs": [ { "name": "_amount","type": "uint256" } ] },[web3.utils.toWei((1000).toString(),'Ether')] );

let abi2 = web3.eth.abi.encodefunctionCall( {"constant":false,"inputs":[],"name":"withdrawAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},[] );

我将上述内容编码为js文件,然后使用数组调用智能合约中存在的函数。智能合约中存在的代码

for (uint i = 0; i < _addrs.length; i++)
    address(_addrs[i]).call(_bytecode[i]);

没有错误消息。

这是yDAI (yearn.finance)代码和abi。

https://etherscan.io/address/0xACd43E627e64355f1861cEC6d3a6688B31a6F952#code

有人可以帮我解决这个难题吗?

关于, ish

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。