Skip to content

Commit

Permalink
Merge pull request #244 from jonathansmirnoff/feat/add-xusd
Browse files Browse the repository at this point in the history
Add XUSD
  • Loading branch information
Define101 authored Feb 22, 2024
2 parents 3fb3ad4 + 44e5a92 commit 1c2028f
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/adapters/peggedAssets/xusd/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const sdk = require("@defillama/sdk");
import { sumSingleBalance } from "../helper/generalUtil";
import {
ChainBlocks,
PeggedIssuanceAdapter,
Balances,
} from "../peggedAsset.type";

type ChainContracts = {
[chain: string]: {
[contract: string]: string[];
};
};

const chainContracts: ChainContracts = {
rsk: {
issued: ["0xb5999795be0ebb5bab23144aa5fd6a02d080299f"],
}
};

async function chainMinted(chain: string, decimals: number) {
return async function (
_timestamp: number,
_ethBlock: number,
_chainBlocks: ChainBlocks
) {
let balances = {} as Balances;
for (let issued of chainContracts[chain].issued) {
const totalSupply = (
await sdk.api.abi.call({
abi: "erc20:totalSupply",
target: issued,
block: _chainBlocks?.[chain],
chain: chain,
})
).output;
sumSingleBalance(
balances,
"peggedUSD",
totalSupply / 10 ** decimals,
"issued",
false
);
}
return balances;
};
}

const adapter: PeggedIssuanceAdapter = {
rsk: {
minted: chainMinted("rsk", 18),
unreleased: async () => ({}),
}
};

export default adapter;
20 changes: 20 additions & 0 deletions src/peggedData/peggedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3243,4 +3243,24 @@ export default [
twitter: "https://twitter.com/Quantoz",
wiki: null,
},
{
id: "162",
name: "XUSD",
address: "rsk:0xb5999795be0ebb5bab23144aa5fd6a02d080299f",
symbol: "XUSD",
url: "https://wiki.sovryn.com/en/technical-documents/xusd-overview",
description:
"XUSD is a USD-pegged stablecoin aggregator of the Babelfish protocol",
mintRedeemDescription:
"Its purpose is to act as a trustless stablecoin translation device - meaning it facilitates the conversion of multiple USD-pegged stablecoins with each other at a fixed 1:1 ratio.",
onCoinGecko: false,
gecko_id: "",
cmcId: "",
pegType: "peggedUSD",
pegMechanism: "crypto-backed",
priceSource: "defillama",
auditLinks: null,
twitter: "https://twitter.com/SovrynBTC",
wiki: null
}
] as PeggedAsset[];

0 comments on commit 1c2028f

Please sign in to comment.