Skip to content

Commit

Permalink
fix: Do not consider xERC20 a collateral standard 2 (hyperlane-xyz#3977)
Browse files Browse the repository at this point in the history
Amending hyperlane-xyz#3973
to ensure output of the CLI doesn't incorrectly add
`collateralAddressOrDenom` to xERC20 configs.

---------

Co-authored-by: nambrot <[email protected]>
  • Loading branch information
AlexBHarley and nambrot authored Jun 17, 2024
1 parent 1579ca2 commit acaa22c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-geckos-behave.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions typescript/cli/src/deploy/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 5 additions & 2 deletions typescript/sdk/src/token/TokenStandard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion typescript/sdk/src/warp/WarpCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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`,
);
Expand Down

0 comments on commit acaa22c

Please sign in to comment.