forked from aragonone/court-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dispute.js
26 lines (22 loc) · 1.16 KB
/
dispute.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const logger = require('@aragonone/court-backend-shared/helpers/logger')('dispute')
const command = 'dispute'
const describe = 'Create dispute submitting evidence'
const builder = {
arbitrable: { alias: 'a', describe: 'Address of the arbitrable instance creating the dispute', type: 'string', demand: true },
rulings: { alias: 'r', describe: 'Number of rulings', type: 'string', default: '2', demand: true },
metadata: { alias: 'm', describe: 'Dispute metadata, it will only be logged', type: 'string' },
evidence: { alias: 'e', describe: 'Evidence contents', type: 'array' },
submitters: { alias: 's', describe: 'Submitters for each evidence content', type: 'array' },
close: { alias: 'c', describe: 'Whether the evidence period should be closed or not', type: 'boolean', default: false },
}
const handlerAsync = async (environment, { arbitrable, rulings, metadata, evidence, submitters, close }) => {
const court = await environment.getCourt()
const disputeId = await court.createDispute(arbitrable, rulings, metadata, evidence, submitters, close)
logger.success(`Created dispute #${disputeId}`)
}
module.exports = {
command,
describe,
builder,
handlerAsync
}