|
|
@ -19,7 +19,12 @@ import { |
|
|
|
isTokenMetadata, |
|
|
|
isTokenMetadata, |
|
|
|
serializeContracts, |
|
|
|
serializeContracts, |
|
|
|
} from '@hyperlane-xyz/sdk'; |
|
|
|
} from '@hyperlane-xyz/sdk'; |
|
|
|
import { ProtocolType, objMap, promiseObjAll } from '@hyperlane-xyz/utils'; |
|
|
|
import { |
|
|
|
|
|
|
|
ProtocolType, |
|
|
|
|
|
|
|
assert, |
|
|
|
|
|
|
|
objMap, |
|
|
|
|
|
|
|
promiseObjAll, |
|
|
|
|
|
|
|
} from '@hyperlane-xyz/utils'; |
|
|
|
|
|
|
|
|
|
|
|
import { readWarpRouteDeployConfig } from '../config/warp.js'; |
|
|
|
import { readWarpRouteDeployConfig } from '../config/warp.js'; |
|
|
|
import { MINIMUM_WARP_DEPLOY_GAS } from '../consts.js'; |
|
|
|
import { MINIMUM_WARP_DEPLOY_GAS } from '../consts.js'; |
|
|
@ -261,31 +266,24 @@ async function getWarpCoreConfig( |
|
|
|
context.multiProvider, |
|
|
|
context.multiProvider, |
|
|
|
configMap, |
|
|
|
configMap, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
assert( |
|
|
|
|
|
|
|
tokenMetadata && isTokenMetadata(tokenMetadata), |
|
|
|
|
|
|
|
'Missing required token metadata', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const { decimals, symbol, name } = tokenMetadata; |
|
|
|
|
|
|
|
assert(decimals, 'Missing decimals on token metadata'); |
|
|
|
|
|
|
|
|
|
|
|
// First pass, create token configs
|
|
|
|
// First pass, create token configs
|
|
|
|
for (const [chainName, contract] of Object.entries(contracts)) { |
|
|
|
for (const [chainName, contract] of Object.entries(contracts)) { |
|
|
|
const config = configMap[chainName]; |
|
|
|
const config = configMap[chainName]; |
|
|
|
const metadata = { |
|
|
|
|
|
|
|
...tokenMetadata, |
|
|
|
|
|
|
|
...config, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isTokenMetadata(metadata)) { |
|
|
|
|
|
|
|
throw new Error('Missing required token metadata'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { decimals } = metadata; |
|
|
|
|
|
|
|
if (!decimals) { |
|
|
|
|
|
|
|
throw new Error('Missing decimals on token metadata'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const collateralAddressOrDenom = |
|
|
|
const collateralAddressOrDenom = |
|
|
|
config.type === TokenType.collateral ? config.token : undefined; |
|
|
|
config.type === TokenType.collateral ? config.token : undefined; |
|
|
|
warpCoreConfig.tokens.push({ |
|
|
|
warpCoreConfig.tokens.push({ |
|
|
|
chainName, |
|
|
|
chainName, |
|
|
|
standard: TOKEN_TYPE_TO_STANDARD[config.type], |
|
|
|
standard: TOKEN_TYPE_TO_STANDARD[config.type], |
|
|
|
...metadata, |
|
|
|
|
|
|
|
decimals, |
|
|
|
decimals, |
|
|
|
|
|
|
|
symbol, |
|
|
|
|
|
|
|
name, |
|
|
|
addressOrDenom: |
|
|
|
addressOrDenom: |
|
|
|
contract[configMap[chainName].type as keyof TokenFactories].address, |
|
|
|
contract[configMap[chainName].type as keyof TokenFactories].address, |
|
|
|
collateralAddressOrDenom, |
|
|
|
collateralAddressOrDenom, |
|
|
|