Skip to content

Commit 03b6370

Browse files
authored
Merge pull request #238 from jonathansmirnoff/feat/add-usd-rif
USD RIF
2 parents 116cbab + 405bc4f commit 03b6370

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const sdk = require("@defillama/sdk");
2+
import { sumSingleBalance } from "../helper/generalUtil";
3+
import {
4+
ChainBlocks,
5+
PeggedIssuanceAdapter,
6+
Balances,
7+
} from "../peggedAsset.type";
8+
9+
type ChainContracts = {
10+
[chain: string]: {
11+
[contract: string]: string[];
12+
};
13+
};
14+
15+
const chainContracts: ChainContracts = {
16+
rsk: {
17+
issued: ["0x3a15461d8ae0f0fb5fa2629e9da7d66a794a6e37"],
18+
}
19+
};
20+
21+
async function chainMinted(chain: string, decimals: number) {
22+
return async function (
23+
_timestamp: number,
24+
_ethBlock: number,
25+
_chainBlocks: ChainBlocks
26+
) {
27+
let balances = {} as Balances;
28+
for (let issued of chainContracts[chain].issued) {
29+
const totalSupply = (
30+
await sdk.api.abi.call({
31+
abi: "erc20:totalSupply",
32+
target: issued,
33+
block: _chainBlocks?.[chain],
34+
chain: chain,
35+
})
36+
).output;
37+
sumSingleBalance(
38+
balances,
39+
"peggedUSD",
40+
totalSupply / 10 ** decimals,
41+
"issued",
42+
false
43+
);
44+
}
45+
return balances;
46+
};
47+
}
48+
49+
const adapter: PeggedIssuanceAdapter = {
50+
rsk: {
51+
minted: chainMinted("rsk", 18),
52+
unreleased: async () => ({}),
53+
}
54+
};
55+
56+
export default adapter;

src/peggedData/peggedData.ts

+20
Original file line numberDiff line numberDiff line change
@@ -3183,4 +3183,24 @@ export default [
31833183
twitter: "https://twitter.com/vnx_platform",
31843184
wiki: null,
31853185
},
3186+
{
3187+
id: "159",
3188+
name: "RIF US Dollar",
3189+
address: "rsk:0x3a15461d8ae0f0fb5fa2629e9da7d66a794a6e37",
3190+
symbol: "USDRIF",
3191+
url: "https://rifonchain.com/",
3192+
description:
3193+
"RIF US Dollar is a fully crypto collateralized stablecoin. 1:1 pegged to US Dollar guaranteed by the smart contract that creates it. USDRIF is built on Rootstock, the first and longest running Bitcoin sidechain.",
3194+
mintRedeemDescription:
3195+
"The USDRIF stablecoins are minted through the RIF On Chain Protocol whenever there is a certain amount of RIFpro (RIFP) staked in the platform by other users who act as liquidity providers. Users can use the decentralised RIF on Chain dApp to exchange RIF tokens for USDRIF stablecoins and vice versa at any point providing there is a liquidity available in the protocol.",
3196+
onCoinGecko: false,
3197+
gecko_id: "",
3198+
cmcId: "",
3199+
pegType: "peggedUSD",
3200+
pegMechanism: "crypto-backed",
3201+
priceSource: null,
3202+
auditLinks: null,
3203+
twitter: "https://twitter.com/rifonchain",
3204+
wiki: null,
3205+
},
31863206
] as PeggedAsset[];

0 commit comments

Comments
 (0)