Skip to content

Commit dd8e203

Browse files
g1nt0kikrk0d3rkrk0d3r
authored
track alphPad (DefiLlama#11409)
Co-authored-by: krk0d3r <[email protected]> Co-authored-by: krk0d3r <[email protected]>
1 parent 39287d6 commit dd8e203

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

projects/alphpad/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const alephium = require('../helper/chain/alephium')
2+
3+
const Addresses = {
4+
apad: '27HxXZJBTPjhHXwoF1Ue8sLMcSxYdxefoN2U6d8TKmZsm',
5+
alphApadPool: 'vFpZ1DF93x1xGHoXM8rsDBFjpcoSsCi5ZEuA5NG5UJGX',
6+
alphUsdtPool: '2A5R8KZQ3rhKYrW7bAS4JTjY9FCFLJg6HjQpqSFZBqACX',
7+
vault: 'yzoCumd4Fpi959NSis9Nnyr28UkgyRYqrKBgYNAuYj3m'
8+
}
9+
10+
async function apadLocked() {
11+
const results = await alephium.contractMultiCall([
12+
{ group: 0, address: Addresses.vault, methodIndex: 34 },
13+
{ group: 0, address: Addresses.alphApadPool, methodIndex: 8 },
14+
{ group: 0, address: Addresses.alphUsdtPool, methodIndex: 8 },
15+
]);
16+
const apadLocked = results[0].returns[0].value;
17+
const apadInAlph = results[1].returns[0].value / results[1].returns[1].value;
18+
const alphInUsd = (results[2].returns[1].value * 10 ** 12) / results[2].returns[0].value;
19+
return ((apadLocked / 10 ** 18) * apadInAlph) * alphInUsd;
20+
}
21+
22+
async function staking(api) {
23+
const apadLockedValue = await apadLocked();
24+
api.addCGToken('tether', apadLockedValue)
25+
}
26+
27+
28+
module.exports = {
29+
timetravel: false,
30+
methodology: 'TVL locked in the APAD on Alephium',
31+
alephium: {
32+
tvl: () => ({}),
33+
staking
34+
}
35+
}

projects/helper/chain/alephium.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
55
const bs58 = basex(ALPHABET)
66

77
const EXPLORER_API_HOST = 'https://backend-v115.mainnet.alephium.org'
8-
const NODE_API_HOST = 'https://chadnode.ayin.app'
8+
const NODE_API_HOST = 'https://node.mainnet.alephium.org'
99

1010
async function getAlphBalance(address) {
1111
return (await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/balance`)).data

0 commit comments

Comments
 (0)