Skip to content

Commit

Permalink
Merge pull request #435 from dtrinity/master
Browse files Browse the repository at this point in the history
Add dUSD (part of dTRINITY protocol) on Fraxtal
  • Loading branch information
realdealshaman authored Jan 7, 2025
2 parents 50f2c33 + 9ec37d4 commit 325a471
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
73 changes: 73 additions & 0 deletions src/adapters/peggedAssets/dtrinity-usd/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const sdk = require("@defillama/sdk");
import { sumSingleBalance } from "../helper/generalUtil";
import {
Balances,
ChainBlocks,
PeggedIssuanceAdapter,
} from "../peggedAsset.type";

const chainContracts = {
fraxtal: {
issued: "0x788D96f655735f52c676A133f4dFC53cEC614d4A",
amoManager: "0x49a0c8030Ca199f6F246517aE689E3cC0775271a",
issuer: "0x1ec13EF0b22C53298A00b23b03203E03D999b7a2",
},
};

async function dUSDMinted(chain: string, decimals: number) {
return async function (
_timestamp: number,
_ethBlock: number,
_chainBlocks: ChainBlocks,
) {
let balances = {} as Balances;
const circulatingSupply = (
await sdk.api.abi.call({
abi: {
inputs: [],
name: "circulatingDusd",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function",
},
target: chainContracts[chain as keyof typeof chainContracts].issuer,
chain: chain,
block: _chainBlocks?.[chain],
})
).output;

const amoSupply = (
await sdk.api.abi.call({
abi: {
inputs: [],
name: "totalAmoSupply",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function",
},
target: chainContracts[chain as keyof typeof chainContracts].amoManager,
chain: chain,
block: _chainBlocks?.[chain],
})
).output;


sumSingleBalance(
balances,
"peggedUSD",
Number((BigInt(circulatingSupply) + BigInt(amoSupply))/ BigInt(10 ** decimals)),
"issued",
false,
);

return balances;
};
}

const adapter: PeggedIssuanceAdapter = {
fraxtal: {
minted: dUSDMinted("fraxtal", 6),
},
};

export default adapter;
6 changes: 4 additions & 2 deletions src/adapters/peggedAssets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ import vnxau from "./vnx-gold";
import vchf from "./vnx-swiss-franc";
import xusd from "./xusd-babelfish";
import zkusd from "./zkusd";
import dtrinityusd from "./dtrinity-usd";

export default {
tether,
Expand Down Expand Up @@ -443,6 +444,7 @@ export default {
"satoshi-stablecoin": satusd,
"astherus-usdf": usdf,
"usda-2": avalon_usda, // coingecko id first, than token
usdtb, // same as coingeckoID
"tren-debt-token" : xy
usdtb, // same as coingeckoID,
"tren-debt-token" : xy,
"dtrinity-usd": dtrinityusd,
};
19 changes: 19 additions & 0 deletions src/peggedData/peggedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4496,5 +4496,24 @@ export default [
priceSource: "defillama",
twitter: "https://x.com/TrenFinance",
wiki: "https://docs.tren.finance/tokens/xy"
},
{
id: "224",
name: "dTRINITY USD",
address: "fraxtal:0x788D96f655735f52c676A133f4dFC53cEC614d4A",
symbol: "dUSD",
url: "https://dtrinity.org/",
description:
`dUSD is a decentralized and full-reserve stablecoin, backed by an on-chain reserve of other USD-denominated stablecoins and yieldcoins. Based on the ERC-20 standard, every dUSD token is backed by at least $1 of collateral and can be minted permissionlessly via smart contracts with no fees (excluding gas).`,
mintRedeemDescription: "Mirroring the US Dollar's non-redeemability for its underlying gold reserves post-Nixon Shock (1971), dUSD is also designed to have non-redeemable reserves to maximize float interest generation. In place of redemption, dUSD relies on open market operations to manage liquidity and stability, similar to the Fed.",
onCoinGecko: "true",
gecko_id: "dtrinity-usd",
cmcId: "",
pegType: "peggedUSD",
pegMechanism: "crypto-backed",
auditLinks: "https://docs.dtrinity.org/developer/audits-and-security",
priceSource: "coingecko",
twitter: "https://x.com/dtrinity_defi",
wiki: "https://docs.dtrinity.org"
}
] as PeggedAsset[];

0 comments on commit 325a471

Please sign in to comment.