Skip to content

Commit 6fcde6b

Browse files
authored
feat: add mantra blockchain to librecapital (DefiLlama#13369)
1 parent 72786c6 commit 6fcde6b

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

projects/libre-capital/index.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ const RECEIPT_TOKENS = {
8080
}
8181
},
8282
mantra: {
83-
UMA: {
84-
address: '0x8e6c1961e911cc7f1fa3d1dc821b199f0cf90c569c7feece76ee7ed1386d257c',
83+
APCA: {
84+
address: 'mantra1vguuxez2h5ekltfj9gjd62fs5k4rl2zy5hfrncasykzw08rezpfsjx4gjx',
8585
decimals: 18,
8686
underlying: 'security-token',
87-
fundName:'USD I Money Market a sub-fund of Libre SAF VCC'
87+
fundName:'Libre SAF VCC - Access Private Credit Feeder'
8888
}
8989
}
9090
}
@@ -280,12 +280,44 @@ async function ethereumTvl(timestamp, block) {
280280
return balances;
281281
}
282282

283+
async function mantraTvl() {
284+
const balances = {}
285+
let totalTvl = 0;
286+
const fundPrices = await getFundPrices();
287+
288+
// Query total supply from Mantra contract
289+
const supply = await queryContractCosmos({
290+
contract: RECEIPT_TOKENS.mantra.APCA.address,
291+
chain: 'mantra',
292+
data: {
293+
token_info: {}
294+
}
295+
})
296+
297+
if (supply?.total_supply) {
298+
const token = RECEIPT_TOKENS.mantra.APCA;
299+
const balance = supply.total_supply;
300+
const price = fundPrices[token.fundName] || 1;
301+
302+
// Convert balance to human readable and multiply by price
303+
const adjustedBalance = Number(balance) / (10 ** token.decimals);
304+
const valueUSD = adjustedBalance * price;
305+
306+
totalTvl += valueUSD;
307+
}
308+
309+
// Return the total value in the format DeFiLlama expects
310+
balances['usd-coin'] = totalTvl;
311+
return balances;
312+
}
313+
283314
module.exports = {
284-
methodology: "TVL represents the total value of institutional funds represented by UMA, BHMA and UMA receipt tokens on Ethereum, Polygon, Injective, Sui, Solana and NEAR. The value is calculated by multiplying the total supply of receipt tokens by their respective NAV prices, denominated in their underlying stablecoin value",
315+
methodology: "TVL represents the total value of institutional funds represented by UMA, BHMA and UMA receipt tokens on Ethereum, Polygon, Injective, Sui, Solana, NEAR and Mantra. The value is calculated by multiplying the total supply of receipt tokens by their respective NAV prices, denominated in their underlying stablecoin value",
285316
ethereum: { tvl: ethereumTvl },
286317
polygon: { tvl: polygonTvl },
287318
injective: { tvl: injectiveTvl },
288319
sui: { tvl: suiTvl },
289320
solana: { tvl: solanaTvl },
290321
near: { tvl: nearTvl },
322+
mantra: { tvl: mantraTvl },
291323
}

0 commit comments

Comments
 (0)