From bd7be245f768cbf4abd94816982d142a332b50b5 Mon Sep 17 00:00:00 2001 From: GENGE Date: Mon, 30 Sep 2024 19:21:54 +0200 Subject: [PATCH] feat: suzaku adapter (#11787) --- projects/suzaku/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/suzaku/index.js diff --git a/projects/suzaku/index.js b/projects/suzaku/index.js new file mode 100644 index 000000000000..a70624952415 --- /dev/null +++ b/projects/suzaku/index.js @@ -0,0 +1,15 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +async function tvl(api) { + const logs = await getLogs2({ api, factory: '0xE5296638Aa86BD4175d802A210E158688e41A93c', eventAbi: 'event AddEntity(address indexed entity)', fromBlock: 20011312, }) + const COLLATERALS = logs.map(log => log.entity) + const tokens = await api.multiCall({ abi: 'address:asset', calls: COLLATERALS, }) + return api.sumTokens({ tokensAndOwners2: [tokens, COLLATERALS] }) +} + +module.exports = { + start: 1727654400, + avax: { + tvl, + }, +}