-
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.
Co-authored-by: Paras Jain <paras@zoth.io>
- Loading branch information
1 parent
f247e11
commit af5345e
Showing
1 changed file
with
21 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,21 @@ | ||
const router = '0x2f52C3664Ff2b12A1A8Bc7B6020C7E92DBa781aE' | ||
const ZTLN = '0xfEd3D6557Dc46A1B25d0A6F666513Cb33835864B' | ||
|
||
const abi = { | ||
getAllSubVaults: 'function getAllSubVaults() view returns (address[] collaterals, (string integrationType, address collateralAddress, address subVaultAddress, uint256 price, uint256 ltv, bool isActive, uint256 registeredAt, uint256 lastUpdatedAt, uint8 tokenType)[] details)' | ||
} | ||
|
||
const tvl = async (api) => { | ||
const activeVaults = await api.call({ target: router, abi: abi.getAllSubVaults }) | ||
|
||
const tokensAndOwners = activeVaults.details.map((vault) => { | ||
const { collateralAddress, subVaultAddress} = vault | ||
return [collateralAddress, subVaultAddress] | ||
}) | ||
|
||
return api.sumTokens({ tokensAndOwners, blacklistedTokens: [ZTLN] }) | ||
} | ||
|
||
module.exports = { | ||
ethereum: { tvl } | ||
} |