Pass author rewards via forum
This commit is contained in:
parent
edd6d6d4d2
commit
a40bbc8059
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue