Skip to content

Commit 7388395

Browse files
authored
refactor: deployment scripts and commands (#12)
## Summary Improve the quality of `scripts/`. ## Detail ### Changeset * add linting for scripts/ * add deployment and verify command for legacy `DeployTokenCallbackPlugin` ### Checklist - [x] 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 No impact. ## Documentation n/a
1 parent 31398de commit 7388395

18 files changed

+54
-43
lines changed

.solhint-script.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "solhint:recommended",
3+
"rules": {
4+
"compiler-version": ["error", "0.8.24"],
5+
"func-visibility": ["error", { "ignoreConstructors": true }],
6+
"no-console": "off"
7+
}
8+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"clean": "rm -rf cache artifacts typechain-types",
77
"build": "forge build",
8-
"lint": "solhint -w 130 -c .solhint-src.json './src/**/*.sol' && solhint -w 245 -c .solhint-test.json './test/**/*.sol'",
8+
"lint": "solhint -w 127 -c .solhint-src.json './src/**/*.sol' && solhint -w 242 -c .solhint-test.json './test/**/*.sol' && solhint -w 0 -c .solhint-script.json './script/**/*.sol'",
99
"test": "forge test -vv",
1010
"gasreport": "forge test --gas-report > gas/reports/gas-report.txt",
1111
"coverage": "forge coverage --ir-minimum",

script/001_DeployPluginManager.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {PLUGIN_MANAGER_ADDRESS} from "./000_ContractAddress.sol";
2424
import {Script, console} from "forge-std/src/Script.sol";
2525

2626
contract DeployPluginManagerScript is Script {
27-
address EXPECTED_PLUGIN_MANAGER = PLUGIN_MANAGER_ADDRESS;
27+
address internal constant EXPECTED_PLUGIN_MANAGER = PLUGIN_MANAGER_ADDRESS;
2828

2929
function run() public {
3030
uint256 deployerKey = vm.envUint("DEPLOYER_PRIVATE_KEY");

script/002_DeployUpgradableMSCAFactory.s.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import {ENTRY_POINT, PLUGIN_MANAGER_ADDRESS, UPGRADABLE_MSCA_FACTORY_ADDRESS} fr
2424
import {Script, console} from "forge-std/src/Script.sol";
2525

2626
contract DeployUpgradableMSCAFactoryScript is Script {
27-
address OWNER = vm.envAddress("MSCA_FACTORY_OWNER_ADDRESS");
28-
address PLUGIN_MANAGER = PLUGIN_MANAGER_ADDRESS;
29-
address payable EXPECTED_FACTORY_ADDRESS = payable(UPGRADABLE_MSCA_FACTORY_ADDRESS);
27+
address internal constant PLUGIN_MANAGER = PLUGIN_MANAGER_ADDRESS;
28+
address payable internal constant EXPECTED_FACTORY_ADDRESS = payable(UPGRADABLE_MSCA_FACTORY_ADDRESS);
29+
address internal owner = vm.envAddress("MSCA_FACTORY_OWNER_ADDRESS");
3030

3131
function run() public {
3232
address entryPoint = ENTRY_POINT;
@@ -36,7 +36,7 @@ contract DeployUpgradableMSCAFactoryScript is Script {
3636

3737
UpgradableMSCAFactory factory;
3838
if (EXPECTED_FACTORY_ADDRESS.code.length == 0) {
39-
factory = new UpgradableMSCAFactory{salt: 0}(OWNER, entryPoint, PLUGIN_MANAGER);
39+
factory = new UpgradableMSCAFactory{salt: 0}(owner, entryPoint, PLUGIN_MANAGER);
4040
console.log("Deployed new factory at address: %s", address(factory));
4141
} else {
4242
factory = UpgradableMSCAFactory(EXPECTED_FACTORY_ADDRESS);

script/003_DeploySingleOwnerMSCAFactory.s.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
*/
1919
pragma solidity 0.8.24;
2020

21-
import "../src/msca/6900/v0.7/factories/semi/SingleOwnerMSCAFactory.sol";
22-
import "forge-std/src/Script.sol";
21+
import {SingleOwnerMSCAFactory} from "../src/msca/6900/v0.7/factories/semi/SingleOwnerMSCAFactory.sol";
22+
import {Script, console} from "forge-std/src/Script.sol";
2323

2424
contract DeploySingleOwnerMSCAFactoryScript is Script {
25-
address constant PLUGIN_MANAGER = 0xc751A2bFA2A4a5b27E94ad735534c16a0999d871;
26-
address payable constant EXPECTED_FACTORY_ADDRESS = payable(address(0x1a1f5310eD7fF0B84Cef7E6d7D0f94Cc16D23013));
25+
address internal constant PLUGIN_MANAGER = 0xc751A2bFA2A4a5b27E94ad735534c16a0999d871;
26+
address payable internal constant EXPECTED_FACTORY_ADDRESS =
27+
payable(address(0x1a1f5310eD7fF0B84Cef7E6d7D0f94Cc16D23013));
2728

2829
function run() public {
2930
address entryPoint = vm.envAddress("ENTRY_POINT");

script/004_DeploySingleOwnerPlugin.s.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
*/
1919
pragma solidity 0.8.24;
2020

21-
import "../src/msca/6900/v0.7/plugins/v1_0_0/acl/SingleOwnerPlugin.sol";
21+
import {SingleOwnerPlugin} from "../src/msca/6900/v0.7/plugins/v1_0_0/acl/SingleOwnerPlugin.sol";
2222

2323
import {SINGLE_OWNER_PLUGIN_ADDRESS} from "./000_ContractAddress.sol";
24-
import "forge-std/src/Script.sol";
24+
import {Script, console} from "forge-std/src/Script.sol";
2525

2626
contract DeploySingleOwnerPluginScript is Script {
27-
address payable EXPECTED_PLUGIN_ADDRESS = payable(SINGLE_OWNER_PLUGIN_ADDRESS);
27+
address payable internal constant EXPECTED_PLUGIN_ADDRESS = payable(SINGLE_OWNER_PLUGIN_ADDRESS);
2828

2929
function run() public {
3030
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");

script/005_DeployECDSAAccountFactory.s.sol

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818
*/
1919
pragma solidity 0.8.24;
2020

21-
import "../src/account/v1/factory/ECDSAAccountFactory.sol";
22-
import "forge-std/src/Script.sol";
21+
import {ECDSAAccountFactory} from "../src/account/v1/factory/ECDSAAccountFactory.sol";
22+
23+
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
24+
import {Script, console} from "forge-std/src/Script.sol";
2325

2426
/// @dev We actually still used hardhat deployment for this legacy contract. This script is more for convenience
2527
/// purpose.
2628
contract DeployECDSAAccountFactoryScript is Script {
27-
// TODO: replace this with officially deployed address
28-
address payable constant EXPECTED_FACTORY_ADDRESS = payable(address(0x39c09e93D074782C5ffc45da27910c14C628a183));
29+
address payable internal constant EXPECTED_FACTORY_ADDRESS =
30+
payable(address(0x39c09e93D074782C5ffc45da27910c14C628a183));
2931

3032
function run() public {
3133
address entryPoint = vm.envAddress("ENTRY_POINT");

script/006_DeployAddressBookPlugin.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {console} from "forge-std/src/console.sol";
2424

2525
// Deprecated
2626
contract DeployAddressBookPluginScript is Script {
27-
// TODO: replace this with officially deployed address
28-
address payable constant EXPECTED_PLUGIN_ADDRESS = payable(address(0x1E0689ae0171CcFbE9E7C7491B1eb09e0D5b7103));
27+
address payable internal constant EXPECTED_PLUGIN_ADDRESS =
28+
payable(address(0x1E0689ae0171CcFbE9E7C7491B1eb09e0D5b7103));
2929

3030
function run() public {
3131
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");

script/007_DeployColdStorageAddressBookPlugin.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {Script} from "forge-std/src/Script.sol";
2626
import {console} from "forge-std/src/console.sol";
2727

2828
contract DeployColdStorageAddressBookPluginScript is Script {
29-
address payable EXPECTED_PLUGIN_ADDRESS = payable(COLD_STORAGE_ADDRESS_BOOK_PLUGIN_ADDRESS);
29+
address payable internal constant EXPECTED_PLUGIN_ADDRESS = payable(COLD_STORAGE_ADDRESS_BOOK_PLUGIN_ADDRESS);
3030

3131
function run() public {
3232
uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY");

script/008_DeployWeightedWebauthnMultisigPlugin.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {Script} from "forge-std/src/Script.sol";
2626
import {console} from "forge-std/src/console.sol";
2727

2828
contract DeployWeightedWebauthnMultisigPlugin is Script {
29-
address payable EXPECTED_PLUGIN_ADDRESS = payable(WEIGHTED_MULTISIG_PLUGIN_ADDRESS);
29+
address payable internal constant EXPECTED_PLUGIN_ADDRESS = payable(WEIGHTED_MULTISIG_PLUGIN_ADDRESS);
3030

3131
function run() public {
3232
address entryPoint = ENTRY_POINT;

0 commit comments

Comments
 (0)