-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouters.ts
More file actions
87 lines (84 loc) · 2.57 KB
/
Copy pathrouters.ts
File metadata and controls
87 lines (84 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* Router addresses per chain.
*
* Check the address against the official docs before every mainnet deploy:
*
* PancakeSwap: https://docs.pancakeswap.finance/developers/smart-contracts
* Uniswap: https://docs.uniswap.org/contracts/v2/reference/smart-contracts/v2-deployments
*
* Routers get redeployed from time to time, and deploying against the wrong one
* gives you a dead contract: the pair is created somewhere else, the swap back
* never works, and nothing can be fixed — the router address is immutable.
*/
export interface NetworkInfo {
/** Human-readable chain name */
label: string;
/** DEX name, used in logs and in the checklist */
dex: string;
/** Uniswap V2 / PancakeSwap V2 router */
router: string;
/** Wrapped native coin — informational only */
wrappedNative: string;
/** Explorer base URL, no trailing slash */
explorer: string;
/** Native coin ticker */
currency: string;
/** Test network? */
testnet: boolean;
}
export const NETWORKS: Record<number, NetworkInfo> = {
56: {
label: "BNB Smart Chain",
dex: "PancakeSwap V2",
router: "0x10ED43C718714eb63d5aA57B78B54704E256024E",
wrappedNative: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", // WBNB
explorer: "https://bscscan.com",
currency: "BNB",
testnet: false,
},
97: {
label: "BSC Testnet",
dex: "PancakeSwap V2 (testnet)",
router: "0xD99D1c33F9fC3444f8101754aBC46c52416550D1",
wrappedNative: "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd", // WBNB testnet
explorer: "https://testnet.bscscan.com",
currency: "tBNB",
testnet: true,
},
1: {
label: "Ethereum",
dex: "Uniswap V2",
router: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
explorer: "https://etherscan.io",
currency: "ETH",
testnet: false,
},
11155111: {
label: "Sepolia",
dex: "Uniswap V2 (Sepolia)",
router: "0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3",
wrappedNative: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", // WETH Sepolia
explorer: "https://sepolia.etherscan.io",
currency: "SepoliaETH",
testnet: true,
},
31337: {
label: "Hardhat (local)",
dex: "-",
router: "",
wrappedNative: "",
explorer: "",
currency: "ETH",
testnet: true,
},
};
export function networkInfo(chainId: number): NetworkInfo {
const info = NETWORKS[chainId];
if (!info) {
throw new Error(
`chainId=${chainId} is not listed in scripts/routers.ts. ` + `Add it there or set ROUTER_ADDRESS in .env.`,
);
}
return info;
}