Skip to content

Commit

Permalink
chore: more cleanuop
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 15, 2024
1 parent 8e60ecb commit 3a7fd77
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,6 @@ contract Governance is Multicall, UserProxyFactory, ReentrancyGuard, IGovernance
state.countedVoteLQTY -= initiativeState.voteLQTY;
globalState = state;

/// @audit removal math causes issues

/// @audit Should not delete this
/// weeks * 2^16 > u32 so the contract will stop working before this is an issue
registeredInitiatives[_initiative] = UNREGISTERED_INITIATIVE;

Expand All @@ -599,20 +596,19 @@ contract Governance is Multicall, UserProxyFactory, ReentrancyGuard, IGovernance
(VoteSnapshot memory votesSnapshot_,) = _snapshotVotes();
(InitiativeVoteSnapshot memory votesForInitiativeSnapshot_, InitiativeState memory initiativeState_) = _snapshotVotesForInitiative(_initiative);

// TODO: Return type from state FSM can be standardized
(InitiativeStatus status, , uint256 claimableAmount ) = getInitiativeState(_initiative);

/// @audit Return 0 if we cannot claim
/// INVARIANT:
/// We cannot claim only for 2 reasons:
/// We have already claimed
/// We do not meet the threshold
/// TODO: Enforce this with assertions
if(status != InitiativeStatus.CLAIMABLE) {
return 0;
}

assert(votesSnapshot_.forEpoch == epoch() - 1); /// @audit INVARIANT: You can only claim for previous epoch
/// @audit INVARIANT: You can only claim for previous epoch
assert(votesSnapshot_.forEpoch == epoch() - 1);

/// All unclaimed rewards are always recycled
/// Invariant `lastEpochClaim` is < epoch() - 1; |
/// If `lastEpochClaim` is older than epoch() - 1 it means the initiative couldn't claim any rewards this epoch
Expand Down

0 comments on commit 3a7fd77

Please sign in to comment.