Skip to content

Commit a73f07a

Browse files
committed
reworked ntt config, added ntt groups
1 parent 5fc4807 commit a73f07a

32 files changed

+510
-175
lines changed

sdk/src/config/TESTNET.ts

+14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { WormholeConfig, Context, ChainConfig, Contracts } from '../types';
66
*/
77
export const TESTNET_CHAINS = {
88
solana: 1,
9+
goerli: 2,
910
bsc: 4,
1011
mumbai: 5,
1112
fuji: 6,
@@ -47,6 +48,18 @@ export type ChainContracts = {
4748
};
4849

4950
const TESTNET: { [chain in TestnetChainName]: ChainConfig } = {
51+
goerli: {
52+
key: 'goerli',
53+
id: 2,
54+
context: Context.ETH,
55+
contracts: {
56+
...CONTRACTS.TESTNET.ethereum,
57+
relayer: '0x9563a59c15842a6f322b10f69d1dd88b41f2e97b',
58+
},
59+
finalityThreshold: 64,
60+
nativeTokenDecimals: 18,
61+
cctpDomain: 0,
62+
},
5063
solana: {
5164
key: 'solana',
5265
id: 1,
@@ -360,6 +373,7 @@ const env: Environment = 'TESTNET';
360373
const TESTNET_CONFIG: WormholeConfig = {
361374
env,
362375
rpcs: {
376+
goerli: 'https://rpc.ankr.com/eth_goerli',
363377
mumbai: 'https://rpc.ankr.com/polygon_mumbai',
364378
bsc: 'https://data-seed-prebsc-1-s3.binance.org:8545',
365379
fuji: 'https://api.avax-test.network/ext/bc/C/rpc',

wormhole-connect/src/config/devnet/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
DEVNET_RPC_MAPPING,
88
} from './rpcs';
99
import { DEVNET_TOKENS } from './tokens';
10+
import { DEVNET_NTT_GROUPS } from './nttGroups';
1011

1112
export * from './chains';
1213
export * from './gasEstimates';
@@ -20,6 +21,7 @@ const DEVNET: NetworkData = {
2021
rpcs: DEVNET_RPC_MAPPING,
2122
rest: DEVNET_REST_MAPPING,
2223
graphql: DEVNET_GRAPHQL_MAPPING,
24+
nttGroups: DEVNET_NTT_GROUPS,
2325
};
2426

2527
export default DEVNET;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { NttGroups } from 'config/types';
2+
3+
export const DEVNET_NTT_GROUPS: NttGroups = {};

wormhole-connect/src/config/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ export function buildConfig(
132132
// Route options
133133
ethBridgeMaxAmount: customConfig?.ethBridgeMaxAmount ?? 5,
134134
wstETHBridgeMaxAmount: customConfig?.wstETHBridgeMaxAmount ?? 5,
135+
136+
// NTT config
137+
// TODO: allow custom NTT config. validate similar to custom tokens
138+
nttGroups: networkData.nttGroups,
135139
};
136140
}
137141

wormhole-connect/src/config/mainnet/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
MAINNET_RPC_MAPPING,
88
} from './rpcs';
99
import { MAINNET_TOKENS } from './tokens';
10+
import { MAINNET_NTT_GROUPS } from './nttGroups';
1011

1112
export * from './chains';
1213
export * from './gasEstimates';
@@ -20,6 +21,7 @@ const MAINNET: NetworkData = {
2021
rpcs: MAINNET_RPC_MAPPING,
2122
rest: MAINNET_REST_MAPPING,
2223
graphql: MAINNET_GRAPHQL_MAPPING,
24+
nttGroups: MAINNET_NTT_GROUPS,
2325
};
2426

2527
export default MAINNET;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { NttGroups } from 'config/types';
2+
3+
export const MAINNET_NTT_GROUPS: NttGroups = {};

wormhole-connect/src/config/testnet/gasEstimates.ts

+4
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ export const TESTNET_GAS_ESTIMATES: GasEstimates = {
255255
sendToken: 150000,
256256
claim: 200000,
257257
},
258+
[Route.CCTPManual]: {
259+
sendToken: 150000,
260+
claim: 300000,
261+
},
258262
[Route.NttManual]: {
259263
sendToken: 200000,
260264
claim: 250000,

wormhole-connect/src/config/testnet/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
TESTNET_RPC_MAPPING,
88
} from './rpcs';
99
import { TESTNET_TOKENS } from './tokens';
10+
import { TESTNET_NTT_GROUPS } from './nttGroups';
1011

1112
export * from './chains';
1213
export * from './gasEstimates';
@@ -20,6 +21,7 @@ const TESTNET: NetworkData = {
2021
rpcs: TESTNET_RPC_MAPPING,
2122
rest: TESTNET_REST_MAPPING,
2223
graphql: TESTNET_GRAPHQL_MAPPING,
24+
nttGroups: TESTNET_NTT_GROUPS,
2325
};
2426

2527
export default TESTNET;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { NttGroups } from 'config/types';
2+
3+
export const TESTNET_NTT_GROUPS: NttGroups = {
4+
TEST_NTT: {
5+
nttManagers: [
6+
{
7+
chainName: 'sepolia',
8+
address: '0xB231aD95f2301bc82eA44c515001F0F746D637e0',
9+
tokenKey: 'TEST_NTTsepolia',
10+
transceivers: [
11+
{
12+
address: '0x1fDC902e30b188FD2BA976B421Cb179943F57896',
13+
type: 'wormhole',
14+
},
15+
],
16+
},
17+
{
18+
chainName: 'arbitrum_sepolia',
19+
address: '0xEec94CD3083e067398256a79CcA7e740C5c8ef81',
20+
tokenKey: 'TEST_NTTarbitrum_sepolia',
21+
transceivers: [
22+
{
23+
address: '0x0E24D17D7467467b39Bf64A9DFf88776Bd6c74d7',
24+
type: 'wormhole',
25+
},
26+
],
27+
},
28+
{
29+
chainName: 'base_sepolia',
30+
address: '0xB03b030b2f5B40819Df76467d67eD1C85Ff66fAD',
31+
tokenKey: 'TEST_NTTbase_sepolia',
32+
transceivers: [
33+
{
34+
address: '0x1e072169541f1171e427Aa44B5fd8924BEE71b0e',
35+
type: 'wormhole',
36+
},
37+
],
38+
},
39+
{
40+
chainName: 'optimism_sepolia',
41+
address: '0x7f430D4e7939D994C0955A01FC75D9DE33F12D11',
42+
tokenKey: 'TEST_NTToptimism_sepolia',
43+
transceivers: [
44+
{
45+
address: '0x41265eb2863bf0238081F6AeefeF73549C82C3DD',
46+
type: 'wormhole',
47+
},
48+
],
49+
},
50+
{
51+
chainName: 'solana',
52+
address: 'nTTh3bZ5Aer6xboWZe39RDEft4MeVxSQ8D1EYAVLZw9',
53+
tokenKey: 'TEST_NTTsolana',
54+
transceivers: [
55+
{
56+
address: 'nTTh3bZ5Aer6xboWZe39RDEft4MeVxSQ8D1EYAVLZw9',
57+
type: 'wormhole',
58+
},
59+
],
60+
solanaQuoter: 'NqTdGLLL6b6bFo7YESNEezocgF8onH5cst5EdH791en',
61+
},
62+
],
63+
},
64+
TEST_USDC: {
65+
nttManagers: [
66+
{
67+
chainName: 'sepolia',
68+
address: '0xFCD6994bC89FCB5891404Eb6268cFB3701F1C198',
69+
tokenKey: 'USDCsepolia',
70+
transceivers: [
71+
{
72+
address: '0xE18EF44f81fcF4ba3eD765F0B360B68f823Fac33',
73+
type: 'wormhole',
74+
},
75+
],
76+
},
77+
{
78+
chainName: 'alfajores',
79+
address: '0x12594D5EBF88Deb5b02a6B7d265B421f6EE2CbA6',
80+
tokenKey: 'USDCalfajores',
81+
transceivers: [
82+
{
83+
address: '0x328f1fa5f84f62177d1e04976FdC49aB07578cf0',
84+
type: 'wormhole',
85+
},
86+
],
87+
},
88+
],
89+
},
90+
};

wormhole-connect/src/config/testnet/tokens.ts

+30-29
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,21 @@ export const TESTNET_TOKENS: TokensConfig = {
900900
},
901901
},
902902
},
903+
USDCalfajores: {
904+
key: 'USDCalfajores',
905+
symbol: 'USDC',
906+
nativeChain: 'alfajores',
907+
icon: Icon.USDC,
908+
tokenId: {
909+
chain: 'alfajores',
910+
address: '0x4004d1EB4b65A38c65dc9575bEe3DfCb026Cb538',
911+
},
912+
coinGeckoId: 'usd-coin',
913+
color: '#2774CA',
914+
decimals: {
915+
default: 6,
916+
},
917+
},
903918
GLMR: {
904919
key: 'GLMR',
905920
symbol: 'GLMR',
@@ -2124,6 +2139,21 @@ export const TESTNET_TOKENS: TokensConfig = {
21242139
default: 8,
21252140
},
21262141
},
2142+
USDCsepolia: {
2143+
key: 'USDCsepolia',
2144+
symbol: 'USDC',
2145+
nativeChain: 'sepolia',
2146+
icon: Icon.USDC,
2147+
tokenId: {
2148+
chain: 'sepolia',
2149+
address: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
2150+
},
2151+
coinGeckoId: 'usd-coin',
2152+
color: '#2774CA',
2153+
decimals: {
2154+
default: 6,
2155+
},
2156+
},
21272157
ETHarbitrum_sepolia: {
21282158
key: 'ETHarbitrum_sepolia',
21292159
symbol: 'ETH',
@@ -2247,11 +2277,6 @@ export const TESTNET_TOKENS: TokensConfig = {
22472277
Ethereum: 18,
22482278
default: 8,
22492279
},
2250-
ntt: {
2251-
groupId: 'test_ntt',
2252-
nttManager: '0xB231aD95f2301bc82eA44c515001F0F746D637e0',
2253-
wormholeTransceiver: '0x1fDC902e30b188FD2BA976B421Cb179943F57896',
2254-
},
22552280
},
22562281
TEST_NTTarbitrum_sepolia: {
22572282
key: 'TEST_NTTarbitrum_sepolia',
@@ -2268,11 +2293,6 @@ export const TESTNET_TOKENS: TokensConfig = {
22682293
Ethereum: 18,
22692294
default: 8,
22702295
},
2271-
ntt: {
2272-
groupId: 'test_ntt',
2273-
nttManager: '0xEec94CD3083e067398256a79CcA7e740C5c8ef81',
2274-
wormholeTransceiver: '0x0E24D17D7467467b39Bf64A9DFf88776Bd6c74d7',
2275-
},
22762296
},
22772297
TEST_NTTbase_sepolia: {
22782298
key: 'TEST_NTTbase_sepolia',
@@ -2289,11 +2309,6 @@ export const TESTNET_TOKENS: TokensConfig = {
22892309
Ethereum: 18,
22902310
default: 8,
22912311
},
2292-
ntt: {
2293-
groupId: 'test_ntt',
2294-
nttManager: '0xB03b030b2f5B40819Df76467d67eD1C85Ff66fAD',
2295-
wormholeTransceiver: '0x1e072169541f1171e427Aa44B5fd8924BEE71b0e',
2296-
},
22972312
},
22982313
TEST_NTToptimism_sepolia: {
22992314
key: 'TEST_NTToptimism_sepolia',
@@ -2310,11 +2325,6 @@ export const TESTNET_TOKENS: TokensConfig = {
23102325
Ethereum: 18,
23112326
default: 8,
23122327
},
2313-
ntt: {
2314-
groupId: 'test_ntt',
2315-
nttManager: '0x7f430D4e7939D994C0955A01FC75D9DE33F12D11',
2316-
wormholeTransceiver: '0x41265eb2863bf0238081F6AeefeF73549C82C3DD',
2317-
},
23182328
},
23192329
TEST_NTTsolana: {
23202330
key: 'TEST_NTTsolana',
@@ -2331,14 +2341,5 @@ export const TESTNET_TOKENS: TokensConfig = {
23312341
Solana: 9,
23322342
default: 8,
23332343
},
2334-
ntt: {
2335-
groupId: 'test_ntt',
2336-
nttManager: 'nTTh3bZ5Aer6xboWZe39RDEft4MeVxSQ8D1EYAVLZw9',
2337-
// The wormhole transceiver is baked into the Solana NTT contract.
2338-
// If the transceiver is split into a separate contract, this address
2339-
// and route code should be updated to support the new structure.
2340-
wormholeTransceiver: 'nTTh3bZ5Aer6xboWZe39RDEft4MeVxSQ8D1EYAVLZw9',
2341-
solanaQuoter: 'NqTdGLLL6b6bFo7YESNEezocgF8onH5cst5EdH791en',
2342-
},
23432344
},
23442345
};

