Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions projects/kinetic-fxrp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { ChainApi } = require('@defillama/sdk');
const ADDRESSES = require('../helper/coreAssets.json');

const FXRP = '0xAd552A648C74D49E10027AB8a618A3ad4901c5bE';
const KINETIC_ISO_FXRP = '0x870f7B89F0d408D7CA2E6586Df26D00Ea03aA358';

async function lockedXRPL(api) {
const flareApi = new ChainApi({ chain: 'flare', timestamp: api.timestamp });
await flareApi.getBlock();

// Kinetic: getCash() + totalBorrows() = total FXRP supplied
const [kineticCash, kineticBorrows] = await Promise.all([
flareApi.call({ abi: 'uint256:getCash', target: KINETIC_ISO_FXRP }),
flareApi.call({ abi: 'uint256:totalBorrows', target: KINETIC_ISO_FXRP }),
]);

const totalFxrp = BigInt(kineticCash) + BigInt(kineticBorrows);
api.add(ADDRESSES.ripple.XRP, totalFxrp.toString());
return api.getBalances();
}

module.exports = {
ripple: {
tvl: lockedXRPL,
},
methodology: "Counts total FXRP supplied to Kinetic lending protocol on Flare. FXRP is 1:1 backed by XRP.",
};
Loading