diff --git a/projects/nolus/index.js b/projects/nolus/index.js index b1983f2736a5..3bc9d8ee929f 100644 --- a/projects/nolus/index.js +++ b/projects/nolus/index.js @@ -17,6 +17,11 @@ const astroportOracleAddr = 'nolus1jew4l5nq7m3xhkqzy8j7cc99083m5j8d9w004ayyv8xl3 const astroportLppAddr = 'nolus1qqcr7exupnymvg6m63eqwu8pd4n5x6r5t3pyyxdy7r97rcgajmhqy3gn94' const astroportLeaserAddr = 'nolus1et45v5gepxs44jxewfxah0hk4wqmw34m8pm4alf44ucxvj895kas5yrxd8' +// Astroport Noble USDC Protocol Contracts (NEUTRON-ASTROPORT-USDC_NOBLE) pirin-1 +const astroportNobleOracleAddr = 'nolus1vhzdx9lqexuqc0wqd48c5hc437yzw7jy7ggum9k25yy2hz7eaatq0mepvn' +const astroportNobleLeaserAddr = 'nolus1aftavx3jaa20srgwclakxh8xcc84nndn7yvkq98k3pz8ydhy9rvqkhj8dz' +const astroportNobleLppAddr = 'nolus17vsedux675vc44yu7et9m64ndxsy907v7sfgrk7tw3xnjtqemx3q6t3xw6' + const _6Zeros = 1000000 const nativeTokens = { @@ -42,9 +47,9 @@ async function getLeases(leaseAddresses) { return await queryManyContracts({ permitFailure: true, contracts: leaseAddresses, chain: 'nolus', data: {} }) } -async function getLppTvl(lppAddresses) { +async function getLppTvl(lppAddresses) { const lpps = await queryManyContracts({ contracts: lppAddresses, chain: 'nolus', data: { 'lpp_balance': [] } }) - + let totalLpp = 0 lpps.forEach(v => { totalLpp += Number(v.balance.amount) @@ -59,21 +64,24 @@ function sumAssests(balances, leases, currencies) { let ticker = v.opened.amount.ticker const amount = parseInt(v.opened.amount.amount, 10) const currencyData = find(currencies, (n) => n.ticker == ticker) - if (nativeTokens.hasOwnProperty(currencyData.dex_symbol)) { - sdk.util.sumSingleBalance(balances, nativeTokens[currencyData.dex_symbol], amount) + if (currencyData) { + if (nativeTokens.hasOwnProperty(currencyData.dex_symbol)) { + sdk.util.sumSingleBalance(balances, nativeTokens[currencyData.dex_symbol], amount) + } + sdk.util.sumSingleBalance(balances, currencyData.dex_symbol, amount) } - sdk.util.sumSingleBalance(balances, currencyData.dex_symbol, amount) } }) } -function find (collection, predicate) { +function find(collection, predicate) { for (let i = 0; i < collection.length; i++) { if (predicate(collection[i])) { - return collection[i]; + return collection[i] } } - return undefined; + + return undefined } async function tvl(protocols) { @@ -95,14 +103,15 @@ module.exports = { tvl: async () => { return { 'axlusdc': await getLppTvl([osmosisAxlLppAddr, astroportLppAddr]), - 'usd-coin': await getLppTvl([osmosisNobleLppAddr]) + 'usd-coin': await getLppTvl([osmosisNobleLppAddr, astroportNobleLppAddr]) } } }, neutron: { tvl: async () => { return await tvl([ - { leaser: astroportLeaserAddr, oracle: astroportOracleAddr } + { leaser: astroportLeaserAddr, oracle: astroportOracleAddr }, + { leaser: astroportNobleLeaserAddr, oracle: astroportNobleOracleAddr }, ]) } },