Skip to content

Instantly share code, notes, and snippets.

@mfbevan
Last active December 10, 2024 04:52
Show Gist options
  • Select an option

  • Save mfbevan/d6c252261b97974828065bf4b36646b2 to your computer and use it in GitHub Desktop.

Select an option

Save mfbevan/d6c252261b97974828065bf4b36646b2 to your computer and use it in GitHub Desktop.
MCG LZ Config
import { EndpointId } from '@layerzerolabs/lz-definitions'
import { ExecutorOptionType } from '@layerzerolabs/lz-v2-utilities'
import type { OAppOmniGraphHardhat, OmniPointHardhat } from '@layerzerolabs/toolbox-hardhat'
// Note: Do not use address for EVM OmniPointHardhat contracts. Contracts are loaded using hardhat-deploy.
// If you do use an address, ensure artifacts exists.
const ethContract: OmniPointHardhat = {
eid: EndpointId.ETHEREUM_V2_MAINNET,
contractName: 'MetalCoreAdapter',
}
const solanaContract: OmniPointHardhat = {
eid: EndpointId.SOLANA_V2_MAINNET,
address: '9sU66TvUUgjJAbajvnmFUMz3ZzhFrZdrscCXqqd1mYaq', // TODO update this with the OFTStore address.
}
const config: OAppOmniGraphHardhat = {
contracts: [
{
contract: ethContract,
},
{
contract: solanaContract,
},
],
connections: [
{
from: ethContract,
to: solanaContract,
config: {
sendConfig: {
ulnConfig: {
confirmations: BigInt(15),
requiredDVNs: [
'0x589dedbd617e0cbcb916a9223f4d1300c294236b', // LayerZero
],
},
},
enforcedOptions: [
{
msgType: 1,
optionType: ExecutorOptionType.LZ_RECEIVE,
gas: 200000,
value: 2500000,
},
{
msgType: 2,
optionType: ExecutorOptionType.LZ_RECEIVE,
gas: 200000,
value: 2500000,
},
{
// Solana options use (gas == compute units, value == lamports)
msgType: 2,
optionType: ExecutorOptionType.COMPOSE,
index: 0,
gas: 0,
value: 0,
},
],
},
},
{
from: solanaContract,
to: ethContract,
config: {
sendLibrary: '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH',
receiveLibraryConfig: {
receiveLibrary: '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH',
gracePeriod: BigInt(0),
},
// Optional Send Configuration
// @dev Controls how the `from` chain sends messages to the `to` chain.
sendConfig: {
executorConfig: {
maxMessageSize: 10000,
// The configured Executor address. Note, this is the executor PDA not the program ID.
executor: 'AwrbHeCyniXaQhiJZkLhgWdUCteeWSGaSN1sTfLiY7xK',
},
ulnConfig: {
// // The number of block confirmations to wait on BSC before emitting the message from the source chain.
confirmations: BigInt(15),
// The address of the DVNs you will pay to verify a sent message on the source chain ).
// The destination tx will wait until ALL `requiredDVNs` verify the message.
requiredDVNs: [
'4VDjp6XQaxoZf5RGwiPU9NR1EXSZn2TP4ATMmiSzLfhb', // LayerZero
],
// The address of the DVNs you will pay to verify a sent message on the source chain ).
// The destination tx will wait until the configured threshold of `optionalDVNs` verify a message.
optionalDVNs: [],
// The number of `optionalDVNs` that need to successfully verify the message for it to be considered Verified.
optionalDVNThreshold: 0,
},
},
// Optional Receive Configuration
// @dev Controls how the `from` chain receives messages from the `to` chain.
receiveConfig: {
ulnConfig: {
// The number of block confirmations to expect from the `to` chain.
confirmations: BigInt(15),
// The address of the DVNs your `receiveConfig` expects to receive verifications from on the `from` chain ).
// The `from` chain's OApp will wait until the configured threshold of `requiredDVNs` verify the message.
requiredDVNs: [
'4VDjp6XQaxoZf5RGwiPU9NR1EXSZn2TP4ATMmiSzLfhb', // LayerZero
],
// The address of the DVNs you will pay to verify a sent message on the source chain ).
// The destination tx will wait until the configured threshold of `optionalDVNs` verify a message.
optionalDVNs: [],
// The number of `optionalDVNs` that need to successfully verify the message for it to be considered Verified.
optionalDVNThreshold: 0,
},
},
enforcedOptions: [
{
msgType: 1,
optionType: ExecutorOptionType.LZ_RECEIVE,
gas: 200000,
},
{
msgType: 2,
optionType: ExecutorOptionType.LZ_RECEIVE,
gas: 200000,
},
],
},
},
],
}
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment