Fix origyn (#17010)

This commit is contained in:
0xpeluche
2025-11-11 15:24:02 +01:00
committed by GitHub
parent 5a30d82213
commit b851414ac4

View File

@@ -1,7 +1,7 @@
const { toUSDTBalances } = require("../helper/balances");
const { get } = require('../helper/http')
async function staking() {
async function staking(api) {
// Get the total supply in OGY
// Ref: https://github.com/ORIGYN-SA/origyn-sns/blob/master/backend/canisters/token_metrics/impl/src/queries/http_request.rs#L40
const totalSupplyUrl = 'https://juolv-3yaaa-aaaal-ajc6a-cai.raw.icp0.io/total-supply';
@@ -11,17 +11,12 @@ async function staking() {
// Ref: https://github.com/ORIGYN-SA/origyn-sns/blob/master/backend/canisters/token_metrics/impl/src/queries/http_request.rs#L43
const circulatingSupplyUrl = 'https://juolv-3yaaa-aaaal-ajc6a-cai.raw.icp0.io/circulating-supply';
const circulatingSupply = await get(circulatingSupplyUrl);
// Get the OGY/USDT market price
const ogyPriceUrl = 'https://api.origyn.com/ogy/price';
const ogyPriceData = await get(ogyPriceUrl);
const ogyUsdt = ogyPriceData.ogyPrice;
// The token value locked is the locked supply
// total supply - circulating supply
const tokenTvl = (totalSupply - circulatingSupply) * ogyUsdt;
const tokenTvl = (totalSupply - circulatingSupply);
return toUSDTBalances(tokenTvl);
api.addCGToken('origyn-foundation', tokenTvl)
}
async function tvl() {
@@ -38,8 +33,5 @@ module.exports = {
timetravel: false,
misrepresentedTokens: true,
methodology: "TVL the total locked value of staked tokens and the total asset value of ORIGYN certificates.",
icp: {
tvl,
staking,
},
icp: { tvl, staking },
}