Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(infra): added the getEthereumFormUSDTWarpConfig func #5056

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { ethers } from 'ethers';

import { ChainMap, HypTokenRouterConfig, TokenType } from '@hyperlane-xyz/sdk';
import { Address } from '@hyperlane-xyz/utils';

import {
RouterConfigWithoutOwner,
tokens,
} from '../../../../../src/config/warp.js';

const safeOwners: ChainMap<Address> = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment on who owns these

ethereum: '0xec5ad23e29203301B2C1a765718Cc1de7A8d3FbF',
form: '0x41B624412B529409A437f08Ef80bCabE81053650',
};

export const getEthereumFormUSDCWarpConfig = async (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would probably prefer us to split out these into their own files to stick with the pattern. We can ofc import the owners from one of them into the other

routerConfig: ChainMap<RouterConfigWithoutOwner>,
): Promise<ChainMap<HypTokenRouterConfig>> => {
const ethereum: HypTokenRouterConfig = {
mailbox: routerConfig.ethereum.mailbox,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do the

...routerConfig.ethereum,
...getOwnerConfigForAddress(safeOwners.ethereum),

pattern that we've been generally using instead of specifying mailbox and owner

owner: safeOwners.ethereum,
type: TokenType.collateral,
token: tokens.ethereum.USDC,
interchainSecurityModule: ethers.constants.AddressZero,
};

// FiatTokenProxy 0xFBf489bb4783D4B1B2e7D07ba39873Fb8068507D
// MasterMinter 0x9Dec8Dfafcce2d45E8FF8C7792DB1D704AB1dc9D
const form: HypTokenRouterConfig = {
mailbox: routerConfig.form.mailbox,
owner: safeOwners.form,
type: TokenType.collateralFiat,
token: '0xFBf489bb4783D4B1B2e7D07ba39873Fb8068507D',
interchainSecurityModule: ethers.constants.AddressZero,
};

return {
ethereum,
form,
};
};

export const getEthereumFormUSDTWarpConfig = async (
routerConfig: ChainMap<RouterConfigWithoutOwner>,
): Promise<ChainMap<HypTokenRouterConfig>> => {
const ethereum: HypTokenRouterConfig = {
mailbox: routerConfig.ethereum.mailbox,
owner: safeOwners.ethereum,
type: TokenType.collateral,
token: tokens.ethereum.USDT,
interchainSecurityModule: ethers.constants.AddressZero,
};

const form: HypTokenRouterConfig = {
mailbox: routerConfig.form.mailbox,
owner: safeOwners.form,
type: TokenType.synthetic,
interchainSecurityModule: ethers.constants.AddressZero,
};

return {
ethereum,
form,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ export enum WarpRouteIds {
ArbitrumBaseBlastBscEthereumGnosisLiskMantleModeOptimismPolygonScrollZeroNetworkZoraMainnet = 'ETH/arbitrum-base-blast-bsc-ethereum-gnosis-lisk-mantle-mode-optimism-polygon-scroll-zeronetwork-zoramainnet',
AppchainBaseUSDC = 'USDC/appchain-base',
BobaBsquaredSwellUBTC = 'UBTC/boba-bsquared-swell',
EthereumFormUSDT = 'USDT/ethereum-form',
EthereumFormUSDC = 'USDC/ethereum-form',
}
6 changes: 6 additions & 0 deletions typescript/infra/config/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {
} from '../src/config/environment.js';
import { RouterConfigWithoutOwner } from '../src/config/warp.js';

import {
getEthereumFormUSDCWarpConfig,
getEthereumFormUSDTWarpConfig,
} from './environments/mainnet3/warp/configGetters/formConfigGetters.js';
import { getAncient8EthereumUSDCWarpConfig } from './environments/mainnet3/warp/configGetters/getAncient8EthereumUSDCWarpConfig.js';
import { getAppChainBaseUSDCWarpConfig } from './environments/mainnet3/warp/configGetters/getAppchainBaseUSDCWarpConfig.js';
import { getArbitrumBaseBlastBscEthereumGnosisMantleModeOptimismPolygonScrollZeroNetworkZoraMainnetETHWarpConfig } from './environments/mainnet3/warp/configGetters/getArbitrumBaseBlastBscEthereumGnosisMantleModeOptimismPolygonScrollZeroNetworkZoraMainnetETHWarpConfig.js';
Expand Down Expand Up @@ -84,6 +88,8 @@ export const warpConfigGetterMap: Record<string, WarpConfigGetter> = {
[WarpRouteIds.AppchainBaseUSDC]: getAppChainBaseUSDCWarpConfig,
[WarpRouteIds.BobaBsquaredSwellUBTC]: getBobaBsquaredSwellUBTCWarpConfig,
[WarpRouteIds.EthereumZircuitRe7LRT]: getEthereumZircuitRe7LRTWarpConfig,
[WarpRouteIds.EthereumFormUSDT]: getEthereumFormUSDTWarpConfig,
[WarpRouteIds.EthereumFormUSDC]: getEthereumFormUSDCWarpConfig,
};

export async function getWarpConfig(
Expand Down
Loading