diff --git a/src/adapters/orbiter/index.ts b/src/adapters/orbiter/index.ts index 123b56ab..b646fd91 100644 --- a/src/adapters/orbiter/index.ts +++ b/src/adapters/orbiter/index.ts @@ -115,7 +115,7 @@ const constructParams = (chain: string) => { const nativeEvents = await Promise.all( eoaAddressNative.map(async (address: string, i: number) => { - await wait(300 * i); // for etherscan + await wait(500 * i); // for etherscan let txs: any[] = []; if (chain === "merlin") { txs = await getTxsBlockRangeMerlinScan(address, fromBlock, toBlock, { @@ -149,7 +149,6 @@ const constructParams = (chain: string) => { ); const contractEvents = await Promise.all( contractsAddress.map(async (address: string, i: number) => { - console.log(address); await wait(300 * i); // for etherscan const txs: any[] = await getTxsBlockRangeEtherscan(chain, address, fromBlock, toBlock, { includeSignatures: padContractSignature, @@ -157,16 +156,14 @@ const constructParams = (chain: string) => { const eventsRes: EventData[] = [] for( const tx of txs) { let value = BigNumber.from(0); + let isDepositTemp = true; if(tx.value == '0') { - value = await getPadContractTxValue(chain, tx.hash); + const {internalValue, isDeposit} = await getPadContractTxValue(chain, tx.hash); + value = internalValue; + isDepositTemp = isDeposit; } else { - value = tx.value; - } - let isDeposit = true; - if(value.isNegative()){ - value.mul(-1) - isDeposit = false; + value = BigNumber.from(tx.value); } const event: EventData = { txHash: tx.hash, @@ -175,7 +172,7 @@ const constructParams = (chain: string) => { to: tx.to, token: nativeTokens[chain], amount: value, - isDeposit, + isDeposit: isDepositTemp, }; eventsRes.push(event); } diff --git a/src/adapters/orbiter/processTransaction.ts b/src/adapters/orbiter/processTransaction.ts index 64efd2f1..6ae5828a 100644 --- a/src/adapters/orbiter/processTransaction.ts +++ b/src/adapters/orbiter/processTransaction.ts @@ -2,12 +2,12 @@ import { getProvider } from "@defillama/sdk/build/general"; import { BigNumber, ethers } from "ethers" import padAbi from './abi.json' assert { type: 'json' }; -export async function getPadContractTxValue(chain: string, txHash: string, ): Promise { +export async function getPadContractTxValue(chain: string, txHash: string, ): Promise<{internalValue: BigNumber, isDeposit: boolean}> { console.log(`start getPadContractTxValue, ${txHash}`); const provider = getProvider(chain); const txReceipt = await provider.getTransactionReceipt(txHash); if(!txReceipt){ - return BigNumber.from(0); + return { internalValue: BigNumber.from(0), isDeposit: true }; } const contractInterface = new ethers.utils.Interface(padAbi); @@ -18,23 +18,25 @@ export async function getPadContractTxValue(chain: string, txHash: string, ): Pr } catch(error) { const e = error as Error; - console.error(e.message); - return null + console.error("parse log fail:", e.message); + return null; } }).filter(log => log != null) as ethers.utils.LogDescription[]; - let totalValue = BigNumber.from(0) + let totalValue = BigNumber.from(0); + let isDeposit = true; for(const parsedLog of parsedLogs) { let value = BigNumber.from(0); if(parsedLog.name == 'SuccessfulLaunchMessage') { //TODO: add contract process value = parsedLog.args[6] } else if (parsedLog.name == 'SuccessfulLanding') { - value = BigNumber.from(parsedLog.args[1][8]).mul(-1) + value = BigNumber.from(parsedLog.args[1][8]) + isDeposit = false; } else if (parsedLog.name == 'SuccessfulLaunchMultiMessages') { value = parsedLog.args[6] } totalValue = totalValue.add(value); } - return totalValue; + return { internalValue: totalValue, isDeposit }; } \ No newline at end of file diff --git a/src/data/bridgeNetworkData.ts b/src/data/bridgeNetworkData.ts index 8bad7ccd..dcd98164 100644 --- a/src/data/bridgeNetworkData.ts +++ b/src/data/bridgeNetworkData.ts @@ -1124,32 +1124,32 @@ export default [ "Blast", "Arbitrum Nova", "Scroll", - "Manta", - "Mode", "zkSync Era", "Polygon zkEVM", "Merlin", "Bitlayer", "ZkLink", - "X Layer", "BSC", - "Bouncebit", - "Mantle", - "Zkfair", - "opBNB", "Taiko", - "BSquared", + // "Mantle", + // "Zkfair", + // "BSquared", + // "Bouncebit", + // "X Layer", + // "opBNB", + // "Mode", + // "Manta", ], chainMapping: { "arbitrum nova": "arbitrum_nova", "zksync era": "era", "polygon zkevm": "polygon_zkevm", - bsquared: "b2-mainnet", bitlayer: "btr", - "x layer": "xlayer", - bouncebit: "bouncebit-mainnet", - opbnb: "op_bnb", - taiko: "tko-mainnet" + taiko: "tko-mainnet", + // bsquared: "b2-mainnet", + // "x layer": "xlayer", + // bouncebit: "bouncebit-mainnet", + // opbnb: "op_bnb", }, }, { diff --git a/src/helpers/btr.ts b/src/helpers/btr.ts index 56276b30..0a2a8510 100644 --- a/src/helpers/btr.ts +++ b/src/helpers/btr.ts @@ -44,12 +44,10 @@ const getBlockTXbyAddress = async ( `https://api.btrscan.com/scan/api?module=account&action=txlist&address=${address}&startBlock=${startBlock}&endBlock=${endBlock}&sort=asc` ) const data = res.data - if(data.message == 'OK' && data.result.length != 0) { + if(data.message == 'OK' && data.status == 1 &&data.result.length != 0 ) { //filter by address const txList: any[] = data.result; return txList; - }else if(data.hasOwnProperty('error')) { - console.error(JSON.stringify(data.error.json.message)); } return [] } \ No newline at end of file