# 多重委托调用 **Published by:** [web3zoom](https://paragraph.com/@web3zoom/) **Published on:** 2025-07-22 **URL:** https://paragraph.com/@web3zoom/iGLv1gsVuhItzO2JmaPz ## Content // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.30; contract MultiDelegateCall{ error DelegatecallFailed(); function multiDelegatecall(bytes[] calldata data) external payable returns(bytes[] memory results){ results = new bytesUnsupported embed; for(uint i; i<data.length; i++){ (bool ok, bytes memory res) = address(this).delegatecall(data[i]); if (!ok){ revert DelegatecallFailed(); } results[i] = res; } } } contract TestMultiDelegatecall is MultiDelegateCall{ event Log(address caller, string func, uint i); function func1(uint x, uint y) external { emit Log(msg.sender, "func1", x+y); } function func2() external returns(uint){ emit Log(msg.sender, "func2", 2); return 111; } } contract Helper { function getFunc1Data(uint x, uint y) external pure returns(bytes memory){ return abi.encodeWithSelector(TestMultiDelegatecall.func1.selector, x,y); } function getFunc2Data() external pure returns(bytes memory){ return abi.encodeWithSelector(TestMultiDelegatecall.func2.selector); } } 多重委托调用有可能会 ## Publication Information - [web3zoom](https://paragraph.com/@web3zoom/): Publication homepage - [All Posts](https://paragraph.com/@web3zoom/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@web3zoom): Subscribe to updates - [Twitter](https://twitter.com/primer2011): Follow on Twitter