diff --git a/src/adapters/debridgedln/index.ts b/src/adapters/debridgedln/index.ts index 850bf42d..c023221d 100644 --- a/src/adapters/debridgedln/index.ts +++ b/src/adapters/debridgedln/index.ts @@ -80,12 +80,12 @@ const constructParams = (chain: SupportedChains) => { mapTokens: { "0x0000000000000000000000000000000000000000": token }, }; - const finalWithdrawParams = { - ...withdrawParams, - mapTokens: { "0x0000000000000000000000000000000000000000": token }, - }; + // const finalWithdrawParams = { + // ...withdrawParams, + // mapTokens: { "0x0000000000000000000000000000000000000000": token }, + // }; - eventParams.push(finalDepositParams, finalWithdrawParams); + eventParams.push(finalDepositParams); return async (fromBlock: number, toBlock: number) => getTxDataFromEVMEventLogs("debridgedln", chain, fromBlock, toBlock, eventParams); diff --git a/src/adapters/index.ts b/src/adapters/index.ts index 845670f0..b8721c77 100644 --- a/src/adapters/index.ts +++ b/src/adapters/index.ts @@ -37,13 +37,11 @@ import axelarsatellite from "./axelar-satellite"; import manta from "./manta"; import squidrouter from "./squid"; import eywa from "./eywa"; -<<<<<<< HEAD -import rhinofi from "./rhinofi"; -======= import rhinofi from './rhinofi'; import pepeteam_bridge from './pepeteam-bridge'; import pnetwork from './pnetwork'; ->>>>>>> origin +import interport from './interport-finance'; + export default { polygon, @@ -86,6 +84,7 @@ export default { rhinofi, pepeteam_bridge, pnetwork, + interport, } as { [bridge: string]: BridgeAdapter; }; diff --git a/src/adapters/interport-finance/constants.ts b/src/adapters/interport-finance/constants.ts new file mode 100644 index 00000000..0ddc6399 --- /dev/null +++ b/src/adapters/interport-finance/constants.ts @@ -0,0 +1,54 @@ +export const VAULT_TYPE_USDC = 1; +export const VAULT_TYPE_USDT = 2; + +export const ACTION_EXECUTOR_ADDRESSES = { + ethereum: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + arbitrum: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + bsc: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + era: "0xdF3E4dA3EE75F1018d277222967ce3D69F3271D9", + base: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + scroll: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + linea: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + polygon: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + polygon_zkevm: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + optimism: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + opbnb: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + avax: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + eon: "0x7b2E3FC7510D1A51b3bef735F985446589219354", + fantom: "0x7b2E3FC7510D1A51b3bef735F985446589219354", +} as const; + +export const VAULT_ASSET_ADDRESSES = { + [VAULT_TYPE_USDC]: { + ethereum: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + arbitrum: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + bsc: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', + era: '0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4', + base: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', + scroll: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4', + linea: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', + polygon: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + polygon_zkevm: '0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035', + optimism: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', + opbnb: undefined, + avax: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', + eon: '0xCc44eB064CD32AAfEEb2ebb2a47bE0B882383b53', + fantom: '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', + }, + [VAULT_TYPE_USDT]: { + ethereum: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + arbitrum: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', + bsc: '0x55d398326f99059fF775485246999027B3197955', + era: undefined, + base: undefined, + scroll: '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df', + linea: '0xA219439258ca9da29E9Cc4cE5596924745e12B93', + polygon: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + polygon_zkevm: '0x1E4a5963aBFD975d8c9021ce480b42188849D41d', + optimism: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', + opbnb: '0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3', + avax: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', + eon: '0xA167bcAb6791304EDa9B636C8beEC75b3D2829E6', + fantom: '0x049d68029688eAbF473097a2fC38ef61633A3C7A', + }, +}; diff --git a/src/adapters/interport-finance/index.ts b/src/adapters/interport-finance/index.ts new file mode 100644 index 00000000..977877d7 --- /dev/null +++ b/src/adapters/interport-finance/index.ts @@ -0,0 +1,149 @@ +import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeAdapter.type"; +import { BigNumber } from "ethers"; +import { getTxDataFromEVMEventLogsCustom } from "./processTransactionsCustom"; +import {ACTION_EXECUTOR_ADDRESSES, VAULT_TYPE_USDC, VAULT_TYPE_USDT, VAULT_ASSET_ADDRESSES} from "./constants"; + +type SupportedChains = keyof typeof ACTION_EXECUTOR_ADDRESSES; + +const depositParams = (chain: SupportedChains): PartialContractEventParams => { + const actionExecutorAddress = ACTION_EXECUTOR_ADDRESSES[chain]; + + return { + target: actionExecutorAddress, + topic: "SourceProcessed(uint256,bool,address,uint256,address,address,uint256,uint256)", + abi: [ + "event SourceProcessed(uint256 indexed actionId, bool indexed isLocal, address indexed sender, uint256 routerType, address fromTokenAddress, address toTokenAddress, uint256 fromAmount, uint256 resultAmount)" + ], + isDeposit: true, + logKeys: { + blockNumber: "blockNumber", + txHash: "transactionHash", + }, + argKeys: { + token: "toTokenAddress", + from: "sender", + amount: "resultAmount", + }, + fixedEventData: { + to: actionExecutorAddress, + }, + filter: { + includeArg: [{ isLocal: false as unknown as string }], + }, + }; +}; + +const withdrawParams = (chain: SupportedChains): PartialContractEventParams => { + const actionExecutorAddress = ACTION_EXECUTOR_ADDRESSES[chain]; + + return { + target: actionExecutorAddress, + topic: "TargetProcessed(uint256,address,uint256,address,address,uint256,uint256)", + abi: [ + "event TargetProcessed(uint256 indexed actionId, address indexed recipient, uint256 routerType, address fromTokenAddress, address toTokenAddress, uint256 fromAmount, uint256 resultAmount)" + ], + isDeposit: false, + logKeys: { + blockNumber: "blockNumber", + txHash: "transactionHash", + }, + argKeys: { + token: "fromTokenAddress", + to: "recipient", + amount: "fromAmount", + }, + fixedEventData: { + from: actionExecutorAddress, + }, + }; +}; + +const variableBalanceUsdcParams = (chain: SupportedChains): PartialContractEventParams => { + const actionExecutorAddress = ACTION_EXECUTOR_ADDRESSES[chain]; + + return { + target: actionExecutorAddress, + topic: "VariableBalanceAllocated(uint256,address,uint256,uint256)", + abi: [ + "event VariableBalanceAllocated(uint256 indexed actionId, address indexed recipient, uint256 vaultType, uint256 amount)" + ], + isDeposit: false, + logKeys: { + blockNumber: "blockNumber", + txHash: "transactionHash", + }, + argKeys: { + amount: "amount", + to: "recipient", + }, + fixedEventData: { + token: VAULT_ASSET_ADDRESSES[VAULT_TYPE_USDC][chain], + from: actionExecutorAddress, + }, + filter: { + includeArg: [{ vaultType: BigNumber.from(VAULT_TYPE_USDC) as unknown as string }], + }, + }; +}; + +const variableBalanceUsdtParams = (chain: SupportedChains): PartialContractEventParams => { + const actionExecutorAddress = ACTION_EXECUTOR_ADDRESSES[chain]; + + return { + target: actionExecutorAddress, + topic: "VariableBalanceAllocated(uint256,address,uint256,uint256)", + abi: [ + "event VariableBalanceAllocated(uint256 indexed actionId, address indexed recipient, uint256 vaultType, uint256 amount)" + ], + isDeposit: false, + logKeys: { + blockNumber: "blockNumber", + txHash: "transactionHash", + }, + argKeys: { + amount: "amount", + to: "recipient", + }, + fixedEventData: { + token: VAULT_ASSET_ADDRESSES[VAULT_TYPE_USDT][chain], + from: actionExecutorAddress, + }, + filter: { + includeArg: [{ vaultType: BigNumber.from(VAULT_TYPE_USDT) as unknown as string }], + }, + }; +}; + +const constructParams = (chain: SupportedChains) => { + const eventParams = [depositParams(chain), withdrawParams(chain)]; + + if (VAULT_ASSET_ADDRESSES[VAULT_TYPE_USDC][chain]) { + eventParams.push(variableBalanceUsdcParams(chain)); + } + + if (VAULT_ASSET_ADDRESSES[VAULT_TYPE_USDT][chain]) { + eventParams.push(variableBalanceUsdtParams(chain)); + } + + return async (fromBlock: number, toBlock: number) => + getTxDataFromEVMEventLogsCustom("interport", chain, fromBlock, toBlock, eventParams); +}; + +const adapter: BridgeAdapter = { + ethereum: constructParams("ethereum"), + arbitrum: constructParams("arbitrum"), + bsc: constructParams("bsc"), + "zksync era": constructParams("era"), + base: constructParams("base"), + scroll: constructParams("scroll"), + linea: constructParams("linea"), + polygon: constructParams("polygon"), + "polygon zkevm": constructParams("polygon_zkevm"), + optimism: constructParams("optimism"), + opbnb: constructParams("opbnb"), + avalanche: constructParams("avax"), + eon: constructParams("eon"), + fantom: constructParams("fantom"), +}; + +export default adapter; diff --git a/src/adapters/interport-finance/processTransactionsCustom.ts b/src/adapters/interport-finance/processTransactionsCustom.ts new file mode 100644 index 00000000..a46387f0 --- /dev/null +++ b/src/adapters/interport-finance/processTransactionsCustom.ts @@ -0,0 +1,460 @@ +import { getLogs } from "@defillama/sdk/build/util"; +import { ethers, BigNumber } from "ethers"; +import { Chain } from "@defillama/sdk/build/general"; +import { get } from "lodash"; +import { ContractEventParams, PartialContractEventParams } from "../../helpers/bridgeAdapter.type"; +import { EventData } from "../../utils/types"; +import { getProvider } from "@defillama/sdk/build/general"; +import { PromisePool } from "@supercharge/promise-pool"; + +const EventKeyTypes = { + blockNumber: "number", + txHash: "string", + from: "string", + to: "string", + token: "string", + amount: "object", +} as { + [key: string]: string; +}; + +const setTransferEventParams = (isDeposit: boolean, target: string) => { + const topic = "Transfer(address,address,uint256)"; + const logKeys = { + blockNumber: "blockNumber", + txHash: "transactionHash", + token: "address", + }; + const argKeys = { + from: "from", + to: "to", + amount: "value", + }; + const abi = ["event Transfer(address indexed from, address indexed to, uint256 value)"]; + let topics = []; + if (isDeposit) { + topics = [ethers.utils.id("Transfer(address,address,uint256)"), null, ethers.utils.hexZeroPad(target, 32)]; + } else { + topics = [ethers.utils.id("Transfer(address,address,uint256)"), ethers.utils.hexZeroPad(target, 32)]; + } + target = null as any; + return { topic, logKeys, argKeys, abi, topics, target }; +}; + +export const getTxDataFromEVMEventLogsCustom = async ( + adapterName: string, + chainContractsAreOn: Chain, + fromBlock: number, + toBlock: number, + paramsArray: (ContractEventParams | PartialContractEventParams)[] +) => { + let accEventData = [] as EventData[]; + const getLogsPromises = Promise.all( + paramsArray.map(async (params) => { + let { + target, + topic, + abi, + logKeys, + argKeys, + txKeys, + topics, + isDeposit, + chain, + isTransfer, + fixedEventData, + inputDataExtraction, + selectIndexesFromArrays, + functionSignatureFilter, + filter, + mapTokens, + getTokenFromReceipt, + argGetters, + } = params; + // if this is ever used, need to also overwrite fromBlock and toBlock + const overriddenChain = chain ? chain : chainContractsAreOn; + if (isTransfer) { + if (!target) { + throw new Error( + `${adapterName} adapter records Transfer events but no ${target} is given for them in adapter.` + ); + } + // can make following function include a chain parameter if needed + ({ topic, logKeys, argKeys, abi, topics, target } = setTransferEventParams(isDeposit, target)); + params = { + ...params, + topic, + logKeys, + argKeys, + abi, + topics, + target, + }; + } + if (!logKeys) { + logKeys = isDeposit + ? { + blockNumber: "blockNumber", + txHash: "transactionHash", + to: "address", + } + : { + blockNumber: "blockNumber", + txHash: "transactionHash", + from: "address", + }; + } + if (!(topic && abi)) { + throw new Error( + `adapter ${adapterName} with target ${target} either is missing param(s) or isTransfer param is false.` + ); + } + + const iface = new ethers.utils.Interface(abi); + let data = {} as any; + let logs = [] as any[]; + for (let i = 0; i < 5; i++) { + try { + logs = ( + await getLogs({ + target: target!, + topic: topic, + keys: [], + fromBlock: fromBlock, + toBlock: toBlock, + topics: topics as string[], + chain: overriddenChain, + }) + ).output; + //console.log(logs) + if (logs.length === 0) { + console.info(`No logs received for ${adapterName} from ${fromBlock} to ${toBlock} with topic ${topic}.`); + } + break; + } catch (e) { + if (i >= 4) { + console.error(target, e); + } else { + continue; + } + } + } + + let dataKeysToFilter = [] as number[]; + const provider = getProvider(overriddenChain) as any; + const { results, errors } = await PromisePool.withConcurrency(20) + .for(logs) + .process(async (txLog: any, i) => { + data[i] = data[i] || {}; + data[i]["isDeposit"] = isDeposit; + Object.entries(logKeys!).map(([eventKey, logKey]) => { + const value = txLog[logKey]; + if (typeof value !== EventKeyTypes[eventKey]) { + throw new Error( + `Type of ${eventKey} retrieved using ${logKey} is ${typeof value} when it must be ${ + EventKeyTypes[eventKey] + }.` + ); + } + data[i][eventKey] = value; + }); + let parsedLog = {} as any; + try { + parsedLog = iface.parseLog({ + topics: txLog.topics, + data: txLog.data, + }); + } catch (e) { + console.error( + `WARNING: Unable to parse log for ${adapterName}, SKIPPING TX with hash ${txLog.transactionHash} ${chainContractsAreOn}` + ); + dataKeysToFilter.push(i); + return; + } + if (argKeys) { + try { + const args = parsedLog?.args; + if (args === undefined || args.length === 0) { + throw new Error( + `Unable to get log args for ${adapterName} with arg keys ${argKeys} ${chainContractsAreOn}.` + ); + } + Object.entries(argKeys).map(([eventKey, argKey]) => { + // @ts-ignore + const value = argGetters?.[eventKey](args) || get(args, argKey); + if (typeof value !== EventKeyTypes[eventKey] && !Array.isArray(value)) { + throw new Error( + `Type of ${eventKey} retrieved using ${argKey} is ${typeof value} when it must be ${ + EventKeyTypes[eventKey] + }.` + ); + } + data[i][eventKey] = value; + }); + if (filter?.includeArg) { + let toFilter = true; + const includeArgArray = filter.includeArg; + includeArgArray.map((argMappingToInclude) => { + const argKeyToInclude = Object.keys(argMappingToInclude)[0]; + const argValueToInclude = Object.values(argMappingToInclude)[0]; + if ( + args[argKeyToInclude] === argValueToInclude || + ( + // custom logic + args[argKeyToInclude] instanceof BigNumber && + argValueToInclude instanceof BigNumber && + (args[argKeyToInclude]).eq(argValueToInclude) + ) + ) { + toFilter = false; + } + }); + if (toFilter) dataKeysToFilter.push(i); + } + if (filter?.excludeArg) { + let toFilter = false; + const excludeArgArray = filter.excludeArg; + excludeArgArray.map((argMappingToExclude) => { + const argKeyToExclude = Object.keys(argMappingToExclude)[0]; + const argValueToExclude = Object.values(argMappingToExclude)[0]; + if ( + args[argKeyToExclude] === argValueToExclude || + ( + // custom logic + args[argKeyToExclude] instanceof BigNumber && + argValueToExclude instanceof BigNumber && + (args[argKeyToExclude]).eq(argValueToExclude) + ) + ) { + toFilter = true; + } + }); + if (toFilter) dataKeysToFilter.push(i); + } + } catch (error: any) { + console.error( + `Unable to get log args for ${adapterName} with arg keys ${argKeys}. SKIPPING TX with hash ${txLog.transactionHash} ${chainContractsAreOn} + Error: ${error?.message} + ` + ); + return; + } + } + if (txKeys) { + const tx = await provider.getTransaction(txLog.transactionHash); + if (!tx) { + console.error(`WARNING: Unable to get transaction data for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + } else { + Object.entries(txKeys).map(([eventKey, logKey]) => { + const value = tx[logKey]; + if (typeof value !== EventKeyTypes[eventKey]) { + throw new Error( + `Type of ${eventKey} retrieved using ${logKey} is ${typeof value} when it must be ${ + EventKeyTypes[eventKey] + }.` + ); + } + data[i][eventKey] = value; + }); + } + } + if (filter?.includeTxData) { + const tx = await provider.getTransaction(txLog.transactionHash); + if (!tx) { + console.error(`WARNING: Unable to get transaction data for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + } else { + let toFilter = true; + const includeTxDataArray = filter.includeTxData; + includeTxDataArray.map((txMappingToInclude) => { + const txKeyToInclude = Object.keys(txMappingToInclude)[0]; + const txValueToInclude = Object.values(txMappingToInclude)[0]; + if (tx[txKeyToInclude] === txValueToInclude || tx[txKeyToInclude]?.toLowerCase() === txValueToInclude) { + toFilter = false; + } + }); + if (toFilter) dataKeysToFilter.push(i); + } + } + if (getTokenFromReceipt && getTokenFromReceipt.token) { + const txReceipt = await provider.getTransactionReceipt(txLog.transactionHash); + if (!txReceipt) { + console.error(`WARNING: Unable to get transaction receipt for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + } else { + const logs = txReceipt.logs; + const filteredLogs = logs.filter((log: any) => { + const topics = log.topics; + let isTransfer = false; + topics.map((topic: string) => { + if (topic.slice(0, 8) === "0xddf252") { + isTransfer = true; + } + }); + return isTransfer; + }); + if (filteredLogs.length === 0) { + if (!getTokenFromReceipt.native) { + console.error( + `Warning: Transaction receipt for ${adapterName} contained no token transfers and native address was not provided, SKIPPING tx.` + ); + dataKeysToFilter.push(i); + } else { + const tx = await provider.getTransaction(txLog.transactionHash); + if (!tx) { + console.error(`WARNING: Unable to get transaction data for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + } else { + const amount = tx.value; + const token = getTokenFromReceipt.native; + data[i].amount = amount; + data[i].token = token; + } + } + } else { + const firstLog = filteredLogs[0]; + const address = firstLog.address; + data[i].token = address; + if (getTokenFromReceipt.amount) { + const amountData = firstLog.data; + const bnAmount = ethers.BigNumber.from(amountData); + data[i].amount = bnAmount; + } + } + if (filteredLogs.length > 1) { + console.error( + `Warning: Transaction receipt for ${adapterName} contained multiple token transfers, retrieving first token only.` + ); + } + } + } + /* + type FunctionSignatureFilter = { + includeFunctionSignature?: string[] // require initial 8 characters of input data be one of those supplied in array (this is incorrect, should be changed to be 10 characters) + excludeFunctionSignature?: string[] + } + */ + if (functionSignatureFilter) { + const tx = await provider.getTransaction(txLog.transactionHash); + if (!tx) { + console.error(`WARNING: Unable to get transaction data for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + return; + } else { + const signature = tx.data.slice(0, 8); + if ( + functionSignatureFilter.includeSignatures && + !functionSignatureFilter.includeSignatures.includes(signature) + ) { + console.info(`Tx did not have input data matching given filter for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + return; + } + if ( + functionSignatureFilter.excludeSignatures && + functionSignatureFilter.excludeSignatures.includes(signature) + ) { + console.info(`Tx did not have input data matching given filter for ${adapterName}, SKIPPING tx.`); + dataKeysToFilter.push(i); + return; + } + } + } + if (inputDataExtraction) { + const tx = await provider.getTransaction(txLog.transactionHash); + try { + let inputData = [] as any; + if (inputDataExtraction.useDefaultAbiEncoder) { + inputData = ethers.utils.defaultAbiCoder.decode( + inputDataExtraction.inputDataABI, + ethers.utils.hexDataSlice(tx.data, 4) + ); + } else { + const iface = new ethers.utils.Interface(inputDataExtraction.inputDataABI); + inputData = iface.decodeFunctionData(inputDataExtraction.inputDataFnName || "", tx.data); + } + Object.entries(inputDataExtraction.inputDataKeys).map(([eventKey, inputDataKey]) => { + let value = "" as any; + if (inputDataExtraction?.useDefaultAbiEncoder) { + value = inputData[parseInt(inputDataKey)]; + } else { + value = inputData[inputDataKey]; + } + if (typeof value !== EventKeyTypes[eventKey]) { + throw new Error( + `Type of ${eventKey} retrieved using ${inputDataKey} with inputDataExtraction is ${typeof value} when it must be ${ + EventKeyTypes[eventKey] + }.` + ); + } + data[i][eventKey] = value; + }); + } catch (e) { + console.error(`Unable to extract Input Data. Check this transaction: ${txLog.transactionHash}`); + dataKeysToFilter.push(i); + return; + } + } + if (selectIndexesFromArrays) { + Object.entries(selectIndexesFromArrays).map(([eventKey, value]) => { + if (!Array.isArray(data[i][eventKey])) { + throw new Error( + `${eventKey} is not an array, but it has been specified as being one in 'selectIndexesFromArrays' in adapter.` + ); + } + const extractedValue = data[i][eventKey][parseInt(value)]; + data[i][eventKey] = extractedValue; + }); + } + if (mapTokens) { + const map = mapTokens; + const token = data[i].token; + if (token && map[token]) { + data[i].token = map[token]; + } + } + if (fixedEventData) { + Object.entries(fixedEventData).map(([eventKey, value]) => { + if (typeof value !== EventKeyTypes[eventKey]) { + throw new Error( + `Type of ${eventKey} in fixedEventData is ${typeof value} when it must be ${EventKeyTypes[eventKey]}.` + ); + } + data[i][eventKey] = value; + }); + } + }); + + if (errors.length > 0) { + console.error("Errors in getTxDataFromEVMEventLogs", errors); + } + + dataKeysToFilter.map((key) => { + delete data[key]; + }); + + const eventData = Object.values(data) as EventData[]; + + const filteredData = eventData.filter((log) => { + let toFilter = false; + toFilter = + toFilter || + (filter?.excludeFrom?.includes(log.from) ?? false) || + (filter?.excludeTo?.includes(log.to) ?? false) || + (filter?.excludeToken?.includes(log.token) ?? false); + toFilter = + toFilter || + !(filter?.includeFrom?.includes(log.from) ?? true) || + !(filter?.includeTo?.includes(log.to) ?? true) || + !(filter?.includeToken?.includes(log.token) ?? true); + return !toFilter; + }); + accEventData = [...accEventData, ...filteredData]; + }) + ); + await getLogsPromises; + + return accEventData; +}; + diff --git a/src/data/bridgeNetworkData.ts b/src/data/bridgeNetworkData.ts index d087fad2..af127bf8 100644 --- a/src/data/bridgeNetworkData.ts +++ b/src/data/bridgeNetworkData.ts @@ -305,9 +305,9 @@ export default [ "zksync era": "era", }, }, - + { - id: 43, + id: 20, displayName: "DLN (Powered by deBridge)", bridgeDbName: "debridgedln", iconLink: "icons:debridgedln", @@ -590,7 +590,7 @@ export default [ "polygon zkevm": "polygon_zkevm", }, }, - { + { id: 41, displayName: "WanBridge", bridgeDbName: "wanbridge", @@ -634,12 +634,9 @@ export default [ iconLink: "icons:pnetwork", largeTxThreshold: 10000, url: "https://p.network", - chains: [ - "Ethereum", - "BSC" - ] + chains: ["Ethereum", "BSC"], }, - { + { id: 43, displayName: "PepeTeam Bridge", bridgeDbName: "pepeteam_bridge", @@ -649,4 +646,34 @@ export default [ chains: ["Ethereum", "BSC", "Polygon"], destinationChain: "Waves", }, + { + id: 44, + displayName: "Interport Finance", + bridgeDbName: "interport", + iconLink: "icons:interport", + largeTxThreshold: 10000, + url: "https://app.interport.fi", + chains: [ + "Ethereum", + "Arbitrum", + "BSC", + "zkSync Era", + "Base", + "Scroll", + "Linea", + "Polygon", + "Polygon zkEVM", + "Optimism", + "opBNB", + "Avalanche", + "EON", + "Fantom", + ], + chainMapping: { + "zksync era": "era", + "polygon zkevm": "polygon_zkevm", + avalanche: "avax", + opbnb: "op_bnb", + }, + }, ] as BridgeNetwork[];