Multicall
Multicall simply aggregates multiple contract calls into a single JSON RPC request.
Overview
In order to extract a large amount of data in an efficient way we have used Uniswap Multicall Contract for all JSON RPC requests in adapters.
We have coded a JS wrapper over the contracts and placed it in the abi
module of our adapter SDK @spockanalytics/base
. You can use it for contract calls in your project adapter.
Multicall.singleContractMultipleData
Execute multiple inputs for a single contract.
Usage
Argument | Type | Description |
---|---|---|
address | string | contract address |
blockNumber | number optional | Block number at which you want to query |
chain | number | Network chainId |
contractInterface | Interface | Interface of contract generated through typechain |
fragment | string | Method name of contract |
callInput | OptionalMethodInputs | Input parameters |
Multicall.multipleContractMultipleData
Execute multiple inputs for multiple contracts.
Usage
Argument | Type | Description |
---|---|---|
address | string[] | Contract addresses |
blockNumber | number optional | Block at which you want to query |
chain | number | Network chainId |
contractInterface | Interface | Interface of contract generated through typechain |
fragment | string | Method name of contract |
callInput | OptionalMethodInputs | Input parameters |
Multicall.multipleContractSingleData
Execute single input for multiple contracts.
Usage
Argument | Type | Description |
---|---|---|
address | string | Contract address |
blockNumber | number optional | Block at which you want to query |
chain | number | Network chainId |
contractInterface | Interface | Interface of contract generated through typechain |
fragment | string | Method name of contract |
callInput | OptionalMethodInputs optional | Input parameters |
Multicall.execute
Execute multiple calls in one request.
Usage
Call
Argument | Type | Description |
---|---|---|
address | string | Contract address |
contractInterface | Interface | Interface of contract generated through typechain. |
fragment | string | Method name of contract |
callInput | OptionalMethodInputs optional | Input parameters |
Execute
Argument | Type | Description |
---|---|---|
blockNumber | number optional | Block at which you want to query |
calls | Call[] | Calls to be executed |
chain | number | Network chainId |
disableChunk | boolean | Disable chunk calls on out of gas error |
Call Params
Call Result
The return type of each method.
Last updated