Skip to content

Commit e4c98bc

Browse files
Merge pull request #243 from PaulYoSwek/master
Created a adapter for Quantoz EURD
2 parents 42d2bd7 + 7954dbe commit e4c98bc

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

src/adapters/peggedAssets/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ import veur from "./vnx-euro";
158158
import vchf from "./vnx-swiss-franc";
159159
import usdrif from "./usd-rif";
160160
import dllr from "./sovryn-dollar"
161+
import eurd from "./quantoz-eurd";
161162

162163
export default {
163164
tether,
@@ -319,5 +320,6 @@ export default {
319320
"vnx-euro": veur,
320321
"vnx-swiss-franc": vchf,
321322
"rif-us-dollar": usdrif,
322-
"sovryn-dollar": dllr
323+
"sovryn-dollar": dllr,
324+
"quantoz-eurd": eurd
323325
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
const axios = require("axios");
9+
const retry = require("async-retry");
10+
11+
// This shoulddd all work now?
12+
async function algorandMinted() {
13+
return async function (
14+
_timestamp: number,
15+
_ethBlock: number,
16+
_chainBlocks: ChainBlocks
17+
) {
18+
let balances = {} as Balances;
19+
const supplyRes = await retry(
20+
async (_bail: any) =>
21+
await axios.get("https://mainnet-idx.algonode.cloud/v2/assets/1221682136")
22+
);
23+
const supply = supplyRes.data.asset.params.total;
24+
25+
const reserveRes = await retry(
26+
async (_bail: any) =>
27+
await axios.get(
28+
"https://mainnet-idx.algonode.cloud/v2/accounts/R2LPJRKONXXURMO6F65VHGCXPKAZM4GGDC5KH5VZ2W3ZFIZYQRAQT7GLM4"
29+
)
30+
);
31+
32+
const reserveAccount = reserveRes.data.account.assets.filter(
33+
(asset: any) => asset["asset-id"] === 1221682136
34+
);
35+
const reserves = reserveAccount[0].amount;
36+
37+
const balance = (supply - reserves) / 10 ** 8;
38+
39+
sumSingleBalance(balances, "peggedUSD", balance, "issued", false);
40+
return balances;
41+
};
42+
}
43+
44+
const adapter: PeggedIssuanceAdapter = {
45+
algorand: {
46+
minted: algorandMinted(),
47+
unreleased: async () => ({}),
48+
},
49+
};
50+
51+
export default adapter;

0 commit comments

Comments
 (0)