Skip to content

Commit b191504

Browse files
authored
use "@daostack/migration-experimental": "0.1.2-rc.6-v2", (#523)
* use "@daostack/migration-experimental": "0.1.2-rc.6-v2", * JoinAndQuit - > Join
1 parent 771cb4a commit b191504

File tree

13 files changed

+404
-511
lines changed

13 files changed

+404
-511
lines changed

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ services:
2626
GRAPH_GRAPHQL_MAX_FIRST: '1000'
2727

2828
ipfs:
29-
image: daostack/test-env-experimental-ipfs:4.0.17
29+
image: daostack/test-env-experimental-ipfs:4.0.18
3030
ports:
3131
- 5001:5001
3232

3333
postgres:
34-
image: daostack/test-env-experimental-postgres:4.0.17
34+
image: daostack/test-env-experimental-postgres:4.0.18
3535
ports:
3636
- 9432:5432
3737
environment:
3838
POSTGRES_PASSWORD: 'letmein'
3939

4040
ganache:
41-
image: daostack/test-env-experimental-ganache:4.0.17
41+
image: daostack/test-env-experimental-ganache:4.0.18
4242
ports:
4343
- 8545:8545

package-lock.json

Lines changed: 313 additions & 420 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@daostack/arc.js",
3-
"version": "2.0.0-experimental.49",
3+
"version": "2.0.0-experimental.50",
44
"description": "",
55
"keywords": [],
66
"main": "dist/lib/index.js",
@@ -72,8 +72,8 @@
7272
]
7373
},
7474
"devDependencies": {
75-
"@daostack/migration-experimental": "0.1.2-rc.2-v0",
76-
"@daostack/test-env-experimental": "4.0.17",
75+
"@daostack/migration-experimental": "0.1.2-rc.6-v2",
76+
"@daostack/test-env-experimental": "4.0.18",
7777
"@types/graphql": "^14.2.2",
7878
"@types/isomorphic-fetch": "^0.0.34",
7979
"@types/jest": "^24.0.15",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export * from './plugins/proposal'
44
export * from './plugins/proposalPlugin'
55
export * from './plugins/contributionReward'
66
export * from './plugins/contributionRewardExt'
7-
export * from './plugins/joinAndQuit'
7+
export * from './plugins/join'
88
export * from './plugins/competition'
99
export * from './plugins/fundingRequest'
1010
export * from './plugins/genericPlugin'

src/plugins/fundingRequest/plugin.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
transactionErrorHandler,
2020
transactionResultHandler
2121
} from '../../index'
22-
import { IJoinAndQuitState } from '../joinAndQuit'
22+
import { IJoinState } from '../join'
2323

