New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluator reputation update #158
Changes from 16 commits
6fcfcae
7f27d61
be94ed1
ceac110
9558d06
ffa72cb
ac5d611
a67263f
005cb56
38260a9
2f5ed66
8c96077
d69b56a
44a715d
4468d77
870e50e
e69e7ee
b65af24
9545eca
997d0e2
6f1d065
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { | |
EVALUATOR, | ||
WORKER, | ||
MANAGER_PAYOUT, | ||
EVALUATOR_PAYOUT, | ||
WORKER_PAYOUT, | ||
MANAGER_RATING, | ||
WORKER_RATING, | ||
|
@@ -56,6 +57,7 @@ module.exports = { | |
evaluator = EVALUATOR, | ||
worker = WORKER, | ||
manager_payout = MANAGER_PAYOUT, | ||
evaluator_payout = EVALUATOR_PAYOUT, | ||
worker_payout = WORKER_PAYOUT | ||
) { | ||
let tokenAddress; | ||
|
@@ -70,17 +72,25 @@ module.exports = { | |
const potId = task[6].toNumber(); | ||
const managerPayout = new BN(manager_payout); | ||
const workerPayout = new BN(worker_payout); | ||
const totalPayouts = managerPayout.add(workerPayout); | ||
const evaluatorPayout = new BN(evaluator_payout); | ||
const totalPayouts = managerPayout.add(workerPayout).add(evaluatorPayout); | ||
await colony.moveFundsBetweenPots(1, potId, totalPayouts.toString(), tokenAddress); | ||
let txData = await colony.contract.setTaskPayout.getData(taskId, MANAGER_ROLE, tokenAddress, managerPayout.toString()); | ||
|
||
let txData = await colony.contract.setTaskManagerPayout.getData(taskId, tokenAddress, managerPayout.toString()); | ||
await colony.proposeTaskChange(txData, 0, MANAGER_ROLE); | ||
let transactionId = await colony.getTransactionCount.call(); | ||
await colony.approveTaskChange(transactionId, WORKER_ROLE, { from: worker }); | ||
|
||
txData = await colony.contract.setTaskPayout.getData(taskId, WORKER_ROLE, tokenAddress, workerPayout.toString()); | ||
txData = await colony.contract.setTaskEvaluatorPayout.getData(taskId, tokenAddress, evaluatorPayout.toString()); | ||
await colony.proposeTaskChange(txData, 0, MANAGER_ROLE); | ||
transactionId = await colony.getTransactionCount.call(); | ||
await colony.approveTaskChange(transactionId, EVALUATOR_ROLE, { from: evaluator }); | ||
|
||
txData = await colony.contract.setTaskWorkerPayout.getData(taskId, tokenAddress, workerPayout.toString()); | ||
await colony.proposeTaskChange(txData, 0, MANAGER_ROLE); | ||
transactionId = await colony.getTransactionCount.call(); | ||
await colony.approveTaskChange(transactionId, WORKER_ROLE, { from: worker }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that b) We refactor the I haven't explored option b) so feel free to experiment. Overall I'd prefer option a) for simplicity but I want to hear what @area thinks about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now i created separate functions for every role. I will try to find better solution after this PR is merged, because these changes are required for #154. |
||
|
||
return taskId; | ||
}, | ||
async setupRatedTask( | ||
|
@@ -93,13 +103,26 @@ module.exports = { | |
evaluator = EVALUATOR, | ||
worker = WORKER, | ||
manager_payout = MANAGER_PAYOUT, | ||
evaluator_payout = EVALUATOR_PAYOUT, | ||
worker_payout = WORKER_PAYOUT, | ||
manager_rating = MANAGER_RATING, | ||
manager_rating_salt = RATING_1_SALT, | ||
worker_rating = WORKER_RATING, | ||
worker_rating_salt = RATING_2_SALT | ||
) { | ||
const taskId = await this.setupFundedTask(colonyNetwork, colony, token, dueDate, domain, skill, evaluator, worker, manager_payout, worker_payout); | ||
const taskId = await this.setupFundedTask( | ||
colonyNetwork, | ||
colony, | ||
token, | ||
dueDate, | ||
domain, | ||
skill, | ||
evaluator, | ||
worker, | ||
manager_payout, | ||
evaluator_payout, | ||
worker_payout | ||
); | ||
const WORKER_RATING_SECRET = web3Utils.soliditySha3(worker_rating_salt, worker_rating); | ||
const MANAGER_RATING_SECRET = web3Utils.soliditySha3(manager_rating_salt, manager_rating); | ||
await colony.submitTaskWorkRating(taskId, WORKER_ROLE, WORKER_RATING_SECRET, { from: evaluator }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make sense to get the worker to agree to what the manager payout should be. Just don't permission the
setTaskManagerPayout
function for now.