diff --git a/src/proposal.ts b/src/proposal.ts index 15be06d8..4ec248e8 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -173,6 +173,7 @@ export class Proposal implements IStateful { callData executed returnValue + value } genesisProtocolParams { id @@ -475,7 +476,8 @@ export class Proposal implements IStateful { contractToCall: item.genericScheme.contractToCall, executed: item.genericScheme.executed, id: item.genericScheme.id, - returnValue: item.genericScheme.returnValue + returnValue: item.genericScheme.returnValue, + value: new BN(item.genericScheme.value) } } else if (item.schemeRegistrar) { if (item.schemeRegistrar.schemeToRegister) { diff --git a/src/schemes/genericScheme.ts b/src/schemes/genericScheme.ts index 06e36c56..ced7c27c 100644 --- a/src/schemes/genericScheme.ts +++ b/src/schemes/genericScheme.ts @@ -1,3 +1,4 @@ +import BN = require('bn.js') import { Arc } from '../arc' import { Proposal } from '../proposal' import { Address } from '../types' @@ -14,6 +15,7 @@ export interface IGenericScheme { callData: string executed: boolean returnValue: string + value: BN } export interface IProposalCreateOptionsGS { diff --git a/test/proposal-genericscheme.spec.ts b/test/proposal-genericscheme.spec.ts index cbc08dee..5d42db2f 100644 --- a/test/proposal-genericscheme.spec.ts +++ b/test/proposal-genericscheme.spec.ts @@ -5,9 +5,11 @@ import { IProposalState, ISchemeStaticState, Proposal - } from '../src' -import { createAProposal, getTestAddresses, ITestAddresses, LATEST_ARC_VERSION, - newArc, voteToPassProposal, waitUntilTrue } from './utils' +} from '../src' +import { + createAProposal, getTestAddresses, ITestAddresses, LATEST_ARC_VERSION, + newArc, voteToPassProposal, waitUntilTrue, BN +} from './utils' jest.setTimeout(60000) @@ -24,7 +26,7 @@ describe('Proposal', () => { }) it('Check proposal state is correct', async () => { - const daos = await arc.daos({where: { name: 'Nectar DAO'}}).pipe(first()).toPromise() + const daos = await arc.daos({ where: { name: 'Nectar DAO' } }).pipe(first()).toPromise() const dao = daos[0] if (dao === undefined) { throw Error(`Could not find "Nectar DAO"`) @@ -36,13 +38,13 @@ describe('Proposal', () => { const actionMock = new arc.web3.eth.Contract(actionMockABI, testAddresses.test.ActionMock) const callData = await actionMock.methods.test2(dao.id).encodeABI() - const schemes = await dao.schemes({ where: {name: 'GenericScheme' }}).pipe(first()).toPromise() + const schemes = await dao.schemes({ where: { name: 'GenericScheme' } }).pipe(first()).toPromise() const genericScheme = schemes[0].staticState as ISchemeStaticState const proposal = await createAProposal(dao, { callData, scheme: genericScheme.address, schemeToRegister: actionMock.options.address, - value: 0 + value: '1' }) expect(proposal).toBeInstanceOf(Proposal) @@ -55,7 +57,8 @@ describe('Proposal', () => { expect(lastState().genericScheme).toMatchObject({ callData, executed: false, - returnValue: null + returnValue: null, + value: new BN('1') }) // accept the proposal by voting the hell out of it diff --git a/test/proposal-ugenericscheme.spec.ts b/test/proposal-ugenericscheme.spec.ts index d3cb995f..72b74ece 100644 --- a/test/proposal-ugenericscheme.spec.ts +++ b/test/proposal-ugenericscheme.spec.ts @@ -5,10 +5,12 @@ import { IProposalStage, IProposalState, Proposal - } from '../src/proposal' -import { IGenericScheme} from '../src/schemes/genericScheme' -import { createAProposal, getTestAddresses, getTestDAO, ITestAddresses, LATEST_ARC_VERSION, - newArc, voteToPassProposal, waitUntilTrue } from './utils' +} from '../src/proposal' +import { IGenericScheme } from '../src/schemes/genericScheme' +import { + createAProposal, getTestAddresses, getTestDAO, ITestAddresses, LATEST_ARC_VERSION, + newArc, voteToPassProposal, waitUntilTrue, BN +} from './utils' jest.setTimeout(60000) @@ -34,10 +36,10 @@ describe('Proposal', () => { const version = '0.0.1-rc.32' testAddresses = getTestAddresses(arc) // dao = await getTestDAO() - const ugenericSchemes = await arc.schemes({where: {name: "UGenericScheme", version}}).pipe(first()).toPromise() + const ugenericSchemes = await arc.schemes({ where: { name: "UGenericScheme", version } }).pipe(first()).toPromise() const ugenericScheme = ugenericSchemes[0] const ugenericSchemeState = await ugenericScheme.state().pipe(first()).toPromise() - dao = new DAO(ugenericSchemeState.dao, arc) + dao = new DAO(ugenericSchemeState.dao, arc) const states: IProposalState[] = [] const lastState = (): IProposalState => states[states.length - 1] @@ -50,7 +52,7 @@ describe('Proposal', () => { // scheme: testAddresses.base.UGenericScheme, scheme: ugenericSchemeState.address, schemeToRegister: actionMock.options.address, - value: 0 + value: '1' }) expect(proposal).toBeInstanceOf(Proposal) @@ -63,7 +65,8 @@ describe('Proposal', () => { expect(lastState().genericScheme).toMatchObject({ callData, executed: false, - returnValue: null + returnValue: null, + value: new BN('1') }) // accept the proposal by voting the hell out of it