Multicall
Overview
Multicall executes multiple calls as a single transaction. If one call fails, the entire operation is aborted. Use it to prevent leaving your system in an inconsistent state.
Usage example
Before you run protostar multicall
, you need to create an account in order to sign the transaction. If you want to deploy contract within a multicall, you need to declare it first.
Then, create a toml file containing calls defined as array of tables.
In that file, you can use contract address of a contract to be deployed by using references ($DEPLOY_CALL_ID
).
References can be used in contract-address
and inputs
attributes as demonstrated in the example below.
[[call]]
type = "deploy"
class-hash = 0xDEADBEEF
inputs = []
id = "my_contract"
[[call]]
type = "invoke"
contract-address = "$my_contract"
function = "increase_balance"
inputs = [42]
Protostar supports two types of calls — deploy
and invoke
, which take similar arguments to deploy command
and invoke command
.
[project]
protostar-version = "0.8.1"
[multicall]
account-address = 0x...
gateway-url = "http://127.0.0.1:5050"
chain-id = 1536727068981429685321
max-fee = "auto"
export PROTOSTAR_ACCOUNT_PRIVATE_KEY 0x...
protostar multicall calls.toml
Multicall has been sent.
transaction hash: 0x...
my_contract : 0x...