From 05323dbd80820d0062a81218496b30ba5cd8d077 Mon Sep 17 00:00:00 2001 From: 0xJabberwock <0xjabberwock@defi.sucks> Date: Tue, 17 Sep 2024 08:53:00 -0300 Subject: [PATCH 1/2] feat: replace env private keys with keystores (#83) --- .env.example | 4 ++-- README.md | 16 +++++++++++++++- foundry.toml | 4 ++-- package.json | 4 ++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index fe295b73..14d938c8 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ MAINNET_RPC= -MAINNET_DEPLOYER_PK= +MAINNET_DEPLOYER_NAME= SEPOLIA_RPC= -SEPOLIA_DEPLOYER_PK= +SEPOLIA_DEPLOYER_NAME= ETHERSCAN_API_KEY= diff --git a/README.md b/README.md index 7f350720..5a4d6546 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,21 @@ yarn coverage ### Setup -Configure the `.env` variables. +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_NAME --interactive +``` + +```bash +cast wallet import $SEPOLIA_DEPLOYER_NAME --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..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 -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_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", From 537aac83eb0a5c73447dcea78d99c4b4a0f5e083 Mon Sep 17 00:00:00 2001 From: xorsal Date: Tue, 1 Oct 2024 08:01:48 -0400 Subject: [PATCH 2/2] chore: bump husky version (#84) --- .husky/commit-msg | 3 --- .husky/pre-commit | 7 ++----- package.json | 4 ++-- yarn.lock | 8 ++++---- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.husky/commit-msg b/.husky/commit-msg index 314e8214..d468455f 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npx --no-install commitlint --edit $1 \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index 6b3a9be2..c8d494d5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - # 1. Build the contracts -# 2. Stage build output -# 3. Lint and stage style improvements +# 2. Stage build output +# 3. Lint and stage style improvements yarn build && npx lint-staged \ No newline at end of file diff --git a/package.json b/package.json index 911a004b..738c1d49 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js", "lint:sol-logic": "solhint -c .solhint.json 'src/**/*.sol' 'script/**/*.sol'", "lint:sol-tests": "solhint -c .solhint.tests.json 'test/**/*.sol'", - "prepare": "husky install", + "prepare": "husky", "test": "forge test -vvv", "test:fuzz": "echidna test/invariants/fuzz/Greeter.t.sol --contract InvariantGreeter --corpus-dir test/invariants/fuzz/echidna_coverage/ --test-mode assertion", "test:integration": "forge test --match-contract Integration -vvv", @@ -40,7 +40,7 @@ "@defi-wonderland/natspec-smells": "1.1.3", "forge-std": "github:foundry-rs/forge-std#1.9.2", "halmos-cheatcodes": "github:a16z/halmos-cheatcodes#c0d8655", - "husky": ">=8", + "husky": ">=9", "lint-staged": ">=10", "solhint-community": "4.0.0", "sort-package-json": "2.10.0" diff --git a/yarn.lock b/yarn.lock index 8fc2ddf7..59ef3222 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1003,10 +1003,10 @@ human-signals@^5.0.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ== -husky@>=8: - version "9.0.11" - resolved "https://registry.yarnpkg.com/husky/-/husky-9.0.11.tgz#fc91df4c756050de41b3e478b2158b87c1e79af9" - integrity sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw== +husky@>=9: + version "9.1.6" + resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.6.tgz#e23aa996b6203ab33534bdc82306b0cf2cb07d6c" + integrity sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A== ignore@^5.2.4: version "5.3.1"