forked from DefiLlama/DefiLlama-Adapters
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add shprd vaults TVL * code refactor * Update pull request template --------- Co-authored-by: Francis Berger <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
6 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,34 @@ | ||
const protocolConfig = { | ||
factories: { | ||
ethereum: { address: '0xf14c4b935054b8d1017ad96c9a265eb7f8ecf13c' }, | ||
arbitrum: { address: '0xf0ee0b31aae29f0bea8ff806c101377fc92e4ffa' }, | ||
} | ||
} | ||
|
||
async function tvl(ts, block, _, { api }) { | ||
// 1. get all vaults deployed on chain | ||
const factoryAddress = protocolConfig.factories[api.chain].address | ||
const factoryState = await api.call({ | ||
abi: "function getFactoryState() view returns (address[], address, address, address, address, address)", | ||
target: factoryAddress, | ||
}); | ||
const vaultAddresses = factoryState[0] | ||
|
||
// 2. get all tradable erc20s for these same vaults | ||
const tokens = await api.call({ abi: "address[]:getWhitelistedTokens", target: factoryAddress, }); | ||
return api.sumTokens({ owners: vaultAddresses, tokens, }) | ||
} | ||
|
||
|
||
module.exports = { | ||
start: 1688162400, | ||
hallmarks: [ | ||
[1695396647, "Fees distribution #1"], | ||
[1705582439, "Fees distribution #2"], | ||
], | ||
methodology: `TVL is the total value of erc20s managed by SHPRD vaults` | ||
}; | ||
|
||
Object.keys(protocolConfig.factories).forEach(chain => { | ||
module.exports[chain] = { tvl } | ||
}) |
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