Skip to content

Commit

Permalink
Fixed interface for getRewardPayoutInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Lazovic committed Jul 6, 2018
1 parent b2ab367 commit f7f0b10
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 1 addition & 2 deletions contracts/IColony.sol
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,9 @@ contract IColony {
/// @return Reputation root hash at the time of creation
/// @return Total colony tokens at the time of creation
/// @return Total amount of tokens taken aside for reward payout
/// @return Remaining (unclaimed) amount of tokens
/// @return Token address
/// @return Block number at the time of creation
function getRewardPayoutInfo(uint256 _payoutId) public view returns (bytes32, uint256, uint256, uint256, address, uint256);
function getRewardPayoutInfo(uint256 _payoutId) public view returns (bytes32, uint256, uint256, address, uint256);

/// @notice Finalises the reward payout. Allows creation of next reward payouts for token that has been used in `_payoutId`
/// Can only be called when reward payout cycle is finished i.e when 60 days have passed from its creation
Expand Down
16 changes: 15 additions & 1 deletion test/colony-funding.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { toBN, sha3 } from "web3-utils";

import { MANAGER, EVALUATOR, WORKER, MANAGER_ROLE, EVALUATOR_ROLE, WORKER_ROLE, WORKER_PAYOUT, INITIAL_FUNDING } from "../helpers/constants";
import { getTokenArgs, checkErrorRevert, web3GetBalance, forwardTime, bnSqrt } from "../helpers/test-helper";
import { getTokenArgs, checkErrorRevert, web3GetBalance, forwardTime, currentBlockTime, bnSqrt } from "../helpers/test-helper";
import { fundColonyWithTokens, setupRatedTask, executeSignedTaskChange, executeSignedRoleAssignment, makeTask } from "../helpers/test-data-generator";

const EtherRouter = artifacts.require("EtherRouter");
Expand Down Expand Up @@ -1022,6 +1022,20 @@ contract("Colony Funding", addresses => {
);
});

it("should return correct info about reward payout", async () => {
const { logs } = await colony.startNextRewardPayout(otherToken.address);
const payoutId = logs[0].args.id;

const balance = await colony.getPotBalance(0, otherToken.address);
const blockTimestamp = await currentBlockTime();

const info = await colony.getRewardPayoutInfo(payoutId);
assert.equal(info[1].toString(), userTokens.toString());
assert.equal(info[2].toString(), balance.toString());
assert.equal(info[3].toString(), otherToken.address);
assert.equal(info[4].toString(), blockTimestamp.toString());
});

const reputations = [
{
totalReputation: toBN(3),
Expand Down

0 comments on commit f7f0b10

Please sign in to comment.