diff --git a/package.json b/package.json index fb24049348..62978a9fcb 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "node": ">=20" }, "dependencies": { - "@across-protocol/constants": "^3.1.10", + "@across-protocol/constants": "^3.1.11", "@across-protocol/contracts": "^3.0.6", - "@across-protocol/sdk": "^3.1.13", + "@across-protocol/sdk": "^3.1.14", "@arbitrum/sdk": "^3.1.3", "@aws-sdk/client-kms": "^3.592.0", "@aws-sdk/client-s3": "^3.592.0", diff --git a/src/adapter/bridges/BaseBridgeAdapter.ts b/src/adapter/bridges/BaseBridgeAdapter.ts index a54dbc3955..a1c5d726af 100644 --- a/src/adapter/bridges/BaseBridgeAdapter.ts +++ b/src/adapter/bridges/BaseBridgeAdapter.ts @@ -1,4 +1,5 @@ import { + CHAIN_IDs, Contract, BigNumber, EventSearchConfig, @@ -7,6 +8,7 @@ import { getTranslatedTokenAddress, assert, isDefined, + TOKEN_SYMBOLS_MAP, } from "../../utils"; import { SortableEvent } from "../../interfaces"; @@ -59,7 +61,12 @@ export abstract class BaseBridgeAdapter { ): Promise; protected resolveL2TokenAddress(l1Token: string): string { - return getTranslatedTokenAddress(l1Token, this.hubChainId, this.l2chainId, false); + // @todo: Fix call to `getTranslatedTokenAddress()` such that it does not require + // ifDefined(...). This is incompatible with remote chains where both native and + // bridged USDC are defined. + const isNativeUSDC = + this.l2chainId === CHAIN_IDs.SCROLL && isDefined(TOKEN_SYMBOLS_MAP.USDC.addresses[this.l2chainId]); + return getTranslatedTokenAddress(l1Token, this.hubChainId, this.l2chainId, isNativeUSDC); } protected getL1Bridge(): Contract { diff --git a/src/adapter/bridges/ScrollERC20Bridge.ts b/src/adapter/bridges/ScrollERC20Bridge.ts index 1b5a5ecbeb..51d03cf784 100644 --- a/src/adapter/bridges/ScrollERC20Bridge.ts +++ b/src/adapter/bridges/ScrollERC20Bridge.ts @@ -9,8 +9,6 @@ import { fixedPointAdjustment, isContractDeployedToAddress, bnZero, - compareAddressesSimple, - TOKEN_SYMBOLS_MAP, } from "../../utils"; import { CONTRACT_ADDRESSES, SCROLL_CUSTOM_GATEWAY } from "../../common"; import { BaseBridgeAdapter, BridgeTransactionDetails, BridgeEvents } from "./BaseBridgeAdapter"; @@ -129,11 +127,4 @@ export class ScrollERC20Bridge extends BaseBridgeAdapter { protected getScrollGatewayRouter(): Contract { return this.scrollGatewayRouter; } - - protected override resolveL2TokenAddress(l1Token: string): string { - if (compareAddressesSimple(TOKEN_SYMBOLS_MAP.USDC.addresses[this.hubChainId], l1Token)) { - return TOKEN_SYMBOLS_MAP.USDC.addresses[this.l2chainId]; // Scroll only has one USDC token type. - } - return super.resolveL2TokenAddress(l1Token); - } } diff --git a/src/common/Constants.ts b/src/common/Constants.ts index e82471e8b6..cac0e95b81 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -462,6 +462,20 @@ export const DEFAULT_ARWEAVE_GATEWAY = { url: "arweave.net", port: 443, protocol // This list should generally exclude Lite chains because the relayer ignores HubPool liquidity in that case. export const SLOW_WITHDRAWAL_CHAINS = [CHAIN_IDs.ARBITRUM, CHAIN_IDs.BASE, CHAIN_IDs.OPTIMISM]; +// We currently support WBTC, USDT, USDC, and WETH as routes on scroll. WBTC, USDT, and USDC transfer events can all be queried from the standard ERC20 +// gateway, WETH has its own custom gateways, and other ERC20s may also have their own gateway, so it is very important to define unique gateways (ones +// which are NOT the standard ERC20 gateway) if/when we add new deposit routes. +export const SCROLL_CUSTOM_GATEWAY: { [chainId: number]: { l1: string; l2: string } } = { + [TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.MAINNET]]: { + l1: "0x7AC440cAe8EB6328de4fA621163a792c1EA9D4fE", + l2: "0x7003E7B7186f0E6601203b99F7B8DECBfA391cf9", + }, + [TOKEN_SYMBOLS_MAP.USDC.addresses[CHAIN_IDs.MAINNET]]: { + l1: "0xf1AF3b23DE0A5Ca3CAb7261cb0061C0D779A5c7B", + l2: "0x33B60d5Dd260d453cAC3782b0bDC01ce84672142", + }, +}; + // Expected worst-case time for message from L1 to propogate to L2 in seconds export const EXPECTED_L1_TO_L2_MESSAGE_TIME = { [CHAIN_IDs.ARBITRUM]: 20 * 60, diff --git a/yarn.lock b/yarn.lock index e721af14b4..db5b706f67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11,7 +11,12 @@ "@uma/common" "^2.17.0" hardhat "^2.9.3" -"@across-protocol/constants@^3.1.10", "@across-protocol/constants@^3.1.9": +"@across-protocol/constants@^3.1.11": + version "3.1.11" + resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.11.tgz#8a55347fd058e1bfad6320f69f13eb5a06399bc6" + integrity sha512-AevN1x1acJVbi6zlH6M8eEKqzANO+H7nfLCChXlrS5vZi8QINs9RvSZX/U/j0UDW1tCbEKszKZcnL1ZM+Pgb0A== + +"@across-protocol/constants@^3.1.9": version "3.1.10" resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.10.tgz#37d4f391dc68719c224634073dc8e1ef0445b75d" integrity sha512-sG1QXVIZAMFsxURMz8U0ZJ2dfX72yjnE/0OGJTcDNcPvuK0MMDU9mFdSZWBtMwIxt0UZSIG/A5059UstT7+Cfg== @@ -45,13 +50,13 @@ axios "^1.6.2" zksync-web3 "^0.14.3" -"@across-protocol/sdk@^3.1.13": - version "3.1.13" - resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.1.13.tgz#a95b065674d97f5e516b37cac756f1983e1e4ec4" - integrity sha512-qXApbaAnQkpwpGhpX/hZPGA848YB2siwMpWHnIrRao+pl6xpqIBm4C+h93KxfnHnfjbpMX7eaSVy8KtKQyp+JA== +"@across-protocol/sdk@^3.1.14": + version "3.1.14" + resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.1.14.tgz#511bba54fcc26daaeeafecf7418f18ef1cc845d9" + integrity sha512-qLq3C8SJnZb5r3n2YBNXDQekgwVw06oRjpGmm3lsZq76kiTtTvb8v5E6nnZEYAbqxCnVJOk5f0GyGxfUzLsCaw== dependencies: "@across-protocol/across-token" "^1.0.0" - "@across-protocol/constants" "^3.1.10" + "@across-protocol/constants" "^3.1.11" "@across-protocol/contracts" "^3.0.6" "@eth-optimism/sdk" "^3.3.1" "@pinata/sdk" "^2.1.0"