diff --git a/projects/allora/index.js b/projects/allora/index.js new file mode 100644 index 00000000000..756f905c68e --- /dev/null +++ b/projects/allora/index.js @@ -0,0 +1,46 @@ +const { queryV1Beta1 } = require('../helper/chain/cosmos'); + +async function getCosmosStaking() { + const pool = await queryV1Beta1({ + chain: 'allora', + url: 'staking/v1beta1/pool' + }); + + return pool.pool.bonded_tokens || '0'; +} + +async function getReputationalStaking() { + // Reputational staking endpoint not yet available + return '0'; +} + +async function tvl(api) { + // Staking is tracked separately +} + +async function staking() { + const validatorStaking = await getCosmosStaking(); + const reputationalStaking = await getReputationalStaking(); + + const totalStakedUallo = BigInt(validatorStaking) + BigInt(reputationalStaking); + const totalStakedAllo = totalStakedUallo / BigInt(1e18); // 18 decimals + + return { + 'allora': Number(totalStakedAllo) + }; +} + +module.exports = { + methodology: 'Tracks validator staking on Allora Chain via Cosmos SDK staking module. Reputational staking (workers/reputers) will be added when REST endpoint becomes available.', + + timetravel: false, + + allora: { + tvl, + staking + }, + + hallmarks: [ + [1731283200, "Mainnet Launch"], + ], +}; diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 8d58a255ae0..fc491268891 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -54,6 +54,7 @@ const endPoints = { pryzm: "https://api.pryzm.zone", // agoric: 'https://as-proxy.gateway.atomscan.com/agoric-lcd', agoric: 'https://agoric-api.polkachu.com/', + allora: 'https://allora-api.polkachu.com', // TODO: Verify actual mainnet endpoint band: 'https://laozi1.bandchain.org/api', celestia: 'https://celestia-rest.publicnode.com', dydx: 'https://dydx-rest.publicnode.com', diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 0b75ab48457..701a2234237 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -11,6 +11,7 @@ "aleph_zero", "alephium", "algorand", + "allora", "alv", "ancient8", "ao",