diff --git a/src/adapters/xy-finance/constants.ts b/src/adapters/xy-finance/constants.ts index 93821624..6e271a6e 100644 --- a/src/adapters/xy-finance/constants.ts +++ b/src/adapters/xy-finance/constants.ts @@ -31,11 +31,32 @@ export enum VAULTS_TOKEN { ETH } -type ContractAddress = string +type Address = string type YBridgeVaultsTokenAddress = Record + +export const ETH_ADDRESS: Address = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' + +export const NativeTokens: Partial> = { + [Chain.Ethereum]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + [Chain.Arbitrum]: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + [Chain.Optimism]: "0x4200000000000000000000000000000000000006", + [Chain.Base]: "0x4200000000000000000000000000000000000006", + [Chain.Linea]: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f", + [Chain.Blast]: "0x4300000000000000000000000000000000000004", + [Chain.Polygon]: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + [Chain.Scroll]: "0x5300000000000000000000000000000000000004", + [Chain.PolygonZkevm]: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + [Chain.ZkSync]: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", + [Chain.XLayer]: "0x5a77f1443d16ee5761d310e38b62f77f726bc71c", + [Chain.Bsc]: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", + [Chain.Mantle]: "0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111", + [Chain.Taiko]: "0xA51894664A773981C6C112C43ce576f315d5b1B6", + [Chain.Avalanche]: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", +}; + export const YBridgeVaultsTokenContractAddress: Record, YBridgeVaultsTokenAddress> = { [Chain.Ethereum]: { [VAULTS_TOKEN.USDT]: { @@ -361,7 +382,7 @@ export const YBridgeVaultsTokenContractAddress: Record, ContractAddress> = { +export const YBridgeContractAddress: Record, Address> = { [Chain.Ethereum]: '0x4315f344a905dC21a08189A117eFd6E1fcA37D57', [Chain.Scroll]: "0x778C974568e376146dbC64fF12aD55B2d1c4133f", [Chain.Mantle]: "0x73Ce60416035B8D7019f6399778c14ccf5C9c7A1", @@ -387,7 +408,7 @@ export const YBridgeContractAddress: Record, Contr [Chain.Taiko]: "0x73Ce60416035B8D7019f6399778c14ccf5C9c7A1" } -export const XYRouterContractAddress: Record = { +export const XYRouterContractAddress: Record = { [Chain.Ethereum]: "0xFfB9faf89165585Ad4b25F81332Ead96986a2681", [Chain.Scroll]: "0x22bf2A9fcAab9dc96526097318f459eF74277042", [Chain.Mantle]: "0x52075Fd1fF67f03beABCb5AcdA9679b02d98cA37", diff --git a/src/adapters/xy-finance/index.ts b/src/adapters/xy-finance/index.ts index 9e92cb7a..21e8ee39 100644 --- a/src/adapters/xy-finance/index.ts +++ b/src/adapters/xy-finance/index.ts @@ -4,6 +4,8 @@ import { BridgeAdapter, ContractEventParams, PartialContractEventParams } from " import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions"; import { Chain, + ETH_ADDRESS, + NativeTokens, XYRouterContractAddress, YBridgeContractAddress, YBridgeVaultsTokenContractAddress @@ -28,6 +30,13 @@ const getYBridgeSwapRequestedEventParams = (chain: Exclude to: "_referrer", }, argGetters: { + token: (log: any) => { + const token = log?._vaultToken + if (token?.toLowerCase() === ETH_ADDRESS.toLowerCase()) { + return NativeTokens[chain] || token + } + return token + }, to: (log: any) => { const vaultToken = log?._vaultToken const toVaultContract = find(YBridgeVaultsTokenContractAddress[chain], { tokenAddress: vaultToken })?.contractAddress @@ -56,6 +65,15 @@ const getYBridgeSwappedForUserEventParams = (chain: Exclude { + const token = log?._dstToken + if (token?.toLowerCase() === ETH_ADDRESS.toLowerCase()) { + return NativeTokens[chain] || token + } + return token + }, + }, isDeposit: false, } }