File tree 3 files changed +12
-7
lines changed
3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,11 @@ import crvusd from "@curvefi/stablecoin-api";
164
164
// 1257.43
165
165
166
166
await crvusd .totalSupply (); // sum(llammasSupply) + sum(pegKeepersDebt)
167
- // 1415.12
167
+ // {
168
+ // total: '1415.12',
169
+ // minted: '1415.12',
170
+ // pegKeepersDebt: '0'
171
+ // }
168
172
})()
169
173
` ` `
170
174
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @curvefi/stablecoin-api" ,
3
- "version" : " 1.5.2 " ,
3
+ "version" : " 1.5.3 " ,
4
4
"description" : " JavaScript library for Curve Stablecoin" ,
5
5
"main" : " lib/index.js" ,
6
6
"author" : " Macket" ,
Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ export const getUsdRate = async (coin: string): Promise<number> => {
265
265
return _usdRatesCache [ coinAddress ] [ 'rate' ]
266
266
}
267
267
268
- export const totalSupply = async ( ) : Promise < string > => {
268
+ export const totalSupply = async ( ) : Promise < { total : string , minted : string , pegKeepersDebt : string } > => {
269
269
const calls = [ ] ;
270
270
for ( const llammaId of crvusd . getLlammaList ( ) ) {
271
271
const controllerAddress = crvusd . constants . LLAMMAS [ llammaId ] . controller_address ;
@@ -277,14 +277,15 @@ export const totalSupply = async (): Promise<string> => {
277
277
}
278
278
const res : ethers . BigNumber [ ] = await crvusd . multicallProvider . all ( calls ) ;
279
279
280
- let totalSupplyBN = BN ( 0 ) ;
280
+ let mintedBN = BN ( 0 ) ;
281
281
for ( let i = 0 ; i < crvusd . getLlammaList ( ) . length ; i ++ ) {
282
282
const [ _minted , _redeemed ] = res . splice ( 0 , 2 ) ;
283
- totalSupplyBN = toBN ( _minted ) . minus ( toBN ( _redeemed ) ) . plus ( totalSupplyBN ) ;
283
+ mintedBN = toBN ( _minted ) . minus ( toBN ( _redeemed ) ) . plus ( mintedBN ) ;
284
284
}
285
+ let pegKeepersBN = BN ( 0 ) ;
285
286
for ( const _pegKeeperDebt of res ) {
286
- totalSupplyBN = totalSupplyBN . plus ( toBN ( _pegKeeperDebt ) ) ;
287
+ pegKeepersBN = pegKeepersBN . plus ( toBN ( _pegKeeperDebt ) ) ;
287
288
}
288
289
289
- return totalSupplyBN . toString ( ) ;
290
+ return { total : mintedBN . plus ( pegKeepersBN ) . toString ( ) , minted : mintedBN . toString ( ) , pegKeepersDebt : pegKeepersBN . toString ( ) } ;
290
291
}
You can’t perform that action at this time.
0 commit comments