Skip to content

Commit

Permalink
tivel finance v1 (#10656)
Browse files Browse the repository at this point in the history
* tivel finance v1

* code refactor

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
tivelprotocol and g1nt0ki committed Jun 17, 2024
1 parent b9b1ad3 commit 71189d1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions projects/tivel-finance/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const config = {
era: '0x846FcA826196B3D674fd1691Bb785F3E4216bc0F'
}

Object.keys(config).forEach(chain => {
const factory = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const pools = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: 'pools', target: factory })
const tokens = await api.multiCall({ abi: 'address:quoteToken', calls: pools })
return api.sumTokens({ tokensAndOwners2: [tokens, pools] })
}
}
})

0 comments on commit 71189d1

Please sign in to comment.