Skip to content

Commit

Permalink
Update TVL data (#11792)
Browse files Browse the repository at this point in the history
  • Loading branch information
crispyfisherman authored Oct 1, 2024
1 parent 1ccc057 commit e886c33
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions projects/doubleup/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const ADDRESSES = require("../helper/coreAssets.json");
const sui = require("../helper/chain/sui");

const UNI_HOUSE_OBJ_ID = "0x75c63644536b1a7155d20d62d9f88bf794dc847ea296288ddaf306aa320168ab"
const SUI = ADDRESSES.sui.SUI;

async function tvl(api) {
const unihouseDynamicFields = await sui.getDynamicFieldObjects({
Expand All @@ -15,15 +13,22 @@ async function tvl(api) {

const unihouseIdList = unihouseList.map((house) => house.fields.id.id);

// console.log(unihouseIdList);

for (const id of unihouseIdList) {
const house = await sui.getObject(id);

const houseType = house?.type;
const coinType = houseType.split("<")[1].split(">")[0];

const housePipeDebt = house?.fields?.house_pipe_debt?.fields?.value;
const housePool = house?.fields?.house_pool;
const houseTvl = Number(housePipeDebt) + Number(housePool);

api.add(coinType, houseTvl);

const pipeDebt = house?.fields?.pipe_debt?.fields?.value;
const totalSui = Number(pipeDebt) + Number(house?.fields?.pool);
const _tvl = Number(pipeDebt) + Number(house?.fields?.pool);

api.add(SUI, totalSui);
api.add(coinType, _tvl);
}
}

Expand Down

0 comments on commit e886c33

Please sign in to comment.