-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7fe7a9
commit 14ed473
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { sumTokens2 } = require("../helper/unwrapLPs"); | ||
|
||
const CRO_ZKEVM_MOONLANDER_ADDR = '0x02ae2e56bfDF1ee4667405eE7e959CD3fE717A05'; | ||
|
||
function tvl({moonlander,}) { | ||
return async (api) => { | ||
const poolTokens = await api.call({ | ||
abi: abis.totalValue, | ||
target: moonlander, | ||
}) | ||
|
||
const addresses = []; | ||
const valuesUsd = []; | ||
|
||
poolTokens.forEach((poolToken) => { | ||
addresses.push(poolToken.tokenAddress); | ||
valuesUsd.push(poolToken.valueUsd); | ||
}); | ||
|
||
return sumTokens2({ api, owner: moonlander, tokens: addresses, balances: valuesUsd}) | ||
} | ||
} | ||
|
||
const abis = { | ||
totalValue: 'function totalValue() view returns (tuple(address tokenAddress, int256 value, uint8 decimals, int256 valueUsd, uint16 targetWeight, uint16 feeBasisPoints, uint16 taxBasisPoints, bool dynamicFee)[])' | ||
} | ||
|
||
module.exports = { | ||
cronos_zkevm: { | ||
tvl: tvl({ moonlander: CRO_ZKEVM_MOONLANDER_ADDR, }), | ||
}, | ||
} |