Skip to content

Commit 1ce47bd

Browse files
elRaulito0xdevtrn
authored andcommitted
Added v3 of lending (DefiLlama#16344)
1 parent e9933c7 commit 1ce47bd

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

projects/fluidtokens/index.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,18 @@ async function tvl() {
5757
const boosted_tvl= await get("https://api.fluidtokens.com/get-ft-stats");
5858

5959
const boosted=parseInt(boosted_tvl.bs_available_volume)+parseInt(boosted_tvl.bs_active_volume);
60+
61+
const lending_v3 = await get("https://api.fluidtokens.com/get-tvl");
62+
63+
const principal = lending_v3.collectionOfferPools.principal;
64+
const collateral = lending_v3.loans.collateral;
65+
66+
// Sum and convert to integer
67+
const total_v3 = Math.floor(principal + collateral);
6068

6169
return {
6270
// cardano: (SC_offers_tvl+repay_tvl+pools_tvl+boosted) / 1e6,
63-
cardano: (SC_offers_tvl+pools_tvl+boosted) / 1e6,
71+
cardano: (SC_offers_tvl+pools_tvl+boosted+total_v3) / 1e6,
6472
};
6573
}
6674

@@ -80,13 +88,18 @@ async function borrowed() {
8088

8189
const dataOffers = await get("https://api.fluidtokens.com/get-available-collection-offers");
8290
let SC_offers_tvl = 0;
91+
92+
93+
const lending_v3 = await get("https://api.fluidtokens.com/get-tvl");
94+
const lent = lending_v3.loans.principal;
95+
8396

8497
dataOffers.forEach((i) => {
8598
SC_offers_tvl += parseInt(i.offerData.loanAmnt);
8699
});
87100

88101
return {
89-
cardano: (SC_tvl) / 1e6,
102+
cardano: (SC_tvl+lent) / 1e6,
90103
};
91104
}
92105

0 commit comments

Comments
 (0)