diff --git a/typescript/sdk/src/token/Token.test.ts b/typescript/sdk/src/token/Token.test.ts index ebac4bbd6c..ce8eab63b5 100644 --- a/typescript/sdk/src/token/Token.test.ts +++ b/typescript/sdk/src/token/Token.test.ts @@ -136,6 +136,8 @@ const STANDARD_TO_TOKEN: Record = { // Fuel [TokenStandard.FuelNative]: null, + [TokenStandard.EvmHypXERC20Collateral]: null, + [TokenStandard.EvmHypFiatCollateral]: null, }; const PROTOCOL_TO_ADDRESS: Partial> = { diff --git a/typescript/sdk/src/token/TokenStandard.ts b/typescript/sdk/src/token/TokenStandard.ts index 31a31721e5..b6e212de89 100644 --- a/typescript/sdk/src/token/TokenStandard.ts +++ b/typescript/sdk/src/token/TokenStandard.ts @@ -14,6 +14,8 @@ export enum TokenStandard { EvmNative = 'EvmNative', EvmHypNative = 'EvmHypNative', EvmHypCollateral = 'EvmHypCollateral', + EvmHypXERC20Collateral = 'EvmHypXERC20Collateral', + EvmHypFiatCollateral = 'EvmHypFiatCollateral', EvmHypcollateralVault = 'EvmHypcollateralVault', EvmHypSynthetic = 'EvmHypSynthetic', @@ -53,6 +55,8 @@ export const TOKEN_STANDARD_TO_PROTOCOL: Record = { EvmHypCollateral: ProtocolType.Ethereum, EvmHypcollateralVault: ProtocolType.Ethereum, EvmHypSynthetic: ProtocolType.Ethereum, + EvmHypXERC20Collateral: ProtocolType.Ethereum, + EvmHypFiatCollateral: ProtocolType.Ethereum, // Sealevel (Solana) SealevelSpl: ProtocolType.Sealevel, @@ -98,6 +102,8 @@ export const TOKEN_NFT_STANDARDS = [ export const TOKEN_COLLATERALIZED_STANDARDS = [ TokenStandard.EvmHypCollateral, TokenStandard.EvmHypNative, + TokenStandard.EvmHypXERC20Collateral, + TokenStandard.EvmHypFiatCollateral, TokenStandard.SealevelHypCollateral, TokenStandard.SealevelHypNative, TokenStandard.CwHypCollateral, @@ -107,6 +113,8 @@ export const TOKEN_COLLATERALIZED_STANDARDS = [ export const TOKEN_HYP_STANDARDS = [ TokenStandard.EvmHypNative, TokenStandard.EvmHypCollateral, + TokenStandard.EvmHypXERC20Collateral, + TokenStandard.EvmHypFiatCollateral, TokenStandard.EvmHypSynthetic, TokenStandard.SealevelHypNative, TokenStandard.SealevelHypCollateral, @@ -136,6 +144,8 @@ export const TOKEN_TYPE_TO_STANDARD: Record = { [TokenType.native]: TokenStandard.EvmHypNative, [TokenType.collateral]: TokenStandard.EvmHypCollateral, [TokenType.collateralVault]: TokenStandard.EvmHypcollateralVault, + [TokenType.collateralFiat]: TokenStandard.EvmHypFiatCollateral, + [TokenType.collateralXERC20]: TokenStandard.EvmHypXERC20Collateral, [TokenType.collateralUri]: TokenStandard.EvmHypCollateral, [TokenType.fastCollateral]: TokenStandard.EvmHypCollateral, [TokenType.synthetic]: TokenStandard.EvmHypSynthetic, diff --git a/typescript/sdk/src/token/config.ts b/typescript/sdk/src/token/config.ts index d1ffc9d69f..75308e2e2b 100644 --- a/typescript/sdk/src/token/config.ts +++ b/typescript/sdk/src/token/config.ts @@ -8,6 +8,8 @@ export enum TokenType { syntheticUri = 'syntheticUri', collateral = 'collateral', collateralVault = 'collateralVault', + collateralXERC20 = 'collateralXERC20', + collateralFiat = 'collateralFiat', fastCollateral = 'fastCollateral', collateralUri = 'collateralUri', native = 'native', @@ -40,6 +42,8 @@ export type SyntheticConfig = TokenMetadata & { export type CollateralConfig = { type: | TokenType.collateral + | TokenType.collateralXERC20 + | TokenType.collateralFiat | TokenType.collateralUri | TokenType.fastCollateral | TokenType.fastSynthetic @@ -56,6 +60,8 @@ export const isCollateralConfig = ( config: TokenConfig, ): config is CollateralConfig => config.type === TokenType.collateral || + config.type === TokenType.collateralXERC20 || + config.type === TokenType.collateralFiat || config.type === TokenType.collateralUri || config.type === TokenType.fastCollateral || config.type == TokenType.collateralVault; diff --git a/typescript/sdk/src/token/contracts.ts b/typescript/sdk/src/token/contracts.ts index 766e4ca759..50ef36dbb0 100644 --- a/typescript/sdk/src/token/contracts.ts +++ b/typescript/sdk/src/token/contracts.ts @@ -8,8 +8,10 @@ import { HypERC721URICollateral__factory, HypERC721URIStorage__factory, HypERC721__factory, + HypFiatTokenCollateral__factory, HypNativeScaled__factory, HypNative__factory, + HypXERC20Collateral__factory, } from '@hyperlane-xyz/core'; import { proxiedFactories } from '../router/types.js'; @@ -21,6 +23,8 @@ export const hypERC20contracts = { [TokenType.fastSynthetic]: 'FastHypERC20', [TokenType.synthetic]: 'HypERC20', [TokenType.collateral]: 'HypERC20Collateral', + [TokenType.collateralFiat]: 'HypFiatTokenCollateral', + [TokenType.collateralXERC20]: 'HypXERC20Collateral', [TokenType.collateralVault]: 'HypERC20CollateralVaultDeposit', [TokenType.native]: 'HypNative', [TokenType.nativeScaled]: 'HypNativeScaled', @@ -33,6 +37,8 @@ export const hypERC20Tokenfactories = { [TokenType.synthetic]: new HypERC20__factory(), [TokenType.collateral]: new HypERC20Collateral__factory(), [TokenType.collateralVault]: new HypERC20CollateralVaultDeposit__factory(), + [TokenType.collateralFiat]: new HypFiatTokenCollateral__factory(), + [TokenType.collateralXERC20]: new HypXERC20Collateral__factory(), [TokenType.native]: new HypNative__factory(), [TokenType.nativeScaled]: new HypNativeScaled__factory(), }; diff --git a/typescript/sdk/src/token/deploy.ts b/typescript/sdk/src/token/deploy.ts index 1d28f8da1c..19e49c6473 100644 --- a/typescript/sdk/src/token/deploy.ts +++ b/typescript/sdk/src/token/deploy.ts @@ -28,9 +28,7 @@ import { TokenMetadata, TokenType, isCollateralConfig, - isCollateralVaultConfig, isErc20Metadata, - isFastConfig, isNativeConfig, isSyntheticConfig, isTokenMetadata, @@ -38,6 +36,7 @@ import { } from './config.js'; import { HypERC20Factories, + HypERC20contracts, HypERC721Factories, HypERC721contracts, hypERC20contracts, @@ -67,23 +66,7 @@ export class HypERC20Deployer extends GasRouterDeployer< } routerContractKey(config: ERC20RouterConfig) { - if (isCollateralConfig(config)) { - if (isFastConfig(config)) { - return TokenType.fastCollateral; - } else if (isCollateralVaultConfig(config)) { - return TokenType.collateralVault; - } else { - return TokenType.collateral; - } - } else if (isNativeConfig(config)) { - return config.scale ? TokenType.nativeScaled : TokenType.native; - } else if (isSyntheticConfig(config)) { - return isFastConfig(config) - ? TokenType.fastSynthetic - : TokenType.synthetic; - } else { - throw new Error('Unknown collateral type when constructing router name'); - } + return config.type as keyof HypERC20contracts; } async constructorArgs(