From c296f031782b3d6f04ceac628e6172ca8c068428 Mon Sep 17 00:00:00 2001 From: Yorke Rhodes Date: Mon, 14 Aug 2023 21:53:44 -0400 Subject: [PATCH] Deploy native scaled warp route --- artifacts/warp-token-addresses.json | 18 +++++++++++ config/warp_tokens.ts | 10 +++--- package.json | 4 +-- src/warp/WarpRouteDeployer.ts | 3 +- src/warp/config.ts | 9 ++---- yarn.lock | 48 ++++++++++++++--------------- 6 files changed, 55 insertions(+), 37 deletions(-) create mode 100644 artifacts/warp-token-addresses.json diff --git a/artifacts/warp-token-addresses.json b/artifacts/warp-token-addresses.json new file mode 100644 index 0000000..1e87b3d --- /dev/null +++ b/artifacts/warp-token-addresses.json @@ -0,0 +1,18 @@ +{ + "anvil1": { + "router": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8", + "tokenType": "collateral" + }, + "anvil2": { + "router": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9", + "tokenType": "synthetic" + }, + "bsctestnet": { + "router": "0x275f80A63745E3A05f997FD1f364495D371a1a65", + "tokenType": "collateral" + }, + "alfajores": { + "router": "0x0c9fAb95C85f1dbEfE4de742Ce06A007069A99a8", + "tokenType": "native" + } +} diff --git a/config/warp_tokens.ts b/config/warp_tokens.ts index f2d0960..1ea9a77 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: 'anvil1', - 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,9 @@ export const warpRouteConfig: WarpRouteConfig = { }, synthetics: [ { - chainName: 'anvil2', + chainName: 'alfajores', + type: TokenType.native, + scale: 10**9 // 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..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", - "@hyperlane-xyz/sdk": "1.4.2", + "@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/src/warp/WarpRouteDeployer.ts b/src/warp/WarpRouteDeployer.ts index a459101..4edfb1b 100644 --- a/src/warp/WarpRouteDeployer.ts +++ b/src/warp/WarpRouteDeployer.ts @@ -140,9 +140,9 @@ export class WarpRouteDeployer { for (const synthetic of synthetics) { const sChainName = synthetic.chainName; configMap[sChainName] = { - type: TokenType.synthetic, name: synthetic.name || baseTokenMetadata.name, symbol: synthetic.symbol || baseTokenMetadata.symbol, + // @ts-ignore totalSupply: synthetic.totalSupply || 0, owner, mailbox: @@ -155,6 +155,7 @@ export class WarpRouteDeployer { synthetic.interchainGasPaymaster || mergedContractAddresses[sChainName].defaultIsmInterchainGasPaymaster, foreignDeployment: synthetic.foreignDeployment, + ...synthetic }; this.logger( `Hyp token config on synthetic chain ${sChainName}:`, diff --git a/src/warp/config.ts b/src/warp/config.ts index 48419ab..09cc957 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; @@ -33,7 +30,7 @@ export type WarpBaseTokenConfig = export interface WarpRouteConfig { base: WarpBaseTokenConfig; - synthetics: WarpSyntheticTokenConfig[]; + synthetics: (WarpSyntheticTokenConfig | WarpNativeTokenConfig)[]; } // Zod schema for Warp Route config validation validation diff --git a/yarn.lock b/yarn.lock index da3b357..2a57521 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-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/core@npm:1.4.2-beta70" dependencies: - "@hyperlane-xyz/utils": 1.4.2 + "@hyperlane-xyz/utils": 1.4.2-beta70 "@openzeppelin/contracts": ^4.8.0 "@openzeppelin/contracts-upgradeable": ^4.8.0 - checksum: 2c85c752cdaae1603a7f5a6879dbd9477aee6c7a480f91d1649056fa13d14e4a6830dcc488ee398b8c0575cd752f7d6d6701805cd4d978e22425b282eac03431 + 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 - "@hyperlane-xyz/sdk": 1.4.2 + "@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": - version: 1.4.2 - resolution: "@hyperlane-xyz/hyperlane-token@npm:1.4.2" +"@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 - "@hyperlane-xyz/sdk": 1.4.2 - "@hyperlane-xyz/utils": 1.4.2 + "@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: dffdf248090fac08b1d5a34915d32fb57307a7e61a29bce440be700cf585a98dc8d02389141af28bf1e321e6367dc85736a7530a6e7ad1a305d4fdf0af916b29 + checksum: 824ea2da4c22e6ace5ed3aa5d633791a012e7cc1196b7553b91535af42c57eb707afe0b77639911e511de9f4fb2640322e99ab3f776f07a24bd8a49bbe9c3b5b 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-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/sdk@npm:1.4.2-beta70" dependencies: - "@hyperlane-xyz/core": 1.4.2 - "@hyperlane-xyz/utils": 1.4.2 + "@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: 1ba8d77d17da78bcde8a2e3c85d7a4024d5ab812c8c0caf25ab0316d27a34c32712944e94babf81ac3a2d0b1bf06eb200902919a0e5e456cc0ab3f3ceea42dd3 + checksum: a32e3b520bfdfb0109b3cea771634829c9805ddf12ceb4fb2ec6802127800856eb9131fede91439d9cf8188ac1011cfbf6ccd1d979a8afadae53ea47b493d40d 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-beta70": + version: 1.4.2-beta70 + resolution: "@hyperlane-xyz/utils@npm:1.4.2-beta70" dependencies: ethers: ^5.7.2 - checksum: e91d2684856d803824beba912d4d65e21009f6e402571adcc7dd0f0b8f43b11eaa8448f1b11958ffa76178f48794017d4d466bdf909dd9d3698b9eee45df9116 + checksum: a8fa17e27190588873dec83a5adb0fb000fc34cfba6bfe90d47e4ee7a6dea07f44b3d94e37688b991e599e38d7f584388530637a49604d6f39e3649058deabf1 languageName: node linkType: hard