-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconsts.ts
359 lines (336 loc) · 13.1 KB
/
consts.ts
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
import {
Chain,
ChainId,
Network,
chainToChainId,
toChain,
toChainId,
} from '@wormhole-foundation/sdk-base';
export type Mode = 'vaa' | 'ntt' | 'ft';
// This is defined here in an effort to keep the number and text in sync.
// The default value is not exported because the getMissThreshold() function should be used to get the value.
const MISS_THRESHOLD_IN_MINS_DEFAULT = 40;
export const MISS_THRESHOLD_LABEL = '40 minutes';
export const MAX_VAA_DECIMALS = 8;
export const VAA_VERSION = 1;
type NetworkChainBlockMapping = { [key in Network]: { [key in Chain]?: string } };
export const INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN: NetworkChainBlockMapping = {
['Mainnet']: {
Ethereum: '12959638',
Terra: '4810000', // not sure exactly but this should be before the first known message
Bsc: '9745450',
Polygon: '20629146',
Avalanche: '8237163',
Oasis: '1757',
Algorand: '22931277',
Fantom: '31817467',
Karura: '1824665',
Acala: '1144161',
Klaytn: '90563824',
Celo: '12947144',
Moonbeam: '1486591',
Terra2: '399813',
Injective: '20908376',
Arbitrum: '18128584',
Optimism: '69401779',
Aptos: '0', // block is 1094390 but AptosWatcher uses sequence number instead
Near: '72767136',
Xpla: '777549',
Solana: '94396403', // https://explorer.solana.com/tx/2L8rQY94W2d44sycRkhHA1PyXdh5z6ND541ftDDk1dgBcv6RLR9a3zUgTJispPmXjkmqdqd5EDytXcnP5PC2AmEJ
Sui: '1485552', // https://explorer.sui.io/txblock/671SoTvVUvBZQWKXeameDvAwzHQvnr8Nj7dR9MUwm3CV?network=https%3A%2F%2Frpc.mainnet.sui.io
Base: '1422314',
Scroll: '4955534',
Mantle: '64176265',
Blast: '2375628',
Sei: '238594',
Wormchain: '4510119', // https://bigdipper.live/wormhole/transactions/4D861F1BE86325D227FA006CA2745BBC6748AF5B5E0811DE536D02792928472A
Berachain: '968947', //https://berascan.com/tx/0x5a425c6fee87ccc44ef87c1d9cb9c7d1deda4b8596b67c003726e68a2f06e0a4
Snaxchain: '306315',
Unichain: '8115676', // https://unichain.blockscout.com/tx/0x4d65e33abc388c2d92c71ea01374af935a6615d0e555a7abbdef6c44e04613ba
Worldchain: '5805110', // https://worldscan.org/tx/0x568eb14596296bda3022527cf0e915bfec073613b27c495e695fb9e08652f6fc
Ink: '7711131', // Block of contract creation, https://explorer.inkonchain.com/tx/0x2576b03a4c0de8566778cb3149a0dbc1c8f8dfcf5d87c9f5f96038c4b15e3797
},
['Testnet']: {
Ethereum: '0',
Terra: '0',
Bsc: '0',
Polygon: '0',
Avalanche: '0',
Oasis: '0',
Algorand: '0',
Fantom: '0',
Karura: '0',
Acala: '0',
Klaytn: '0',
Celo: '0',
Moonbeam: '0',
Terra2: '0',
Injective: '0',
Arbitrum: '0',
Optimism: '0',
Aptos: '0',
Near: '0',
Xpla: '0',
Solana: '0',
Sui: '0',
Scroll: '0',
Mantle: '0',
Blast: '0',
Base: '0',
Sei: '0',
Wormchain: '4495661',
PolygonSepolia: '2379275',
Berachain: '846481',
Seievm: '142153268', // Block of contract creation
Snaxchain: '482557',
Unichain: '254961', // Block of contract creation
Worldchain: '4487948', // Block of contract creation
Monad: '520060', // Block of contract creation
Ink: '1907965', // Block of contract creation
HyperEVM: '13743181', // Block of contract creation
Mezo: '3102383', // Block of contract creation
},
['Devnet']: {},
};
export const INITIAL_NTT_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN: NetworkChainBlockMapping = {
['Mainnet']: {
Solana: '260508723',
Ethereum: '19583505',
Fantom: '78727372',
Arbitrum: '201652677',
Optimism: '118840800',
Base: '13245519',
},
['Testnet']: {
Solana: '285100152',
Sepolia: '5472203',
ArbitrumSepolia: '22501243',
BaseSepolia: '7249669',
OptimismSepolia: '9232548',
},
['Devnet']: {},
};
export const INITIAL_FT_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN: NetworkChainBlockMapping = {
['Mainnet']: {
Solana: '285350104',
Arbitrum: '245882390',
Avalanche: '55500000',
Base: '18956026',
Ethereum: '21630000',
Optimism: '130500000',
Polygon: '66500000',
},
['Testnet']: {
Solana: '302162456',
ArbitrumSepolia: '49505590',
},
['Devnet']: {},
};
export const INITIAL_DEPLOYMENT_BLOCK_BY_MODE: {
[mode in Mode]: NetworkChainBlockMapping;
} = {
vaa: INITIAL_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN,
ntt: INITIAL_NTT_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN,
ft: INITIAL_FT_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN,
};
export function getMissThreshold(date: Date, chainish: number | string | Chain | ChainId): string {
// We would like chainish to really be a ChainId.
let missThresholdInMins: number;
try {
let chainId: ChainId;
if (typeof chainish === 'string' && !Number.isNaN(Number(chainish))) {
// e.g. Handle '1'
chainId = toChainId(Number(chainish));
} else {
// At this point we either have a number, a non-number string, a Chain, or a ChainId
chainId = toChainId(chainish);
}
missThresholdInMins = chainId === toChainId('Scroll') ? 120 : MISS_THRESHOLD_IN_MINS_DEFAULT;
} catch (e) {
// If we can't get the chainId, we'll use the default value.
missThresholdInMins = MISS_THRESHOLD_IN_MINS_DEFAULT;
}
const missDate = date;
missDate.setMinutes(missDate.getMinutes() - missThresholdInMins);
return missDate.toISOString();
}
export const TOKEN_BRIDGE_EMITTERS: { [key in Chain]?: string } = {
Solana: 'ec7372995d5cc8732397fb0ad35c0121e0eaa90d26f828a534cab54391b3a4f5',
Ethereum: '0000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa585',
Terra: '0000000000000000000000007cf7b764e38a0a5e967972c1df77d432510564e2',
Terra2: 'a463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3',
Bsc: '000000000000000000000000b6f6d86a8f9879a9c87f643768d9efc38c1da6e7',
Polygon: '0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde',
Avalanche: '0000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d8052',
Oasis: '0000000000000000000000005848c791e09901b40a9ef749f2a6735b418d7564',
Algorand: '67e93fa6c8ac5c819990aa7340c0c16b508abb1178be9b30d024b8ac25193d45',
Aptos: '0000000000000000000000000000000000000000000000000000000000000001',
Aurora: '00000000000000000000000051b5123a7b0f9b2ba265f9c4c8de7d78d52f510f',
Fantom: '0000000000000000000000007c9fc5741288cdfdd83ceb07f3ea7e22618d79d2',
Karura: '000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624',
Acala: '000000000000000000000000ae9d7fe007b3327aa64a32824aaac52c42a6e624',
Klaytn: '0000000000000000000000005b08ac39eaed75c0439fc750d9fe7e1f9dd0193f',
Celo: '000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed',
Near: '148410499d3fcda4dcfd68a1ebfcdddda16ab28326448d4aae4d2f0465cdfcb7',
Moonbeam: '000000000000000000000000b1731c586ca89a23809861c6103f0b96b3f57d92',
Arbitrum: '0000000000000000000000000b2402144bb366a632d14b83f244d2e0e21bd39c',
Optimism: '0000000000000000000000001d68124e65fafc907325e3edbf8c4d84499daa8b',
Xpla: '8f9cf727175353b17a5f574270e370776123d90fd74956ae4277962b4fdee24c',
Injective: '00000000000000000000000045dbea4617971d93188eda21530bc6503d153313',
Sui: 'ccceeb29348f71bdd22ffef43a2a19c1f5b5e17c5cca5411529120182672ade5',
Base: '0000000000000000000000008d2de8d2f73f1f4cab472ac9a881c9b123c79627',
Scroll: '00000000000000000000000024850c6f61C438823F01B7A3BF2B89B72174Fa9d',
Mantle: '00000000000000000000000024850c6f61C438823F01B7A3BF2B89B72174Fa9d',
Blast: '00000000000000000000000024850c6f61C438823F01B7A3BF2B89B72174Fa9d',
Xlayer: '0000000000000000000000005537857664B0f9eFe38C9f320F75fEf23234D904',
Sei: '86c5fd957e2db8389553e1728f9c27964b22a8154091ccba54d75f4b10c61f5e',
Wormchain: 'aeb534c45c3049d380b9d9b966f9895f53abd4301bfaff407fa09dea8ae7a924',
};
export const isTokenBridgeEmitter = (chain: ChainId | Chain, emitter: string) =>
TOKEN_BRIDGE_EMITTERS[toChain(chain)]?.toLowerCase() === emitter.toLowerCase();
export const NFT_BRIDGE_EMITTERS: { [key in Chain]?: string } = {
Solana: '0def15a24423e1edd1a5ab16f557b9060303ddbab8c803d2ee48f4b78a1cfd6b',
Ethereum: '0000000000000000000000006ffd7ede62328b3af38fcd61461bbfc52f5651fe',
Bsc: '0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde',
Polygon: '00000000000000000000000090bbd86a6fe93d3bc3ed6335935447e75fab7fcf',
Avalanche: '000000000000000000000000f7b6737ca9c4e08ae573f75a97b73d7a813f5de5',
Oasis: '00000000000000000000000004952d522ff217f40b5ef3cbf659eca7b952a6c1',
Aurora: '0000000000000000000000006dcc0484472523ed9cdc017f711bcbf909789284',
Fantom: '000000000000000000000000a9c7119abda80d4a4e0c06c8f4d8cf5893234535',
Karura: '000000000000000000000000b91e3638f82a1facb28690b37e3aae45d2c33808',
Acala: '000000000000000000000000b91e3638f82a1facb28690b37e3aae45d2c33808',
Klaytn: '0000000000000000000000003c3c561757baa0b78c5c025cdeaa4ee24c1dffef',
Celo: '000000000000000000000000a6a377d75ca5c9052c9a77ed1e865cc25bd97bf3',
Moonbeam: '000000000000000000000000453cfbe096c0f8d763e8c5f24b441097d577bde2',
Arbitrum: '0000000000000000000000003dd14d553cfd986eac8e3bddf629d82073e188c8',
Optimism: '000000000000000000000000fe8cd454b4a1ca468b57d79c0cc77ef5b6f64585',
Aptos: '0000000000000000000000000000000000000000000000000000000000000005',
Base: '000000000000000000000000da3adc6621b2677bef9ad26598e6939cf0d92f88',
};
export const isNFTBridgeEmitter = (chain: ChainId | Chain, emitter: string) =>
NFT_BRIDGE_EMITTERS[toChain(chain)]?.toLowerCase() === emitter.toLowerCase();
export const CIRCLE_INTEGRATION_EMITTERS: { [key in Chain]?: string } = {
Ethereum: '000000000000000000000000aada05bd399372f0b0463744c09113c137636f6a',
Avalanche: '00000000000000000000000009fb06a271faff70a651047395aaeb6265265f13',
Optimism: '0000000000000000000000002703483b1a5a7c577e8680de9df8be03c6f30e3c',
Arbitrum: '0000000000000000000000002703483b1a5a7c577e8680de9df8be03c6f30e3c',
Base: '00000000000000000000000003faBB06Fa052557143dC28eFCFc63FC12843f1D',
Polygon: '0000000000000000000000000FF28217dCc90372345954563486528aa865cDd6',
};
export const isCircleIntegrationEmitter = (chain: ChainId | Chain, emitter: string) =>
CIRCLE_INTEGRATION_EMITTERS[toChain(chain)]?.toLowerCase() === emitter.toLowerCase();
// https://developers.circle.com/stablecoins/docs/supported-domains
export const CIRCLE_DOMAIN_TO_CHAIN_ID: { [key: number]: ChainId } = {
0: chainToChainId('Ethereum'),
1: chainToChainId('Avalanche'),
2: chainToChainId('Optimism'),
3: chainToChainId('Arbitrum'),
6: chainToChainId('Base'),
7: chainToChainId('Polygon'),
};
export const ACCOUNTANT_CONTRACT_ADDRESS =
'wormhole14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9srrg465';
export const NTT_ACCOUNTANT_CONTRACT_ADDRESS_MAINNET =
'wormhole1mc23vtzxh46e63vq22e8cnv23an06akvkqws04kghkrxrauzpgwq2hmwm7';
export const NTT_ACCOUNTANT_CONTRACT_ADDRESS_TESTNET =
'wormhole169tvyx49zmjqhlv7mzwj8j2weprascc0jq3rdglw9pynldqx34nscvhc7k';
export const GUARDIAN_SET_4 = [
{
pubkey: '0x5893B5A76c3f739645648885bDCcC06cd70a3Cd3',
name: 'RockawayX',
},
{
pubkey: '0xfF6CB952589BDE862c25Ef4392132fb9D4A42157',
name: 'Staked',
},
{
pubkey: '0x114De8460193bdf3A2fCf81f86a09765F4762fD1',
name: 'Figment',
},
{
pubkey: '0x107A0086b32d7A0977926A205131d8731D39cbEB',
name: 'ChainodeTech',
},
{
pubkey: '0x8C82B2fd82FaeD2711d59AF0F2499D16e726f6b2',
name: 'Inotel',
},
{
pubkey: '0x11b39756C042441BE6D8650b69b54EbE715E2343',
name: 'HashQuark',
},
{
pubkey: '0x54Ce5B4D348fb74B958e8966e2ec3dBd4958a7cd',
name: 'Chainlayer',
},
{
pubkey: '0x15e7cAF07C4e3DC8e7C469f92C8Cd88FB8005a20',
name: 'xLabs',
},
{
pubkey: '0x74a3bf913953D695260D88BC1aA25A4eeE363ef0',
name: 'Forbole',
},
{
pubkey: '0x000aC0076727b35FBea2dAc28fEE5cCB0fEA768e',
name: 'Staking Fund',
},
{
pubkey: '0xAF45Ced136b9D9e24903464AE889F5C8a723FC14',
name: 'MoonletWallet',
},
{
pubkey: '0xf93124b7c738843CBB89E864c862c38cddCccF95',
name: 'P2P Validator',
},
{
pubkey: '0xD2CC37A4dc036a8D232b48f62cDD4731412f4890',
name: '01Node',
},
{
pubkey: '0xDA798F6896A3331F64b48c12D1D57Fd9cbe70811',
name: 'MCF',
},
{
pubkey: '0x71AA1BE1D36CaFE3867910F99C09e347899C19C3',
name: 'Everstake',
},
{
pubkey: '0x8192b6E7387CCd768277c17DAb1b7a5027c0b3Cf',
name: 'Chorus One',
},
{
pubkey: '0x178e21ad2E77AE06711549CFBB1f9c7a9d8096e8',
name: 'Syncnode',
},
{
pubkey: '0x5E1487F35515d02A92753504a8D75471b9f49EdB',
name: 'Triton',
},
{
pubkey: '0x6FbEBc898F403E4773E95feB15E80C9A99c8348d',
name: 'Staking Facilities',
},
];
export const STANDBY_GUARDIANS = [
{
pubkey: '0x68c16a92903c4c74ffddc730582ba53d967d3dac',
name: 'Google Cloud',
},
];
export type GuardianSetInfo = {
timestamp: string;
contract: string;
guardianSetIndex: string;
guardianSet: string;
};
export type GuardianSetInfoByChain = {
[chain in Chain]?: GuardianSetInfo;
};
// TODO: this should probably be a table in the database
export const TVL_TOKEN_DENYLIST: { [key in ChainId]?: string[] } = {
[chainToChainId('Fantom')]: ['0x5b2af7fd27e2ea14945c82dd254c79d3ed34685e'], // coingecko reporting bad prices
};
export const isTokenDenylisted = (chainId: ChainId, address: string): boolean => {
return TVL_TOKEN_DENYLIST[chainId]?.includes(address.toLowerCase()) ?? false;
};