Skip to content

Commit 7b86020

Browse files
authored
Merge pull request #218 from r4topunk/fix/require-etherscan-key
fix(stake): require a mainnet ETHERSCAN_API_KEY
2 parents fb47e01 + 1ef5b12 commit 7b86020

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/services/stake-graph.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ async function getEthUsd(): Promise<number> {
139139
// which the free RPCs block for eth_getLogs (that silently emptied this scan in
140140
// prod). One unified key covers every chain (chainid=1 here).
141141
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
142-
const ETHERSCAN_KEY = process.env.ETHERSCAN_API_KEY || process.env.BASESCAN_API_KEY;
142+
// Must be a MAINNET-capable key from etherscan.io. The repo's BASESCAN_API_KEY
143+
// is Basescan-only → chainid=1 returns "NOTOK / invalid api key", so it's NOT a
144+
// usable fallback here; set ETHERSCAN_API_KEY explicitly in the env.
145+
const ETHERSCAN_KEY = process.env.ETHERSCAN_API_KEY;
143146
const USER_REFERRED_SIG = keccak256(toHex("UserReferred(uint256,address,address,uint256)"));
144147
const pad32 = (a: Address) => `0x000000000000000000000000${a.slice(2).toLowerCase()}`;
145148

0 commit comments

Comments
 (0)