-
Notifications
You must be signed in to change notification settings - Fork 280
Expand file tree
/
Copy pathmove.layerzero.config.ts
More file actions
127 lines (123 loc) · 4.72 KB
/
Copy pathmove.layerzero.config.ts
File metadata and controls
127 lines (123 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// NOTE: This config is an example for wiring Solana -> Aptos.
// See wiring-to-aptos.md for more information.
import { EndpointId } from '@layerzerolabs/lz-definitions'
import { ExecutorOptionType } from '@layerzerolabs/lz-v2-utilities'
import { OAppOmniGraphHardhat, OmniPointHardhat } from '@layerzerolabs/toolbox-hardhat'
// TODO: This example uses a single LayerZero Labs DVN in `requiredDVNs` for clarity.
// Production OApps must use at least 2 DVNs. Before mainnet, add a non-LayerZero-Labs
// DVN to each `requiredDVNs` array below. See:
// - DVN providers: https://docs.layerzero.network/v2/deployments/dvn-addresses
// - Migration guide: https://docs.layerzero.network/v2/get-started/migrating-from-single-dvn
enum MsgType {
SEND = 1,
SEND_AND_CALL = 2,
}
const aptosContract: OmniPointHardhat = {
eid: EndpointId.APTOS_V2_TESTNET as EndpointId,
address: 'YOUR_DEPLOYED_APTOS_CONTRACT_ADDRESS',
}
const solanaContract: OmniPointHardhat = {
eid: EndpointId.SOLANA_V2_TESTNET as EndpointId,
address: 'YOUR_DEPLOYED_SOLANA_OAPP_ADDRESS',
}
const layerZeroDVNAptosAddress = '0x756f8ab056688d22687740f4a9aeec3b361170b28d08b719e28c4d38eed1043e'
const layerZeroDVNSolanaAddress = '4VDjp6XQaxoZf5RGwiPU9NR1EXSZn2TP4ATMmiSzLfhb'
const config: OAppOmniGraphHardhat = {
contracts: [
{
contract: solanaContract,
config: {
owner: 'YOUR_SOLANA_OWNER_ADDRESS',
delegate: 'YOUR_SOLANA_OWNER_ADDRESS',
},
},
{
contract: aptosContract,
config: {
owner: 'YOUR_APTOS_ACCOUNT_ADDRESS',
delegate: 'YOUR_APTOS_ACCOUNT_ADDRESS',
},
},
],
connections: [
{
from: aptosContract,
to: solanaContract,
config: {
enforcedOptions: [
{
msgType: MsgType.SEND_AND_CALL,
optionType: ExecutorOptionType.LZ_RECEIVE,
gas: 5_000,
value: 0,
},
],
sendLibrary: '0xcc1c03aed42e2841211865758b5efe93c0dde2cb7a2a5dc6cf25a4e33ad23690',
receiveLibraryConfig: {
receiveLibrary: '0xcc1c03aed42e2841211865758b5efe93c0dde2cb7a2a5dc6cf25a4e33ad23690',
gracePeriod: BigInt(0),
},
sendConfig: {
executorConfig: {
maxMessageSize: 10_000,
executor: '0x93353700091200ef9fdc536ce6a86182cc7e62da25f94356be9421c6310b9585',
},
ulnConfig: {
confirmations: BigInt(10),
requiredDVNs: [layerZeroDVNAptosAddress],
optionalDVNs: [],
optionalDVNThreshold: 0,
},
},
receiveConfig: {
ulnConfig: {
confirmations: BigInt(15),
requiredDVNs: [layerZeroDVNAptosAddress],
optionalDVNs: [],
optionalDVNThreshold: 0,
},
},
},
},
{
from: solanaContract,
to: aptosContract,
config: {
enforcedOptions: [
{
msgType: 1,
optionType: ExecutorOptionType.LZ_RECEIVE,
gas: 200_000,
value: 0,
},
],
sendLibrary: '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH',
receiveLibraryConfig: {
receiveLibrary: '7a4WjyR8VZ7yZz5XJAKm39BUGn5iT9CKcv2pmG9tdXVH',
gracePeriod: BigInt(0),
},
sendConfig: {
executorConfig: {
maxMessageSize: 10_000,
executor: 'AwrbHeCyniXaQhiJZkLhgWdUCteeWSGaSN1sTfLiY7xK',
},
ulnConfig: {
confirmations: BigInt(15),
requiredDVNs: [layerZeroDVNSolanaAddress],
optionalDVNs: [],
optionalDVNThreshold: 0,
},
},
receiveConfig: {
ulnConfig: {
confirmations: BigInt(10),
requiredDVNs: [layerZeroDVNSolanaAddress],
optionalDVNs: [],
optionalDVNThreshold: 0,
},
},
},
},
],
}
export default config