Skip to content

Commit

Permalink
Add Haedal AMM Adapter (#12977)
Browse files Browse the repository at this point in the history
  • Loading branch information
Efrain9502 authored Jan 7, 2025
1 parent c545bb2 commit f35f4b9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions projects/haedal-amm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const sui = require('../helper/chain/sui')

async function suiTVL(api) {
const poolObjectID = '0x3b822ea230e2f63860b05d4166ddce7133c0d04838d8f93ce02a88098fe0c609'
const {fields:{pools:{fields: {contents:listPool}}}} = await sui.getObject(poolObjectID)
for( const pool of listPool){
const {fields:{value: pool_id}} = pool
const {type,fields:{coins:{fields:{base_coin, quote_coin}}}} = await sui.getObject(pool_id)
const [coinA, coinB] = type.replace('>', '').split('<')[1].split(', ')
api.add(coinA, base_coin)
api.add(coinB, quote_coin)
}
}

module.exports = {
sui: {
tvl: suiTVL,
}
}

0 comments on commit f35f4b9

Please sign in to comment.