Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
making direct contract calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Padraic-O-Mhuiris committed Jul 9, 2020
1 parent d9434e7 commit bd17808
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/dai-plugin-mcd/contracts/abiMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ module.exports = {
MIGRATION_PROXY_ACTIONS: require('./abis/MigrationProxyActions.json'),
USDC: require('./abis/USDC.json'),
WBTC: require('./abis/WBTC.json'),
TUSD: require('./abis/DSToken.json')
TUSD: require('./abis/DSToken.json'),
'PSM_*': require('./abis/Psm.json')
};
12 changes: 10 additions & 2 deletions packages/dai-plugin-mcd/src/PsmType.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert';
import CdpType from './CdpType';
import { ServiceRoles } from './constants';

export default class PsmType {
constructor(
Expand All @@ -10,6 +11,9 @@ export default class PsmType {
assert(currency && ilk, 'currency and ilk are required');

this._psmTypeService = psmTypeService;
this._smartContractService = this._psmTypeService
.get(ServiceRoles.SYSTEM_DATA)
.get('smartContract');
this._cdpType = new CdpType(
this._psmTypeService,
{ currency, ilk, decimals },
Expand All @@ -23,11 +27,11 @@ export default class PsmType {
}

get feeIn() {
return null;
return this.psm.feeIn();
}

get feeOut() {
return null;
return this.psm.feeOut();
}

async prefetch() {
Expand All @@ -53,4 +57,8 @@ export default class PsmType {
assert(this.cache()[name], `${name} is not cached`);
return this.cache()[name];
}

get psm() {
return this._smartContractService.getContract(this.ilk.replace(/-/g, '_'));
}
}

0 comments on commit bd17808

Please sign in to comment.