fix: Do not consider xERC20 a collateral standard 2 (#3977)

Amending https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3973
to ensure output of the CLI doesn't incorrectly add
`collateralAddressOrDenom` to xERC20 configs.

---------

Co-authored-by: nambrot <nambrot@googlemail.com>
pull/3980/head
Alex 4 months ago committed by GitHub
parent 1579ca221c
commit acaa22cd90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/olive-geckos-behave.md
  2. 5
      typescript/cli/src/deploy/warp.ts
  3. 7
      typescript/sdk/src/token/TokenStandard.ts
  4. 6
      typescript/sdk/src/warp/WarpCore.ts

@ -0,0 +1,5 @@
---
"@hyperlane-xyz/sdk": patch
---
Do not consider xERC20 a collateral standard to fix fungibility checking logic while maintaining mint limit checking

@ -183,10 +183,7 @@ async function getWarpCoreConfig(
return wrappedToken;
}
if (
config.type === TokenType.collateral ||
config.type === TokenType.XERC20
) {
if (config.type === TokenType.collateral) {
return config.token;
}

@ -94,14 +94,17 @@ export const TOKEN_NFT_STANDARDS = [
export const TOKEN_COLLATERALIZED_STANDARDS = [
TokenStandard.EvmHypCollateral,
TokenStandard.EvmHypNative,
TokenStandard.EvmHypXERC20,
TokenStandard.EvmHypXERC20Lockbox,
TokenStandard.SealevelHypCollateral,
TokenStandard.SealevelHypNative,
TokenStandard.CwHypCollateral,
TokenStandard.CwHypNative,
];
export const MINT_LIMITED_STANDARDS = [
TokenStandard.EvmHypXERC20,
TokenStandard.EvmHypXERC20Lockbox,
];
export const TOKEN_HYP_STANDARDS = [
TokenStandard.EvmHypNative,
TokenStandard.EvmHypCollateral,

@ -22,6 +22,7 @@ import { Token } from '../token/Token.js';
import { TokenAmount } from '../token/TokenAmount.js';
import { parseTokenConnectionId } from '../token/TokenConnection.js';
import {
MINT_LIMITED_STANDARDS,
TOKEN_COLLATERALIZED_STANDARDS,
TOKEN_STANDARD_TO_PROVIDER_TYPE,
TokenStandard,
@ -427,7 +428,10 @@ export class WarpCore {
originToken.getConnectionForChain(destinationName)?.token;
assert(destinationToken, `No connection found for ${destinationName}`);
if (!TOKEN_COLLATERALIZED_STANDARDS.includes(destinationToken.standard)) {
if (
!TOKEN_COLLATERALIZED_STANDARDS.includes(destinationToken.standard) &&
!MINT_LIMITED_STANDARDS.includes(destinationToken.standard)
) {
this.logger.debug(
`${destinationToken.symbol} is not collateralized, skipping`,
);

Loading…
Cancel
Save