File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
5
5
const bs58 = basex ( ALPHABET )
6
6
7
7
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 '
9
9
10
10
async function getAlphBalance ( address ) {
11
11
return ( await axios . get ( `${ EXPLORER_API_HOST } /addresses/${ address } /balance` ) ) . data
You can’t perform that action at this time.
0 commit comments