@@ -3,7 +3,7 @@ import { getMnemonic } from "@uma/common";
33import { task } from "hardhat/config" ;
44import { HardhatRuntimeEnvironment } from "hardhat/types" ;
55import { CHAIN_IDs , TOKEN_SYMBOLS_MAP } from "../utils/constants" ;
6- import { askYesNoQuestion } from "./utils" ;
6+ import { askYesNoQuestion , resolveTokenOnChain } from "./utils" ;
77
88// Chain adapter names are not 1:1 consistent with chain names, so some overrides are needed.
99const chains = {
@@ -23,8 +23,6 @@ task("testChainAdapter", "Verify a chain adapter")
2323 const signer = new ethers . Wallet . fromMnemonic ( getMnemonic ( ) ) . connect ( provider ) ;
2424
2525 const hubChainId = await getChainId ( ) ;
26- const { address : hubPoolAddress , abi : hubPoolAbi } = await deployments . get ( "HubPool" ) ;
27- const hubPool = new ethers . Contract ( hubPoolAddress , hubPoolAbi , provider ) ;
2826 const spokeChainId = parseInt ( args . chain ) ;
2927
3028 const [ spokeName ] = Object . entries ( CHAIN_IDs ) . find ( ( [ , chainId ] ) => chainId === spokeChainId ) ?? [ ] ;
@@ -38,15 +36,10 @@ task("testChainAdapter", "Verify a chain adapter")
3836 const tokenAddress = TOKEN_SYMBOLS_MAP [ tokenSymbol ] . addresses [ hubChainId ] ;
3937
4038 // For USDC this will resolve to native USDC on CCTP-enabled chains.
41- const l2Token = await hubPool . poolRebalanceRoute ( spokeChainId , tokenAddress ) ;
42- if ( l2Token === ethers . constants . AddressZero ) {
43- const proceed = await askYesNoQuestion (
44- `\t\nWARNING: ${ tokenSymbol } maps to address ${ l2Token } on chain ${ spokeChainId } \n\t\nProceed ?`
45- ) ;
46- if ( ! proceed ) process . exit ( 0 ) ;
47- } else {
48- console . log ( `Resolved ${ tokenSymbol } l2 token address on chain ${ spokeChainId } : ${ l2Token } .` ) ;
49- }
39+ const _l2Token = resolveTokenOnChain ( tokenSymbol , spokeChainId ) ;
40+ assert ( _l2Token !== undefined , `Token ${ tokenSymbol } is not known on chain ${ spokeChainId } ` ) ;
41+ const l2Token = _l2Token . address ;
42+ console . log ( `Resolved ${ tokenSymbol } l2 token address on chain ${ spokeChainId } : ${ l2Token } .` ) ;
5043
5144 const erc20 = ( await ethers . getContractFactory ( "ExpandedERC20" ) ) . attach ( tokenAddress ) ;
5245 let balance = await erc20 . balanceOf ( adapterAddress ) ;
0 commit comments