Arbitrum Stylus logo

Stylus by Example

Multicall

An Arbitrum Stylus version implementation of Solidity Multi Call contract that aggregates multiple queries using a for loop and RawCall.

Example implementation of a Multi Call contract written in Rust: Here is the interface for TimeLock.

1/**
2 * This file was automatically generated by Stylus and represents a Rust program.
3 * For more information, please see [The Stylus SDK](https://github.com/OffchainLabs/stylus-sdk-rs).
4 */
5
6// SPDX-License-Identifier: MIT-OR-APACHE-2.0
7pragma solidity ^0.8.23;
8
9interface IMultiCall {
10    function multicall(address[] memory addresses, bytes[] memory data) external view returns (bytes[] memory);
11
12    error ArraySizeNotMatch();
13
14    error CallFailed(uint256);
15}
1/**
2 * This file was automatically generated by Stylus and represents a Rust program.
3 * For more information, please see [The Stylus SDK](https://github.com/OffchainLabs/stylus-sdk-rs).
4 */
5
6// SPDX-License-Identifier: MIT-OR-APACHE-2.0
7pragma solidity ^0.8.23;
8
9interface IMultiCall {
10    function multicall(address[] memory addresses, bytes[] memory data) external view returns (bytes[] memory);
11
12    error ArraySizeNotMatch();
13
14    error CallFailed(uint256);
15}

src/lib.rs

1Loading...
1Loading...

Cargo.toml

1Loading...
1Loading...

src/main.rs

1Loading...
1Loading...