This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { PublicService } from '@makerdao/services-core'; | ||
import { RAD, RAY, ServiceRoles, SECONDS_PER_YEAR } from './constants'; | ||
import BigNumber from 'bignumber.js'; | ||
import { MDAI } from './index'; | ||
|
||
export default class SystemDataService extends PublicService { | ||
constructor(name = ServiceRoles.SYSTEM_DATA) { | ||
|
@@ -33,6 +34,15 @@ export default class SystemDataService extends PublicService { | |
return live.eq(0); | ||
} | ||
|
||
async getSystemSurplus() { | ||
const vowAddr = this.get('smartContract').getContractAddress('MCD_VOW'); | ||
const [ dai, sin ] = await Promise.all([ | ||
this.vat.dai(vowAddr), | ||
this.vat.sin(vowAddr) | ||
]); | ||
return MDAI.rad(dai).minus(MDAI.rad(sin)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tyler17
Author
Collaborator
|
||
} | ||
|
||
// Helpers ---------------------------------------------- | ||
|
||
get cat() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running the gov portal on kovan, i was getting an error like
currency can't be negative
here. Looking at this line, i'm wondering ifsin
is higher thandai
on kovan? Is there a safe way to make the currency object negative if so? cc @tyler17 @levity