From be28d4b13736da184ce455c7528c257ca1821bda Mon Sep 17 00:00:00 2001 From: Vladislav Matus Date: Tue, 10 Dec 2024 12:45:21 +0100 Subject: [PATCH] Access Protocol TVL --- projects/access-protocol/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/access-protocol/index.js diff --git a/projects/access-protocol/index.js b/projects/access-protocol/index.js new file mode 100644 index 000000000000..8dd2b1c143dd --- /dev/null +++ b/projects/access-protocol/index.js @@ -0,0 +1,21 @@ +const { CentralStateV2, ACCESS_PROGRAM_ID } = require("@accessprotocol/js"); +const { getConnection } = require("../helper/solana"); + +async function staking() { + const connection = getConnection(); + const [centralKey] = CentralStateV2.getKey(ACCESS_PROGRAM_ID); + const centralState = await CentralStateV2.retrieve(connection, centralKey); + return { + [`solana:${centralState.tokenMint.toString()}`]: Number(centralState.totalStaked.toString()) + } +} + +module.exports = { + timetravel: false, + methodology: + "Uses the Access Protocol SDK to fetch the total supply of staked ACS tokens", + solana: { + tvl: async () => ({}), + staking, + }, +};