File tree 2 files changed +76
-0
lines changed
adapters/peggedAssets/xusd
2 files changed +76
-0
lines changed 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
+ rsk : {
17
+ issued : [ "0xb5999795be0ebb5bab23144aa5fd6a02d080299f" ] ,
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 ;
Original file line number Diff line number Diff line change @@ -3243,4 +3243,24 @@ export default [
3243
3243
twitter : "https://twitter.com/Quantoz" ,
3244
3244
wiki : null ,
3245
3245
} ,
3246
+ {
3247
+ id : "162" ,
3248
+ name : "XUSD" ,
3249
+ address : "rsk:0xb5999795be0ebb5bab23144aa5fd6a02d080299f" ,
3250
+ symbol : "XUSD" ,
3251
+ url : "https://wiki.sovryn.com/en/technical-documents/xusd-overview" ,
3252
+ description :
3253
+ "XUSD is a USD-pegged stablecoin aggregator of the Babelfish protocol" ,
3254
+ mintRedeemDescription :
3255
+ "Its purpose is to act as a trustless stablecoin translation device - meaning it facilitates the conversion of multiple USD-pegged stablecoins with each other at a fixed 1:1 ratio." ,
3256
+ onCoinGecko : false ,
3257
+ gecko_id : "" ,
3258
+ cmcId : "" ,
3259
+ pegType : "peggedUSD" ,
3260
+ pegMechanism : "crypto-backed" ,
3261
+ priceSource : "defillama" ,
3262
+ auditLinks : null ,
3263
+ twitter : "https://twitter.com/SovrynBTC" ,
3264
+ wiki : null
3265
+ }
3246
3266
] as PeggedAsset [ ] ;
You can’t perform that action at this time.
0 commit comments