From bd17808dfc0b8a7f9d22a2df7df931e99b99e30b Mon Sep 17 00:00:00 2001 From: padraic-X Date: Thu, 9 Jul 2020 15:26:27 +0100 Subject: [PATCH] making direct contract calls --- packages/dai-plugin-mcd/contracts/abiMap.js | 3 ++- packages/dai-plugin-mcd/src/PsmType.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/dai-plugin-mcd/contracts/abiMap.js b/packages/dai-plugin-mcd/contracts/abiMap.js index 11e8f7d28..b041263a9 100644 --- a/packages/dai-plugin-mcd/contracts/abiMap.js +++ b/packages/dai-plugin-mcd/contracts/abiMap.js @@ -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') }; diff --git a/packages/dai-plugin-mcd/src/PsmType.js b/packages/dai-plugin-mcd/src/PsmType.js index 7171e9efc..764c894c8 100644 --- a/packages/dai-plugin-mcd/src/PsmType.js +++ b/packages/dai-plugin-mcd/src/PsmType.js @@ -1,5 +1,6 @@ import assert from 'assert'; import CdpType from './CdpType'; +import { ServiceRoles } from './constants'; export default class PsmType { constructor( @@ -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 }, @@ -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() { @@ -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, '_')); + } }