Skip to content

Commit

Permalink
update the calculation for inj and noble
Browse files Browse the repository at this point in the history
  • Loading branch information
realdealshaman committed Aug 30, 2024
1 parent 322429c commit 41ec4ab
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/adapters/peggedAssets/ondo-us-dollar-yield/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ChainBlocks, PeggedIssuanceAdapter } from "../peggedAsset.type";
const axios = require("axios");
const retry = require("async-retry");
import { addChainExports } from "../helper/getSupply";
import { sumSingleBalance } from '../helper/generalUtil';


async function injectiveBridged() {
Expand All @@ -20,13 +21,13 @@ async function injectiveBridged() {
(token: any) => token.denom === targetDenom
);

const balance = targetToken ? targetToken.amount / 1e18 : 0;
return { peggedUSD: balance };
const circulatingSupply = targetToken ? targetToken.amount / 1e18 : 0;
let balances = {}
sumSingleBalance(balances, "peggedUSD", circulatingSupply, "issued", false);
return balances;
};
}



async function nobleBridged() {
return async function (
_timestamp: number,
Expand All @@ -37,13 +38,15 @@ async function nobleBridged() {
axios.get("https://ondo.finance/api/v1/assets")
);

// Accessing specific token's amount
const tokens = issuance?.data?.assets[0].tvlUsd.noble;
const balance = tokens / issuance?.data?.assets[0].priceUsd ;
return { peggedUSD: balance };
const circulatingSupply = tokens / issuance?.data?.assets[0].priceUsd;

let balances = {};
sumSingleBalance(balances, "peggedUSD", circulatingSupply, "issued", false);
return balances;
};
}
// Define the chain contracts

const chainContracts = {
ethereum: {
issued: [
Expand Down

0 comments on commit 41ec4ab

Please sign in to comment.