diff --git a/ts-src/deploy/01_LockingInfo.ts b/ts-src/deploy/01_LockingInfo.ts index 4324890..fb1e02c 100644 --- a/ts-src/deploy/01_LockingInfo.ts +++ b/ts-src/deploy/01_LockingInfo.ts @@ -1,26 +1,6 @@ import { DeployFunction } from "hardhat-deploy/types"; import { LockingInfoContractName } from "../utils/constant"; - -const l2ChainIdMap: { [key: string]: number } = { - mainnet: 1088, - sepolia: 59902, - holesky: 59903, - devnet: Number(process.env["DEVBNET_L2_CHAINID"]), -}; - -const l1BridgeMap: { [key: string]: string } = { - mainnet: "0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b", - sepolia: "0x9848dE505e6Aa301cEecfCf23A0a150140fc996e", - holesky: "0x890D4Ef96551C9904e7D4E73d2C22D3F207F5CFb", - devnet: process.env["DEVBNET_METIST_L1_BRIDGE"] as string, -}; - -const l1MetisMap: { [key: string]: string } = { - mainnet: "0x9e32b13ce7f2e80a01932b42553652e053d6ed8e", - sepolia: "0x7f49160EB9BB068101d445fe77E17ecDb37D0B47", - holesky: "0xaf8e5B10c69c983204505cDCD56Ec2aC2280D08e", - devnet: process.env["DEVBNET_METIST_TOKEN"] as string, -}; +import { l1BridgeMap, l1MetisMap, l2ChainIdMap } from "../utils/address"; const func: DeployFunction = async function (hre) { const networkName = hre.network.name; diff --git a/ts-src/tasks/l1.ts b/ts-src/tasks/l1.ts index 6b6d4eb..b9467ed 100644 --- a/ts-src/tasks/l1.ts +++ b/ts-src/tasks/l1.ts @@ -9,6 +9,7 @@ import { LockingInfoContractName, LockingPoolContractName, } from "../utils/constant"; +import { l1MetisMap } from "../utils/address"; task("l1:whitelist", "Whitelist an sequencer address") .addParam("addr", "the sequencer address", "", types.string) @@ -76,7 +77,7 @@ task("l1:lock", "Lock Metis to LockingPool contract") throw new Error(`${hre.network.name} is not an l1`); } - const metisL1Addr = process.env.MEITS_L1_TOKEN as string; + const metisL1Addr = l1MetisMap[hre.network.name]; if (!hre.ethers.isAddress(metisL1Addr)) { throw new Error(`MEITS_L1_TOKEN env is not set or it's not an address`); } @@ -409,7 +410,7 @@ task("l1:set-reward-payer", "Update reward payer") return; } - const metisL1Addr = process.env.MEITS_L1_TOKEN; + const metisL1Addr = l1MetisMap[hre.network.name]; if (!hre.ethers.isAddress(metisL1Addr)) { throw new Error(`MEITS_L1_TOKEN env is not set or it's not an address`); } diff --git a/ts-src/utils/address.ts b/ts-src/utils/address.ts new file mode 100644 index 0000000..4e67efa --- /dev/null +++ b/ts-src/utils/address.ts @@ -0,0 +1,22 @@ +const l2ChainIdMap: { [key: string]: number } = { + mainnet: 1088, + sepolia: 59902, + holesky: 59903, + devnet: Number(process.env["DEVBNET_L2_CHAINID"]), +}; + +const l1BridgeMap: { [key: string]: string } = { + mainnet: "0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b", + sepolia: "0x9848dE505e6Aa301cEecfCf23A0a150140fc996e", + holesky: "0x890D4Ef96551C9904e7D4E73d2C22D3F207F5CFb", + devnet: process.env["DEVBNET_METIST_L1_BRIDGE"] as string, +}; + +const l1MetisMap: { [key: string]: string } = { + mainnet: "0x9e32b13ce7f2e80a01932b42553652e053d6ed8e", + sepolia: "0x7f49160EB9BB068101d445fe77E17ecDb37D0B47", + holesky: "0xaf8e5B10c69c983204505cDCD56Ec2aC2280D08e", + devnet: process.env["DEVBNET_METIST_TOKEN"] as string, +}; + +export { l2ChainIdMap, l1BridgeMap, l1MetisMap };