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, + }, +};