Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update thala lsd tvl #11141

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions projects/thala-lsd/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
const { aQuery } = require('../helper/chain/aptos')
const { aQuery, function_view } = require('../helper/chain/aptos')

// Note: thala-lsd is under the umbrella of Thala protocols

const LSD_ACCOUNT = "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6";
const THALA_VALIDATOR = "0xe888a0adfb4ca871bfe6aada8511f5326e877a8ce66a9980ef089eb2218d740c";

module.exports = {
timetravel: false,
methodology: "Aggregates thAPT backing Thala LSD's APT delegation.",
aptos: {
tvl: async () => {
const { data: { supply } } = await aQuery(`/v1/accounts/${LSD_ACCOUNT}/resource/0x1::coin::CoinInfo%3C${LSD_ACCOUNT}::staking::ThalaAPT%3E`)
const { data: { supply } } = await aQuery(`/v1/accounts/${LSD_ACCOUNT}/resource/0x1::coin::CoinInfo%3C${LSD_ACCOUNT}::staking::ThalaAPT%3E`);
const [active, inactive, pending_active, pending_inactive] = await function_view({
functionStr: `0x1::delegation_pool::get_delegation_pool_stake`,
type_arguments: [],
args: [THALA_VALIDATOR]
});
const validator_apt = Number(active) + Number(inactive) + Number(pending_active) + Number(pending_inactive);

return {
aptos: supply.vec[0].integer.vec[0].value / 1e8
aptos: (Number(supply.vec[0].integer.vec[0].value) + validator_apt) / 1e8
}
}
}
Expand Down
Loading