2424
export interface IFundingRequestState extends IPluginState {
2525
pluginParams: {
@@ -157,15 +157,15 @@ export class FundingRequest
157157
if (err.message.match(/funding is not allowed yet/)) {
158158
const state = await this.fetchState()
159159
const dao = state.dao.entity
160-
const joinAndQuit = (await dao.plugin({ where: { name: 'JoinAndQuit' } }))
161-
const joinAndQuitState = await joinAndQuit.fetchState() as IJoinAndQuitState
162-
const deadline = joinAndQuitState.pluginParams.fundingGoalDeadline
160+
const join = (await dao.plugin({ where: { name: 'Join' } }))
161+
const joinState = await join.fetchState() as IJoinState
162+
const deadline = joinState.pluginParams.fundingGoalDeadline
163163
const now = new Date()
164164
if (deadline < now) {
165165
return new Error(`${err.message}: fundingGoal deadline ${deadline} has passed before reaching the funding goal`)
166166

167167
}
168-
return new Error(`${err.message}: funding goal: ${fromWei(joinAndQuitState.pluginParams.fundingGoal)}, deadline: ${joinAndQuitState.pluginParams.fundingGoalDeadline}`)
168+
return new Error(`${err.message}: funding goal: ${fromWei(joinState.pluginParams.fundingGoal)}, deadline: ${joinState.pluginParams.fundingGoalDeadline}`)
169169
}
170170
throw err
171171
}
File renamed without changes.

src/plugins/joinAndQuit/plugin.ts renamed to src/plugins/join/plugin.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import {
77
Arc,
88
getEventArgs,
99
IGenesisProtocolParams,
10-
IJoinAndQuitProposalState,
10+
IJoinProposalState,
1111
IPluginState,
1212
IProposalBaseCreateOptions,
1313
ITransaction,
1414
ITransactionReceipt,
15-
JoinAndQuitProposal,
15+
JoinProposal,
1616
mapGenesisProtocolParams,
1717
Plugin,
1818
ProposalPlugin,
@@ -21,7 +21,7 @@ import {
2121
} from '../../index'
2222
import { NULL_ADDRESS, secondSinceEpochToDate } from '../../utils'
2323

24-
export interface IJoinAndQuitState extends IPluginState {
24+
export interface IJoinState extends IPluginState {
2525
pluginParams: {
2626
votingMachine: Address
2727
voteParams: IGenesisProtocolParams
@@ -33,7 +33,7 @@ export interface IJoinAndQuitState extends IPluginState {
3333
}
3434
}
3535

36-
export interface IProposalCreateOptionsJoinAndQuit extends IProposalBaseCreateOptions {
36+
export interface IProposalCreateOptionsJoin extends IProposalBaseCreateOptions {
3737
fee: BN
3838
}
3939

@@ -51,17 +51,17 @@ export interface IInitParamsJQ {
5151
rageQuitEnable: boolean
5252
}
5353

54-
export class JoinAndQuit extends ProposalPlugin<
55-
IJoinAndQuitState,
56-
IJoinAndQuitProposalState,
57-
IProposalCreateOptionsJoinAndQuit> {
54+
export class Join extends ProposalPlugin<
55+
IJoinState,
56+
IJoinProposalState,
57+
IProposalCreateOptionsJoin> {
5858

5959
public static get fragment() {
6060
if (!this.fragmentField) {
6161
this.fragmentField = {
62-
name: 'JoinAndQuitParams',
63-
fragment: gql` fragment JoinAndQuitParams on ControllerScheme {
64-
joinAndQuitParams {
62+
name: 'JoinParams',
63+
fragment: gql` fragment JoinParams on ControllerScheme {
64+
joinParams {
6565
id
6666
votingMachine
6767
voteParams {
@@ -97,7 +97,7 @@ export class JoinAndQuit extends ProposalPlugin<
9797

9898
Object.keys(initParams).forEach((key) => {
9999
if (initParams[key] === undefined) {
100-
throw new Error(`JoinAndQuit's initialize parameter '${key}' cannot be undefined`)
100+
throw new Error(`Join's initialize parameter '${key}' cannot be undefined`)
101101
}
102102
})
103103

@@ -116,25 +116,25 @@ export class JoinAndQuit extends ProposalPlugin<
116116
]
117117
}
118118

119-
public static itemMap(context: Arc, item: any, queriedId?: string): IJoinAndQuitState | null {
119+
public static itemMap(context: Arc, item: any, queriedId?: string): IJoinState | null {
120120
if (!item) {
121121
return null
122122
}
123123

124-
if (!item.joinAndQuitParams) {
125-
throw new Error(`Plugin ${queriedId ? `with id '${queriedId}'` : ''}wrongly instantiated as JoinAndQuit Plugin`)
124+
if (!item.joinParams) {
125+
throw new Error(`Plugin ${queriedId ? `with id '${queriedId}'` : ''}wrongly instantiated as Join Plugin`)
126126
}
127127

128128
const baseState = Plugin.itemMapToBaseState(context, item)
129129

130130
const fundingRequestParams = {
131-
voteParams: mapGenesisProtocolParams(item.joinAndQuitParams.voteParams),
132-
votingMachine: item.joinAndQuitParams.votingMachine,
133-
fundingToken: item.joinAndQuitParams.fundingToken,
134-
minFeeToJoin: new BN(item.joinAndQuitParams.minFeeToJoin),
135-
memberReputation: new BN(item.joinAndQuitParams.memberReputation),
136-
fundingGoal: new BN(item.joinAndQuitParams.fundingGoal),
137-
fundingGoalDeadline: secondSinceEpochToDate(item.joinAndQuitParams.fundingGoalDeadline)
131+
voteParams: mapGenesisProtocolParams(item.joinParams.voteParams),
132+
votingMachine: item.joinParams.votingMachine,
133+
fundingToken: item.joinParams.fundingToken,
134+
minFeeToJoin: new BN(item.joinParams.minFeeToJoin),
135+
memberReputation: new BN(item.joinParams.memberReputation),
136+
fundingGoal: new BN(item.joinParams.fundingGoal),
137+
fundingGoalDeadline: secondSinceEpochToDate(item.joinParams.fundingGoalDeadline)
138138
}
139139

140140
return {
@@ -145,10 +145,10 @@ export class JoinAndQuit extends ProposalPlugin<
145145

146146
private static fragmentField: { name: string, fragment: DocumentNode } | undefined
147147

148-
public async createProposalTransaction(options: IProposalCreateOptionsJoinAndQuit): Promise<ITransaction> {
148+
public async createProposalTransaction(options: IProposalCreateOptionsJoin): Promise<ITransaction> {
149149

150150
if (options.plugin === undefined) {
151-
throw new Error(`Missing argument "plugin" for JoinAndQuit in Proposal.create()`)
151+
throw new Error(`Missing argument "plugin" for Join in Proposal.create()`)
152152
}
153153

154154
const state = this.fetchState()
@@ -176,13 +176,13 @@ export class JoinAndQuit extends ProposalPlugin<
176176

177177
public createProposalTransactionMap(): transactionResultHandler<any> {
178178
return async (receipt: ITransactionReceipt) => {
179-
const args = getEventArgs(receipt, 'JoinInProposal', 'JoinAndQuit.createProposal')
179+
const args = getEventArgs(receipt, 'JoinInProposal', 'Join.createProposal')
180180
const proposalId = args[1]
181-
return new JoinAndQuitProposal(this.context, proposalId)
181+
return new JoinProposal(this.context, proposalId)
182182
}
183183
}
184184

185-
public createProposalErrorHandler(options: IProposalCreateOptionsJoinAndQuit): transactionErrorHandler {
185+
public createProposalErrorHandler(options: IProposalCreateOptionsJoin): transactionErrorHandler {
186186
return async (err) => {
187187
throw err
188188
}

src/plugins/joinAndQuit/proposal.ts renamed to src/plugins/join/proposal.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ import {
1212
IProposalState,
1313
ITransaction,
1414
ITransactionReceipt,
15-
JoinAndQuit,
15+
Join,
1616
Operation,
1717
Plugin,
1818
Proposal,
1919
toIOperationObservable
2020
} from '../../index'
2121

22-
export interface IJoinAndQuitProposalState extends IProposalState {
22+
export interface IJoinProposalState extends IProposalState {
2323
proposedMember: Address
2424
dao: IEntityRef<DAO>
2525
funding: BN,
2626
executed: boolean,
2727
reputationMinted: BN
2828
}
2929

30-
export class JoinAndQuitProposal extends Proposal<IJoinAndQuitProposalState> {
30+
export class JoinProposal extends Proposal<IJoinProposalState> {
3131

3232
public static get fragment() {
3333
if (!this.fragmentField) {
3434
this.fragmentField = {
35-
name: 'JoinAndQuitProposalFields',
35+
name: 'JoinProposalFields',
3636
fragment: gql`
37-
fragment JoinAndQuitProposalFields on Proposal {
38-
joinAndQuit {
37+
fragment JoinProposalFields on Proposal {
38+
join {
3939
id
4040
dao { id }
4141
proposedMember
@@ -51,39 +51,39 @@ export class JoinAndQuitProposal extends Proposal<IJoinAndQuitProposalState> {
5151
return this.fragmentField
5252
}
5353

54-
public static itemMap(context: Arc, item: any, query?: string): IJoinAndQuitProposalState | null {
54+
public static itemMap(context: Arc, item: any, query?: string): IJoinProposalState | null {
5555

5656
if (!item) { return null }
5757

58-
const joinAndQuitState = JoinAndQuit.itemMap(context, item.scheme, query)
58+
const joinState = Join.itemMap(context, item.scheme, query)
5959

60-
if (!joinAndQuitState) { return null }
60+
if (!joinState) { return null }
6161

62-
const joinAndQuit = new JoinAndQuit(context, joinAndQuitState)
63-
const joinAndQuitProposal = new JoinAndQuitProposal(context, item.id)
62+
const join = new Join(context, joinState)
63+
const joinProposal = new JoinProposal(context, item.id)
6464

6565
const baseState = Proposal.itemMapToBaseState(
6666
context,
6767
item,
68-
joinAndQuit,
69-
joinAndQuitProposal,
70-
'JoinAndQuit'
68+
join,
69+
joinProposal,
70+
'Join'
7171
)
7272

7373
if (baseState == null) { return null }
7474

7575
return {
7676
...baseState,
77-
proposedMember: item.joinAndQuit.proposedMember,
78-
funding: new BN(item.joinAndQuit.funding),
79-
executed: item.joinAndQuit.executed,
80-
reputationMinted: new BN(item.joinAndQuit.reputationMinted)
77+
proposedMember: item.join.proposedMember,
78+
funding: new BN(item.join.funding),
79+
executed: item.join.executed,
80+
reputationMinted: new BN(item.join.reputationMinted)
8181
}
8282
}
8383

8484
private static fragmentField: { name: string, fragment: DocumentNode } | undefined
8585

86-
public state(apolloQueryOptions: IApolloQueryOptions): Observable<IJoinAndQuitProposalState> {
86+
public state(apolloQueryOptions: IApolloQueryOptions): Observable<IJoinProposalState> {
8787
const query = gql`query ProposalState
8888
{
8989
proposal(id: "${this.id}") {
@@ -101,8 +101,8 @@ export class JoinAndQuitProposal extends Proposal<IJoinAndQuitProposalState> {
101101
`
102102

103103
const result = this.context.getObservableObject(
104-
this.context, query, JoinAndQuitProposal.itemMap, this.id, apolloQueryOptions
105-
) as Observable<IJoinAndQuitProposalState>
104+
this.context, query, JoinProposal.itemMap, this.id, apolloQueryOptions
105+
) as Observable<IJoinProposalState>
106106
return result
107107
}
108108
/**

src/plugins/pluginManager/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type IProposalCreateOptionsPM =
4444
IProposalCreateOptions<'Competition'> |
4545
IProposalCreateOptions<'ContributionRewardExt'> |
4646
IProposalCreateOptions<'FundingRequest'> |
47-
IProposalCreateOptions<'JoinAndQuit'> |
47+
IProposalCreateOptions<'Join'> |
4848
IProposalCreateOptions<'SchemeRegistrar'> |
4949
IProposalCreateOptions<'SchemeFactory'> |
5050
IProposalCreateOptions<'ReputationFromToken'>

src/plugins/utils.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import {
2525
IProposalCreateOptionsCRExt,
2626
IProposalCreateOptionsFundingRequest,
2727
IProposalCreateOptionsGS,
28-
IProposalCreateOptionsJoinAndQuit,
28+
IProposalCreateOptionsJoin,
2929
IProposalCreateOptionsPM,
3030
IProposalCreateOptionsSR,
3131
IProposalState,
32-
JoinAndQuit,
33-
JoinAndQuitProposal,
32+
Join,
33+
JoinProposal,
3434
Plugin,
3535
PluginManagerPlugin,
3636
PluginManagerProposal,
@@ -45,7 +45,7 @@ import {
4545

4646
export const ProposalPlugins = {
4747
FundingRequest,
48-
JoinAndQuit,
48+
Join,
4949
GenericScheme: GenericPlugin,
5050
SchemeRegistrar: PluginRegistrarPlugin,
5151
ContributionReward: ContributionRewardPlugin,
@@ -69,7 +69,7 @@ export const Proposals = {
6969
Competition: CompetitionProposal,
7070
ContributionRewardExt: ContributionRewardExtProposal,
7171
FundingRequest: FundingRequestProposal,
72-
JoinAndQuit: JoinAndQuitProposal,
72+
Join: JoinProposal,
7373
SchemeRegistrar: PluginRegistrarProposal,
7474
SchemeRegistrarAdd: PluginRegistrarProposal,
7575
SchemeRegistrarRemove: PluginRegistrarProposal,
@@ -83,7 +83,7 @@ export interface IInitParams {
8383
Competition: IInitParamsCompetition,
8484
ContributionRewardExt: IInitParamsCRExt,
8585
FundingRequest: IInitParamsFR,
86-
JoinAndQuit: IInitParamsJQ,
86+
Join: IInitParamsJQ,
8787
SchemeRegistrar: IInitParamsSR,
8888
SchemeFactory: IInitParamsPM,
8989
ReputationFromToken: IInitParamsRT
@@ -98,7 +98,7 @@ export type ProposalCreateOptions =
9898
IProposalCreateOptionsComp |
9999
IProposalCreateOptionsCR |
100100
IProposalCreateOptionsFundingRequest |
101-
IProposalCreateOptionsJoinAndQuit |
101+
IProposalCreateOptionsJoin |
102102
IProposalCreateOptionsPM
103103

104104
export abstract class AnyProposal extends Proposal<IProposalState> { }

0 commit comments

Comments
 (0)