From 71189d121d60269447e6309859c826176954c7d8 Mon Sep 17 00:00:00 2001 From: 0xulti <125024743+tivelprotocol@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:24:19 +0700 Subject: [PATCH] tivel finance v1 (#10656) * tivel finance v1 * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/tivel-finance/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/tivel-finance/index.js diff --git a/projects/tivel-finance/index.js b/projects/tivel-finance/index.js new file mode 100644 index 00000000000..8cff75dd4c5 --- /dev/null +++ b/projects/tivel-finance/index.js @@ -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] }) + } + } +}) \ No newline at end of file