Generalized EIP-3074 Invokers.
BaseInvoker
- Invoker template for building arbitrary Invoker logic.BatchInvoker
- Invoker with batch transaction support.
Warning
WIP. Very experimental, not audited, use with caution.
Developing with these contracts currently requires foundry-alphanet
– a repository containing patches for Foundry to support EIP-3074 opcodes.
We have abstracted foundry-alphanet
docker image execution into a set of Makefile scripts listed below.
First, we will need to set up the submodules for the repository.
make install
We can build the contracts using forge build
via foundry-alphanet
:
make cmd="forge build"
We can run tests using forge test
via foundry-alphanet
:
make cmd="forge test"
We can launch an Anvil instance using anvil
via foundry-alphanet
:
make cmd="anvil"
Below, we will deploy the BatchInvoker
contract to a local Anvil network.
First, we will need to launch an Anvil instance. If you are deploying to a launched network, you can skip this step.
make cmd="anvil"
Deploy the BatchInvoker
contract to the network.
make cmd="forge script Deploy --sig 'deploy()' --rpc-url $RPC_URL --private-key $EXECUTOR_PRIVATE_KEY --broadcast"
Note: if the $RPC_URL
you're pointing to is on host, you should use http://host.docker.internal:8545 instead of http://localhost:8545. See Docker's networking docs here.
We can test the BatchInvoker
by sending a transaction via the contract.
make cmd="forge script Executor --sig 'sendEth(address,address,uint256)' $INVOKER_ADDRESS 0x3074ca113074ca113074ca113074ca113074ca11 0.01ether --rpc-url $RPC_URL --broadcast"
Powered by Reth AlphaNet, check out Otim's 3074 devnet docs for detailed information on how to set up the network, get devnet ETH, use the deployed BatchInvoker
, and more.