diff --git a/ethereum/contracts/core/ValidationPools.sol b/ethereum/contracts/core/ValidationPools.sol index 26337f9..0ffdc29 100644 --- a/ethereum/contracts/core/ValidationPools.sol +++ b/ethereum/contracts/core/ValidationPools.sol @@ -158,6 +158,9 @@ contract ValidationPools is Reputation, Forum { } stakedFor += pool.minted / 2; stakedAgainst += pool.minted / 2; + if (pool.minted % 2 != 0) { + stakedFor += 1; + } // Special case for early evaluation if dao.totalSupply has been staked require( block.timestamp > pool.endTime || @@ -227,6 +230,9 @@ contract ValidationPools is Reputation, Forum { // Here we assume a stakeForAuthor ratio of 0.5 // TODO: Make stakeForAuthor an adjustable parameter totalRewards += pool.minted / 2; + if (pool.minted % 2 != 0) { + totalRewards += 1; + } // Include the losign portion of the VP initial stake // Issue rewards to the winners for (uint i = 0; i < pool.stakeCount; i++) { @@ -244,6 +250,7 @@ contract ValidationPools is Reputation, Forum { } // Due to rounding, there may be some excess REP. Award it to the author. uint remainder = totalRewards - totalAllocated; + // Transfer REP to the forum instead of to the author directly _onValidatePost(pool.postIndex, pool.minted / 2 + remainder); } else { diff --git a/ethereum/test/Forum.js b/ethereum/test/Forum.js index 8c42a23..aa8036a 100644 --- a/ethereum/test/Forum.js +++ b/ethereum/test/Forum.js @@ -305,10 +305,10 @@ describe('Forum', () => { expect(await dao.totalSupply()).to.equal(375); expect(await dao.balanceOf(account1)).to.equal(0); expect(await dao.balanceOf(account2)).to.equal(250); - expect(await dao.balanceOf(account3)).to.equal(124); + expect(await dao.balanceOf(account3)).to.equal(125); expect((await dao.posts(0)).reputation).to.equal(26); expect((await dao.posts(1)).reputation).to.equal(100); - expect((await dao.posts(2)).reputation).to.equal(124); + expect((await dao.posts(2)).reputation).to.equal(125); }); }); });