From bf98a37971de1dd3759d897be455222419f6f15b Mon Sep 17 00:00:00 2001 From: 0xJabberwock <0xjabberwock@defi.sucks> Date: Wed, 4 Sep 2024 22:09:06 -0300 Subject: [PATCH 1/3] feat: replace env private keys with keystores --- .env.example | 3 --- README.md | 8 +++++++- foundry.toml | 4 ++-- package.json | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index fe295b73..582b8aff 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,4 @@ MAINNET_RPC= -MAINNET_DEPLOYER_PK= - SEPOLIA_RPC= -SEPOLIA_DEPLOYER_PK= ETHERSCAN_API_KEY= diff --git a/README.md b/README.md index 7f350720..9d016ff7 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,13 @@ yarn coverage ### Setup -Configure the `.env` variables. +```bash +cast wallet import MAINNET_DEPLOYER --interactive +``` + +```bash +cast wallet import SEPOLIA_DEPLOYER --interactive +``` ### Sepolia diff --git a/foundry.toml b/foundry.toml index f3644c39..fcadc272 100644 --- a/foundry.toml +++ b/foundry.toml @@ -32,5 +32,5 @@ mainnet = "${MAINNET_RPC}" sepolia = "${SEPOLIA_RPC}" [etherscan] -mainnet = { key = "${ETHERSCAN_API_KEY}", chain = "mainnet" } -sepolia = { key = "${ETHERSCAN_API_KEY}", chain = "sepolia" } +mainnet = { key = "${ETHERSCAN_API_KEY}" } +sepolia = { key = "${ETHERSCAN_API_KEY}" } diff --git a/package.json b/package.json index b92bb27c..fab2780d 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "build": "forge build", "build:optimized": "FOUNDRY_PROFILE=optimized forge build", "coverage": "forge coverage --report summary --report lcov --match-path 'test/unit/*'", - "deploy:mainnet": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $MAINNET_RPC --broadcast --chain mainnet --private-key $MAINNET_DEPLOYER_PK'", - "deploy:sepolia": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $SEPOLIA_RPC --broadcast --chain sepolia --private-key $SEPOLIA_DEPLOYER_PK'", + "deploy:mainnet": "bash -c 'source .env && forge script Deploy --rpc-url $MAINNET_RPC --account MAINNET_DEPLOYER --broadcast --verify --chain mainnet -vvvvv'", + "deploy:sepolia": "bash -c 'source .env && forge script Deploy --rpc-url $SEPOLIA_RPC --account SEPOLIA_DEPLOYER --broadcast --verify --chain sepolia -vvvvv'", "lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check", "lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix", "lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js", From 49ca4196588b30a23f668fb5cbbdf838bfca96c8 Mon Sep 17 00:00:00 2001 From: 0xJabberwock <0xjabberwock@defi.sucks> Date: Fri, 6 Sep 2024 12:56:24 -0300 Subject: [PATCH 2/3] feat: set account names via env variables --- .env.example | 3 +++ README.md | 12 ++++++++++-- package.json | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 582b8aff..007051e7 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,7 @@ MAINNET_RPC= +MAINNET_DEPLOYER= + SEPOLIA_RPC= +SEPOLIA_DEPLOYER= ETHERSCAN_API_KEY= diff --git a/README.md b/README.md index 9d016ff7..c8371f78 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,20 @@ yarn coverage ### Setup +Configure the `.env` variables and source them: + +```bash +source .env +``` + +Import your private keys into Foundry's encrypted keystore: + ```bash -cast wallet import MAINNET_DEPLOYER --interactive +cast wallet import $MAINNET_DEPLOYER --interactive ``` ```bash -cast wallet import SEPOLIA_DEPLOYER --interactive +cast wallet import $SEPOLIA_DEPLOYER --interactive ``` ### Sepolia diff --git a/package.json b/package.json index fab2780d..0739738e 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "build": "forge build", "build:optimized": "FOUNDRY_PROFILE=optimized forge build", "coverage": "forge coverage --report summary --report lcov --match-path 'test/unit/*'", - "deploy:mainnet": "bash -c 'source .env && forge script Deploy --rpc-url $MAINNET_RPC --account MAINNET_DEPLOYER --broadcast --verify --chain mainnet -vvvvv'", - "deploy:sepolia": "bash -c 'source .env && forge script Deploy --rpc-url $SEPOLIA_RPC --account SEPOLIA_DEPLOYER --broadcast --verify --chain sepolia -vvvvv'", + "deploy:mainnet": "bash -c 'source .env && forge script Deploy --rpc-url $MAINNET_RPC --account $MAINNET_DEPLOYER --broadcast --verify --chain mainnet -vvvvv'", + "deploy:sepolia": "bash -c 'source .env && forge script Deploy --rpc-url $SEPOLIA_RPC --account $SEPOLIA_DEPLOYER --broadcast --verify --chain sepolia -vvvvv'", "lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check", "lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix", "lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js", From 6b8b5c2b1e85f78a7e4000c002b1d8424f436c74 Mon Sep 17 00:00:00 2001 From: 0xJabberwock <0xjabberwock@defi.sucks> Date: Fri, 6 Sep 2024 19:48:08 -0300 Subject: [PATCH 3/3] refactor: env account names --- .env.example | 4 ++-- README.md | 4 ++-- package.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 007051e7..14d938c8 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ MAINNET_RPC= -MAINNET_DEPLOYER= +MAINNET_DEPLOYER_NAME= SEPOLIA_RPC= -SEPOLIA_DEPLOYER= +SEPOLIA_DEPLOYER_NAME= ETHERSCAN_API_KEY= diff --git a/README.md b/README.md index c8371f78..5a4d6546 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ source .env Import your private keys into Foundry's encrypted keystore: ```bash -cast wallet import $MAINNET_DEPLOYER --interactive +cast wallet import $MAINNET_DEPLOYER_NAME --interactive ``` ```bash -cast wallet import $SEPOLIA_DEPLOYER --interactive +cast wallet import $SEPOLIA_DEPLOYER_NAME --interactive ``` ### Sepolia diff --git a/package.json b/package.json index 0739738e..911a004b 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "build": "forge build", "build:optimized": "FOUNDRY_PROFILE=optimized forge build", "coverage": "forge coverage --report summary --report lcov --match-path 'test/unit/*'", - "deploy:mainnet": "bash -c 'source .env && forge script Deploy --rpc-url $MAINNET_RPC --account $MAINNET_DEPLOYER --broadcast --verify --chain mainnet -vvvvv'", - "deploy:sepolia": "bash -c 'source .env && forge script Deploy --rpc-url $SEPOLIA_RPC --account $SEPOLIA_DEPLOYER --broadcast --verify --chain sepolia -vvvvv'", + "deploy:mainnet": "bash -c 'source .env && forge script Deploy --rpc-url $MAINNET_RPC --account $MAINNET_DEPLOYER_NAME --broadcast --verify --chain mainnet -vvvvv'", + "deploy:sepolia": "bash -c 'source .env && forge script Deploy --rpc-url $SEPOLIA_RPC --account $SEPOLIA_DEPLOYER_NAME --broadcast --verify --chain sepolia -vvvvv'", "lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check", "lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix", "lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js",