let forum, rather than VP, update members list
This commit is contained in:
parent
3eee257669
commit
a18da7dac1
|
@ -137,6 +137,14 @@ contract Forum is Reputation {
|
|||
int amount
|
||||
) internal returns (int refund) {
|
||||
int allocated;
|
||||
|
||||
for (uint i = 0; i < post.authors.length; i++) {
|
||||
address authorAddress = post.authors[i].authorAddress;
|
||||
if (!isMember[authorAddress]) {
|
||||
members[memberCount++] = authorAddress;
|
||||
isMember[authorAddress] = true;
|
||||
}
|
||||
}
|
||||
for (uint i = 0; i < post.authors.length; i++) {
|
||||
Author memory author = post.authors[i];
|
||||
int share;
|
||||
|
@ -149,6 +157,10 @@ contract Forum is Reputation {
|
|||
}
|
||||
if (share > 0) {
|
||||
_update(address(this), author.authorAddress, uint(share));
|
||||
if (!isMember[author.authorAddress]) {
|
||||
members[memberCount++] = author.authorAddress;
|
||||
isMember[author.authorAddress] = true;
|
||||
}
|
||||
} else if (balanceOf(author.authorAddress) < uint(-share)) {
|
||||
// Author has already lost some REP gained from this post.
|
||||
// That means other DAO members have earned it for policing.
|
||||
|
|
|
@ -4,6 +4,10 @@ pragma solidity ^0.8.24;
|
|||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
contract Reputation is ERC20("Reputation", "REP") {
|
||||
mapping(uint => address) public members;
|
||||
uint public memberCount;
|
||||
mapping(address => bool) public isMember;
|
||||
|
||||
function decimals() public pure override returns (uint8) {
|
||||
return 9;
|
||||
}
|
||||
|
|
|
@ -41,10 +41,6 @@ contract ValidationPools is Reputation, Forum {
|
|||
mapping(uint => ValidationPool) public validationPools;
|
||||
uint public validationPoolCount;
|
||||
|
||||
mapping(uint => address) public members;
|
||||
uint public memberCount;
|
||||
mapping(address => bool) public isMember;
|
||||
|
||||
uint constant minDuration = 1; // 1 second
|
||||
uint constant maxDuration = 365_000_000 days; // 1 million years
|
||||
uint[2] minQuorum = [1, 10];
|
||||
|
@ -196,15 +192,6 @@ contract ValidationPools is Reputation, Forum {
|
|||
votePasses =
|
||||
stakedFor * pool.params.winRatio[1] >=
|
||||
(stakedFor + stakedAgainst) * pool.params.winRatio[0];
|
||||
if (votePasses) {
|
||||
for (uint i = 0; i < post.authors.length; i++) {
|
||||
address authorAddress = post.authors[i].authorAddress;
|
||||
if (!isMember[authorAddress]) {
|
||||
members[memberCount++] = authorAddress;
|
||||
isMember[authorAddress] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pool.resolved = true;
|
||||
pool.outcome = votePasses;
|
||||
emit ValidationPoolResolved(poolIndex, votePasses, true);
|
||||
|
|
Loading…
Reference in New Issue