wormhole-connect/src/config/types.ts

+23-6
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ export interface InternalConfig {
171171
// Route settings
172172
ethBridgeMaxAmount: number;
173173
wstETHBridgeMaxAmount: number;
174+
175+
// NTT config
176+
nttGroups: NttGroups;
174177
}
175178

176179
export type ExplorerConfig = {
@@ -233,12 +236,6 @@ export type TokenConfig = {
233236
decimals: number;
234237
};
235238
};
236-
ntt?: {
237-
groupId: string;
238-
nttManager: string;
239-
wormholeTransceiver: string;
240-
solanaQuoter?: string;
241-
};
242239
};
243240

244241
export type TokensConfig = { [key: string]: TokenConfig };
@@ -281,6 +278,7 @@ export type NetworkData = {
281278
rpcs: RpcMapping;
282279
rest: RpcMapping;
283280
graphql: RpcMapping;
281+
nttGroups: NttGroups;
284282
};
285283

286284
export interface MenuEntry {
@@ -289,3 +287,22 @@ export interface MenuEntry {
289287
target?: string;
290288
order?: number;
291289
}
290+
291+
export type NttTransceiverConfig = {
292+
address: string;
293+
type: 'wormhole'; // only wormhole is supported for now
294+
};
295+
296+
export type NttManagerConfig = {
297+
chainName: ChainName;
298+
address: string;
299+
tokenKey: string; // token key for the token this NTT manager has configured
300+
transceivers: NttTransceiverConfig[];
301+
solanaQuoter?: string;
302+
};
303+
304+
export type NttGroup = {
305+
nttManagers: NttManagerConfig[];
306+
};
307+
308+
export type NttGroups = { [key: string]: NttGroup };

wormhole-connect/src/routes/abstracts/routeAbstract.ts

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export abstract class RouteAbstract {
179179
abstract getForeignAsset(
180180
token: TokenId,
181181
chain: ChainName | ChainId,
182+
destToken?: TokenConfig,
182183
): Promise<string | null>;
183184

184185
abstract getMessage(

wormhole-connect/src/routes/bridge/baseRoute.ts

-4
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ export abstract class BaseRoute extends RouteAbstract {
4747
if (isTBTCToken(token) && token.nativeChain !== chainName) {
4848
return false;
4949
}
50-
if (token.ntt) {
51-
return false;
52-
}
5350
return true;
5451
}
5552

@@ -63,7 +60,6 @@ export abstract class BaseRoute extends RouteAbstract {
6360
if (!token.tokenId) return false;
6461
if (destChain && isIlliquidDestToken(token, destChain)) return false;
6562
if (isTBTCToken(token)) return false;
66-
if (token.ntt) return false;
6763
if (sourceToken) {
6864
const wrapped = getWrappedToken(sourceToken);
6965
return wrapped.key === token.key;

0 commit comments

Comments
 (0)