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

Commit

Permalink
Merge branch 'dev' into fix/goerli-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rafinskipg authored Oct 15, 2021
2 parents 7b61d75 + 8220a44 commit 18576c0
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/dai-plugin-governance/babel.config.js

This file was deleted.

23 changes: 23 additions & 0 deletions packages/dai-plugin-governance/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = function(api) {
api.cache(true);

const presets = ['@babel/preset-env'];
const plugins = [
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime'
];

const babelrcRoots = ['.', './lib/*'];

return {
presets,
plugins,
babelrcRoots
};
};

2 changes: 1 addition & 1 deletion packages/dai-plugin-governance/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@makerdao/dai-plugin-governance",
"description": "A dai.js plugin for adding MKR governance support to dapps.",
"version": "0.14.3",
"version": "0.14.6",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions packages/dai-plugin-governance/src/SpellService.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class SpellService extends PublicService {
this.executionDate = {};
this.scheduledDate = {};
this.nextCastTime = {};
this.expiration = {};
this.executiveHash = {};
this.officeHours = {};
}
Expand Down Expand Up @@ -50,6 +51,18 @@ export default class SpellService extends PublicService {
return this.nextCastTime[spellAddress];
}

async getExpiration(spellAddress) {
if (this.expiration[spellAddress]) return this.expiration[spellAddress];
const spell = this.get('smartContract').getContractByAddressAndAbi(
spellAddress,
DsSpellAbi
);
const expiration = await spell.expiration();
if (!expiration.toNumber()) return undefined;
this.expiration[spellAddress] = new Date(expiration.toNumber() * 1000);
return this.expiration[spellAddress];
}

async getScheduledDate(spellAddress) {
if (this.scheduledDate[spellAddress])
return this.scheduledDate[spellAddress];
Expand Down
9 changes: 9 additions & 0 deletions packages/dai-plugin-governance/test/SpellService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ describe('use mainnet', () => {
expect(eta).toEqual(new Date('2020-01-26T11:53:19.000Z'));
});

test('get spell expiration', async () => {
const eta = await spellService.getExpiration(
'0x9400d4D59134af2a48a4bf4237E809A80f90Fe63'
);
expect(eta).toEqual(new Date('2021-11-07T20:22:48.000Z'));
});

//TODO: add test for getNextCastTime();

test('get executive hash text', async () => {
const done = await spellService.getExecutiveHash(
'0x9400d4D59134af2a48a4bf4237E809A80f90Fe63'
Expand Down
2 changes: 1 addition & 1 deletion packages/dai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@makerdao/dai",
"version": "0.32.15",
"version": "0.35.16",
"contributors": [
"Wouter Kampmann <[email protected]>",
"Sean Brennan <[email protected]>",
Expand Down

0 comments on commit 18576c0

Please sign in to comment.