Skip to content

Commit 595e96a

Browse files
committed
chore: add task for generating setup data for safe; eth rpc fix
1 parent 1226b92 commit 595e96a

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

hardhat.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function customChain(networkName) {
115115
const networks = {
116116
// mainnets
117117
ethereum: {
118-
url: "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161", // public infura endpoint
118+
url: "https://eth.llamarpc.com",
119119
chainId: 1,
120120
accounts: accounts(),
121121
verify: verifyChain(1),

tasks/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ task("setupOFT", "go through all steps of the base OFTV2 setup", require("./setu
175175
.addOptionalParam("skipAdapter", "skip setting custom adapter params", false, types.boolean)
176176
.addOptionalParam("gasOnly", "skip setting trusted remote and custom adapter params", false, types.boolean)
177177

178+
task("setupOFTData", "READONLY all steps of the base OFTV2 setup", require("./setupOFTData"))
179+
.addParam("localContract", "name of contract on source chain")
180+
.addParam("remoteContract", "name of contract on destination chain")
181+
.addParam("targetNetwork", "destination network")
182+
.addOptionalParam("minGas", "gas config", 0, types.int)
183+
178184
task("setupONFT712", "go through all steps of the base ONFT setup", require("./setupONFT712"))
179185
.addParam("localContract", "name of contract on source chain")
180186
.addParam("remoteContract", "name of contract on destination chain")

tasks/setupOFTData.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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

Comments
 (0)