foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.18k stars 1.7k forks source link

Support Account Abstraction in Foundry #7128

Open excaliborr opened 7 months ago

excaliborr commented 7 months ago

Component

Forge

Describe the feature you would like

Adding account abstraction to foundry would allow users to leverage paymasters to submit transactions in their foundry scripts, this also allows developers to make gasless transactions to testnets without needing to find a faucet as paymaster providers can sponsor the testnet gas, and many do already!

Additional context

Hardhat Implementation

We have already built a plugin to add account abstraction scripting to hardhat and want to work on getting it implemented into foundry next, if you want to check out the hardhat plugin to see how it works check it out here.

Who we are?

We are Wonderland, the largest core development group in web3. Our commitment is to a financial future that's open, decentralized, and accessible to all.

Design

The design of how the scripts would work is open-ended and no way a final design, the goal is to discuss the best way to implement this feature.

Example code snippet:

// Single broadcast
vm.sponsoredBroadcast(signer);
testToken.mint(100);

// Start and stop broadcast
vm.startSponsoredBroadcast(signer);
ERC20 testToken = new TestToken();
testToken.mint(100);
vm.stopSponsoredBroadcast();

Important Caveats

Open ended questions for discussion:

gakonst commented 7 months ago

1232 related -- thinking about how to make this work for both

zerosnacks commented 2 months ago

Given https://eips.ethereum.org/EIPS/eip-7702 is included in the Prague/Electra network upgrade I think it makes sense to considering having support for account abstraction.

@excaliborr would this specifically be related to supporting ERC-4337, given that one of the design goals of EIP-7702 is not conflicting with it?

I feel a lot of account abstraction proposals are still up in the air.

Feel free to leave thoughts / requirements related to how extensions in Foundry could look on https://github.com/foundry-rs/foundry/issues/8266