File tree 2 files changed +60
-2
lines changed
src/adapters/peggedAssets
2 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,8 @@ import vchf from "./vnx-swiss-franc";
159
159
import usdrif from "./usd-rif" ;
160
160
import dllr from "./sovryn-dollar"
161
161
import eurd from "./quantoz-eurd" ;
162
- import xusd from "./xusd"
162
+ import xusd from "./xusd" ;
163
+ import ultra from "./ultra"
163
164
164
165
export default {
165
166
tether,
@@ -323,5 +324,6 @@ export default {
323
324
"rif-us-dollar" : usdrif ,
324
325
"sovryn-dollar" : dllr ,
325
326
"quantoz-eurd" : eurd ,
326
- "xusd-fake" : xusd
327
+ "xusd-fake" : xusd ,
328
+ "ultra" : ultra
327
329
} ;
Original file line number Diff line number Diff line change
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
+ ethereum : {
17
+ issued : [ "0x35282d87011f87508D457F08252Bc5bFa52E10A0" ] ,
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
+ ethereum : {
51
+ minted : chainMinted ( "ethereum" , 18 ) ,
52
+ unreleased : async ( ) => ( { } ) ,
53
+ }
54
+ } ;
55
+
56
+ export default adapter ;
You can’t perform that action at this time.
0 commit comments