Skip to content
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
121 changes: 121 additions & 0 deletions broadcast/DeployFactory.s.sol/17069/run-1754374105692.json

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

121 changes: 121 additions & 0 deletions broadcast/DeployFactory.s.sol/690/run-1754374168600.json

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

121 changes: 121 additions & 0 deletions broadcast/DeployFactory.s.sol/695569/run-1754374144569.json

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

46 changes: 31 additions & 15 deletions script/DeployFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +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 = 0x00000110dCdEdC9581cb5eCB8467282f2926534d;
address constant EXPECTED_FACTORY = 0xBA5ED110eFDBa3D005bfC882d75358ACBbB85842;
address constant EXPECTED_IMPLEMENTATION =
0x1d8a44516C3B3Dc1306b140106EA1b73f4FEAC2a;
address constant EXPECTED_FACTORY =
0x08e62719a7da36830c50a2903517c2B13d4c8204;

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: 0x3771220e68256b8d5aa359fe953bf594dad1a5473239d1251256f0e5e7473b16
});
console2.log("implementation", implementation);
assert(implementation == EXPECTED_IMPLEMENTATION);

address factory = SafeSingletonDeployer.broadcastDeploy({
creationCode: type(CoinbaseSmartWalletFactory).creationCode,
args: abi.encode(EXPECTED_IMPLEMENTATION),
salt: 0x0000000000000000000000000000000000000000e8448b6b950698874d6a35bd
});
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: 0x3771220e68256b8d5aa359fe953bf594dad1a5473239d1251256f0e5e7473b16
});
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: 0x0000000000000000000000000000000000000000e8448b6b950698874d6a35bd
});
console2.log("factory", factory);
assert(factory == EXPECTED_FACTORY);
}
}
}