From c856ae225e127f557c1ba157d0a012ecdb61001f Mon Sep 17 00:00:00 2001 From: cmdevbc <89685615+cmdevbc@users.noreply.github.com> Date: Wed, 4 Sep 2024 16:26:46 +0300 Subject: [PATCH] Update prdt contracts BSC Signed-off-by: cmdevbc <89685615+cmdevbc@users.noreply.github.com> --- src/factory/providers/bsc/prdt/index.ts | 48 +++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/factory/providers/bsc/prdt/index.ts b/src/factory/providers/bsc/prdt/index.ts index abea5f4..765bf1c 100644 --- a/src/factory/providers/bsc/prdt/index.ts +++ b/src/factory/providers/bsc/prdt/index.ts @@ -3,11 +3,20 @@ import formatter from '../../../../util/formatter'; import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl'; import BigNumber from 'bignumber.js'; -const CONTRACT1 = '0x31b8a8ee92961524fd7839dc438fd631d34b49c6'; -const CONTRACT2 = '0x00199E444155f6a06d74CF36315419d39b874f5c'; +const contracts = [ + '0x31B8A8Ee92961524fD7839DC438fd631D34b49C6', + '0x00199E444155f6a06d74CF36315419d39b874f5c', + '0xE39A6a119E154252214B369283298CDF5396026B', + '0x3Df33217F0f82c99fF3ff448512F22cEf39CC208', + '0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE', + '0x22dB94d719659d7861612E0f43EE28C9FF9909C7', + '0x49eFb44831aD88A9cFFB183d48C0c60bF4028da8', +]; + const TOKENS = [ '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', '0x55d398326f99059fF775485246999027B3197955', + '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', ]; async function tvl(params: ITvlParams): Promise> { @@ -17,30 +26,25 @@ async function tvl(params: ITvlParams): Promise> { return {}; } - const tokenBalances1 = await util.getTokenBalances( - CONTRACT1, - TOKENS, - block, - chain, - web3, - ); + const balances = {}; + let totalBnbBalance = new BigNumber(0); - const bnbBalance1 = await web3.eth.getBalance(CONTRACT1, block); + for (const contract of contracts) { + const tokenBalances = await util.getTokenBalances( + contract, + TOKENS, + block, + chain, + web3, + ); - const tokenBalances2 = await util.getTokenBalances( - CONTRACT2, - TOKENS, - block, - chain, - web3, - ); + const bnbBalance = await web3.eth.getBalance(contract, block); - const bnbBalance2 = await web3.eth.getBalance(CONTRACT2, block); + formatter.sumMultiBalanceOf(balances, tokenBalances, chain, provider); + totalBnbBalance = totalBnbBalance.plus(bnbBalance); + } - const balances = {}; - formatter.sumMultiBalanceOf(balances, tokenBalances1, chain, provider); - formatter.sumMultiBalanceOf(balances, tokenBalances2, chain, provider); - balances['bnb'] = new BigNumber(bnbBalance1).plus(bnbBalance2).toString(); + balances['bnb'] = totalBnbBalance.toString(); formatter.convertBalancesToFixed(balances);