Skip to content

Commit

Permalink
Combine if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
kronosapiens committed Oct 27, 2023
1 parent aa1e101 commit 5b58225
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions contracts/colony/ColonyFunding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -301,18 +301,15 @@ contract ColonyFunding is
);
}

// If this pot is associated with an Expenditure, prevent money
// being taken from the pot if the remaining balance is less than
// the amount needed for payouts, unless the task was cancelled.
if (fromPot.associatedType == FundingPotAssociatedType.Expenditure) {
// If this pot belongs to an Expenditure, prevent money being removed if
// the remaining balance is insufficient for payouts, unless cancelled
require(
expenditures[fromPot.associatedTypeId].status == ExpenditureStatus.Cancelled ||
fromPot.balance[_token] >= fromPot.payouts[_token],
"colony-funding-expenditure-bad-state"
);
}

if (fromPot.associatedType == FundingPotAssociatedType.Expenditure) {
uint256 fromPotPreviousAmount = fromPot.balance[_token] + _amount;
updatePayoutsWeCannotMakeAfterPotChange(_fromPot, _token, fromPotPreviousAmount);
}
Expand Down

0 comments on commit 5b58225

Please sign in to comment.