From dc28f740b3400610b6a3726a667055cd362df85d Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Thu, 3 Aug 2023 18:13:36 +0100 Subject: [PATCH 01/11] Use version of Native warp route with donate fn --- config/warp_tokens.ts | 4 ++++ package.json | 4 ++-- yarn.lock | 48 +++++++++++++++++++++---------------------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index f2d0960..0499b2d 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -20,6 +20,10 @@ export const warpRouteConfig: WarpRouteConfig = { synthetics: [ { chainName: 'anvil2', + // Typescript expects a non-native warp route type here, but just ts-ignore it + // and set native. TODO: fix Typescript typing to support this + // @ts-ignore + type: TokenType.native, // Optionally specify a name, symbol, and totalSupply // If not specified, the base token's properties will be used diff --git a/package.json b/package.json index e8a29bb..ef5ca41 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Utilities for deploying Hyperlane", "dependencies": { - "@hyperlane-xyz/hyperlane-token": "1.4.2", - "@hyperlane-xyz/sdk": "1.4.2", + "@hyperlane-xyz/hyperlane-token": "1.4.2-beta69", + "@hyperlane-xyz/sdk": "1.4.2-beta69", "ethers": "^5.7.2", "yargs": "^17.7.1", "zod": "^3.21.4" diff --git a/yarn.lock b/yarn.lock index da3b357..79be741 100644 --- a/yarn.lock +++ b/yarn.lock @@ -634,14 +634,14 @@ __metadata: languageName: node linkType: hard -"@hyperlane-xyz/core@npm:1.4.2": - version: 1.4.2 - resolution: "@hyperlane-xyz/core@npm:1.4.2" +"@hyperlane-xyz/core@npm:1.4.2-beta69": + version: 1.4.2-beta69 + resolution: "@hyperlane-xyz/core@npm:1.4.2-beta69" dependencies: - "@hyperlane-xyz/utils": 1.4.2 + "@hyperlane-xyz/utils": 1.4.2-beta69 "@openzeppelin/contracts": ^4.8.0 "@openzeppelin/contracts-upgradeable": ^4.8.0 - checksum: 2c85c752cdaae1603a7f5a6879dbd9477aee6c7a480f91d1649056fa13d14e4a6830dcc488ee398b8c0575cd752f7d6d6701805cd4d978e22425b282eac03431 + checksum: 23b9c622090b56ad5297553762defd26a7b3125b0a768b5d54d9db06ce6066c274862b3158293da7c38f2eafdeb2b730e7af87cc616f11e865e2300399caf737 languageName: node linkType: hard @@ -649,8 +649,8 @@ __metadata: version: 0.0.0-use.local resolution: "@hyperlane-xyz/deploy@workspace:." dependencies: - "@hyperlane-xyz/hyperlane-token": 1.4.2 - "@hyperlane-xyz/sdk": 1.4.2 + "@hyperlane-xyz/hyperlane-token": 1.4.2-beta69 + "@hyperlane-xyz/sdk": 1.4.2-beta69 "@trivago/prettier-plugin-sort-imports": ^4.1.1 "@types/node": ^18.14.5 "@types/yargs": ^17.0.22 @@ -667,25 +667,25 @@ __metadata: languageName: unknown linkType: soft -"@hyperlane-xyz/hyperlane-token@npm:1.4.2": - version: 1.4.2 - resolution: "@hyperlane-xyz/hyperlane-token@npm:1.4.2" +"@hyperlane-xyz/hyperlane-token@npm:1.4.2-beta69": + version: 1.4.2-beta69 + resolution: "@hyperlane-xyz/hyperlane-token@npm:1.4.2-beta69" dependencies: - "@hyperlane-xyz/core": 1.4.2 - "@hyperlane-xyz/sdk": 1.4.2 - "@hyperlane-xyz/utils": 1.4.2 + "@hyperlane-xyz/core": 1.4.2-beta69 + "@hyperlane-xyz/sdk": 1.4.2-beta69 + "@hyperlane-xyz/utils": 1.4.2-beta69 "@openzeppelin/contracts-upgradeable": ^4.8.0 ethers: ^5.7.2 - checksum: dffdf248090fac08b1d5a34915d32fb57307a7e61a29bce440be700cf585a98dc8d02389141af28bf1e321e6367dc85736a7530a6e7ad1a305d4fdf0af916b29 + checksum: 3baf78b5a5a9ae86aab1b05304071fee83eeed7a13971dfe936bb07724c26b23751505d784e2eee9e6a88a339b260398cd62e16e95e554cb5eb9937e2e9c54e6 languageName: node linkType: hard -"@hyperlane-xyz/sdk@npm:1.4.2": - version: 1.4.2 - resolution: "@hyperlane-xyz/sdk@npm:1.4.2" +"@hyperlane-xyz/sdk@npm:1.4.2-beta69": + version: 1.4.2-beta69 + resolution: "@hyperlane-xyz/sdk@npm:1.4.2-beta69" dependencies: - "@hyperlane-xyz/core": 1.4.2 - "@hyperlane-xyz/utils": 1.4.2 + "@hyperlane-xyz/core": 1.4.2-beta69 + "@hyperlane-xyz/utils": 1.4.2-beta69 "@types/coingecko-api": ^1.0.10 "@types/debug": ^4.1.7 "@wagmi/chains": ^0.2.6 @@ -694,16 +694,16 @@ __metadata: debug: ^4.3.4 ethers: ^5.7.2 zod: ^3.21.2 - checksum: 1ba8d77d17da78bcde8a2e3c85d7a4024d5ab812c8c0caf25ab0316d27a34c32712944e94babf81ac3a2d0b1bf06eb200902919a0e5e456cc0ab3f3ceea42dd3 + checksum: a444262e618918ddeda2b64151682a56384b29080b72ec1c2d4f880c9fb19af5d1303fedff0afbacd3936645d5fc3e0dc768b679fe7d572b4c2dc4f03faf21f2 languageName: node linkType: hard -"@hyperlane-xyz/utils@npm:1.4.2": - version: 1.4.2 - resolution: "@hyperlane-xyz/utils@npm:1.4.2" +"@hyperlane-xyz/utils@npm:1.4.2-beta69": + version: 1.4.2-beta69 + resolution: "@hyperlane-xyz/utils@npm:1.4.2-beta69" dependencies: ethers: ^5.7.2 - checksum: e91d2684856d803824beba912d4d65e21009f6e402571adcc7dd0f0b8f43b11eaa8448f1b11958ffa76178f48794017d4d466bdf909dd9d3698b9eee45df9116 + checksum: 3eadbc12889bb5a2e38e648be5a2fb330e7f91087dd88d3c6b0200ec6ca7e4273b457b97e9c34348b393cfd7b74edeca9a1a349c49d8843428021b1e1bd91e25 languageName: node linkType: hard From ccd559d8382638e609b13a81518c37efa43af7a8 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Mon, 7 Aug 2023 15:14:51 +0100 Subject: [PATCH 02/11] Change configs a bit --- config/warp_tokens.ts | 8 +++----- src/warp/WarpRouteDeployer.ts | 4 +++- src/warp/config.ts | 19 ++++++++++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index 0499b2d..a7ae3f9 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -7,7 +7,7 @@ import type { WarpRouteConfig } from '../src/warp/config'; export const warpRouteConfig: WarpRouteConfig = { base: { // Chain name must be in the Hyperlane SDK or in the chains.ts config - chainName: 'anvil1', + chainName: 'fuji', type: TokenType.native, // TokenType.native or TokenType.collateral // If type is collateral, a token address is required: // address: '0x123...' @@ -19,10 +19,8 @@ export const warpRouteConfig: WarpRouteConfig = { }, synthetics: [ { - chainName: 'anvil2', - // Typescript expects a non-native warp route type here, but just ts-ignore it - // and set native. TODO: fix Typescript typing to support this - // @ts-ignore + chainName: 'anvil1', + type: TokenType.native, // Optionally specify a name, symbol, and totalSupply diff --git a/src/warp/WarpRouteDeployer.ts b/src/warp/WarpRouteDeployer.ts index a459101..24625c9 100644 --- a/src/warp/WarpRouteDeployer.ts +++ b/src/warp/WarpRouteDeployer.ts @@ -139,11 +139,13 @@ export class WarpRouteDeployer { for (const synthetic of synthetics) { const sChainName = synthetic.chainName; + configMap[sChainName] = { - type: TokenType.synthetic, + type: synthetic.type, name: synthetic.name || baseTokenMetadata.name, symbol: synthetic.symbol || baseTokenMetadata.symbol, totalSupply: synthetic.totalSupply || 0, + token: (synthetic.type == TokenType.collateral ? synthetic.address : baseTokenAddr), owner, mailbox: synthetic.mailbox || mergedContractAddresses[sChainName].mailbox, diff --git a/src/warp/config.ts b/src/warp/config.ts index 48419ab..57fcea9 100644 --- a/src/warp/config.ts +++ b/src/warp/config.ts @@ -31,9 +31,26 @@ export type WarpBaseTokenConfig = | WarpNativeTokenConfig | WarpCollateralTokenConfig; +export interface SyntheticNativeTokenConfig extends WarpSyntheticTokenConfig { + type: TokenType.native; +} + +export interface SyntheticCollateralTokenConfig extends WarpSyntheticTokenConfig { + type: TokenType.collateral; + address: string; + isNft?: boolean; +} + +export interface SyntheticTokenConfig extends WarpSyntheticTokenConfig { + type: TokenType.synthetic; +} + +export type RemoteWarpTokenConfig = SyntheticNativeTokenConfig | SyntheticCollateralTokenConfig | SyntheticTokenConfig; + export interface WarpRouteConfig { base: WarpBaseTokenConfig; - synthetics: WarpSyntheticTokenConfig[]; + // TODO rename? + synthetics: RemoteWarpTokenConfig[]; } // Zod schema for Warp Route config validation validation From b8c06184e4de16d66e92f19f33c8f9644ba96436 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Tue, 15 Aug 2023 11:33:07 +0100 Subject: [PATCH 03/11] Solana devnet & proteus deploy --- config/chains.ts | 47 ++++++++++++++++++----------------- config/multisig_ism.ts | 18 ++++++++------ config/warp_tokens.ts | 17 ++++++++++--- src/warp/WarpRouteDeployer.ts | 1 + 4 files changed, 48 insertions(+), 35 deletions(-) diff --git a/config/chains.ts b/config/chains.ts index 4f8532f..00c58b6 100644 --- a/config/chains.ts +++ b/config/chains.ts @@ -4,37 +4,38 @@ import { ChainMap, ChainMetadata, ProtocolType } from '@hyperlane-xyz/sdk'; // A map of chain names to ChainMetadata export const chains: ChainMap = { // ----------- Add your chains here ----------------- - anvil1: { - name: 'anvil1', + proteustestnet: { + chainId: 88002, + domainId: 88002, + name: 'proteustestnet', protocol: ProtocolType.Ethereum, - // anvil default chain id - chainId: 31337, - // Used to configure a Warp Route to bridge anvil1 ETH - // to anvil2 in CI tests. + displayName: 'Proteus Testnet', nativeToken: { - name: 'ether', - symbol: 'ETH', + name: 'Zebec', + symbol: 'ZBC', decimals: 18, }, rpcUrls: [ { - http: 'http://127.0.0.1:8545', - }, - ], - // You can set overrides for transaction fields here - // transactionOverrides: { - // gasLimit: 1000000 - // }, - }, - anvil2: { - name: 'anvil2', - protocol: ProtocolType.Ethereum, - chainId: 31338, - rpcUrls: [ - { - http: 'http://127.0.0.1:8555', + http: 'https://api.proteus.nautchain.xyz/solana', }, ], + // blockExplorers: [ + // { + // name: 'GnosisScan', + // url: 'https://gnosisscan.io', + // apiUrl: 'https://api.gnosisscan.io/api', + // family: ExplorerFamily.Etherscan, + // }, + // ], + blocks: { + confirmations: 1, + reorgPeriod: 1, + estimateBlockTime: 1, + }, + // gasCurrencyCoinGeckoId: 'xdai', + // gnosisSafeTransactionServiceUrl: + // 'https://safe-transaction-gnosis-chain.safe.global/', }, // -------------------------------------------------- // You can also override the default chain metadata (completely) diff --git a/config/multisig_ism.ts b/config/multisig_ism.ts index 208ed5b..44b87c3 100644 --- a/config/multisig_ism.ts +++ b/config/multisig_ism.ts @@ -2,20 +2,22 @@ import { ChainMap, ModuleType, MultisigIsmConfig } from '@hyperlane-xyz/sdk'; export const multisigIsmConfig: ChainMap = { // ----------- Your chains here ----------------- - anvil1: { + proteustestnet: { type: ModuleType.LEGACY_MULTISIG, - threshold: 1, + threshold: 2, validators: [ - // Last anvil address - '0xa0ee7a142d267c1f36714e4a8f75612f20a79720', + '0x79fc73656abb9eeaa5ee853c4569124f5bdaf9d8', + '0x72840388d5ab57323bc4f6e6d3ddedfd5cc911f0', + '0xd4b2a50c53fc6614bb3cd3198e0fdc03f5da973f', ], }, - anvil2: { + solanadevnet: { type: ModuleType.LEGACY_MULTISIG, - threshold: 1, + threshold: 2, validators: [ - // Last anvil address - '0xa0ee7a142d267c1f36714e4a8f75612f20a79720', + '0xec0f73dbc5b1962a20f7dcbe07c98414025b0c43', + '0x9c20a149dfa09ea9f77f5a7ca09ed44f9c025133', + '0x967c5ecdf2625ae86580bd203b630abaaf85cd62', ], }, }; diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index a7ae3f9..6d1f13c 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -7,10 +7,10 @@ import type { WarpRouteConfig } from '../src/warp/config'; export const warpRouteConfig: WarpRouteConfig = { base: { // Chain name must be in the Hyperlane SDK or in the chains.ts config - chainName: 'fuji', - type: TokenType.native, // TokenType.native or TokenType.collateral + chainName: 'bsctestnet', + type: TokenType.collateral, // TokenType.native or TokenType.collateral // If type is collateral, a token address is required: - // address: '0x123...' + address: '0x64544969ed7ebf5f083679233325356ebe738930', // If the token is an NFT (ERC721), set to true: // isNft: boolean @@ -19,7 +19,7 @@ export const warpRouteConfig: WarpRouteConfig = { }, synthetics: [ { - chainName: 'anvil1', + chainName: 'proteustestnet', type: TokenType.native, @@ -29,5 +29,14 @@ export const warpRouteConfig: WarpRouteConfig = { // Optionally, specify owner, mailbox, and interchainGasPaymaster addresses // If not specified, the Permissionless Deployment artifacts or the SDK's defaults will be used }, + { + chainName: 'solanadevnet', + type: TokenType.collateral, + address: '0x64544969ed7ebf5f083679233325356ebe738930', + name: 'DUMMY', + symbol: 'DUMMY', + decimals: 6, + foreignDeployment: '0x05b6502b1d91c60ca0c0d0ab20a16ec40c66f2559becc7888a4fc3c0cefff9a5', + } ], }; diff --git a/src/warp/WarpRouteDeployer.ts b/src/warp/WarpRouteDeployer.ts index 24625c9..49f5646 100644 --- a/src/warp/WarpRouteDeployer.ts +++ b/src/warp/WarpRouteDeployer.ts @@ -157,6 +157,7 @@ export class WarpRouteDeployer { synthetic.interchainGasPaymaster || mergedContractAddresses[sChainName].defaultIsmInterchainGasPaymaster, foreignDeployment: synthetic.foreignDeployment, + decimals: synthetic.decimals || baseTokenMetadata.decimals, }; this.logger( `Hyp token config on synthetic chain ${sChainName}:`, From a6d46a8ec96a2557b9220dd7bb1c4d5227b1dfbd Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Tue, 15 Aug 2023 12:03:26 +0100 Subject: [PATCH 04/11] Deploy solana & nautilus core --- config/chains.ts | 47 +++++++++++++++++++++++++++--------------- config/multisig_ism.ts | 16 +++++++------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/config/chains.ts b/config/chains.ts index 00c58b6..433ad5f 100644 --- a/config/chains.ts +++ b/config/chains.ts @@ -3,13 +3,12 @@ import { ChainMap, ChainMetadata, ProtocolType } from '@hyperlane-xyz/sdk'; // import { chainMetadata } from '@hyperlane-xyz/sdk'; // A map of chain names to ChainMetadata export const chains: ChainMap = { - // ----------- Add your chains here ----------------- - proteustestnet: { - chainId: 88002, - domainId: 88002, - name: 'proteustestnet', + nautilus: { + chainId: 22222, + domainId: 22222, + name: 'nautilus', protocol: ProtocolType.Ethereum, - displayName: 'Proteus Testnet', + displayName: 'Nautilus', nativeToken: { name: 'Zebec', symbol: 'ZBC', @@ -17,26 +16,40 @@ export const chains: ChainMap = { }, rpcUrls: [ { - http: 'https://api.proteus.nautchain.xyz/solana', + http: 'https://api.nautilus.nautchain.xyz', }, ], + blocks: { + confirmations: 1, + reorgPeriod: 1, + estimateBlockTime: 1, + }, + }, + + solana: { + protocol: ProtocolType.Sealevel, + // Uses the same ChainId as https://www.alchemy.com/chain-connect/chain/solana + chainId: 1399811149, + domainId: 1399811149, + name: 'solana', + displayName: 'Solana', + nativeToken: { name: 'Sol', symbol: 'SOL', decimals: 9 }, + rpcUrls: [{ http: 'https://api.mainnet-beta.solana.com' }], // blockExplorers: [ // { - // name: 'GnosisScan', - // url: 'https://gnosisscan.io', - // apiUrl: 'https://api.gnosisscan.io/api', - // family: ExplorerFamily.Etherscan, + // name: 'SolScan', + // url: 'https://solscan.io', + // apiUrl: 'https://public-api.solscan.io', + // family: ExplorerFamily.Other, // }, // ], blocks: { confirmations: 1, - reorgPeriod: 1, - estimateBlockTime: 1, + reorgPeriod: 0, + estimateBlockTime: 0.4, }, - // gasCurrencyCoinGeckoId: 'xdai', - // gnosisSafeTransactionServiceUrl: - // 'https://safe-transaction-gnosis-chain.safe.global/', - }, + } + // -------------------------------------------------- // You can also override the default chain metadata (completely) // ethereum: { diff --git a/config/multisig_ism.ts b/config/multisig_ism.ts index 44b87c3..14c767b 100644 --- a/config/multisig_ism.ts +++ b/config/multisig_ism.ts @@ -2,22 +2,22 @@ import { ChainMap, ModuleType, MultisigIsmConfig } from '@hyperlane-xyz/sdk'; export const multisigIsmConfig: ChainMap = { // ----------- Your chains here ----------------- - proteustestnet: { + solana: { type: ModuleType.LEGACY_MULTISIG, threshold: 2, validators: [ - '0x79fc73656abb9eeaa5ee853c4569124f5bdaf9d8', - '0x72840388d5ab57323bc4f6e6d3ddedfd5cc911f0', - '0xd4b2a50c53fc6614bb3cd3198e0fdc03f5da973f', + '0x3cd1a081f38874bbb075bf10b62adcb858db864c', + '0x28aa072634dd41d19471640237852e807bd9901f', + '0x8a93ba04f4e30064660670cb581d9aa10df78929', ], }, - solanadevnet: { + nautilus: { type: ModuleType.LEGACY_MULTISIG, threshold: 2, validators: [ - '0xec0f73dbc5b1962a20f7dcbe07c98414025b0c43', - '0x9c20a149dfa09ea9f77f5a7ca09ed44f9c025133', - '0x967c5ecdf2625ae86580bd203b630abaaf85cd62', + '0x9c920af9467595a23cb3433adefc3854d498a437', + '0x12b583ce1623b7de3fc727ccccda24dcab1fe022', + '0xc8b996a421ff1e203070c709c1af93944c049cc0', ], }, }; From 2715bc2a73c039865bb046f8751a740bbf4dd372 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Tue, 15 Aug 2023 12:36:31 +0100 Subject: [PATCH 05/11] Deploy mainnet warp route --- config/warp_tokens.ts | 20 +++++++++--------- package.json | 4 ++-- yarn.lock | 48 +++++++++++++++++++++---------------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index 6d1f13c..54ffefb 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -7,10 +7,10 @@ import type { WarpRouteConfig } from '../src/warp/config'; export const warpRouteConfig: WarpRouteConfig = { base: { // Chain name must be in the Hyperlane SDK or in the chains.ts config - chainName: 'bsctestnet', + chainName: 'bsc', type: TokenType.collateral, // TokenType.native or TokenType.collateral // If type is collateral, a token address is required: - address: '0x64544969ed7ebf5f083679233325356ebe738930', + address: '0x37a56cdcD83Dce2868f721De58cB3830C44C6303', // If the token is an NFT (ERC721), set to true: // isNft: boolean @@ -19,9 +19,9 @@ export const warpRouteConfig: WarpRouteConfig = { }, synthetics: [ { - chainName: 'proteustestnet', - + chainName: 'nautilus', type: TokenType.native, + scale: 10**9, // Optionally specify a name, symbol, and totalSupply // If not specified, the base token's properties will be used @@ -30,13 +30,13 @@ export const warpRouteConfig: WarpRouteConfig = { // If not specified, the Permissionless Deployment artifacts or the SDK's defaults will be used }, { - chainName: 'solanadevnet', + chainName: 'solana', type: TokenType.collateral, - address: '0x64544969ed7ebf5f083679233325356ebe738930', - name: 'DUMMY', - symbol: 'DUMMY', - decimals: 6, - foreignDeployment: '0x05b6502b1d91c60ca0c0d0ab20a16ec40c66f2559becc7888a4fc3c0cefff9a5', + address: '0x0000000000000000000000000000000000000000', + name: 'Zebec', + symbol: 'ZBC', + decimals: 9, + foreignDeployment: '0xd6d38f335e9f8bc4c7339d52275a502fc42caeaaf9370b9d47aa92de4bb2adcc', } ], }; diff --git a/package.json b/package.json index ef5ca41..5366c32 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Utilities for deploying Hyperlane", "dependencies": { - "@hyperlane-xyz/hyperlane-token": "1.4.2-beta69", - "@hyperlane-xyz/sdk": "1.4.2-beta69", + "@hyperlane-xyz/hyperlane-token": "1.4.2-beta70", + "@hyperlane-xyz/sdk": "1.4.2-beta70", "ethers": "^5.7.2", "yargs": "^17.7.1", "zod": "^3.21.4" diff --git a/yarn.lock b/yarn.lock index 79be741..2a57521 100644 --- a/yarn.lock +++ b/yarn.lock @@ -634,14 +634,14 @@ __metadata: languageName: node linkType: hard -"@hyperlane-xyz/core@npm:1.4.2-beta69": - version: 1.4.2-beta69 - resolution: "@hyperlane-xyz/core@npm:1.4.2-beta69" +"@hyperlane-xyz/core@npm:1.4.2-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/core@npm:1.4.2-beta70" dependencies: - "@hyperlane-xyz/utils": 1.4.2-beta69 + "@hyperlane-xyz/utils": 1.4.2-beta70 "@openzeppelin/contracts": ^4.8.0 "@openzeppelin/contracts-upgradeable": ^4.8.0 - checksum: 23b9c622090b56ad5297553762defd26a7b3125b0a768b5d54d9db06ce6066c274862b3158293da7c38f2eafdeb2b730e7af87cc616f11e865e2300399caf737 + checksum: 171db0da0a816048b76d01920c79f2cc76d147004d3528e2196403bf8c6cdf454ef77e61966a56ba05e171d291840140666d5aae4c42f627b14b74552c9f0db8 languageName: node linkType: hard @@ -649,8 +649,8 @@ __metadata: version: 0.0.0-use.local resolution: "@hyperlane-xyz/deploy@workspace:." dependencies: - "@hyperlane-xyz/hyperlane-token": 1.4.2-beta69 - "@hyperlane-xyz/sdk": 1.4.2-beta69 + "@hyperlane-xyz/hyperlane-token": 1.4.2-beta70 + "@hyperlane-xyz/sdk": 1.4.2-beta70 "@trivago/prettier-plugin-sort-imports": ^4.1.1 "@types/node": ^18.14.5 "@types/yargs": ^17.0.22 @@ -667,25 +667,25 @@ __metadata: languageName: unknown linkType: soft -"@hyperlane-xyz/hyperlane-token@npm:1.4.2-beta69": - version: 1.4.2-beta69 - resolution: "@hyperlane-xyz/hyperlane-token@npm:1.4.2-beta69" +"@hyperlane-xyz/hyperlane-token@npm:1.4.2-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/hyperlane-token@npm:1.4.2-beta70" dependencies: - "@hyperlane-xyz/core": 1.4.2-beta69 - "@hyperlane-xyz/sdk": 1.4.2-beta69 - "@hyperlane-xyz/utils": 1.4.2-beta69 + "@hyperlane-xyz/core": 1.4.2-beta70 + "@hyperlane-xyz/sdk": 1.4.2-beta70 + "@hyperlane-xyz/utils": 1.4.2-beta70 "@openzeppelin/contracts-upgradeable": ^4.8.0 ethers: ^5.7.2 - checksum: 3baf78b5a5a9ae86aab1b05304071fee83eeed7a13971dfe936bb07724c26b23751505d784e2eee9e6a88a339b260398cd62e16e95e554cb5eb9937e2e9c54e6 + checksum: 824ea2da4c22e6ace5ed3aa5d633791a012e7cc1196b7553b91535af42c57eb707afe0b77639911e511de9f4fb2640322e99ab3f776f07a24bd8a49bbe9c3b5b languageName: node linkType: hard -"@hyperlane-xyz/sdk@npm:1.4.2-beta69": - version: 1.4.2-beta69 - resolution: "@hyperlane-xyz/sdk@npm:1.4.2-beta69" +"@hyperlane-xyz/sdk@npm:1.4.2-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/sdk@npm:1.4.2-beta70" dependencies: - "@hyperlane-xyz/core": 1.4.2-beta69 - "@hyperlane-xyz/utils": 1.4.2-beta69 + "@hyperlane-xyz/core": 1.4.2-beta70 + "@hyperlane-xyz/utils": 1.4.2-beta70 "@types/coingecko-api": ^1.0.10 "@types/debug": ^4.1.7 "@wagmi/chains": ^0.2.6 @@ -694,16 +694,16 @@ __metadata: debug: ^4.3.4 ethers: ^5.7.2 zod: ^3.21.2 - checksum: a444262e618918ddeda2b64151682a56384b29080b72ec1c2d4f880c9fb19af5d1303fedff0afbacd3936645d5fc3e0dc768b679fe7d572b4c2dc4f03faf21f2 + checksum: a32e3b520bfdfb0109b3cea771634829c9805ddf12ceb4fb2ec6802127800856eb9131fede91439d9cf8188ac1011cfbf6ccd1d979a8afadae53ea47b493d40d languageName: node linkType: hard -"@hyperlane-xyz/utils@npm:1.4.2-beta69": - version: 1.4.2-beta69 - resolution: "@hyperlane-xyz/utils@npm:1.4.2-beta69" +"@hyperlane-xyz/utils@npm:1.4.2-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/utils@npm:1.4.2-beta70" dependencies: ethers: ^5.7.2 - checksum: 3eadbc12889bb5a2e38e648be5a2fb330e7f91087dd88d3c6b0200ec6ca7e4273b457b97e9c34348b393cfd7b74edeca9a1a349c49d8843428021b1e1bd91e25 + checksum: a8fa17e27190588873dec83a5adb0fb000fc34cfba6bfe90d47e4ee7a6dea07f44b3d94e37688b991e599e38d7f584388530637a49604d6f39e3649058deabf1 languageName: node linkType: hard From 92686545b031358ba1ef66fea0e6d4a1015ab344 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Tue, 15 Aug 2023 15:26:57 +0100 Subject: [PATCH 06/11] Fix scale not being passed in --- src/warp/WarpRouteDeployer.ts | 1 + src/warp/config.ts | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/warp/WarpRouteDeployer.ts b/src/warp/WarpRouteDeployer.ts index 49f5646..eedbb35 100644 --- a/src/warp/WarpRouteDeployer.ts +++ b/src/warp/WarpRouteDeployer.ts @@ -158,6 +158,7 @@ export class WarpRouteDeployer { mergedContractAddresses[sChainName].defaultIsmInterchainGasPaymaster, foreignDeployment: synthetic.foreignDeployment, decimals: synthetic.decimals || baseTokenMetadata.decimals, + scale: synthetic.scale, }; this.logger( `Hyp token config on synthetic chain ${sChainName}:`, diff --git a/src/warp/config.ts b/src/warp/config.ts index 57fcea9..7a95130 100644 --- a/src/warp/config.ts +++ b/src/warp/config.ts @@ -1,19 +1,16 @@ import { z } from 'zod'; -import { TokenType } from '@hyperlane-xyz/hyperlane-token'; +import { NativeConfig, TokenType } from '@hyperlane-xyz/hyperlane-token'; import { RouterConfig } from '@hyperlane-xyz/sdk/dist/router/types'; import { MinimalTokenMetadata } from './types'; type WarpBaseToken = { - type: TokenType.native | TokenType.collateral; chainName: string; } & Partial & Partial; -export interface WarpNativeTokenConfig extends WarpBaseToken { - type: TokenType.native; -} +export interface WarpNativeTokenConfig extends WarpBaseToken, NativeConfig {} export interface WarpCollateralTokenConfig extends WarpBaseToken { type: TokenType.collateral; From 69f272b5ee2d807f4a4842ac7a16a979c6d2d3f5 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Wed, 16 Aug 2023 10:22:48 +0100 Subject: [PATCH 07/11] new deploy --- config/warp_tokens.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index 54ffefb..d30b79f 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -36,7 +36,7 @@ export const warpRouteConfig: WarpRouteConfig = { name: 'Zebec', symbol: 'ZBC', decimals: 9, - foreignDeployment: '0xd6d38f335e9f8bc4c7339d52275a502fc42caeaaf9370b9d47aa92de4bb2adcc', + foreignDeployment: '0xc5ba229fa2822fe65ac2bd0a93d8371d75292c3415dd381923c1088a3308528b', } ], }; From 64bf580a15ec137dd86390cdbf35a50106834b2a Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Wed, 16 Aug 2023 11:39:52 +0100 Subject: [PATCH 08/11] rm todo --- src/warp/config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/warp/config.ts b/src/warp/config.ts index 7a95130..9880196 100644 --- a/src/warp/config.ts +++ b/src/warp/config.ts @@ -46,7 +46,6 @@ export type RemoteWarpTokenConfig = SyntheticNativeTokenConfig | SyntheticCollat export interface WarpRouteConfig { base: WarpBaseTokenConfig; - // TODO rename? synthetics: RemoteWarpTokenConfig[]; } From 132b65794ed7d29249a89eb0b51176a02758a4c3 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Wed, 16 Aug 2023 11:49:09 +0100 Subject: [PATCH 09/11] Clean up a lil --- config/chains.ts | 2 +- config/warp_tokens.ts | 7 ++++--- src/warp/WarpRouteDeployer.ts | 10 ++++++++-- src/warp/config.ts | 23 ++++++----------------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/config/chains.ts b/config/chains.ts index 433ad5f..3e3bbac 100644 --- a/config/chains.ts +++ b/config/chains.ts @@ -48,7 +48,7 @@ export const chains: ChainMap = { reorgPeriod: 0, estimateBlockTime: 0.4, }, - } + }, // -------------------------------------------------- // You can also override the default chain metadata (completely) diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index d30b79f..c67024b 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -21,7 +21,7 @@ export const warpRouteConfig: WarpRouteConfig = { { chainName: 'nautilus', type: TokenType.native, - scale: 10**9, + scale: 10 ** 9, // Optionally specify a name, symbol, and totalSupply // If not specified, the base token's properties will be used @@ -36,7 +36,8 @@ export const warpRouteConfig: WarpRouteConfig = { name: 'Zebec', symbol: 'ZBC', decimals: 9, - foreignDeployment: '0xc5ba229fa2822fe65ac2bd0a93d8371d75292c3415dd381923c1088a3308528b', - } + foreignDeployment: + '0xc5ba229fa2822fe65ac2bd0a93d8371d75292c3415dd381923c1088a3308528b', + }, ], }; diff --git a/src/warp/WarpRouteDeployer.ts b/src/warp/WarpRouteDeployer.ts index eedbb35..ee813a0 100644 --- a/src/warp/WarpRouteDeployer.ts +++ b/src/warp/WarpRouteDeployer.ts @@ -144,8 +144,14 @@ export class WarpRouteDeployer { type: synthetic.type, name: synthetic.name || baseTokenMetadata.name, symbol: synthetic.symbol || baseTokenMetadata.symbol, - totalSupply: synthetic.totalSupply || 0, - token: (synthetic.type == TokenType.collateral ? synthetic.address : baseTokenAddr), + totalSupply: + (synthetic.type === TokenType.synthetic + ? synthetic.totalSupply + : undefined) || 0, + token: + synthetic.type === TokenType.collateral + ? synthetic.address + : baseTokenAddr, owner, mailbox: synthetic.mailbox || mergedContractAddresses[sChainName].mailbox, diff --git a/src/warp/config.ts b/src/warp/config.ts index 9880196..8e2405d 100644 --- a/src/warp/config.ts +++ b/src/warp/config.ts @@ -19,6 +19,7 @@ export interface WarpCollateralTokenConfig extends WarpBaseToken { } export type WarpSyntheticTokenConfig = { + type: TokenType.synthetic; chainName: string; totalSupply?: number; } & Partial & @@ -28,25 +29,13 @@ export type WarpBaseTokenConfig = | WarpNativeTokenConfig | WarpCollateralTokenConfig; -export interface SyntheticNativeTokenConfig extends WarpSyntheticTokenConfig { - type: TokenType.native; -} - -export interface SyntheticCollateralTokenConfig extends WarpSyntheticTokenConfig { - type: TokenType.collateral; - address: string; - isNft?: boolean; -} - -export interface SyntheticTokenConfig extends WarpSyntheticTokenConfig { - type: TokenType.synthetic; -} - -export type RemoteWarpTokenConfig = SyntheticNativeTokenConfig | SyntheticCollateralTokenConfig | SyntheticTokenConfig; - export interface WarpRouteConfig { base: WarpBaseTokenConfig; - synthetics: RemoteWarpTokenConfig[]; + synthetics: ( + | WarpNativeTokenConfig + | WarpCollateralTokenConfig + | WarpSyntheticTokenConfig + )[]; } // Zod schema for Warp Route config validation validation From 7704a360eb17b1e2d6f4e4a37b6666a04ad4e29b Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Wed, 16 Aug 2023 11:51:57 +0100 Subject: [PATCH 10/11] Get rid of deploy-specific configs --- config/chains.ts | 60 ++++++++++++++++-------------------------- config/multisig_ism.ts | 18 ++++++------- config/warp_tokens.ts | 20 +++----------- 3 files changed, 35 insertions(+), 63 deletions(-) diff --git a/config/chains.ts b/config/chains.ts index 3e3bbac..4f8532f 100644 --- a/config/chains.ts +++ b/config/chains.ts @@ -3,53 +3,39 @@ import { ChainMap, ChainMetadata, ProtocolType } from '@hyperlane-xyz/sdk'; // import { chainMetadata } from '@hyperlane-xyz/sdk'; // A map of chain names to ChainMetadata export const chains: ChainMap = { - nautilus: { - chainId: 22222, - domainId: 22222, - name: 'nautilus', + // ----------- Add your chains here ----------------- + anvil1: { + name: 'anvil1', protocol: ProtocolType.Ethereum, - displayName: 'Nautilus', + // anvil default chain id + chainId: 31337, + // Used to configure a Warp Route to bridge anvil1 ETH + // to anvil2 in CI tests. nativeToken: { - name: 'Zebec', - symbol: 'ZBC', + name: 'ether', + symbol: 'ETH', decimals: 18, }, rpcUrls: [ { - http: 'https://api.nautilus.nautchain.xyz', + http: 'http://127.0.0.1:8545', }, ], - blocks: { - confirmations: 1, - reorgPeriod: 1, - estimateBlockTime: 1, - }, + // You can set overrides for transaction fields here + // transactionOverrides: { + // gasLimit: 1000000 + // }, }, - - solana: { - protocol: ProtocolType.Sealevel, - // Uses the same ChainId as https://www.alchemy.com/chain-connect/chain/solana - chainId: 1399811149, - domainId: 1399811149, - name: 'solana', - displayName: 'Solana', - nativeToken: { name: 'Sol', symbol: 'SOL', decimals: 9 }, - rpcUrls: [{ http: 'https://api.mainnet-beta.solana.com' }], - // blockExplorers: [ - // { - // name: 'SolScan', - // url: 'https://solscan.io', - // apiUrl: 'https://public-api.solscan.io', - // family: ExplorerFamily.Other, - // }, - // ], - blocks: { - confirmations: 1, - reorgPeriod: 0, - estimateBlockTime: 0.4, - }, + anvil2: { + name: 'anvil2', + protocol: ProtocolType.Ethereum, + chainId: 31338, + rpcUrls: [ + { + http: 'http://127.0.0.1:8555', + }, + ], }, - // -------------------------------------------------- // You can also override the default chain metadata (completely) // ethereum: { diff --git a/config/multisig_ism.ts b/config/multisig_ism.ts index 14c767b..208ed5b 100644 --- a/config/multisig_ism.ts +++ b/config/multisig_ism.ts @@ -2,22 +2,20 @@ import { ChainMap, ModuleType, MultisigIsmConfig } from '@hyperlane-xyz/sdk'; export const multisigIsmConfig: ChainMap = { // ----------- Your chains here ----------------- - solana: { + anvil1: { type: ModuleType.LEGACY_MULTISIG, - threshold: 2, + threshold: 1, validators: [ - '0x3cd1a081f38874bbb075bf10b62adcb858db864c', - '0x28aa072634dd41d19471640237852e807bd9901f', - '0x8a93ba04f4e30064660670cb581d9aa10df78929', + // Last anvil address + '0xa0ee7a142d267c1f36714e4a8f75612f20a79720', ], }, - nautilus: { + anvil2: { type: ModuleType.LEGACY_MULTISIG, - threshold: 2, + threshold: 1, validators: [ - '0x9c920af9467595a23cb3433adefc3854d498a437', - '0x12b583ce1623b7de3fc727ccccda24dcab1fe022', - '0xc8b996a421ff1e203070c709c1af93944c049cc0', + // Last anvil address + '0xa0ee7a142d267c1f36714e4a8f75612f20a79720', ], }, }; diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index c67024b..f2d0960 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -7,10 +7,10 @@ import type { WarpRouteConfig } from '../src/warp/config'; export const warpRouteConfig: WarpRouteConfig = { base: { // Chain name must be in the Hyperlane SDK or in the chains.ts config - chainName: 'bsc', - type: TokenType.collateral, // TokenType.native or TokenType.collateral + chainName: 'anvil1', + type: TokenType.native, // TokenType.native or TokenType.collateral // If type is collateral, a token address is required: - address: '0x37a56cdcD83Dce2868f721De58cB3830C44C6303', + // address: '0x123...' // If the token is an NFT (ERC721), set to true: // isNft: boolean @@ -19,9 +19,7 @@ export const warpRouteConfig: WarpRouteConfig = { }, synthetics: [ { - chainName: 'nautilus', - type: TokenType.native, - scale: 10 ** 9, + chainName: 'anvil2', // Optionally specify a name, symbol, and totalSupply // If not specified, the base token's properties will be used @@ -29,15 +27,5 @@ export const warpRouteConfig: WarpRouteConfig = { // Optionally, specify owner, mailbox, and interchainGasPaymaster addresses // If not specified, the Permissionless Deployment artifacts or the SDK's defaults will be used }, - { - chainName: 'solana', - type: TokenType.collateral, - address: '0x0000000000000000000000000000000000000000', - name: 'Zebec', - symbol: 'ZBC', - decimals: 9, - foreignDeployment: - '0xc5ba229fa2822fe65ac2bd0a93d8371d75292c3415dd381923c1088a3308528b', - }, ], }; From 22f204d1b3fb96854481cdcffb942319a2285285 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Wed, 16 Aug 2023 12:09:40 +0100 Subject: [PATCH 11/11] fix build --- config/warp_tokens.ts | 1 + src/warp/WarpRouteDeployer.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index f2d0960..c835b38 100644 --- a/config/warp_tokens.ts +++ b/config/warp_tokens.ts @@ -20,6 +20,7 @@ export const warpRouteConfig: WarpRouteConfig = { synthetics: [ { chainName: 'anvil2', + type: TokenType.synthetic, // or TokenType.native or TokenType.collateral // Optionally specify a name, symbol, and totalSupply // If not specified, the base token's properties will be used diff --git a/src/warp/WarpRouteDeployer.ts b/src/warp/WarpRouteDeployer.ts index ee813a0..310b846 100644 --- a/src/warp/WarpRouteDeployer.ts +++ b/src/warp/WarpRouteDeployer.ts @@ -141,7 +141,7 @@ export class WarpRouteDeployer { const sChainName = synthetic.chainName; configMap[sChainName] = { - type: synthetic.type, + type: synthetic.type || TokenType.synthetic, name: synthetic.name || baseTokenMetadata.name, symbol: synthetic.symbol || baseTokenMetadata.symbol, totalSupply: