Skip to content

Commit

Permalink
Add elocks adapter (#11052)
Browse files Browse the repository at this point in the history
* Add elocks adapter

* fix lint issues

* fix lint errors

* code refactor

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
ftm1337 and g1nt0ki authored Jul 22, 2024
1 parent 6c654af commit 9014ffc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions projects/elocks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { sumTokens2 } = require("../helper/unwrapLPs")

const IELOCKS = {
lockedAssets: "function lockedAssets(uint) public view returns (address token, uint balance, uint)"
}

const elocks = {
fantom: "0x2f20A659601d1c161A108E0725FEF31256a907ad"
}

module.exports = {
misrepresentedTokens: true,
}

Object.keys(elocks).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
const data = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: IELOCKS.lockedAssets, target: elocks[api.chain], startFromOne: true, })
data.forEach(i => api.addToken(i.token, i.balance))
return sumTokens2({ api, resolveLP: true})
},
}
})
2 changes: 1 addition & 1 deletion projects/helper/cache/sumUnknownTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ async function getTokenPrices({
async function sumUnknownTokens({ api, tokensAndOwners = [], balances,
coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio,
log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, abis,
ownerTokens,
ownerTokens = [],
}) {
if (api) {
chain = api.chain ?? chain
Expand Down

0 comments on commit 9014ffc

Please sign in to comment.