Skip to content

JoinAndQuit updates #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions contracts/schemes/JoinAndQuit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ contract JoinAndQuit is
}

struct MemberFund {
bool candidate;
bool rageQuit;
uint256 funding;
}
Expand All @@ -68,7 +69,7 @@ contract JoinAndQuit is
uint256 public minFeeToJoin;
uint256 public memberReputation;
uint256 public fundingGoal;
uint256 public fundingGoalDeadLine;
uint256 public fundingGoalDeadline;
uint256 public totalDonation;

/**
Expand All @@ -83,7 +84,7 @@ contract JoinAndQuit is
* @param _memberReputation the repution which will be allocated for members
if this param is zero so the repution will be allocated proportional to the fee paid
* @param _fundingGoal the funding goal
* @param _fundingGoalDeadLine the funding goal deadline
* @param _fundingGoalDeadline the funding goal deadline
*/
function initialize(
Avatar _avatar,
Expand All @@ -95,7 +96,7 @@ contract JoinAndQuit is
uint256 _minFeeToJoin,
uint256 _memberReputation,
uint256 _fundingGoal,
uint256 _fundingGoalDeadLine
uint256 _fundingGoalDeadline
)
external
initializer
Expand All @@ -121,7 +122,7 @@ contract JoinAndQuit is
minFeeToJoin = _minFeeToJoin;
memberReputation = _memberReputation;
fundingGoal = _fundingGoal;
fundingGoalDeadLine = _fundingGoalDeadLine;
fundingGoalDeadline = _fundingGoalDeadline;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ contract JoinAndQuit is
fundingToken.safeTransfer(proposal.proposedMember, proposal.funding);
}
}
fundings[proposal.proposedMember].candidate = false;
emit ProposalExecuted(address(avatar), _proposalId, _decision);
return true;
}
Expand All @@ -178,8 +180,10 @@ contract JoinAndQuit is
returns(bytes32)
{
address proposer = msg.sender;
require(!fundings[proposer].candidate, "already a candidate");
require(avatar.nativeReputation().balanceOf(proposer) == 0, "already a member");
require(_feeAmount >= minFeeToJoin, "_feeAmount should be >= then the minFeeToJoin");
fundings[proposer].candidate = true;
if (fundingToken == IERC20(0)) {
require(_feeAmount == msg.value, "ETH received shoul match the _feeAmount");
} else {
Expand Down Expand Up @@ -266,7 +270,7 @@ contract JoinAndQuit is
/**
* @dev setFundingGoalReachedFlag check if funding goal reached.
*/
function setFundingGoalReachedFlag() private {
function setFundingGoalReachedFlag() public {
uint256 avatarBalance;
if (fundingToken == IERC20(0)) {
avatarBalance = (address(avatar.vault())).balance;
Expand All @@ -277,7 +281,7 @@ contract JoinAndQuit is
.hashCompareWithLengthCheck(CommonInterface.FUNDED_BEFORE_DEADLINE_VALUE) == false) &&
(avatarBalance >= fundingGoal) &&
// solhint-disable-next-line not-rely-on-time
(now < fundingGoalDeadLine)) {
(now < fundingGoalDeadline)) {
require(
Controller(
avatar.owner()).
Expand Down
Loading