From 451712cea2f4d9e128efa8edfdd42f65859a2e62 Mon Sep 17 00:00:00 2001 From: TerrenceAddison Date: Wed, 7 Aug 2024 17:01:13 +0700 Subject: [PATCH] add Arrow Markets --- projects/arrowmarkets/abi.json | 5 ++++ projects/arrowmarkets/index.js | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 projects/arrowmarkets/abi.json create mode 100644 projects/arrowmarkets/index.js diff --git a/projects/arrowmarkets/abi.json b/projects/arrowmarkets/abi.json new file mode 100644 index 000000000000..ce4ecec8ba57 --- /dev/null +++ b/projects/arrowmarkets/abi.json @@ -0,0 +1,5 @@ +{ + "stakingContract": { + "totalStakeAmounts": "function totalStakeAmounts() view returns (uint256)" + } +} \ No newline at end of file diff --git a/projects/arrowmarkets/index.js b/projects/arrowmarkets/index.js new file mode 100644 index 000000000000..b386c8ca2e35 --- /dev/null +++ b/projects/arrowmarkets/index.js @@ -0,0 +1,44 @@ +const { staking } = require('../helper/staking'); +const { pool2 } = require('../helper/pool2'); +const sdk = require('@defillama/sdk'); +const abi = require('./abi.json'); + +const chain = 'avax'; // specify the chain as Avalanche + +// If your project has staking on Avalanche +const stakingContractAddress = '0x9193957DC6d298a83afdA45A83C24c6C397b135f'; +const stakingTokenAddress = '0x5c5e384Bd4e36724B2562cCAA582aFd125277C9B'; + + +// If your project has liquidity pools (pool2) on Avalanche +const pool2LPs = [ + '0xc3311F358AFaD52e13425d41053F6fdCaf0DE6dB', +]; + +module.exports = { + methodology: `TVL is calculated by fetching the total staked amount from the staking contract and the value of tokens in the liquidity pools.`, + [chain]: { + tvl: async (api) => { + // Fetch the total staked amount + const totalStaked = await getTotalStakedAmount(api); + + // Add the staked tokens to the TVL + api.add(stakingTokenAddress, totalStaked); + + // Add other TVL calculations if necessary + // Example: You can add liquidity pool TVL calculations here + + return api.getBalances(); + }, + }, + }; + + async function getTotalStakedAmount(api) { + const { output: totalStaked } = await sdk.api.abi.call({ + target: stakingContractAddress, + abi: abi.stakingContract.totalStakeAmounts, + chain: chain, + }); + + return totalStaked; + }