Skip to content

Commit aaa4b5d

Browse files
spravin3Pravin Singh
andauthored
Add Allora Network adapter (#17346)
Co-authored-by: Pravin Singh <pravinsingh@Pravins-MacBook-Pro.local>
1 parent 2e5dfb3 commit aaa4b5d

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

projects/allora/index.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const { queryV1Beta1 } = require('../helper/chain/cosmos');
2+
3+
async function getCosmosStaking() {
4+
const pool = await queryV1Beta1({
5+
chain: 'allora',
6+
url: 'staking/v1beta1/pool'
7+
});
8+
9+
return pool.pool.bonded_tokens || '0';
10+
}
11+
12+
async function getReputationalStaking() {
13+
// Reputational staking endpoint not yet available
14+
return '0';
15+
}
16+
17+
async function tvl(api) {
18+
// Staking is tracked separately
19+
}
20+
21+
async function staking() {
22+
const validatorStaking = await getCosmosStaking();
23+
const reputationalStaking = await getReputationalStaking();
24+
25+
const totalStakedUallo = BigInt(validatorStaking) + BigInt(reputationalStaking);
26+
const totalStakedAllo = totalStakedUallo / BigInt(1e18); // 18 decimals
27+
28+
return {
29+
'allora': Number(totalStakedAllo)
30+
};
31+
}
32+
33+
module.exports = {
34+
methodology: 'Tracks validator staking on Allora Chain via Cosmos SDK staking module. Reputational staking (workers/reputers) will be added when REST endpoint becomes available.',
35+
36+
timetravel: false,
37+
38+
allora: {
39+
tvl,
40+
staking
41+
},
42+
43+
hallmarks: [
44+
[1731283200, "Mainnet Launch"],
45+
],
46+
};

projects/helper/chain/cosmos.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const endPoints = {
5454
pryzm: "https://api.pryzm.zone",
5555
// agoric: 'https://as-proxy.gateway.atomscan.com/agoric-lcd',
5656
agoric: 'https://agoric-api.polkachu.com/',
57+
allora: 'https://allora-api.polkachu.com', // TODO: Verify actual mainnet endpoint
5758
band: 'https://laozi1.bandchain.org/api',
5859
celestia: 'https://celestia-rest.publicnode.com',
5960
dydx: 'https://dydx-rest.publicnode.com',

projects/helper/chains.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"aleph_zero",
1212
"alephium",
1313
"algorand",
14+
"allora",
1415
"alv",
1516
"ancient8",
1617
"ao",

0 commit comments

Comments
 (0)