forked from DefiLlama/DefiLlama-Adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Access Protocol TVL functionality and refactor code (DefiLlama#12652
) Co-authored-by: Vladislav Matus <[email protected]>
- Loading branch information
1 parent
1bd7a4f
commit e0d9675
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { getMultipleAccounts, decodeAccount } = require("../helper/solana"); | ||
const { PublicKey } = require("@solana/web3.js"); | ||
|
||
async function staking(api) { | ||
const programId = new PublicKey('6HW8dXjtiTGkD4jzXs7igdFmZExPpmwUrRN5195xGup') | ||
const accountKey = getKey(programId); | ||
const [account] = await getMultipleAccounts([accountKey]); | ||
const decoded = decodeAccount('access', account); | ||
api.add(decoded.tokenMint.toBase58(), decoded.totalStaked); | ||
} | ||
|
||
const getKey = (address) => { | ||
return PublicKey.findProgramAddressSync([address.toBuffer()], address)[0].toBase58(); | ||
} | ||
|
||
module.exports = { | ||
timetravel: false, | ||
methodology: | ||
"Uses the Access Protocol SDK to fetch the total supply of staked ACS tokens", | ||
solana: { | ||
tvl: async () => ({}), | ||
staking, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters