Pass author rewards via forum

This commit is contained in:
Ladd Hoffman 2024-04-10 15:04:25 -05:00
parent edd6d6d4d2
commit a40bbc8059
2 changed files with 10 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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;