【发布时间】:2022-08-17 19:39:10
【问题描述】:
作为来自 Ethernaut 的 PuzzleWallet 挑战的一部分,我希望从我的合同中调用外部合同的这种方法:
function multicall(bytes[] calldata data) external payable onlyWhitelisted
更具体地说,我正在尝试使用递归调用进行调用。
multidata
________|________
| |
multidata multidata
| |
deposit deposit
我正在使用abi.encodeWithSignature 方法,但看起来 Solidity 不允许Nested dynamic arrays not implemented here.:
bytes memory data = abi.encode([bytes4(keccak256(\'deposit()\'))]);
bytes memory singleMulticallData = abi.encodePacked(bytes4(keccak256(\'multicall(bytes[])\')), data);
(bool successDeposit, ) = address(proxy).call(abi.encodeWithSignature(\"multicall(bytes[])\", [singleMulticallData, singleMulticallData]));
require(successDeposit, \"deposit not successful\");
关于如何创建包含字节的字节数组的任何想法?
标签: solidity