Skip to content
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

Remediate [BVR-02C, EHF-02C, PHF-02C] Redundant Parenthesis Statement #750

Merged
merged 5 commits into from
Aug 17, 2023
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
10 changes: 5 additions & 5 deletions contracts/protocol/clients/voucher/BosonVoucher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ contract BosonVoucherBase is IBosonVoucher, BeaconClientBase, OwnableUpgradeable

// Revert if exchange id falls within a reserved range
uint256 rangeStart = range.start;
require((_tokenId < rangeStart) || (_tokenId >= rangeStart + range.length), EXCHANGE_ID_IN_RESERVED_RANGE);
require(_tokenId < rangeStart || _tokenId >= rangeStart + range.length, EXCHANGE_ID_IN_RESERVED_RANGE);

// Issue voucher is called only during commitToOffer (in protocol), so token can be set as committed
_committed[_tokenId] = true;
Expand Down Expand Up @@ -225,7 +225,7 @@ contract BosonVoucherBase is IBosonVoucher, BeaconClientBase, OwnableUpgradeable

// Make sure that offer is not expired or voided
(Offer memory offer, OfferDates memory offerDates) = getBosonOffer(_offerId);
require(!offer.voided && (block.timestamp <= offerDates.validUntil), OFFER_EXPIRED_OR_VOIDED);
require(!offer.voided && block.timestamp <= offerDates.validUntil, OFFER_EXPIRED_OR_VOIDED);

// Get the first token to mint
uint256 start = range.start + range.minted;
Expand Down Expand Up @@ -281,10 +281,10 @@ contract BosonVoucherBase is IBosonVoucher, BeaconClientBase, OwnableUpgradeable

// Make sure that offer is either expired or voided
(Offer memory offer, OfferDates memory offerDates) = getBosonOffer(_offerId);
require(offer.voided || (block.timestamp > offerDates.validUntil), OFFER_STILL_VALID);
require(offer.voided || block.timestamp > offerDates.validUntil, OFFER_STILL_VALID);

// Get the first token to burn
uint256 start = (range.lastBurnedTokenId == 0) ? range.start : (range.lastBurnedTokenId + 1);
uint256 start = range.lastBurnedTokenId == 0 ? range.start : range.lastBurnedTokenId + 1;

// Get the last token to burn
uint256 end = start + _amount;
Expand Down Expand Up @@ -319,7 +319,7 @@ contract BosonVoucherBase is IBosonVoucher, BeaconClientBase, OwnableUpgradeable
function getAvailablePreMints(uint256 _offerId) external view returns (uint256 count) {
// If offer is expired or voided, return 0
(Offer memory offer, OfferDates memory offerDates) = getBosonOffer(_offerId);
if (offer.voided || (block.timestamp > offerDates.validUntil)) {
if (offer.voided || block.timestamp > offerDates.validUntil) {
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/protocol/facets/ExchangeHandlerFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ contract ExchangeHandlerFacet is IBosonExchangeHandler, BuyerBase, DisputeBase {
return IERC1155(_condition.tokenAddress).balanceOf(_buyer, _tokenId) >= _condition.threshold;
} else {
// no need to check if is NonFungible token there is no way to create a SpecifiedToken condition with a Fungible token
return (IERC721(_condition.tokenAddress).ownerOf(_tokenId) == _buyer);
return IERC721(_condition.tokenAddress).ownerOf(_tokenId) == _buyer;
}
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/protocol/facets/PauseHandlerFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ contract PauseHandlerFacet is ProtocolBase, IBosonPauseHandler {

for (uint256 i = 0; i < totalRegions; i++) {
// Check if the region is paused by bitwise AND operation with shifted 1
if ((status.pauseScenario & (1 << i)) != 0) {
if (status.pauseScenario & (1 << i) != 0) {
zajck marked this conversation as resolved.
Show resolved Hide resolved
regions[count] = BosonTypes.PausableRegion(i);

count++;
Expand Down