Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion constants/chainIds.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"optimism-goerli": 10132,
"fantom-testnet": 10112,
"meter-testnet": 10156,
"zksync-testnet": 10165
"zksync-testnet": 10165,

"op-sepolia": 10232,
"base-sepolia": 10245
}
628 changes: 627 additions & 1 deletion constants/endpoint_abi.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion constants/layerzeroEndpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@
"optimism-goerli": "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
"fantom-testnet": "0x7dcAD72640F835B0FA36EFD3D6d3ec902C7E5acf",
"meter-testnet": "0x3De2f3D1Ac59F18159ebCB422322Cb209BA96aAD",
"zksync-testnet": "0x093D2CF57f764f09C3c2Ac58a42A2601B8C79281"
"zksync-testnet": "0x093D2CF57f764f09C3c2Ac58a42A2601B8C79281",
"op-sepolia": "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
"base-sepolia": "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8"
}
16 changes: 8 additions & 8 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,21 @@ module.exports = {
accounts: accounts(),
},

goerli: {
url: "https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161", // public infura endpoint
chainId: 5,
accounts: accounts(),
},
"bsc-testnet": {
url: "https://data-seed-prebsc-1-s1.binance.org:8545/",
chainId: 97,
"op-sepolia": {
url: "https://optimism-sepolia.gateway.tenderly.co",
chainId: 11155420,
accounts: accounts(),
},
fuji: {
url: `https://api.avax-test.network/ext/bc/C/rpc`,
chainId: 43113,
accounts: accounts(),
},
"base-sepolia": {
url: "https://base-sepolia.gateway.tenderly.co",
chainId: 84532,
accounts: accounts(),
},
mumbai: {
url: "https://rpc-mumbai.maticvigil.com/",
chainId: 80001,
Expand Down
27 changes: 27 additions & 0 deletions tasks/checkEndpointVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json")
const ABI = require("../constants/endpoint_abi.json")

module.exports = async function (taskArgs, hre) {

const contract = await ethers.getContract(taskArgs.contract)
const oAppAddress = contract.address

const lzEndpointAddress = LZ_ENDPOINTS[hre.network.name]
const endpoint = await hre.ethers.getContractAt(ABI, lzEndpointAddress)

const sendVersion = await endpoint.getSendVersion(oAppAddress)
const receiveVersion = await endpoint.getReceiveVersion(oAppAddress)

const latestVersion = await endpoint.latestVersion()
const receiveUln301Version = latestVersion;
const sendUln301Version = latestVersion - 1;
Comment on lines +16 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these indexes deterministic? I actually have no clue to be honest.

Copy link
Collaborator

@St0rmBr3w St0rmBr3w Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryandgoulding they're latest for now, but there's a better way to do this in case we ever do decide to add a new ULN version to EPV1.

https://github.com/LayerZero-Labs/devtools/blob/88cdb92f994e9b73d1e3713803f58b5fb126b71c/examples/lzapp-migration/tasks/common/taskHelper.ts#L426-L457


if (sendVersion < sendUln301Version) {
console.log(`You may optionally upgrade to the latest version of UltraLightNode301 for send. Latest version: ${sendUln301Version}. Current version: ${sendVersion}.`)
}

if (receiveVersion < receiveUln301Version) {
console.log(`You may optionally upgrade to the latest version of UltraLightNode301 for receive. Latest version: ${receiveUln301Version}. Current version: ${receiveVersion}.`)
}

}
6 changes: 6 additions & 0 deletions tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ task("checkWireUpAll", "check wire up all", require("./checkWireUpAll"))
.addOptionalParam("proxyContract", "name of proxy contract")
.addOptionalParam("proxyChain", "name of proxy chain")


//
task("checkEndpointVersion", "check endpoint version", require("./checkEndpointVersion"))
.addParam("e", "environment testnet/mainet")
.addParam("contract", "the contract to inspect")

//
task(
"setTrustedRemote",
Expand Down
5 changes: 4 additions & 1 deletion tasks/setTrustedRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ module.exports = async function (taskArgs, hre) {
console.log(`✅ [${hre.network.name}] setTrustedRemote(${remoteChainId}, ${remoteAndLocal})`)
console.log(` tx: ${tx.transactionHash}`)
} catch (e) {
if (e.error.message.includes("The chainId + address is already trusted")) {
if (e.error?.message.includes("The chainId + address is already trusted")) {
console.log("*source already set*")
} else if (e.error) {
console.log(e.error)
} else {
console.log(e)
console.log(`❌ [${hre.network.name}] setTrustedRemote(${remoteChainId}, ${remoteAndLocal})`)
}
}
Expand Down
Loading