From 3d84257eff60faddd65f6f9db6b057346b3e9269 Mon Sep 17 00:00:00 2001 From: Lawson Graham Date: Sun, 12 May 2024 01:13:31 -0700 Subject: [PATCH] feat: added thala vethl tvl --- projects/thala-vethl/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/thala-vethl/index.js diff --git a/projects/thala-vethl/index.js b/projects/thala-vethl/index.js new file mode 100644 index 000000000000..becf14e3f626 --- /dev/null +++ b/projects/thala-vethl/index.js @@ -0,0 +1,26 @@ +const utils = require("../helper/utils"); +const sdk = require("@defillama/sdk"); +const { transformBalances } = require("../helper/portedTokens"); + +const THALA_API = "https://app.thala.fi/api"; +const thlAddress = "0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::THL"; +const thlDecimals = 8; + +module.exports = { + timetravel: true, + start: 1692598825, + methodology: + `TVL data is pulled from the Thala's API "https://app.thala.fi/api/vethl-tvl".`, + aptos: { + tvl: async ({ timestamp }) => { + const response = await utils.fetchURL(`${THALA_API}/vethl-tvl?timestamp=${ timestamp }`); + const thlAmount = response.data.data * 10**thlDecimals; + + const balances = {}; + sdk.util.sumSingleBalance(balances, thlAddress, thlAmount); + + return transformBalances("aptos", balances); + }, + }, +}; +