From 4aa7a330571cf8d80ea814f2196cc4fb0cdbe1ff Mon Sep 17 00:00:00 2001 From: Carl Yin <867119150@qq.com> Date: Thu, 8 Aug 2024 16:20:21 +0800 Subject: [PATCH] add Bitdrome adapter (#11230) * add Bitdrome adapter * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bitdrome/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/bitdrome/index.js diff --git a/projects/bitdrome/index.js b/projects/bitdrome/index.js new file mode 100644 index 000000000000..a8e4e946a5b7 --- /dev/null +++ b/projects/bitdrome/index.js @@ -0,0 +1,13 @@ +async function tvl(api) { + const TwoPoolFactory = '0x634FB7F07BDb77281c64a57F69E1EB19583E727a' + const pools = await api.fetchList({ lengthAbi: 'pool_count', itemAbi: 'pool_list', target: TwoPoolFactory }) + const tokens = await api.multiCall({ target: TwoPoolFactory, calls: pools, abi: 'function get_coins(address _pool) view returns (address[2])' }) + const ownerTokens = tokens.map((v, i) => [v, pools[i]]) + return api.sumTokens({ ownerTokens }) +} + +module.exports = { + bevm: { + tvl + } +} \ No newline at end of file