Skip to content

Commit f9e71c3

Browse files
authored
JoinAndQuit updates (#740)
* setFundingGoalReachedFlag is public cannot propose for already a candidate * use candidate field on MemberFunds instead of canditates mapping * naming * bump version to rc16
1 parent 50ae068 commit f9e71c3

File tree

5 files changed

+347
-254
lines changed

5 files changed

+347
-254
lines changed

contracts/schemes/JoinAndQuit.sol

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ contract JoinAndQuit is
5454
}
5555

5656
struct MemberFund {
57+
bool candidate;
5758
bool rageQuit;
5859
uint256 funding;
5960
}
@@ -68,7 +69,7 @@ contract JoinAndQuit is
6869
uint256 public minFeeToJoin;
6970
uint256 public memberReputation;
7071
uint256 public fundingGoal;
71-
uint256 public fundingGoalDeadLine;
72+
uint256 public fundingGoalDeadline;
7273
uint256 public totalDonation;
7374

7475
/**
@@ -83,7 +84,7 @@ contract JoinAndQuit is
8384
* @param _memberReputation the repution which will be allocated for members
8485
if this param is zero so the repution will be allocated proportional to the fee paid
8586
* @param _fundingGoal the funding goal
86-
* @param _fundingGoalDeadLine the funding goal deadline
87+
* @param _fundingGoalDeadline the funding goal deadline
8788
*/
8889
function initialize(
8990
Avatar _avatar,
@@ -95,7 +96,7 @@ contract JoinAndQuit is
9596
uint256 _minFeeToJoin,
9697
uint256 _memberReputation,
9798
uint256 _fundingGoal,
98-
uint256 _fundingGoalDeadLine
99+
uint256 _fundingGoalDeadline
99100
)
100101
external
101102
initializer
@@ -121,7 +122,7 @@ contract JoinAndQuit is
121122
minFeeToJoin = _minFeeToJoin;
122123
memberReputation = _memberReputation;
123124
fundingGoal = _fundingGoal;
124-
fundingGoalDeadLine = _fundingGoalDeadLine;
125+
fundingGoalDeadline = _fundingGoalDeadline;
125126
}
126127

127128
/**
@@ -159,6 +160,7 @@ contract JoinAndQuit is
159160
fundingToken.safeTransfer(proposal.proposedMember, proposal.funding);
160161
}
161162
}
163+
fundings[proposal.proposedMember].candidate = false;
162164
emit ProposalExecuted(address(avatar), _proposalId, _decision);
163165
return true;
164166
}
@@ -178,8 +180,10 @@ contract JoinAndQuit is
178180
returns(bytes32)
179181
{
180182
address proposer = msg.sender;
183+
require(!fundings[proposer].candidate, "already a candidate");
181184
require(avatar.nativeReputation().balanceOf(proposer) == 0, "already a member");
182185
require(_feeAmount >= minFeeToJoin, "_feeAmount should be >= then the minFeeToJoin");
186+
fundings[proposer].candidate = true;
183187
if (fundingToken == IERC20(0)) {
184188
require(_feeAmount == msg.value, "ETH received shoul match the _feeAmount");
185189
} else {
@@ -266,7 +270,7 @@ contract JoinAndQuit is
266270
/**
267271
* @dev setFundingGoalReachedFlag check if funding goal reached.
268272
*/
269-
function setFundingGoalReachedFlag() private {
273+
function setFundingGoalReachedFlag() public {
270274
uint256 avatarBalance;
271275
if (fundingToken == IERC20(0)) {
272276
avatarBalance = (address(avatar.vault())).balance;
@@ -277,7 +281,7 @@ contract JoinAndQuit is
277281
.hashCompareWithLengthCheck(CommonInterface.FUNDED_BEFORE_DEADLINE_VALUE) == false) &&
278282
(avatarBalance >= fundingGoal) &&
279283
// solhint-disable-next-line not-rely-on-time
280-
(now < fundingGoalDeadLine)) {
284+
(now < fundingGoalDeadline)) {
281285
require(
282286
Controller(
283287
avatar.owner()).

0 commit comments

Comments
 (0)