Skip to content

Commit

Permalink
Combine if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
kronosapiens authored and area committed Oct 30, 2023
1 parent 4bc182f commit 9775819
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) {
// Prevent money being removed if the remaining balance is insufficient for payouts,
// unless the expenditure was 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 9775819

Please sign in to comment.