-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split account deployment into its own script (#62)
## Summary Etherscan can't handle IR pipeline optimization (had no issues on sourcify and okx so far) if the factory includes account creation. Deployment & verify commands ``` forge script script/003_DeploySingleOwnerMSCA.s.sol --rpc-url $RPC_URL --broadcast --verify -vvvv --slow forge script script/003.1_DeploySingleOwnerMSCAFactory.s.sol --rpc-url $RPC_URL --broadcast --verify -vvvv --slow ``` For standard json input used in manual verification ``` forge verify-contract -c 11155111 --optimizer-runs 200 --constructor-args $(cast abi-encode "constructor(address,address)" 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 0xc93D6559Fe4dB59742751A857d11a04861a50CCC) --via-ir 0x9693313996cA03a194A529ef82AB3E3a9955C66d SingleOwnerMSCA --show-standard-json-input > ~/Downloads/account.json forge verify-contract -c 11155111 --optimizer-runs 200 --constructor-args $(cast abi-encode "constructor(address)" 0x9693313996cA03a194A529ef82AB3E3a9955C66d) --via-ir 0xf4f25B6058bB5F4Bb63F51Ed8D351B66e1Fc0776 SingleOwnerMSCAFactory --show-standard-json-input > ~/Downloads/factory.json ``` ## Detail ### Changeset * Added a dedicated script to deploy account first * Updated the factory script to use a deployed account * Update the constructor of factory ### Checklist - [ ] Did you add new tests and confirm all tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `docs` folder) - [x] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [x] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [x] Did you run lint (`yarn lint`) and fix any issues? - [x] Did you run formatter (`yarn format:check`) and fix any issues (`yarn format:write`)? ## Testing * Updated the existing tests to reflect the constructor changes ## Documentation n/a
- Loading branch information
Showing
10 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2025 Circle Internet Group, Inc. All rights reserved. | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
pragma solidity 0.8.24; | ||
|
||
import {SingleOwnerMSCA} from "../src/msca/6900/v0.7/account/semi/SingleOwnerMSCA.sol"; | ||
import {PluginManager} from "../src/msca/6900/v0.7/managers/PluginManager.sol"; | ||
import {ENTRY_POINT, PLUGIN_MANAGER_ADDRESS, SINGLE_OWNER_MSCA_ADDRESS} from "./000_ContractAddress.sol"; | ||
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol"; | ||
import {Script, console} from "forge-std/src/Script.sol"; | ||
|
||
contract DeploySingleOwnerMSCAScript is Script { | ||
address payable internal constant EXPECTED_ACCOUNT_ADDRESS = payable(SINGLE_OWNER_MSCA_ADDRESS); | ||
|
||
event AccountImplementationDeployed( | ||
address indexed accountImplementation, address entryPoint, address pluginManager | ||
); | ||
|
||
function run() public { | ||
address entryPoint = ENTRY_POINT; | ||
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
vm.startBroadcast(key); | ||
SingleOwnerMSCA account; | ||
if (EXPECTED_ACCOUNT_ADDRESS.code.length == 0) { | ||
account = new SingleOwnerMSCA{salt: 0}(IEntryPoint(entryPoint), PluginManager(PLUGIN_MANAGER_ADDRESS)); | ||
emit AccountImplementationDeployed(address(account), entryPoint, PLUGIN_MANAGER_ADDRESS); | ||
console.log("New single owner MSCA address: %s", address(account)); | ||
} else { | ||
account = SingleOwnerMSCA(EXPECTED_ACCOUNT_ADDRESS); | ||
console.log("Found existing single owner MSCA at expected address: %s", address(account)); | ||
} | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters