https://github.com/destiner/deployless-multicall
https://github.com/destiner/deployless-multicall
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/destiner/deployless-multicall
- Owner: Destiner
- License: mit
- Created: 2021-10-07T00:25:06.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T17:22:53.000Z (over 4 years ago)
- Last Synced: 2025-04-03T06:22:05.508Z (over 1 year ago)
- Language: Solidity
- Size: 5.86 KB
- Stars: 32
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deployless Multicall
An implementation of Multicall contract that doesn't require it to be deployed. Can be used in any EVM chain at any block.
## Usage
[ethcall](https://github.com/Destiner/ethcall) provides a convenient wrapper around low-level interation. Alternatively, you can compile a contract yourself, and make an "read-only deploy" eth_call:
```js
const args = encode(deploylessMulticallAbi, [calls]);
const data = ethers.utils.hexConcat([deploylessMulticallBytecode, args]);
const callData = await provider.call({
data,
});
const result = decode(multicallAbi, 'aggregate', callData);
return result;
```
where `encode` and `decode` is the ABI coding functions.
## How
Normally, a consturcor in Solidity contract returns the bytecode of the newly created contract. Here, we use inline assembly to overwrite return data with the call result.
The code makes some assuptions about how the variables stored in memory, so it's better to stick to Solidity version specified in the contract.