This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(playground-mod): set payback dusd by dfi & add dusd collateral t…
…oken (#381) * setgov payback dfi and set dusd as collateral token * Update src/module.playground/setup/setup.loan.collateral.ts * update fork height on dc Co-authored-by: Fuxing Loh <[email protected]>
- Loading branch information
1 parent
fd494d2
commit edc7ff7
Showing
5 changed files
with
59 additions
and
3 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
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
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { PlaygroundSetup } from '@src/module.playground/setup/setup' | ||
import { Injectable } from '@nestjs/common' | ||
|
||
@Injectable() | ||
export class SetupGov extends PlaygroundSetup<Record<string, any>> { | ||
list (): Array<Record<string, any>> { | ||
return [ | ||
{ ATTRIBUTES: { 'v0/token/:dusdId/payback_dfi': 'true' } } | ||
] | ||
} | ||
|
||
async create (each: any): Promise<void> { | ||
const key = Object.keys(each)[0] | ||
if (key === 'ATTRIBUTES') { | ||
const dusdInfo = await this.client.token.getToken('DUSD') | ||
const dusdId = Object.keys(dusdInfo)[0] | ||
/* eslint-disable-next-line */ | ||
var re = new RegExp(':dusdId', 'g'); | ||
const k = Object.keys(each[key])[0] | ||
each[key] = { [k.replace(re, dusdId)]: 'true' } | ||
} | ||
|
||
await this.client.masternode.setGov(each) | ||
} | ||
|
||
async has (each: any): Promise<boolean> { | ||
const key = Object.keys(each)[0] | ||
const gov = await this.client.masternode.getGov(key) | ||
if (Object.keys(gov[key]).length > 0) { | ||
return true | ||
} | ||
return false | ||
} | ||
} |
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