From aedb6d3008ef82b6dac36e60bda1963d7b29d3b4 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Tue, 16 Apr 2024 19:13:03 -0500 Subject: [PATCH] clarify code related to VP author rewards --- ethereum/contracts/core/ValidationPools.sol | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ethereum/contracts/core/ValidationPools.sol b/ethereum/contracts/core/ValidationPools.sol index 0ffdc29..77e6800 100644 --- a/ethereum/contracts/core/ValidationPools.sol +++ b/ethereum/contracts/core/ValidationPools.sol @@ -230,9 +230,6 @@ 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++) { @@ -250,9 +247,13 @@ contract ValidationPools is Reputation, Forum { } // Due to rounding, there may be some excess REP. Award it to the author. uint remainder = totalRewards - totalAllocated; - + uint reward = pool.minted / 2 + remainder; + if (pool.minted % 2 != 0) { + // We staked the odd remainder in favor of the post, on behalf of the author. + reward += 1; + } // Transfer REP to the forum instead of to the author directly - _onValidatePost(pool.postIndex, pool.minted / 2 + remainder); + _onValidatePost(pool.postIndex, reward); } else { // If vote does not pass, divide the losing stake among the winners totalRewards += pool.minted;