From 0f228d1d4fac0fba6c95926237c697f1fbfed8a5 Mon Sep 17 00:00:00 2001 From: 0xh3rman <119309671+0xh3rman@users.noreply.github.com> Date: Fri, 5 Dec 2025 10:00:36 +0900 Subject: [PATCH 1/2] Refactor explorer API keys and update deployment scripts Consolidated scan API keys into a single ETHERSCAN_API_KEY in .env.example and removed per-chain keys from foundry.toml. Updated README to reference explorer keys and added deployment addresses. Enhanced justfile with build and verification tasks for Monad Staking Lens, including support for Sourcify and Etherscan verification. --- .env.example | 10 ++-------- README.md | 6 ++++-- foundry.toml | 9 --------- justfile | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/.env.example b/.env.example index 48b4560..2137b4b 100644 --- a/.env.example +++ b/.env.example @@ -17,14 +17,8 @@ POLYGON_RPC_URL= ARBITRUM_RPC_URL= MONAD_RPC_URL= -# Etherscan API Keys -ETHEREUM_SCAN_API_KEY= -OPTIMISM_SCAN_API_KEY= -BASE_SCAN_API_KEY= -BSC_SCAN_API_KEY= -# AVALANCHE_SCAN_API_KEY= -POLYGON_SCAN_API_KEY= -ARBITRUM_SCAN_API_KEY= +# Explorer API Keys +ETHERSCAN_API_KEY= # Private Key for Deployment PRIVATE_KEY= diff --git a/README.md b/README.md index ccea745..be0837e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Gem Wallet deployment helpers and read lenses. ## Development 1) Install [Foundry](https://book.getfoundry.sh/). -2) Copy `.env.example` to `.env` and fill RPCs (including `MONAD_RPC_URL`), scan keys, and `PRIVATE_KEY` for deploys. +2) Copy `.env.example` to `.env` and fill RPCs (including `MONAD_RPC_URL`), explorer keys, and `PRIVATE_KEY` for deploys. ## Common Tasks @@ -23,6 +23,8 @@ Gem Wallet deployment helpers and read lenses. - Stargate fee receiver: `just deploy-stargate optimism` (or another supported chain) - Monad staking lens: `just deploy-monad-staking` +## Deployments - +- Hub Reader (BSC): [0x830295c0abe7358f7e24bc38408095621474280b](https://bscscan.com/address/0x830295c0abe7358f7e24bc38408095621474280b) +- Monad Staking Lens: [0x1c5C7645daB3A1642048AF96FACE6be29952CbF9](https://monadvision.com/address/0x1c5C7645daB3A1642048AF96FACE6be29952CbF9?tab=Contract) diff --git a/foundry.toml b/foundry.toml index afa4140..f2937ca 100644 --- a/foundry.toml +++ b/foundry.toml @@ -13,12 +13,3 @@ avalanche = "${AVALANCHE_RPC_URL}" polygon = "${POLYGON_RPC_URL}" arbitrum = "${ARBITRUM_RPC_URL}" monad = "${MONAD_RPC_URL}" - -[etherscan] -ethereum = { key = "${ETHEREUM_SCAN_API_KEY}" } -optimism = { key = "${OPTIMISM_SCAN_API_KEY}" } -base = { key = "${BASE_SCAN_API_KEY}" } -bsc = { key = "${BSC_SCAN_API_KEY}" } -# avalanche = { key = "${AVALANCHE_SCAN_API_KEY}" } // We don't need api key for verification -polygon = { key = "${POLYGON_SCAN_API_KEY}" } -arbitrum = { key = "${ARBITRUM_SCAN_API_KEY}" } diff --git a/justfile b/justfile index 81c0f3a..c45e40d 100644 --- a/justfile +++ b/justfile @@ -6,6 +6,9 @@ list: build: forge build +build-monad: + forge build --contracts src/monad/StakingLens.sol + test: forge test @@ -20,3 +23,23 @@ deploy-hub-reader: deploy-monad-staking: forge script --force script/monad/StakingLens.s.sol:StakingLensScript --rpc-url "$MONAD_RPC_URL" --broadcast -vvvv + +verify-monad-staking: build-monad + forge verify-contract \ + --rpc-url https://rpc.monad.xyz \ + --verifier sourcify \ + --verifier-url 'https://sourcify-api-monad.blockvision.org/' \ + --chain-id 143 \ + 0x1c5C7645daB3A1642048AF96FACE6be29952CbF9 \ + src/monad/StakingLens.sol:StakingLens + +verify-monad-staking-etherscan: build-monad + [ -n "${ETHERSCAN_API_KEY-}" ] || { echo "ETHERSCAN_API_KEY is required" >&2; exit 1; } + forge verify-contract \ + --verifier etherscan \ + --verifier-url 'https://api.etherscan.io/v2/api?chainid=143' \ + --chain 143 \ + --rpc-url https://rpc.monad.xyz \ + --etherscan-api-key "$ETHERSCAN_API_KEY" \ + 0x1c5C7645daB3A1642048AF96FACE6be29952CbF9 \ + src/monad/StakingLens.sol:StakingLens From 5afbbc51bf0c5bebbc7d2226b31ac81814964518 Mon Sep 17 00:00:00 2001 From: 0xh3rman <119309671+0xh3rman@users.noreply.github.com> Date: Fri, 5 Dec 2025 10:28:46 +0900 Subject: [PATCH 2/2] Add STAKING_LENS_ADDRESS env and improve verification scripts Introduces STAKING_LENS_ADDRESS to .env.example and updates justfile to use this variable for contract verification. Adds a helper to read the deployed address from broadcast files and improves verification tasks to use dynamic addresses instead of hardcoded values. --- .env.example | 3 +++ justfile | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 2137b4b..b58d682 100644 --- a/.env.example +++ b/.env.example @@ -20,5 +20,8 @@ MONAD_RPC_URL= # Explorer API Keys ETHERSCAN_API_KEY= +# Deployed addresses +STAKING_LENS_ADDRESS= + # Private Key for Deployment PRIVATE_KEY= diff --git a/justfile b/justfile index c45e40d..ca1659f 100644 --- a/justfile +++ b/justfile @@ -24,16 +24,24 @@ deploy-hub-reader: deploy-monad-staking: forge script --force script/monad/StakingLens.s.sol:StakingLensScript --rpc-url "$MONAD_RPC_URL" --broadcast -vvvv -verify-monad-staking: build-monad +read-staking-lens-address BROADCAST_FILE="broadcast/StakingLens.s.sol/143/run-latest.json": + #!/usr/bin/env bash + jq -r '.receipts[]?.contractAddress // empty' "{{BROADCAST_FILE}}" + +verify-monad-staking ADDRESS="": build-monad + ADDRESS_TO_VERIFY=${STAKING_LENS_ADDRESS:-${ADDRESS-}} + [ -n "${ADDRESS_TO_VERIFY-}" ] || { echo "Set STAKING_LENS_ADDRESS (hint: STAKING_LENS_ADDRESS=$(just read-staking-lens-address))" >&2; exit 1; } forge verify-contract \ --rpc-url https://rpc.monad.xyz \ --verifier sourcify \ --verifier-url 'https://sourcify-api-monad.blockvision.org/' \ --chain-id 143 \ - 0x1c5C7645daB3A1642048AF96FACE6be29952CbF9 \ + "$ADDRESS_TO_VERIFY" \ src/monad/StakingLens.sol:StakingLens -verify-monad-staking-etherscan: build-monad +verify-monad-staking-etherscan ADDRESS="": build-monad + ADDRESS_TO_VERIFY=${STAKING_LENS_ADDRESS:-${ADDRESS-}} + [ -n "${ADDRESS_TO_VERIFY-}" ] || { echo "Set STAKING_LENS_ADDRESS (hint: STAKING_LENS_ADDRESS=$(just read-staking-lens-address))" >&2; exit 1; } [ -n "${ETHERSCAN_API_KEY-}" ] || { echo "ETHERSCAN_API_KEY is required" >&2; exit 1; } forge verify-contract \ --verifier etherscan \ @@ -41,5 +49,5 @@ verify-monad-staking-etherscan: build-monad --chain 143 \ --rpc-url https://rpc.monad.xyz \ --etherscan-api-key "$ETHERSCAN_API_KEY" \ - 0x1c5C7645daB3A1642048AF96FACE6be29952CbF9 \ + "$ADDRESS_TO_VERIFY" \ src/monad/StakingLens.sol:StakingLens