@@ -3,7 +3,7 @@ import { getMnemonic } from "@uma/common";
3
3
import { task } from "hardhat/config" ;
4
4
import { HardhatRuntimeEnvironment } from "hardhat/types" ;
5
5
import { CHAIN_IDs , TOKEN_SYMBOLS_MAP } from "../utils/constants" ;
6
- import { askYesNoQuestion } from "./utils" ;
6
+ import { askYesNoQuestion , resolveTokenOnChain } from "./utils" ;
7
7
8
8
// Chain adapter names are not 1:1 consistent with chain names, so some overrides are needed.
9
9
const chains = {
@@ -23,8 +23,6 @@ task("testChainAdapter", "Verify a chain adapter")
23
23
const signer = new ethers . Wallet . fromMnemonic ( getMnemonic ( ) ) . connect ( provider ) ;
24
24
25
25
const hubChainId = await getChainId ( ) ;
26
- const { address : hubPoolAddress , abi : hubPoolAbi } = await deployments . get ( "HubPool" ) ;
27
- const hubPool = new ethers . Contract ( hubPoolAddress , hubPoolAbi , provider ) ;
28
26
const spokeChainId = parseInt ( args . chain ) ;
29
27
30
28
const [ spokeName ] = Object . entries ( CHAIN_IDs ) . find ( ( [ , chainId ] ) => chainId === spokeChainId ) ?? [ ] ;
@@ -38,15 +36,10 @@ task("testChainAdapter", "Verify a chain adapter")
38
36
const tokenAddress = TOKEN_SYMBOLS_MAP [ tokenSymbol ] . addresses [ hubChainId ] ;
39
37
40
38
// 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 } .` ) ;
50
43
51
44
const erc20 = ( await ethers . getContractFactory ( "ExpandedERC20" ) ) . attach ( tokenAddress ) ;
52
45
let balance = await erc20 . balanceOf ( adapterAddress ) ;
0 commit comments