Skip to content

Commit e332f56

Browse files
committed
chore: modernise repo, prepare for new v1 bridge
1 parent 1f955ae commit e332f56

10 files changed

Lines changed: 137 additions & 42 deletions

File tree

.copilotignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env*

.nvmrc

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.17.1
1+
lts/hydrogen

constants/layerzeroEndpoints.json

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"optimism": "0x3c2269811836af69497E5F486A85D7316753cf62",
88
"fantom": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
99
"beam": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
10-
"base:": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
10+
"base": "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
1111

1212
"goerli": "0xbfD2135BFfbb0B5378b56643c2Df8a87552Bfa23",
1313
"sepolia": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",

deploy/BeamOFT.js

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module.exports = async function ({ deployments, getNamedAccounts }) {
1717
}
1818

1919
const tokenConfig = TOKEN_CONFIG[hre.network.name][CONTRACT_NAME]
20-
if (!tokenConfig.name || !tokenConfig.symbol) {
21-
console.error("No configuration found for target network.")
20+
if (!tokenConfig.name || !tokenConfig.symbol || !lzEndpointAddress) {
21+
console.error("No configuration found for target network:", hre.network.name)
2222
return
2323
}
2424

hardhat.config.js

100644100755
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ const apiUrl = {
8484
"optimism-goerli": "https://api-goerli-optimistic.etherscan.io",
8585
arbitrum: "https://api.arbiscan.io",
8686
"arbitrum-goerli": "https://api-goerli.arbiscan.io",
87-
"imtbl-zkevm-testnet": "https://explorer.testnet.immutable.com/api",
88-
"imtbl-zkevm": "https://explorer.immutable.com/api",
89-
base: "https://basescan.org",
90-
"base-testnet": "https://sepolia.basescan.org",
87+
"imtbl-zkevm-testnet": "https://explorer.testnet.immutable.com",
88+
"imtbl-zkevm": "https://explorer.immutable.com",
89+
base: "https://api.basescan.org",
90+
"base-testnet": "https://api.sepolia.basescan.org",
9191
}
9292

9393
// `hardhat-deploy etherscan-verify` network config
94-
function verifyChain(networkName) {
94+
function verifyChain(chainId) {
9595
return {
9696
etherscan: {
97-
apiKey: apiKey[networkName] || undefined,
98-
apiUrl: apiUrl[networkName] || undefined,
97+
apiKey: process.env.ETHERSCAN_ONLY_API_KEY,
98+
apiUrl: `https://api.etherscan.io/v2/api?chainid=${chainId}`,
9999
},
100100
}
101101
}
@@ -106,7 +106,7 @@ function customChain(networkName) {
106106
network: networkName,
107107
chainId: networks[networkName] ? networks[networkName].chainId : -1,
108108
urls: {
109-
apiURL: apiUrl[networkName] ? `${apiUrl[networkName]}/api` : undefined,
109+
apiURL: `https://api.etherscan.io/v2/api&chainid=${networks[networkName].chainId}`,
110110
browserURL: apiUrl[networkName] ? apiUrl[networkName].replace("api.", "").replace("api-", "") : undefined,
111111
},
112112
}
@@ -118,43 +118,43 @@ const networks = {
118118
url: "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161", // public infura endpoint
119119
chainId: 1,
120120
accounts: accounts(),
121-
verify: verifyChain("ethereum"),
121+
verify: verifyChain(1),
122122
},
123123
bsc: {
124124
url: "https://bsc-dataseed1.binance.org",
125125
chainId: 56,
126126
accounts: accounts(),
127-
verify: verifyChain("bsc"),
127+
verify: verifyChain(56),
128128
},
129129
avalanche: {
130130
url: "https://api.avax.network/ext/bc/C/rpc",
131131
chainId: 43114,
132132
accounts: accounts(),
133-
verify: verifyChain("avalanche"),
133+
verify: verifyChain(43114),
134134
},
135135
polygon: {
136136
url: "https://rpc-mainnet.maticvigil.com",
137137
chainId: 137,
138138
accounts: accounts(),
139-
verify: verifyChain("polygon"),
139+
verify: verifyChain(137),
140140
},
141141
arbitrum: {
142142
url: "https://arb1.arbitrum.io/rpc",
143143
chainId: 42161,
144144
accounts: accounts(),
145-
verify: verifyChain("arbitrum"),
145+
verify: verifyChain(42161),
146146
},
147147
optimism: {
148148
url: "https://mainnet.optimism.io",
149149
chainId: 10,
150150
accounts: accounts(),
151-
verify: verifyChain("optimism"),
151+
verify: verifyChain(10),
152152
},
153153
fantom: {
154154
url: "https://rpcapi.fantom.network",
155155
chainId: 250,
156156
accounts: accounts(),
157-
verify: verifyChain("fantom"),
157+
verify: verifyChain(250),
158158
},
159159
metis: {
160160
url: "https://andromeda.metis.io/?owner=1088",
@@ -175,57 +175,57 @@ const networks = {
175175
url: "https://mainnet.base.org",
176176
chainId: 8453,
177177
accounts: accounts(),
178-
verify: verifyChain("base"),
178+
verify: verifyChain(8453),
179179
},
180180

181181
// testnets
182182
goerli: {
183183
url: "https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161", // public infura endpoint
184184
chainId: 5,
185185
accounts: accounts(),
186-
verify: verifyChain("goerli"),
186+
verify: verifyChain(5),
187187
},
188188
sepolia: {
189189
url: "https://ethereum-sepolia.publicnode.com",
190190
chainId: 11155111,
191191
accounts: accounts(),
192-
verify: verifyChain("sepolia"),
192+
verify: verifyChain(11155111),
193193
},
194194
"bsc-testnet": {
195195
url: "https://data-seed-prebsc-1-s1.binance.org:8545/",
196196
chainId: 97,
197197
accounts: accounts(),
198-
verify: verifyChain("bsc-testnet"),
198+
verify: verifyChain(97),
199199
},
200200
fuji: {
201201
url: "https://api.avax-test.network/ext/bc/C/rpc",
202202
chainId: 43113,
203203
accounts: accounts(),
204-
verify: verifyChain("fuji"),
204+
verify: verifyChain(43113),
205205
},
206206
mumbai: {
207207
url: "https://rpc-mumbai.maticvigil.com/",
208208
chainId: 80001,
209209
accounts: accounts(),
210-
verify: verifyChain("mumbai"),
210+
verify: verifyChain(80001),
211211
},
212212
"arbitrum-goerli": {
213213
url: "https://goerli-rollup.arbitrum.io/rpc/",
214214
chainId: 421613,
215215
accounts: accounts(),
216-
verify: verifyChain("arbitrum-goerli"),
216+
verify: verifyChain(421613),
217217
},
218218
"optimism-goerli": {
219219
url: "https://goerli.optimism.io/",
220220
chainId: 420,
221221
accounts: accounts(),
222-
verify: verifyChain("optimism-goerli"),
222+
verify: verifyChain(420),
223223
},
224224
"fantom-testnet": {
225225
url: "https://rpc.ankr.com/fantom_testnet",
226226
chainId: 4002,
227227
accounts: accounts(),
228-
verify: verifyChain("fantom-testnet"),
228+
verify: verifyChain(4002),
229229
},
230230
"beam-testnet": {
231231
url: "https://subnets.avax.network/beam/testnet/rpc",
@@ -241,7 +241,7 @@ const networks = {
241241
url: "https://sepolia.base.org",
242242
chainId: 84532,
243243
accounts: accounts(),
244-
verify: verifyChain("base-testnet"),
244+
verify: verifyChain(84532),
245245
},
246246
}
247247

tasks/index.js

100644100755
Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,93 @@ task("setupOFT", "go through all steps of the base OFTV2 setup", require("./setu
171171
.addParam("localContract", "name of contract on source chain")
172172
.addParam("remoteContract", "name of contract on destination chain")
173173
.addParam("targetNetwork", "destination network")
174-
.addOptionalParam("minGas", "gas config", "")
174+
.addOptionalParam("minGas", "gas config", 0, types.int)
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

178178
task("setupONFT712", "go through all steps of the base ONFT setup", require("./setupONFT712"))
179179
.addParam("localContract", "name of contract on source chain")
180180
.addParam("remoteContract", "name of contract on destination chain")
181181
.addParam("targetNetwork", "destination network")
182-
.addOptionalParam("minGas", "gas config", "")
182+
.addOptionalParam("minGas", "gas config", 0, types.int)
183183

184184
task("setupONFT1155", "go through all steps of the base ONFT setup", require("./setupONFT1155"))
185185
.addParam("localContract", "name of contract on source chain")
186186
.addParam("remoteContract", "name of contract on destination chain")
187187
.addParam("targetNetwork", "destination network")
188-
.addOptionalParam("minGas", "gas config", "")
188+
.addOptionalParam("minGas", "gas config", 0, types.int)
189+
.addOptionalParam("skipAdapter", "skip setting custom adapter params", false, types.boolean)
190+
191+
task("transfer", "Fetches all ERC-20 Transfer events from a list of transaction IDs").setAction(async (taskArgs, hre) => {
192+
const txIds = [
193+
"0xff076be87f4bf6158d625118d8e9e2001c7dbd1a7e72a3d014f7771bdfa6dc0d",
194+
"0xf9bc7db7114b18ec9151592d923d53664652d7cd2e1f16494f2212c9d4e917d7",
195+
"0x03426bc297ecc8103b090a6f0d8f4cc6fdcf94090eec5ffea6c1588def50f664",
196+
"0x73cd758cd38ee909fe14d264bb9e21ee1a26cd1ca7ed021783d0852520c0bd3f",
197+
"0x7662be66a804a6475c0da317a653447282cdcbfa07bfa8aa9fd258c4ca3bbee8",
198+
"0x77490617306b8deaadef49c55b4d61685cff8e11b0e309e970d063559daedab9",
199+
"0xfcf22c950928cf0f646b5d6b9f668c31360a253f8a240f60eec2ed81fb0ee149",
200+
"0x306938dbf9920eb22d5880a3f361829136dbca42e77a20656c911eefaf358c61",
201+
"0x8cdb02dad0a311cbb1b77d89a2171234c7cba312a5e5939fbb18416100802af4",
202+
"0xd510256a732147e51231f1282904f78782f5ce5e5c71e592b2c4a802a269bee8",
203+
"0x23a0e754283878f8c099769d8e86d9901c56c32f3e46449f91733e9c4604d0f5",
204+
"0xbddf80f6fb0466f44e4f082cb60431c838b4d5199013e4efa2468f57a53efe26",
205+
"0xa2325f26dd0238433d0b5ede3b1d0b1d3bc13f8a8f682c6e19110988b315fe36",
206+
"0xdab2ecc354a39a51c711026e65a18a3924bb91dddc37cd1dc681f0dbec79fc15",
207+
"0x20372ec32b4a649fd38b9a55d7daa6ac77dfae7ed0c2d216c0b3624476f29170",
208+
"0x5189b0076294c52281e0ce809aeb95b172b0aeeadaf5f92d353654c20d79cd50",
209+
"0x0f21c9ab4e99fa67c5261d823a055c322b94ba0784d6ecf8f4f9052e2a3427ad",
210+
"0x690d57da370ac0198054e49a3759e94e26172422a60d1e28d42f3e81ae860351",
211+
"0x5499f54ec7adf86a2359df873f3bc87b8d103dfb1ae09c9ce7c9c09b673fb38d",
212+
"0x287590ce7c870488d9f9a73745ab9929cf57656fa2d590c46906a2b6e89598e9",
213+
"0xd4af9a078aac03ba59274e31e237a2eed3e6ee4223b9c69d594db785d82cf369",
214+
"0x666bc8685638235130850dcdc3d720c9eb188204e3613092c9b52f598a878c1a",
215+
"0x1f21ed54a942dab2293bd48fc17360a324f82851c0c9ac46fc1b982e624f8e77",
216+
"0x3be37f31d6dd58e1786a55b021a7236323268280734899245183fd4c657fae9c",
217+
"0x5969f1bd63e6c405678429b318139aca6053ae4ff7e1e91b77d77db1e0f1d68c",
218+
"0xa883712abe2da91be9bdc54890dfe2d2e131e6569eadd40927b97fa2503f0515",
219+
"0x84b1d071b41b97eb21e9e24d05aba5cde62b78b84cbe8e024b638c901e7f32eb",
220+
"0x25f016aa91e530f64649f0566a1835041a75ffc23fb3ad54286460584440c604",
221+
"0x901eed4557cd5d1180d23701c78e60fc62ed818b3884030565207a3d5d0c4810",
222+
"0x532d41585eaedc9c6f322049429dab497b28eebd5aae4302c075a07e8416a32c",
223+
"0xcdbec87b7e9854f4080e3e3ee722b07355577cb1141e171153e6e7b274c6b236",
224+
"0x0343b9f15e5bc0b73232153039bebabab6d7e876e5dfea8a91af3b14a537e186",
225+
"0x4337383481e64a1af4c5d87e8a758fb5b30372e33c9d538c4102485926d9e237",
226+
"0x87ccf669cdb36c32e8c4714b05647b714d445258f9d6fbfdc4fd026db9f48b94",
227+
]
228+
229+
const data = []
230+
for (const txId of txIds) {
231+
try {
232+
const txReceipt = await hre.ethers.provider.getTransactionReceipt(txId.trim())
233+
if (!txReceipt) {
234+
console.log(`Transaction receipt not found for txId: ${txId}`)
235+
continue
236+
}
237+
238+
//console.log(`\nProcessing txId ${txId}:`, JSON.stringify(txReceipt, null, 2))
239+
240+
for (const log of txReceipt.logs) {
241+
try {
242+
const iface = new ethers.utils.Interface(["event Transfer(address indexed from, address indexed to, uint256 value)"])
243+
244+
const parsedLog = iface.parseLog(log)
245+
if (parsedLog.name === "Transfer") {
246+
console.log(`Transfer Event:
247+
To: ${parsedLog.args.to},
248+
Value: ${parsedLog.args.value.toString()}
249+
Token: ${log.address}`)
250+
251+
data.push(`${log.address}, ${parsedLog.args.to}, ${parsedLog.args.value.toString()}`)
252+
}
253+
} catch (error) {
254+
// Ignore logs that cannot be parsed as Transfer events
255+
}
256+
}
257+
} catch (error) {
258+
console.error(`Error processing txId ${txId}:`, error.message)
259+
}
260+
}
261+
262+
console.log(JSON.stringify(data, null, 2))
263+
})

tasks/sendOFT.js

100644100755
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ module.exports = async function (taskArgs, hre) {
5151

5252
// quote LZ fee with default adapterParams
5353
let adapterParams = ethers.utils.solidityPack(["uint16", "uint256"], [1, 10000000]) // default beam adapterParams example
54+
console.log(
55+
`estimating send fee. remoteChainId: ${remoteChainId}, toAddress: ${toAddressBytes}, qty: ${qty}, useZro: false, adapterParams: ${adapterParams}`
56+
)
5457
let lzFees = await localContractInstance.estimateSendFee(remoteChainId, toAddressBytes, qty, false, adapterParams)
5558
console.log(`lzFees[0] (wei): ${lzFees[0]} / (eth): ${ethers.utils.formatEther(lzFees[0])}`)
5659

tasks/setupOFT.js

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ const setMinDstGas = require("./setMinDstGas")
33
const setCustomAdapterParams = require("./setCustomAdapterParams")
44
const TOKEN_CONFIG = require("../constants/tokenConfig")
55

6+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
7+
68
module.exports = async function ({ localContract, remoteContract, targetNetwork, minGas: minDstGas, skipAdapter, gasOnly }, hre) {
79
let minGas = minDstGas
810
if (!minGas) {
911
if (TOKEN_CONFIG[targetNetwork] && TOKEN_CONFIG[targetNetwork][remoteContract] && TOKEN_CONFIG[targetNetwork][remoteContract].minGas) {
1012
minGas = TOKEN_CONFIG[targetNetwork][remoteContract].minGas
1113
console.log(`\nusing configured minGas of ${minGas} for ${targetNetwork}\n`)
1214
} else {
13-
minGas = targetNetwork.startsWith("beam") ? 10000000 : 100000
15+
minGas = targetNetwork.startsWith("beam") ? 10000000 : 200000
1416
console.log(`\nusing default minGas of ${minGas} for ${targetNetwork}\n`)
1517
}
1618
} else {
@@ -27,6 +29,7 @@ module.exports = async function ({ localContract, remoteContract, targetNetwork,
2729
},
2830
hre
2931
)
32+
await wait(5000)
3033
} else {
3134
console.log("\nskipped setting trusted remote.\n")
3235
}
@@ -41,6 +44,7 @@ module.exports = async function ({ localContract, remoteContract, targetNetwork,
4144
},
4245
hre
4346
)
47+
await wait(5000)
4448

4549
await setMinDstGas(
4650
{
@@ -51,6 +55,7 @@ module.exports = async function ({ localContract, remoteContract, targetNetwork,
5155
},
5256
hre
5357
)
58+
await wait(5000)
5459

5560
if (!skipAdapter && !gasOnly) {
5661
console.log("\nsetting custom adapter params...\n")

tasks/setupONFT1155.js

100644100755
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ const setTrustedRemote = require("./setTrustedRemote")
22
const setMinDstGas = require("./setMinDstGas")
33
const TOKEN_CONFIG = require("../constants/tokenConfig")
44

5-
module.exports = async function ({ localContract, remoteContract, targetNetwork, minGas: minDstGas }, hre) {
5+
module.exports = async function ({ localContract, remoteContract, targetNetwork, minGas: minDstGas, skipAdapter }, hre) {
66
let minGas = minDstGas
7-
87
if (!minGas) {
98
if (TOKEN_CONFIG[targetNetwork] && TOKEN_CONFIG[targetNetwork][remoteContract] && TOKEN_CONFIG[targetNetwork][remoteContract].minGas) {
109
minGas = TOKEN_CONFIG[targetNetwork][remoteContract].minGas
10+
console.log(`\nusing configured minGas of ${minGas} for ${targetNetwork}\n`)
1111
} else {
1212
minGas = targetNetwork.startsWith("beam") ? 10000000 : 100000
13+
console.log(`\nusing default minGas of ${minGas} for ${targetNetwork}\n`)
1314
}
15+
} else {
16+
console.log(`\nusing passed minGas of ${minGas} for ${targetNetwork}\n`)
1417
}
1518

1619
console.log("\nsetting trusted remote...\n")
@@ -44,11 +47,15 @@ module.exports = async function ({ localContract, remoteContract, targetNetwork,
4447
hre
4548
)
4649

47-
console.log("\nsetting custom adapter params...\n")
48-
await setCustomAdapterParams(
49-
{
50-
contract: localContract,
51-
},
52-
hre
53-
)
50+
if (!skipAdapter) {
51+
console.log("\nsetting custom adapter params...\n")
52+
await setCustomAdapterParams(
53+
{
54+
contract: localContract,
55+
},
56+
hre
57+
)
58+
} else {
59+
console.log("\nskipped setting custom adapter params.\n")
60+
}
5461
}

tasks/setupONFT712.js

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ module.exports = async function ({ localContract, remoteContract, targetNetwork,
77
if (!minGas) {
88
if (TOKEN_CONFIG[targetNetwork] && TOKEN_CONFIG[targetNetwork][remoteContract] && TOKEN_CONFIG[targetNetwork][remoteContract].minGas) {
99
minGas = TOKEN_CONFIG[targetNetwork][remoteContract].minGas
10+
console.log(`\nusing configured minGas of ${minGas} for ${targetNetwork}\n`)
1011
} else {
1112
minGas = targetNetwork.startsWith("beam") ? 10000000 : 100000
13+
console.log(`\nusing default minGas of ${minGas} for ${targetNetwork}\n`)
1214
}
15+
} else {
16+
console.log(`\nusing passed minGas of ${minGas} for ${targetNetwork}\n`)
1317
}
1418

1519
console.log("\nsetting trusted remote...\n")

0 commit comments

Comments
 (0)