diff --git a/ethereum/contracts/core/Forum.sol b/ethereum/contracts/core/Forum.sol index f281bb0..0396c86 100644 --- a/ethereum/contracts/core/Forum.sol +++ b/ethereum/contracts/core/Forum.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.24; +import "./Reputation.sol"; + struct Post { uint id; address sender; @@ -9,7 +11,7 @@ struct Post { // TODO: citations } -contract Forum { +contract Forum is Reputation { mapping(uint => Post) public posts; uint public postCount; @@ -27,4 +29,9 @@ contract Forum { post.contentId = contentId; emit PostAdded(postIndex); } + + function _onValidatePost(uint postIndex, uint amount) internal { + Post storage post = posts[postIndex]; + _update(address(this), post.author, amount); + } } diff --git a/ethereum/contracts/core/ValidationPools.sol b/ethereum/contracts/core/ValidationPools.sol index a602bea..be9ea07 100644 --- a/ethereum/contracts/core/ValidationPools.sol +++ b/ethereum/contracts/core/ValidationPools.sol @@ -235,8 +235,8 @@ contract ValidationPools is Reputation, Forum { uint reward = ((((totalRewards * pool.minted) / 2) / amountFromWinners) * pool.params.bindingPercent) / 100; totalAllocated += reward; - _update(address(this), post.author, pool.minted / 2 + reward); - // TODO: Transfer REP to the forum instead of to the author directly + // Transfer REP to the forum instead of to the author directly + _onValidatePost(pool.postIndex, pool.minted / 2 + reward); } else { // If vote does not pass, divide the losing stake among the winners totalRewards += pool.minted;