From dd12940feeffb64dc60eefd0bb0c1c43476b7026 Mon Sep 17 00:00:00 2001 From: Dozer Date: Wed, 29 Nov 2023 11:33:06 +0200 Subject: [PATCH 1/4] interport adapter --- src/adapters/index.ts | 2 + src/adapters/interport-finance/constants.ts | 54 ++ src/adapters/interport-finance/index.ts | 149 ++++++ .../processTransactionsCustom.ts | 460 ++++++++++++++++++ src/data/bridgeNetworkData.ts | 31 +- 5 files changed, 695 insertions(+), 1 deletion(-) create mode 100644 src/adapters/interport-finance/constants.ts create mode 100644 src/adapters/interport-finance/index.ts create mode 100644 src/adapters/interport-finance/processTransactionsCustom.ts diff --git a/src/adapters/index.ts b/src/adapters/index.ts index ca70b4e3..fda3a919 100644 --- a/src/adapters/index.ts +++ b/src/adapters/index.ts @@ -40,6 +40,7 @@ import eywa from "./eywa"; import rhinofi from './rhinofi'; import pepeteam_bridge from './pepeteam-bridge'; import pnetwork from './pnetwork'; +import interport from './interport-finance'; export default { polygon, @@ -82,6 +83,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 eb8a2a06..1ec05997 100644 --- a/src/data/bridgeNetworkData.ts +++ b/src/data/bridgeNetworkData.ts @@ -304,7 +304,7 @@ export default [ "zksync era": "era", }, }, - + { id: 43, displayName: "DLN (Powered by deBridge)", @@ -648,4 +648,33 @@ 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", + }, + }, ] as BridgeNetwork[]; From 42eb653eec2fc504d4cc262214a1fb56afcc7d0f Mon Sep 17 00:00:00 2001 From: cryptolei Date: Wed, 13 Dec 2023 21:27:57 +0800 Subject: [PATCH 2/4] [update] fix DLN's id --- src/data/bridgeNetworkData.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/bridgeNetworkData.ts b/src/data/bridgeNetworkData.ts index 51919cf7..7c12f9d9 100644 --- a/src/data/bridgeNetworkData.ts +++ b/src/data/bridgeNetworkData.ts @@ -307,7 +307,7 @@ export default [ }, { - id: 43, + id: 20, displayName: "DLN (Powered by deBridge)", bridgeDbName: "debridgedln", iconLink: "icons:debridgedln", From 29b2d508c26379d61d6ff0f85eb676cc6f621080 Mon Sep 17 00:00:00 2001 From: cryptolei Date: Wed, 13 Dec 2023 21:28:48 +0800 Subject: [PATCH 3/4] [update] remove DLN's withdraws --- src/adapters/debridgedln/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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); From 1dd7db62d3a13254a15016ac2de42bfc1b112806 Mon Sep 17 00:00:00 2001 From: vrtnd Date: Wed, 13 Dec 2023 17:05:21 +0300 Subject: [PATCH 4/4] add interport --- src/data/bridgeNetworkData.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/data/bridgeNetworkData.ts b/src/data/bridgeNetworkData.ts index 1ec05997..c698ef57 100644 --- a/src/data/bridgeNetworkData.ts +++ b/src/data/bridgeNetworkData.ts @@ -589,7 +589,7 @@ export default [ "polygon zkevm": "polygon_zkevm", }, }, - { + { id: 41, displayName: "WanBridge", bridgeDbName: "wanbridge", @@ -633,12 +633,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", @@ -675,6 +672,7 @@ export default [ "zksync era": "era", "polygon zkevm": "polygon_zkevm", avalanche: "avax", + opbnb: "op_bnb", }, }, ] as BridgeNetwork[];