Skip to content

Commit

Permalink
web 3 dollar (#295)
Browse files Browse the repository at this point in the history
* web 3 dollar

* Update peggedData.ts

---------

Co-authored-by: Web3 Dollar <Web3>
Co-authored-by: Define101 <93603962+Define101@users.noreply.github.com>
  • Loading branch information
web3dollar and Define101 authored Apr 9, 2024
1 parent 504e715 commit 6b353d2
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/adapters/peggedAssets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import cash from "./stabl-fi";
import dsu from "./digital-standard-unit";
import electronicusd from "./electronic-usd";
import hyusd from "./high-yield-usd";
import usd3 from "./web-3-dollar";
import eure from "./monerium-eur-money";
import anonusd from "./offshift-anonusd";
import nxusd from "./nxusd";
Expand Down Expand Up @@ -281,6 +282,7 @@ export default {
"digital-standard-unit": dsu,
"electronic-usd": electronicusd,
"high-yield-usd": hyusd,
"web-3-dollar": usd3,
"monerium-eur-money": eure,
"offshift-anonusd": anonusd,
nxusd,
Expand Down
56 changes: 56 additions & 0 deletions src/adapters/peggedAssets/web-3-dollar/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 = {
ethereum: {
issued: ["0x0d86883FAf4FfD7aEb116390af37746F45b6f378"],
},
};

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 = {
ethereum: {
minted: chainMinted("ethereum", 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 @@ -3566,4 +3566,24 @@ export default [
twitter: "https://twitter.com/nostrafinance",
wiki: null,
},
{
id: "178",
name: "Web 3 Dollar",
address: "0x0d86883FAf4FfD7aEb116390af37746F45b6f378",
symbol: "USD3",
url: "https://app.reserve.org/ethereum/token/0x0d86883faf4ffd7aeb116390af37746f45b6f378/overview",
description:
"Earn the DeFi rate any time you're in stables",
mintRedeemDescription:
"Minting requires a deposit of the defined collateral tokens in equal value amounts to the RToken smart contracts.",
onCoinGecko: null,
gecko_id: "web-3-dollar", //fakecg
cmcId: null,
pegType: "peggedUSD",
pegMechanism: "crypto-backed",
priceSource: "defillama",
auditLinks: null,
twitter: "https://twitter.com/USD_3",
wiki: "https://app.reserve.org/ethereum/token/0x0d86883faf4ffd7aeb116390af37746f45b6f378/overview",
}
] as PeggedAsset[];

0 comments on commit 6b353d2

Please sign in to comment.