Add useful error message when token config cannot be built (#70)

pull/2435/head
Asa Oines 2 years ago committed by GitHub
parent 5047ac5130
commit d574b9185a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/deploy.ts

@ -13,6 +13,8 @@ import { GasConfig, RouterConfig } from '@hyperlane-xyz/sdk/dist/router/types';
import { import {
CollateralConfig, CollateralConfig,
ERC20Metadata, ERC20Metadata,
ERC20RouterConfig,
ERC721RouterConfig,
HypERC20CollateralConfig, HypERC20CollateralConfig,
HypERC20Config, HypERC20Config,
HypERC721CollateralConfig, HypERC721CollateralConfig,
@ -24,11 +26,9 @@ import {
isErc20Metadata, isErc20Metadata,
isNativeConfig, isNativeConfig,
isSyntheticConfig, isSyntheticConfig,
isTokenMetadata,
isUriConfig, isUriConfig,
} from './config'; } from './config';
import { isTokenMetadata } from './config';
import { ERC721RouterConfig } from './config';
import { ERC20RouterConfig } from './config';
import { HypERC20Factories, HypERC721Factories } from './contracts'; import { HypERC20Factories, HypERC721Factories } from './contracts';
import { import {
ERC20__factory, ERC20__factory,
@ -180,6 +180,10 @@ export class HypERC20Deployer extends GasRouterDeployer<
...chainMetadata.nativeToken, ...chainMetadata.nativeToken,
totalSupply: 0, totalSupply: 0,
}; };
} else {
throw new Error(
`Warp route config specifies native token but chain metadata for ${chain} does not provide native token details`,
);
} }
} else if (isErc20Metadata(config)) { } else if (isErc20Metadata(config)) {
tokenMetadata = config; tokenMetadata = config;

Loading…
Cancel
Save