diff --git a/docker-compose.yml b/docker-compose.yml index ffe87402..a7952cd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ version: "3" services: graph-node: - image: 'graphprotocol/graph-node@sha256:8af6adc44d6c55eaed7f6d3ac2b96af0823044e94ffee380288f07e96d5ff30b' + image: 'graphprotocol/graph-node:v0.16.1' ports: - 8000:8000 - 8001:8001 @@ -21,21 +21,23 @@ services: ipfs: ipfs:5001 ethereum: private:http://ganache:8545 GRAPH_LOG: "graph.log" - GRAPH_GRAPHQL_MAX_FIRST: 1000 + GRAPH_IPFS_TIMEOUT: '2' + GRAPH_MAX_IPFS_FILE_BYTES: '990000' + GRAPH_GRAPHQL_MAX_FIRST: '1000' ipfs: - image: daostack/subgraph-ipfs:0.0.1-rc.33-v1-3.0.17 + image: daostack/subgraph-ipfs:0.0.1-rc.36-v1-3.0.19 ports: - 5001:5001 postgres: - image: daostack/subgraph-postgres:0.0.1-rc.33-v1-3.0.17 + image: daostack/subgraph-postgres:0.0.1-rc.36-v1-3.0.19 ports: - 9432:5432 environment: POSTGRES_PASSWORD: 'letmein' ganache: - image: daostack/test-env:0.0.1-rc.33-v1-3.0.17 + image: daostack/test-env:0.0.1-rc.36-v1-3.0.19 ports: - 8545:8545 diff --git a/package-lock.json b/package-lock.json index 74d285c9..9786828c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@daostack/client", - "version": "0.2.34", + "version": "0.2.35", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -199,14 +199,14 @@ } }, "@daostack/arc": { - "version": "0.0.1-rc.33", - "resolved": "https://registry.npmjs.org/@daostack/arc/-/arc-0.0.1-rc.33.tgz", - "integrity": "sha512-JIlf/gj2OSvyo9xWrZuMQNOo8UTDPvv7lrw0scYod3hjB/SkqnqEH5h8iU1xFyDvmo+nB4QJvAbMojfItqqgLg==", + "version": "0.0.1-rc.36", + "resolved": "https://registry.npmjs.org/@daostack/arc/-/arc-0.0.1-rc.36.tgz", + "integrity": "sha512-rf2rlWoThZl+s6x/crj1buiVnAoCTUNzbEVvt+V/zFwg9pHW6jiNJQ1NvE8ha7DSokf0tKTyx1Q3emj5lR6KFA==", "dev": true, "requires": { "@daostack/infra": "0.0.1-rc.15", "math": "0.0.3", - "openzeppelin-solidity": "2.3.0", + "openzeppelin-solidity": "2.4.0", "truffle-flattener": "^1.4.2" } }, @@ -235,15 +235,23 @@ "requires": { "ethereumjs-abi": "^0.6.5", "openzeppelin-solidity": "2.3.0" + }, + "dependencies": { + "openzeppelin-solidity": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-2.3.0.tgz", + "integrity": "sha512-QYeiPLvB1oSbDt6lDQvvpx7k8ODczvE474hb2kLXZBPKMsxKT1WxTCHBYrCU7kS7hfAku4DcJ0jqOyL+jvjwQw==", + "dev": true + } } }, "@daostack/migration": { - "version": "0.0.1-rc.33-v1", - "resolved": "https://registry.npmjs.org/@daostack/migration/-/migration-0.0.1-rc.33-v1.tgz", - "integrity": "sha512-rUk+SbZk9AC8YXH/qkl4VtzmgE8ILQiK+dBRYvrCezeuo6H/hiiurQWwPp8LejVkVmPCqW58ztdLbVY8g3OXmg==", + "version": "0.0.1-rc.36-v1", + "resolved": "https://registry.npmjs.org/@daostack/migration/-/migration-0.0.1-rc.36-v1.tgz", + "integrity": "sha512-sBPkckEeRDT5GoOyXrBR/p/3pwkBRmggnw2EQ0FtxGoFEy8JMm5NmeoPM0Kb0mlO0IZskye3X3GOZ5d6mAdMxw==", "dev": true, "requires": { - "@daostack/arc": "0.0.1-rc.33", + "@daostack/arc": "0.0.1-rc.36", "@daostack/arc-hive": "0.0.1-rc.4", "ethereumjs-wallet": "^0.6.3", "fstream": "^1.0.12", @@ -7423,9 +7431,9 @@ } }, "jsonschema": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.4.tgz", - "integrity": "sha512-lz1nOH69GbsVHeVgEdvyavc/33oymY1AZwtePMiMj4HZPMbP5OIKK3zT9INMWjwua/V4Z4yq7wSlBbSG+g4AEw==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.5.tgz", + "integrity": "sha512-kVTF+08x25PQ0CjuVc0gRM9EUPb0Fe9Ln/utFOgcdxEIOHuU7ooBk/UPTd7t1M91pP35m0MU1T8M5P7vP1bRRw==", "dev": true }, "jsprim": { @@ -8954,9 +8962,9 @@ } }, "openzeppelin-solidity": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-2.3.0.tgz", - "integrity": "sha512-QYeiPLvB1oSbDt6lDQvvpx7k8ODczvE474hb2kLXZBPKMsxKT1WxTCHBYrCU7kS7hfAku4DcJ0jqOyL+jvjwQw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-2.4.0.tgz", + "integrity": "sha512-533gc5jkspxW5YT0qJo02Za5q1LHwXK9CJCc48jNj/22ncNM/3M/3JfWLqfpB90uqLwOKOovpl0JfaMQTR+gXQ==", "dev": true }, "optimism": { diff --git a/package.json b/package.json index 41ff4721..68ba309f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@daostack/client", - "version": "0.2.34", + "version": "0.2.35", "description": "", "keywords": [], "main": "dist/lib/index.js", @@ -65,7 +65,7 @@ ] }, "devDependencies": { - "@daostack/migration": "0.0.1-rc.33-v1", + "@daostack/migration": "0.0.1-rc.36-v1", "@types/graphql": "^14.2.2", "@types/isomorphic-fetch": "^0.0.34", "@types/jest": "^24.0.15", diff --git a/src/proposal.ts b/src/proposal.ts index d52a8e1b..ed8bf5df 100644 --- a/src/proposal.ts +++ b/src/proposal.ts @@ -14,6 +14,7 @@ import { ISchemeState } from './scheme' import * as ContributionReward from './schemes/contributionReward' import * as GenericScheme from './schemes/genericScheme' import * as SchemeRegistrar from './schemes/schemeRegistrar' +// import * as Competition from './schemes/competition' import { LATEST_ARC_VERSION, REDEEMER_CONTRACT_VERSION } from './settings' import { IStakeQueryOptions, Stake } from './stake' import { Address, Date, ICommonQueryOptions, IStateful } from './types' @@ -68,6 +69,7 @@ export interface IProposalState extends IProposalStaticState { accountsWithUnclaimedRewards: Address[], boostedAt: Date contributionReward: ContributionReward.IContributionReward|null + // competition: Competition.ICompetitionProposal|null confidenceThreshold: number closingAt: Date createdAt: Date diff --git a/src/scheme.ts b/src/scheme.ts index 07eb94e4..267aee68 100644 --- a/src/scheme.ts +++ b/src/scheme.ts @@ -349,7 +349,9 @@ export class Scheme implements IStateful { voteParams: mapGenesisProtocolParams(item.genericSchemeParams.voteParams), votingMachine: item.genericSchemeParams.votingMachine } - + const schemeParams = ( + uGenericSchemeParams || contributionRewardParams || schemeRegistrarParams || genericSchemeParams + ) return { address: item.address, canDelegateCall: item.canDelegateCall, @@ -365,7 +367,7 @@ export class Scheme implements IStateful { numberOfPreBoostedProposals: Number(item.numberOfPreBoostedProposals), numberOfQueuedProposals: Number(item.numberOfQueuedProposals), paramsHash: item.paramsHash, - schemeParams: uGenericSchemeParams || contributionRewardParams || schemeRegistrarParams || genericSchemeParams, + schemeParams, schemeRegistrarParams, uGenericSchemeParams, version: item.version diff --git a/test/proposal-claim-reward.spec.ts b/test/proposal-claim-reward.spec.ts index 1cc60585..eb90607a 100644 --- a/test/proposal-claim-reward.spec.ts +++ b/test/proposal-claim-reward.spec.ts @@ -1,6 +1,8 @@ +import { first } from 'rxjs/operators' import { Arc } from '../src/arc' import { DAO } from '../src/dao' import { IProposalOutcome, IProposalStage, IProposalState, Proposal } from '../src/proposal' + import BN = require('bn.js') import { createAProposal, firstResult, getTestAddresses, getTestDAO, ITestAddresses, LATEST_ARC_VERSION, newArc, toWei, voteToPassProposal, waitUntilTrue } from './utils' @@ -136,6 +138,15 @@ describe('Claim rewards', () => { }) it('works with non-CR proposal', async () => { + + 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 ugenericScheme = ugenericSchemes[0] + const ugenericSchemeState = await ugenericScheme.state().pipe(first()).toPromise() + dao = new DAO(ugenericSchemeState.dao, arc) + const beneficiary = arc.web3.eth.defaultAccount const stakeAmount = new BN(123456789) await arc.GENToken().transfer(dao.id, stakeAmount).send() @@ -145,7 +156,7 @@ describe('Claim rewards', () => { const proposal = await createAProposal(dao, { callData, - scheme: testAddresses.base.UGenericScheme, + scheme: ugenericSchemeState.address, schemeToRegister: actionMock.options.address, value: 0 }) diff --git a/test/proposal-ugenericscheme.spec.ts b/test/proposal-ugenericscheme.spec.ts index cc274d6a..d3cb995f 100644 --- a/test/proposal-ugenericscheme.spec.ts +++ b/test/proposal-ugenericscheme.spec.ts @@ -1,3 +1,4 @@ +import { first } from 'rxjs/operators' import { DAO } from '../src//dao' import { Arc } from '../src/arc' import { @@ -29,19 +30,25 @@ describe('Proposal', () => { })).rejects.toThrow(/missing argument "callData"/i) }) - it('proposal flow works for LATEST_ARC_VERSION', async () => { + it('proposal flow works for rc.32', async () => { + const version = '0.0.1-rc.32' testAddresses = getTestAddresses(arc) - dao = await getTestDAO() + // dao = await getTestDAO() + 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) const states: IProposalState[] = [] const lastState = (): IProposalState => states[states.length - 1] - const actionMockABI = arc.getABI(undefined, 'ActionMock', LATEST_ARC_VERSION) + const actionMockABI = arc.getABI(undefined, 'ActionMock', version) const actionMock = new arc.web3.eth.Contract(actionMockABI, testAddresses.test.ActionMock) const callData = await actionMock.methods.test2(dao.id).encodeABI() const proposal = await createAProposal(dao, { callData, - scheme: testAddresses.base.UGenericScheme, + // scheme: testAddresses.base.UGenericScheme, + scheme: ugenericSchemeState.address, schemeToRegister: actionMock.options.address, value: 0 }) diff --git a/test/proposal.spec.ts b/test/proposal.spec.ts index 67930add..f9603f9d 100644 --- a/test/proposal.spec.ts +++ b/test/proposal.spec.ts @@ -194,7 +194,7 @@ describe('Proposal', () => { expect(pState).toMatchObject({ boostedAt: 0, - description: null, + description: '', descriptionHash: '0x000000000000000000000000000000000000000000000000000000000000efgh', // downStakeNeededToQueue: new BN(0), executedAt: 0, @@ -218,7 +218,7 @@ describe('Proposal', () => { resolvedAt: 0, // stage: IProposalStage.Queued, title: '', - url: null, + url: '', winningOutcome: IProposalOutcome.Fail }) expect(pState.contributionReward).toMatchObject({ diff --git a/test/scheme.spec.ts b/test/scheme.spec.ts index 6918e131..ee550034 100644 --- a/test/scheme.spec.ts +++ b/test/scheme.spec.ts @@ -50,9 +50,11 @@ describe('Scheme', () => { schemeStates.push(state) })) expect((schemeStates.map((r) => r.name)).sort()).toEqual([ - 'UGenericScheme', 'ContributionReward', - 'SchemeRegistrar' + 'ControllerCreator', + 'SchemeRegistrar', + 'UGenericScheme' + ].sort()) result = await Scheme.search(arc, {where: {dao: dao.id, name: 'ContributionReward'}}) .pipe(first()).toPromise() @@ -106,15 +108,12 @@ describe('Scheme', () => { }) it('Scheme.state() is working for UGenericScheme schemes', async () => { - const dao = await getTestDAO() const result = await Scheme - .search(arc, {where: {dao: dao.id, name: 'UGenericScheme'}}) + .search(arc, {where: {name: 'UGenericScheme'}}) .pipe(first()).toPromise() - const scheme = result[0] const state = await scheme.state().pipe(first()).toPromise() expect(state).toMatchObject({ - address: testAddresses.base.UGenericScheme.toLowerCase(), id: scheme.id, name: 'UGenericScheme' }) @@ -135,7 +134,7 @@ describe('Scheme', () => { }) // the subgraph is a bit weird here, popoulating uGenericSchemeParams instead of the expected schemeParams - expect(state.uGenericSchemeParams).toEqual(state.schemeParams) + expect(state.genericSchemeParams).toEqual(state.schemeParams) }) it('state() should be equal to proposal.state().scheme', async () => { diff --git a/test/utils.ts b/test/utils.ts index f2a0248c..6f91d584 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -16,7 +16,7 @@ export const graphqlWsProvider: string = 'http://127.0.0.1:8001/subgraphs/name/d export const web3Provider: string = 'ws://127.0.0.1:8545' export const ipfsProvider: string = '/ip4/127.0.0.1/tcp/5001' -export const LATEST_ARC_VERSION = '0.0.1-rc.33' +export const LATEST_ARC_VERSION = '0.0.1-rc.32' export { BN } @@ -64,7 +64,7 @@ export function getTestAddresses(arc: Arc, version: string = LATEST_ARC_VERSION) const migration = require(migrationFile).private let UGenericScheme: string = '' try { - UGenericScheme = arc.getContractInfoByName('UGenericScheme', version).address + UGenericScheme = arc.getContractInfoByName('GenericScheme', version).address } catch (err) { if (err.message.match(/no contract/i)) { // pass