diff --git a/package.json b/package.json index e6acf82f7e..5279ccea0d 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "node": ">=16.18.0" }, "dependencies": { - "@across-protocol/constants-v2": "1.0.7", + "@across-protocol/constants-v2": "1.0.8", "@across-protocol/contracts-v2": "2.4.7", - "@across-protocol/sdk-v2": "0.18.0", + "@across-protocol/sdk-v2": "0.19.0", "@arbitrum/sdk": "^3.1.3", "@defi-wonderland/smock": "^2.3.5", "@eth-optimism/sdk": "^3.1.0", diff --git a/src/clients/InventoryClient.ts b/src/clients/InventoryClient.ts index 93b88a48e9..b1434c3bb5 100644 --- a/src/clients/InventoryClient.ts +++ b/src/clients/InventoryClient.ts @@ -124,7 +124,7 @@ export class InventoryClient { } getDestinationTokenForL1Token(l1Token: string, chainId: number | string): string { - return this.hubPoolClient.getDestinationTokenForL1Token(l1Token, Number(chainId)); + return this.hubPoolClient.getL2TokenForL1TokenAtBlock(l1Token, Number(chainId)); } getEnabledChains(): number[] { @@ -184,14 +184,15 @@ export class InventoryClient { // If this number of more than the target for the designation chain + rebalance overshoot then refund on L1. // Else, the post fill amount is within the target, so refund on the destination chain. async determineRefundChainId(deposit: Deposit, l1Token?: string): Promise { - const { amount, destinationChainId } = deposit; + const { originChainId, originToken, amount, destinationChainId } = deposit; + const hubChainId = this.hubPoolClient.chainId; // Always refund on L1 if the transfer is to L1. - if (!this.isInventoryManagementEnabled() || destinationChainId === this.hubPoolClient.chainId) { + if (!this.isInventoryManagementEnabled() || destinationChainId === hubChainId) { return destinationChainId; } - l1Token ??= this.hubPoolClient.getL1TokenForDeposit(deposit); + l1Token ??= this.hubPoolClient.getL1TokenForL2TokenAtBlock(originToken, originChainId); // If there is no inventory config for this token or this token and destination chain the return the destination chain. if ( @@ -214,7 +215,7 @@ export class InventoryClient { } catch (e) { // Fallback to getting refunds on Mainnet if calculating bundle refunds goes wrong. // Inventory management can always rebalance from Mainnet to other chains easily if needed. - return this.hubPoolClient.chainId; + return hubChainId; } // Add upcoming refunds going to this destination chain. @@ -236,7 +237,7 @@ export class InventoryClient { // If the post relay allocation, considering funds in transit, is larger than the target threshold then refund on L1 // Else, refund on destination chian to keep funds within the target. const targetPct = toBN(this.inventoryConfig.tokenConfig[l1Token][destinationChainId].targetPct); - const refundChainId = expectedPostRelayAllocation.gt(targetPct) ? this.hubPoolClient.chainId : destinationChainId; + const refundChainId = expectedPostRelayAllocation.gt(targetPct) ? hubChainId : destinationChainId; this.log("Evaluated refund Chain", { chainShortfall, diff --git a/src/clients/ProfitClient.ts b/src/clients/ProfitClient.ts index b78f6e43e0..1b04216386 100644 --- a/src/clients/ProfitClient.ts +++ b/src/clients/ProfitClient.ts @@ -508,7 +508,7 @@ export class ProfitClient { const destinationToken = destinationChainId === hubPoolClient.chainId ? hubToken - : hubPoolClient.getDestinationTokenForL1Token(hubToken, destinationChainId); + : hubPoolClient.getL2TokenForL1TokenAtBlock(hubToken, destinationChainId); assert(isDefined(destinationToken), `Chain ${destinationChainId} SpokePool is not configured for ${testSymbol}`); const deposit: Deposit = { diff --git a/src/clients/bridges/AdapterManager.ts b/src/clients/bridges/AdapterManager.ts index 8b75e9cf87..8e1ce7bd8b 100644 --- a/src/clients/bridges/AdapterManager.ts +++ b/src/clients/bridges/AdapterManager.ts @@ -113,12 +113,12 @@ export class AdapterManager { try { // That the line below is critical. if the hubpoolClient returns the wrong destination token for the L1 token then // the bot can irrecoverably send the wrong token to the chain and loose money. It should crash if this is detected. - const l2TokenForL1Token = this.hubPoolClient.getDestinationTokenForL1Token(l1Token, chainId); + const l2TokenForL1Token = this.hubPoolClient.getL2TokenForL1TokenAtBlock(l1Token, chainId); if (!l2TokenForL1Token) { throw new Error(`No L2 token found for L1 token ${l1Token} on chain ${chainId}`); } if (l2TokenForL1Token !== getL2TokenAddresses(l1Token)[chainId]) { - throw new Error("Mismatch tokens!"); + throw new Error(`Token address mismatch (${l2TokenForL1Token} != ${getL2TokenAddresses(l1Token)[chainId]})`); } return l2TokenForL1Token; } catch (error) { diff --git a/src/dataworker/DataworkerUtils.ts b/src/dataworker/DataworkerUtils.ts index 1bb339346c..c536a8d4f1 100644 --- a/src/dataworker/DataworkerUtils.ts +++ b/src/dataworker/DataworkerUtils.ts @@ -218,9 +218,9 @@ export function _buildRelayerRefundRoot( // net send amount value if the net send amount is negative. let amountToReturn = bnZero; if (!isUBA) { - const l1TokenCounterpart = clients.hubPoolClient.getL1TokenCounterpartAtBlock( - repaymentChainId, + const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock( l2TokenAddress, + repaymentChainId, endBlockForMainnet ); @@ -259,10 +259,7 @@ export function _buildRelayerRefundRoot( return; } - const l2TokenCounterpart = clients.hubPoolClient.getDestinationTokenForL1Token( - leaf.l1Tokens[index], - leaf.chainId - ); + const l2TokenCounterpart = clients.hubPoolClient.getL2TokenForL1TokenAtBlock(leaf.l1Tokens[index], leaf.chainId); // If we've already seen this leaf, then skip. If UBA, reset the net send amount and then skip. const existingLeaf = relayerRefundLeaves.find( (relayerRefundLeaf) => diff --git a/src/dataworker/PoolRebalanceUtils.ts b/src/dataworker/PoolRebalanceUtils.ts index 63b177a0cc..219c289bb5 100644 --- a/src/dataworker/PoolRebalanceUtils.ts +++ b/src/dataworker/PoolRebalanceUtils.ts @@ -57,9 +57,9 @@ export function updateRunningBalanceForFill( fill: interfaces.FillWithBlock, updateAmount: BigNumber ): void { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - fill.destinationChainId, + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( fill.destinationToken, + fill.destinationChainId, endBlockForMainnet ); updateRunningBalance(runningBalances, fill.destinationChainId, l1TokenCounterpart, updateAmount); @@ -71,9 +71,9 @@ export function updateRunningBalanceForDeposit( deposit: interfaces.DepositWithBlock, updateAmount: BigNumber ): void { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - deposit.originChainId, + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( deposit.originToken, + deposit.originChainId, deposit.quoteBlockNumber ); updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart, updateAmount); @@ -89,9 +89,9 @@ export function updateRunningBalanceForEarlyDeposit( const originChainId = Number(deposit.args[1].toString()); const originToken = deposit.args[6]; - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - originChainId, + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( originToken, + originChainId, // TODO: this must be handled s.t. it doesn't depend on when this is run. // For now, tokens do not change their mappings often, so this will work, but // to keep the system resilient, this must be updated. @@ -131,9 +131,9 @@ export function initializeRunningBalancesFromRelayerRepayments( const repaymentChainId = Number(_repaymentChainId); Object.entries(fillsForChain).forEach( ([l2TokenAddress, { realizedLpFees: totalRealizedLpFee, totalRefundAmount }]) => { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - repaymentChainId, + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( l2TokenAddress, + repaymentChainId, latestMainnetBlock ); @@ -160,9 +160,9 @@ export function addSlowFillsToRunningBalances( unfilledDeposits: UnfilledDeposit[] ): void { unfilledDeposits.forEach((unfilledDeposit) => { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - unfilledDeposit.deposit.originChainId, + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( unfilledDeposit.deposit.originToken, + unfilledDeposit.deposit.originChainId, latestMainnetBlock ); updateRunningBalance( diff --git a/src/finalizer/utils/arbitrum.ts b/src/finalizer/utils/arbitrum.ts index c39b3e1a27..a862dd14e1 100644 --- a/src/finalizer/utils/arbitrum.ts +++ b/src/finalizer/utils/arbitrum.ts @@ -46,14 +46,14 @@ async function multicallArbitrumFinalizations( ): Promise<{ callData: Multicall2Call[]; withdrawals: Withdrawal[] }> { const finalizableMessages = await getFinalizableMessages(logger, tokensBridged, hubSigner); const callData = await Promise.all(finalizableMessages.map((message) => finalizeArbitrum(message.message))); - const withdrawals = finalizableMessages.map((message) => { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( + const withdrawals = finalizableMessages.map(({ info: { l2TokenAddress, amountToReturn } }) => { + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( + l2TokenAddress, CHAIN_ID, - message.info.l2TokenAddress, hubPoolClient.latestBlockSearched ); const l1TokenInfo = hubPoolClient.getTokenInfo(1, l1TokenCounterpart); - const amountFromWei = convertFromWei(message.info.amountToReturn.toString(), l1TokenInfo.decimals); + const amountFromWei = convertFromWei(amountToReturn.toString(), l1TokenInfo.decimals); const withdrawal: Withdrawal = { l2ChainId: CHAIN_ID, l1TokenSymbol: l1TokenInfo.symbol, diff --git a/src/finalizer/utils/polygon.ts b/src/finalizer/utils/polygon.ts index c33b8ecaaa..12e678d0b2 100644 --- a/src/finalizer/utils/polygon.ts +++ b/src/finalizer/utils/polygon.ts @@ -177,14 +177,14 @@ async function multicallPolygonFinalizations( ) ); callData.push(...callDataRetrievals); - const withdrawals = finalizableMessages.map((message) => { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( + const withdrawals = finalizableMessages.map(({ l2TokenAddress, amountToReturn }) => { + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( + l2TokenAddress, CHAIN_ID, - message.l2TokenAddress, hubPoolClient.latestBlockSearched ); const l1TokenInfo = hubPoolClient.getTokenInfo(1, l1TokenCounterpart); - const amountFromWei = convertFromWei(message.amountToReturn.toString(), l1TokenInfo.decimals); + const amountFromWei = convertFromWei(amountToReturn.toString(), l1TokenInfo.decimals); const withdrawal: Withdrawal = { l2ChainId: CHAIN_ID, l1TokenSymbol: l1TokenInfo.symbol, @@ -208,7 +208,7 @@ async function retrieveTokenFromMainnetTokenBridger( mainnetSigner: Signer, hubPoolClient: HubPoolClient ): Promise { - const l1Token = hubPoolClient.getL1TokenCounterpartAtBlock(CHAIN_ID, l2Token, hubPoolClient.latestBlockSearched); + const l1Token = hubPoolClient.getL1TokenForL2TokenAtBlock(l2Token, CHAIN_ID, hubPoolClient.latestBlockSearched); const mainnetTokenBridger = getMainnetTokenBridger(mainnetSigner); const callData = await mainnetTokenBridger.populateTransaction.retrieve(l1Token); return { diff --git a/src/finalizer/utils/zkSync.ts b/src/finalizer/utils/zkSync.ts index 13d52ac3ff..59c105f97b 100644 --- a/src/finalizer/utils/zkSync.ts +++ b/src/finalizer/utils/zkSync.ts @@ -47,8 +47,7 @@ export async function zkSyncFinalizer( const txns = await prepareFinalizations(l1ChainId, l2ChainId, withdrawalParams); const withdrawals = candidates.map(({ l2TokenAddress, amountToReturn }) => { - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - l2ChainId, + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( l2TokenAddress, hubPoolClient.latestBlockSearched ); diff --git a/src/monitor/Monitor.ts b/src/monitor/Monitor.ts index 632fdcebec..6cc9150841 100644 --- a/src/monitor/Monitor.ts +++ b/src/monitor/Monitor.ts @@ -107,10 +107,17 @@ export class Monitor { }, ]) ); + const { hubPoolClient } = this.clients; + const l1Tokens = hubPoolClient.getL1Tokens().map(({ address }) => address); const tokensPerChain = Object.fromEntries( this.monitorChains.map((chainId) => { - const l2Tokens = this.clients.hubPoolClient.getDestinationTokensToL1TokensForChainId(chainId); - return [chainId, Object.keys(l2Tokens)]; + const l2Tokens = l1Tokens + .filter((l1Token) => hubPoolClient.l2TokenEnabledForL1Token(l1Token, chainId)) + .map((l1Token) => { + const l2Token = hubPoolClient.getL2TokenForL1TokenAtBlock(l1Token, chainId); + return l2Token; + }); + return [chainId, l2Tokens]; }) ); await this.clients.tokenTransferClient.update(searchConfigs, tokensPerChain); @@ -125,7 +132,7 @@ export class Monitor { return { l1Token: l1Token.address, chainId: this.monitorConfig.hubPoolChainId, - poolCollateralSymbol: this.clients.hubPoolClient.getTokenInfoForL1Token(l1Token.address).symbol, + poolCollateralSymbol: l1Token.symbol, utilization: toBN(utilization.toString()), }; }) @@ -286,9 +293,18 @@ export class Monitor { // Update current balances of all tokens on each supported chain for each relayer. async updateCurrentRelayerBalances(relayerBalanceReport: RelayerBalanceReport): Promise { + const { hubPoolClient } = this.clients; + const l1Tokens = hubPoolClient.getL1Tokens(); for (const relayer of this.monitorConfig.monitoredRelayers) { for (const chainId of this.monitorChains) { - const l2ToL1Tokens = this.clients.hubPoolClient.getDestinationTokensToL1TokensForChainId(chainId); + const l2ToL1Tokens = Object.fromEntries( + l1Tokens + .filter(({ address: l1Token }) => hubPoolClient.l2TokenEnabledForL1Token(l1Token, chainId)) + .map((l1Token) => { + const l2Token = hubPoolClient.getL2TokenForL1TokenAtBlock(l1Token.address, chainId); + return [l2Token, l1Token]; + }) + ); const l2TokenAddresses = Object.keys(l2ToL1Tokens); const tokenBalances = await this._getBalances( @@ -606,7 +622,7 @@ export class Monitor { } updateUnknownTransfers(relayerBalanceReport: RelayerBalanceReport): void { - const hubPoolClient = this.clients.hubPoolClient; + const { hubPoolClient, spokePoolClients } = this.clients; for (const relayer of this.monitorConfig.monitoredRelayers) { const report = relayerBalanceReport[relayer]; @@ -614,9 +630,14 @@ export class Monitor { let mrkdwn = ""; for (const chainId of this.monitorChains) { - const spokePoolClient = this.clients.spokePoolClients[chainId]; + const spokePoolClient = spokePoolClients[chainId]; const transfersPerToken: TransfersByTokens = transfersPerChain[chainId]; - const l2ToL1Tokens = hubPoolClient.getDestinationTokensToL1TokensForChainId(chainId); + const l2ToL1Tokens = Object.fromEntries( + Object.keys(transfersPerToken).map((l2Token) => [ + l2Token, + hubPoolClient.getL1TokenForL2TokenAtBlock(l2Token, chainId, hubPoolClient.latestBlockSearched), + ]) + ); let currentChainMrkdwn = ""; for (const l2Token of Object.keys(l2ToL1Tokens)) { diff --git a/src/relayer/Relayer.ts b/src/relayer/Relayer.ts index 94dc87de26..97bf492544 100644 --- a/src/relayer/Relayer.ts +++ b/src/relayer/Relayer.ts @@ -590,21 +590,18 @@ export class Relayer { destinationToken, fillAmount: amount, realizedLpFeePct, - repaymentChainId: chainId, + repaymentChainId, blockNumber: fillBlock, } = fill; - const contract = spokePoolClients[chainId].spokePool; + const contract = spokePoolClients[repaymentChainId].spokePool; const method = "requestRefund"; // @todo: Support specifying max impact against the refund amount (i.e. to mitigate price impact by fills). const maxCount = ethersConstants.MaxUint256; - // Resolve the refund token from the fill token. The name getDestinationtTokenForDeposit() is a misnomer here. - const refundToken = hubPoolClient.getDestinationTokenForDeposit({ - originChainId: destinationChainId, - originToken: destinationToken, - destinationChainId: chainId, - }); + // Resolve the refund token from the fill token. + const hubPoolToken = hubPoolClient.getL1TokenForL2TokenAtBlock(destinationToken, destinationChainId); + const refundToken = hubPoolClient.getL2TokenForL1TokenAtBlock(hubPoolToken, repaymentChainId); const args = [ refundToken, @@ -617,11 +614,11 @@ export class Relayer { maxCount, ]; - const message = `Submitted refund request on chain ${getNetworkName(chainId)}.`; + const message = `Submitted refund request on chain ${getNetworkName(repaymentChainId)}.`; const mrkdwn = this.constructRefundRequestMarkdown(fill); this.logger.debug({ at: "Relayer::requestRefund", message: "Requesting refund for fill.", fill }); - multiCallerClient.enqueueTransaction({ chainId, contract, method, args, message, mrkdwn }); + multiCallerClient.enqueueTransaction({ chainId: repaymentChainId, contract, method, args, message, mrkdwn }); } protected async resolveRepaymentChain( diff --git a/src/scripts/validateRunningBalances.ts b/src/scripts/validateRunningBalances.ts index e3e622a6c4..27ff9adfa0 100644 --- a/src/scripts/validateRunningBalances.ts +++ b/src/scripts/validateRunningBalances.ts @@ -114,7 +114,7 @@ export async function runScript(_logger: winston.Logger, baseSigner: Signer): Pr mrkdwn += `\n\tLeaf for chain ID ${leaf.chainId} and token ${tokenInfo.symbol} (${l1Token})`; const decimals = tokenInfo.decimals; - const l2Token = clients.hubPoolClient.getDestinationTokenForL1Token(l1Token, leaf.chainId); + const l2Token = clients.hubPoolClient.getL2TokenForL1TokenAtBlock(l1Token, leaf.chainId, followingBlockNumber); const l2TokenContract = new Contract(l2Token, ERC20.abi, await getProvider(leaf.chainId)); const runningBalance = leaf.runningBalances[i]; const netSendAmount = leaf.netSendAmounts[i]; diff --git a/src/utils/FillUtils.ts b/src/utils/FillUtils.ts index 772feb7039..f3aa6085bf 100644 --- a/src/utils/FillUtils.ts +++ b/src/utils/FillUtils.ts @@ -35,12 +35,17 @@ export function getRefundInformationFromFill( hubPoolClient.chainId, chainIdListForBundleEvaluationBlockNumbers )[1]; - const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( - fill.destinationChainId, + // @todo In v3, destination... must be swapped for origin... + const l1TokenCounterpart = hubPoolClient.getL1TokenForL2TokenAtBlock( fill.destinationToken, + fill.destinationChainId, + endBlockForMainnet + ); + const repaymentToken = hubPoolClient.getL2TokenForL1TokenAtBlock( + l1TokenCounterpart, + chainToSendRefundTo, endBlockForMainnet ); - const repaymentToken = hubPoolClient.getDestinationTokenForL1Token(l1TokenCounterpart, chainToSendRefundTo); return { chainToSendRefundTo, repaymentToken, diff --git a/test/AdapterManager.SendTokensCrossChain.ts b/test/AdapterManager.SendTokensCrossChain.ts index cf37460830..183336538d 100644 --- a/test/AdapterManager.SendTokensCrossChain.ts +++ b/test/AdapterManager.SendTokensCrossChain.ts @@ -96,10 +96,8 @@ describe("AdapterManager: Send tokens cross-chain", async function () { // Throws if there is a misconfiguration between L1 tokens and L2 tokens. This checks that the bot will error out // if it tries to delete money in the bridge. configure hubpool to return the wrong token for Optimism - hubPoolClient.setL1TokensToDestinationTokens({ - // bad config. map USDC on L1 to boba on L2. This is WRONG for chainID 10 and should error. - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": { 10: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" }, - }); + // bad config. map USDC on L1 to Arbitrum on L2. This is WRONG for chainID 10 and should error. + hubPoolClient.setTokenMapping(mainnetTokens["usdc"], 10, getL2TokenAddresses(mainnetTokens["usdc"])[42161]); let thrown2 = false; try { await adapterManager.sendTokenCrossChain(relayer.address, CHAIN_IDs.OPTIMISM, mainnetTokens.usdc, amountToSend); @@ -291,8 +289,11 @@ describe("AdapterManager: Send tokens cross-chain", async function () { async function seedMocks() { const allL1Tokens = Object.values(TOKEN_SYMBOLS_MAP).map((details) => details.addresses[CHAIN_IDs.MAINNET]); - const tokenAddressMapping = Object.fromEntries(allL1Tokens.map((address) => [address, getL2TokenAddresses(address)])); - hubPoolClient.setL1TokensToDestinationTokens(tokenAddressMapping); + allL1Tokens.forEach((address) => + Object.entries(getL2TokenAddresses(address)).forEach(([chainId, l2Addr]) => + hubPoolClient.setTokenMapping(address, Number(chainId), l2Addr) + ) + ); // Construct fake spoke pool clients. All the adapters need is a signer and a provider on each chain. for (const chainId of enabledChainIds) { diff --git a/test/InventoryClient.InventoryRebalance.ts b/test/InventoryClient.InventoryRebalance.ts index dd1ce454e9..647292717e 100644 --- a/test/InventoryClient.InventoryRebalance.ts +++ b/test/InventoryClient.InventoryRebalance.ts @@ -309,7 +309,7 @@ function seedMocks(seedBalances: { [chainId: string]: { [token: string]: BigNumb adapterManager.setMockedOutstandingCrossChainTransfers(chainId, owner.address, mainnetUsdc, toBN(0)); tokenClient.setTokenData(chainId, l2TokensForWeth[chainId], seedBalances[chainId][mainnetWeth], toBN(0)); tokenClient.setTokenData(chainId, l2TokensForUsdc[chainId], seedBalances[chainId][mainnetUsdc], toBN(0)); + hubPoolClient.setTokenMapping(mainnetWeth, chainId, l2TokensForWeth[chainId]); + hubPoolClient.setTokenMapping(mainnetUsdc, chainId, l2TokensForUsdc[chainId]); }); - - hubPoolClient.setL1TokensToDestinationTokens({ [mainnetWeth]: l2TokensForWeth, [mainnetUsdc]: l2TokensForUsdc }); } diff --git a/test/InventoryClient.RefundChain.ts b/test/InventoryClient.RefundChain.ts index 0f379da82a..f0704b3608 100644 --- a/test/InventoryClient.RefundChain.ts +++ b/test/InventoryClient.RefundChain.ts @@ -115,7 +115,6 @@ describe("InventoryClient: Refund chain selection", async function () { quoteTimestamp: 1234, message: "0x", }; - hubPoolClient.setReturnedL1TokenForDeposit(mainnetWeth); }); it("Correctly decides when to refund based on relay size", async function () { @@ -232,7 +231,7 @@ function seedMocks(seedBalances: { [chainId: string]: { [token: string]: BigNumb adapterManager.setMockedOutstandingCrossChainTransfers(chainId, owner.address, mainnetUsdc, toBN(0)); tokenClient.setTokenData(chainId, l2TokensForWeth[chainId], seedBalances[chainId][mainnetWeth]); tokenClient.setTokenData(chainId, l2TokensForUsdc[chainId], seedBalances[chainId][mainnetUsdc]); + hubPoolClient.setTokenMapping(mainnetWeth, chainId, l2TokensForWeth[chainId]); + hubPoolClient.setTokenMapping(mainnetUsdc, chainId, l2TokensForUsdc[chainId]); }); - - hubPoolClient.setL1TokensToDestinationTokens({ [mainnetWeth]: l2TokensForWeth, [mainnetUsdc]: l2TokensForUsdc }); } diff --git a/test/Monitor.ts b/test/Monitor.ts index 906838cea3..2da922c9c5 100644 --- a/test/Monitor.ts +++ b/test/Monitor.ts @@ -359,7 +359,7 @@ describe("Monitor", async function () { monitorInstance.clients.hubPoolClient.getL1Tokens(), [UNKNOWN_TRANSFERS_NAME] ); - await monitorInstance.updateUnknownTransfers(reports); + monitorInstance.updateUnknownTransfers(reports); expect(lastSpyLogIncludes(spy, `Transfers that are not fills for relayer ${depositor.address} 🦨`)).to.be.true; }); diff --git a/test/utils/utils.ts b/test/utils/utils.ts index 07dda29aa9..e30a2aea64 100644 --- a/test/utils/utils.ts +++ b/test/utils/utils.ts @@ -309,7 +309,7 @@ export async function buildDepositStruct( return { ...deposit, - destinationToken: hubPoolClient.getDestinationTokenForDeposit(deposit), + destinationToken: hubPoolClient.getL2TokenForDeposit(deposit), quoteBlockNumber: quoteBlock, realizedLpFeePct, blockNumber: await getLastBlockNumber(), diff --git a/yarn.lock b/yarn.lock index 0284671f86..9e6a066591 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11,10 +11,10 @@ "@uma/common" "^2.17.0" hardhat "^2.9.3" -"@across-protocol/constants-v2@1.0.7", "@across-protocol/constants-v2@^1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.7.tgz#e2e9eeaa58f72cfcf9abb4f9f53d2d3e93be1c13" - integrity sha512-zDkzEs9fzXCzlbRPJE0f98tRDkroL1Qmx0xKDEDh0D9t53oXbG/Ao5FI2ItsXPgCDEExfGR9YdzFdMf93/ZKIg== +"@across-protocol/constants-v2@1.0.8", "@across-protocol/constants-v2@^1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.8.tgz#0f4dc9fbcf7b99dd895a06bb6070b5d3c8e1188d" + integrity sha512-7rygtlYseWNI/5ocIT9SXYu6L86oQbKTtFNAOw5MqD53bbsREzRy5dU0wkUHJzvHiNIQ+iawKnzprqshHHeRKw== "@across-protocol/constants-v2@^1.0.4": version "1.0.4" @@ -48,13 +48,13 @@ "@openzeppelin/contracts" "4.1.0" "@uma/core" "^2.18.0" -"@across-protocol/sdk-v2@0.18.0": - version "0.18.0" - resolved "https://registry.yarnpkg.com/@across-protocol/sdk-v2/-/sdk-v2-0.18.0.tgz#4ca377e88f7e43eb3c2aa7ea26b9d0687294b750" - integrity sha512-4ibLbcJmSasG9l6efVuYoQva9tUo/07iECan7j8fRqJrUkB+5K8NEPl37P/BrBgjqOyeOmzYdscImaAlH397qw== +"@across-protocol/sdk-v2@0.19.0": + version "0.19.0" + resolved "https://registry.yarnpkg.com/@across-protocol/sdk-v2/-/sdk-v2-0.19.0.tgz#95d6151030bbe8bcd3737abca7564749d22bf892" + integrity sha512-l1TjbUhH5RWd5CJq5QPax+49d4cAjB/bQRvN3tArRyxPwD/Fbei6oFUInjTYSZzWBOlrWYlfO/Ni1xaJS/2R3w== dependencies: "@across-protocol/across-token" "^1.0.0" - "@across-protocol/constants-v2" "^1.0.7" + "@across-protocol/constants-v2" "^1.0.8" "@across-protocol/contracts-v2" "^2.4.7" "@eth-optimism/sdk" "^2.1.0" "@pinata/sdk" "^2.1.0"