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

wip entrykit #2

Open
wants to merge 4 commits into
base: entrypoint-0.7
Choose a base branch
from
Open
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
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
deploy :; source .env && export FOUNDRY_PROFILE=deploy && forge script script/DeployFactory.s.sol --rpc-url $${RPC_URL} --account $${ACCOUNT} --broadcast --verify
deploy: ;
export FOUNDRY_PROFILE=deploy && \
forge script script/DeployFactory.s.sol \
--rpc-url $${RPC_URL} \
--private-key $${PRIVATE_KEY} \
--broadcast

deploy-local: ;
source .env && \
export FOUNDRY_PROFILE=deploy && \
cast rpc anvil_setCode 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3 \
--rpc-url $${RPC_URL} && \
forge script script/DeployFactory.s.sol \
--rpc-url $${RPC_URL} \
--private-key $${PRIVATE_KEY} \
--broadcast
110 changes: 110 additions & 0 deletions broadcast/DeployFactory.s.sol/17420/run-1728906404.json

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

47 changes: 32 additions & 15 deletions script/DeployFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,40 @@ import {SafeSingletonDeployer} from "safe-singleton-deployer-sol/src/SafeSinglet
import {CoinbaseSmartWallet, CoinbaseSmartWalletFactory} from "../src/CoinbaseSmartWalletFactory.sol";

contract DeployFactoryScript is Script {
address constant EXPECTED_IMPLEMENTATION = 0x000100abaad02f1cfC8Bbe32bD5a564817339E72;
address constant EXPECTED_FACTORY = 0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428a;
address constant EXPECTED_IMPLEMENTATION =
0x09655Fb46D2673302AEea47a496C7F4408f5c192;
address constant EXPECTED_FACTORY =
0x356336adA1619BeC1Ae4E6D94Dd9c0490DA414a8;

function isDeployed(address addr) public view returns (bool) {
// Check if there is a contract at the address
return addr.code.length > 0;
}

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

if (isDeployed(EXPECTED_IMPLEMENTATION)) {
console2.log("implementation already deployed");
} else {
address implementation = SafeSingletonDeployer.broadcastDeploy({
creationCode: type(CoinbaseSmartWallet).creationCode,
salt: 0x3438ae5ce1ff7750c1e09c4b28e2a04525da412f91561eb5b57729977f591fbb
});
console2.log("implementation", implementation);
assert(implementation == EXPECTED_IMPLEMENTATION);
}

if (isDeployed(EXPECTED_FACTORY)) {
console2.log("factory already deployed");
} else {
address factory = SafeSingletonDeployer.broadcastDeploy({
creationCode: type(CoinbaseSmartWalletFactory).creationCode,
args: abi.encode(EXPECTED_IMPLEMENTATION),
salt: 0x278d06dab87f67bb2d83470a70c8975a2c99872f290058fb43bcc47da5f0390c
});
console2.log("factory", factory);
assert(factory == EXPECTED_FACTORY);
}
}
}