Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy on more chains and update README #69

Merged
merged 3 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy :; source .env && export FOUNDRY_PROFILE=deploy && forge script script/DeployFactory.s.sol --rpc-url $${RPC_URL} --account $${ACCOUNT} --broadcast --verify
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,19 @@ forge test
## Deploying
To deploy on a new chain, in your `.env` set
```bash
FOUNDRY_PROFILE=deploy
#`cast wallet` name
ACCOUNT=
# Node RPC URL
RPC_URL=
# Optional Etherscan API key for contract verification
ETHERSCAN_API_KEY=
```
See [here](https://book.getfoundry.sh/reference/cast/cast-wallet-import) for more details on `cast wallet`.

Then run
```
forge script script/DeployFactory.s.sol --rpc-url https://...
make deploy
```

As written, the script uses a private key that is loaded from env (`PRIVATE_KEY`). However the deployer can configure the deploy key as they wish, see [here](https://book.getfoundry.sh/reference/forge/forge-script?highlight=script#wallet-options---keystore).

## Influences
Much of the code in this repository started from Solady's [ERC4337](https://github.com/Vectorized/solady/blob/main/src/accounts/ERC4337.sol) implementation. We were also influenced by [DaimoAccount](https://github.com/daimo-eth/daimo/blob/master/packages/contract/src/DaimoAccount.sol), which pioneered using passkey signers on ERC-4337 accounts, and [LightAccount](https://github.com/alchemyplatform/light-account).
61 changes: 61 additions & 0 deletions broadcast/DeployFactory.s.sol/1/run-1714757847.json

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions broadcast/DeployFactory.s.sol/1/run-latest.json

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions broadcast/DeployFactory.s.sol/10/run-1714743977.json

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions broadcast/DeployFactory.s.sol/10/run-1714744077.json

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions broadcast/DeployFactory.s.sol/10/run-latest.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions broadcast/DeployFactory.s.sol/421614/run-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"transactions": [
{
"hash": "0x68bf9b639a1f19296a9408646f046ced382cc222a61d97520b451c4050615fb0",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x914d7fec6aac8cd542e72bca78b30650d45643d7",
"function": null,
"arguments": null,
"transaction": {
"from": "0xfd896bf5eba7e1b9843b91ef6182de16b547273b",
"to": "0x914d7fec6aac8cd542e72bca78b30650d45643d7",
"gas": "0x85553",
"value": "0x0",
"input": "0x278d06dab87f67bb2d83470a70c8975a2c99872f290058fb43bcc47da5f0390c60a060405260405161071638038061071683398101604081905261002291610033565b6001600160a01b0316608052610063565b60006020828403121561004557600080fd5b81516001600160a01b038116811461005c57600080fd5b9392505050565b6080516106846100926000396000818160b301528181610139015281816101dc015261027901526106846000f3fe60806040526004361061003f5760003560e01c8063250b1b41146100445780633ffba36f1461008e5780635c60da1b146100a1578063db4c545e146100d5575b600080fd5b34801561005057600080fd5b5061006461005f366004610480565b61017f565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61006461009c366004610480565b610235565b3480156100ad57600080fd5b506100647f000000000000000000000000000000000000000000000000000000000000000081565b3480156100e157600080fd5b50604080517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f360609081527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076835261600960209081527f0000000000000000000000000000000000000000000000000000000000000000601e5268603d3d8160223d3973600a52605f60212093839052600090915291815201610085565b600061022d61021c604080517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f360609081527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e207683526160096020527f0000000000000000000000000000000000000000000000000000000000000000601e5268603d3d8160223d3973600a52605f60212091909252600090915290565b610227868686610344565b3061037a565b949350505050565b6000828103610270576040517f3c776be100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806102a8347f00000000000000000000000000000000000000000000000000000000000000006102a3898989610344565b61039c565b915091508092508161033b576040517f6f2de70e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690636f2de70e906103089089908990600401610616565b600060405180830381600087803b15801561032257600080fd5b505af1158015610336573d6000803e3d6000fd5b505050505b50509392505050565b600083838360405160200161035b9392919061062a565b6040516020818303038152906040528051906020012090509392505050565b600060ff60005350603592835260601b60015260155260556000908120915290565b6000806040517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f36060527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e207660405261600960205284601e5268603d3d8160223d3973600a52605f60212060358201523060581b815260ff8153836015820152605581209150813b6104485783605f602188f59150816104435763301164256000526004601cfd5b61046e565b60019250851561046e5760003860003889865af161046e5763b12d13eb6000526004601cfd5b80604052506000606052935093915050565b60008060006040848603121561049557600080fd5b833567ffffffffffffffff808211156104ad57600080fd5b818601915086601f8301126104c157600080fd5b8135818111156104d057600080fd5b8760208260051b85010111156104e557600080fd5b6020928301989097509590910135949350505050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6000838385526020808601955060208560051b8301018460005b87811015610609577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840301895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126105bf57600080fd5b8701848101903567ffffffffffffffff8111156105db57600080fd5b8036038213156105ea57600080fd5b6105f58582846104fb565b9a86019a945050509083019060010161055e565b5090979650505050505050565b60208152600061022d602083018486610544565b60408152600061063e604083018587610544565b905082602083015294935050505056fea2646970667358221220e7c6d439c70f2eaafecf93e778d782e7cba05d58eaf254e2d2be4dd98bc1b11464736f6c63430008170033000000000000000000000000000100abaad02f1cfc8bbe32bd5a564817339e72",
"nonce": "0x8",
"chainId": "0x66eee",
"accessList": null,
"type": null
},
"additionalContracts": [
{
"transactionType": "CREATE2",
"address": "0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",
"initCode": "0x60a060405260405161071638038061071683398101604081905261002291610033565b6001600160a01b0316608052610063565b60006020828403121561004557600080fd5b81516001600160a01b038116811461005c57600080fd5b9392505050565b6080516106846100926000396000818160b301528181610139015281816101dc015261027901526106846000f3fe60806040526004361061003f5760003560e01c8063250b1b41146100445780633ffba36f1461008e5780635c60da1b146100a1578063db4c545e146100d5575b600080fd5b34801561005057600080fd5b5061006461005f366004610480565b61017f565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61006461009c366004610480565b610235565b3480156100ad57600080fd5b506100647f000000000000000000000000000000000000000000000000000000000000000081565b3480156100e157600080fd5b50604080517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f360609081527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076835261600960209081527f0000000000000000000000000000000000000000000000000000000000000000601e5268603d3d8160223d3973600a52605f60212093839052600090915291815201610085565b600061022d61021c604080517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f360609081527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e207683526160096020527f0000000000000000000000000000000000000000000000000000000000000000601e5268603d3d8160223d3973600a52605f60212091909252600090915290565b610227868686610344565b3061037a565b949350505050565b6000828103610270576040517f3c776be100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806102a8347f00000000000000000000000000000000000000000000000000000000000000006102a3898989610344565b61039c565b915091508092508161033b576040517f6f2de70e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690636f2de70e906103089089908990600401610616565b600060405180830381600087803b15801561032257600080fd5b505af1158015610336573d6000803e3d6000fd5b505050505b50509392505050565b600083838360405160200161035b9392919061062a565b6040516020818303038152906040528051906020012090509392505050565b600060ff60005350603592835260601b60015260155260556000908120915290565b6000806040517fcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f36060527f5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e207660405261600960205284601e5268603d3d8160223d3973600a52605f60212060358201523060581b815260ff8153836015820152605581209150813b6104485783605f602188f59150816104435763301164256000526004601cfd5b61046e565b60019250851561046e5760003860003889865af161046e5763b12d13eb6000526004601cfd5b80604052506000606052935093915050565b60008060006040848603121561049557600080fd5b833567ffffffffffffffff808211156104ad57600080fd5b818601915086601f8301126104c157600080fd5b8135818111156104d057600080fd5b8760208260051b85010111156104e557600080fd5b6020928301989097509590910135949350505050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6000838385526020808601955060208560051b8301018460005b87811015610609577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840301895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126105bf57600080fd5b8701848101903567ffffffffffffffff8111156105db57600080fd5b8036038213156105ea57600080fd5b6105f58582846104fb565b9a86019a945050509083019060010161055e565b5090979650505050505050565b60208152600061022d602083018486610544565b60408152600061063e604083018587610544565b905082602083015294935050505056fea2646970667358221220e7c6d439c70f2eaafecf93e778d782e7cba05d58eaf254e2d2be4dd98bc1b11464736f6c63430008170033000000000000000000000000000100abaad02f1cfc8bbe32bd5a564817339e72"
}
],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0x1f3fd2",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"transactionHash": "0x68bf9b639a1f19296a9408646f046ced382cc222a61d97520b451c4050615fb0",
"transactionIndex": "0x3",
"blockHash": "0xd7c6bd51cfa5634d3ebada2e7996a5caff40ca205646c94cd22c3fbb91574ec8",
"blockNumber": "0x231294e",
"gasUsed": "0x65478",
"effectiveGasPrice": "0x5f5e100",
"from": "0xfd896bf5eba7e1b9843b91ef6182de16b547273b",
"to": "0x914d7fec6aac8cd542e72bca78b30650d45643d7",
"contractAddress": null,
"gasUsedForL1": "0x0",
"l1BlockNumber": "0x57ec2d"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1713898604,
"chain": 421614,
"commit": "5e5fb8d"
}
115 changes: 115 additions & 0 deletions broadcast/DeployFactory.s.sol/7777777/run-1714757746.json

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions broadcast/DeployFactory.s.sol/7777777/run-latest.json

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions script/DeployFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ contract DeployFactoryScript is Script {

function run() public {
console2.log("Deploying on chain ID", block.chainid);
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address implementation = SafeSingletonDeployer.broadcastDeploy({
deployerPrivateKey: deployerPrivateKey,
creationCode: type(CoinbaseSmartWallet).creationCode,
args: "",
salt: 0x3438ae5ce1ff7750c1e09c4b28e2a04525da412f91561eb5b57729977f591fbb
});
console2.log("implementation", implementation);
assert(implementation == EXPECTED_IMPLEMENTATION);
address factory = SafeSingletonDeployer.broadcastDeploy({
deployerPrivateKey: deployerPrivateKey,
creationCode: type(CoinbaseSmartWalletFactory).creationCode,
args: abi.encode(implementation),
salt: 0x278d06dab87f67bb2d83470a70c8975a2c99872f290058fb43bcc47da5f0390c
Expand Down
Loading