|
| 1 | +const TOKEN_CONFIG = require("../constants/tokenConfig") |
| 2 | +const CHAIN_ID = require("../constants/chainIds.json") |
| 3 | +const { getDeploymentAddresses } = require("../utils/readStatic") |
| 4 | + |
| 5 | +module.exports = async function ({ localContract, remoteContract, targetNetwork, minGas: minDstGas }, hre) { |
| 6 | + let minGas = minDstGas |
| 7 | + if (!minGas) { |
| 8 | + if (TOKEN_CONFIG[targetNetwork] && TOKEN_CONFIG[targetNetwork][remoteContract] && TOKEN_CONFIG[targetNetwork][remoteContract].minGas) { |
| 9 | + minGas = TOKEN_CONFIG[targetNetwork][remoteContract].minGas |
| 10 | + console.log(`\nusing configured minGas of ${minGas} for ${targetNetwork}\n`) |
| 11 | + } else { |
| 12 | + minGas = targetNetwork.startsWith("beam") ? 10000000 : 200000 |
| 13 | + console.log(`\nusing default minGas of ${minGas} for ${targetNetwork}\n`) |
| 14 | + } |
| 15 | + } else { |
| 16 | + console.log(`\nusing passed minGas of ${minGas} for ${targetNetwork}\n`) |
| 17 | + } |
| 18 | + |
| 19 | + const localContractInstance = await ethers.getContract(localContract) |
| 20 | + const remoteChainId = CHAIN_ID[targetNetwork] |
| 21 | + const remoteAddress = getDeploymentAddresses(targetNetwork)[remoteContract] |
| 22 | + const remoteAndLocal = hre.ethers.utils.solidityPack(["address", "address"], [remoteAddress, localContractInstance.address]) |
| 23 | + |
| 24 | + console.log("Bridge contract address:", localContractInstance.address) |
| 25 | + console.log("setTrustedRemote:", remoteChainId, remoteAndLocal) |
| 26 | + console.log("setMinDstGas:", remoteChainId, 0, minGas) |
| 27 | + console.log("setMinDstGas:", remoteChainId, 1, minGas) |
| 28 | +} |
0 commit comments