From 1d6d831a8195b2445a735a63ea1118f9d61f846d Mon Sep 17 00:00:00 2001 From: Mischa Date: Mon, 29 May 2023 09:28:51 +0100 Subject: [PATCH] This cleans up some local variable names (#607) Co-authored-by: Klemen <64400885+zajck@users.noreply.github.com> --- contracts/protocol/bases/BeaconClientBase.sol | 6 +++--- contracts/protocol/bases/BundleBase.sol | 16 ++++++++-------- contracts/protocol/bases/ClientBase.sol | 6 +++--- .../bases/ClientExternalAddressesBase.sol | 6 +++--- .../protocol/facets/ExchangeHandlerFacet.sol | 14 +++++++------- contracts/protocol/libs/BeaconClientLib.sol | 8 ++++---- contracts/protocol/libs/ClientLib.sol | 6 +++--- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/contracts/protocol/bases/BeaconClientBase.sol b/contracts/protocol/bases/BeaconClientBase.sol index c4a75ca91..36738468f 100644 --- a/contracts/protocol/bases/BeaconClientBase.sol +++ b/contracts/protocol/bases/BeaconClientBase.sol @@ -27,10 +27,10 @@ abstract contract BeaconClientBase is BosonTypes { * * See: {AccessController.hasRole} * - * @param role - the role to check + * @param _role - the role to check */ - modifier onlyRole(bytes32 role) { - require(BeaconClientLib.hasRole(role), ACCESS_DENIED); + modifier onlyRole(bytes32 _role) { + require(BeaconClientLib.hasRole(_role), ACCESS_DENIED); _; } diff --git a/contracts/protocol/bases/BundleBase.sol b/contracts/protocol/bases/BundleBase.sol index ec85a7e38..b88b8d4a5 100644 --- a/contracts/protocol/bases/BundleBase.sol +++ b/contracts/protocol/bases/BundleBase.sol @@ -138,22 +138,22 @@ contract BundleBase is ProtocolBase, IBosonBundleEvents { * - Offers' total quantity is greater than twin supply when token is nonfungible * - Offers' total quantity multiplied by twin amount is greater than twin supply when token is fungible or multitoken * - * @param offersTotalQuantity - sum of offers' total quantity available + * @param _offersTotalQuantity - sum of offers' total quantity available * @param _twinId - twin id to compare */ - function bundleSupplyChecks(uint256 offersTotalQuantity, uint256 _twinId) internal view { + function bundleSupplyChecks(uint256 _offersTotalQuantity, uint256 _twinId) internal view { // make sure twin exist and belong to the seller Twin storage twin = getValidTwin(_twinId); // twin is NonFungibleToken or bundle has an unlimited offer - if (twin.tokenType == TokenType.NonFungibleToken || offersTotalQuantity == type(uint256).max) { + if (twin.tokenType == TokenType.NonFungibleToken || _offersTotalQuantity == type(uint256).max) { // the sum of all offers quantity should be less or equal twin supply - require(offersTotalQuantity <= twin.supplyAvailable, INSUFFICIENT_TWIN_SUPPLY_TO_COVER_BUNDLE_OFFERS); + require(_offersTotalQuantity <= twin.supplyAvailable, INSUFFICIENT_TWIN_SUPPLY_TO_COVER_BUNDLE_OFFERS); } else { // twin is FungibleToken or MultiToken // the sum of all offers quantity multiplied by twin amount should be less or equal twin supply require( - offersTotalQuantity * twin.amount <= twin.supplyAvailable, + _offersTotalQuantity * twin.amount <= twin.supplyAvailable, INSUFFICIENT_TWIN_SUPPLY_TO_COVER_BUNDLE_OFFERS ); } @@ -162,12 +162,12 @@ contract BundleBase is ProtocolBase, IBosonBundleEvents { /** * * @notice Calculates bundled offers' total quantity available. - * @param previousTotal - previous offers' total quantity or initial value + * @param _previousTotal - previous offers' total quantity or initial value * @param _offerId - offer id to add to total quantity * @return offersTotalQuantity - previous offers' total quantity plus the current offer quantityAvailable */ function calculateOffersTotalQuantity( - uint256 previousTotal, + uint256 _previousTotal, uint256 _offerId ) internal view returns (uint256 offersTotalQuantity) { // make sure all offers exist and belong to the seller @@ -176,7 +176,7 @@ contract BundleBase is ProtocolBase, IBosonBundleEvents { // Unchecked because we're handling overflow below unchecked { // Calculate the bundle offers total quantity available. - offersTotalQuantity = previousTotal + offer.quantityAvailable; + offersTotalQuantity = _previousTotal + offer.quantityAvailable; } // offersTotalQuantity should be max uint if overflow happens diff --git a/contracts/protocol/bases/ClientBase.sol b/contracts/protocol/bases/ClientBase.sol index 8e02f8912..1328561f3 100644 --- a/contracts/protocol/bases/ClientBase.sol +++ b/contracts/protocol/bases/ClientBase.sol @@ -25,10 +25,10 @@ abstract contract ClientBase is BosonTypes { * * See: {AccessController.hasRole} * - * @param role - the role to check + * @param _role - the role to check */ - modifier onlyRole(bytes32 role) { - require(ClientLib.hasRole(role), ACCESS_DENIED); + modifier onlyRole(bytes32 _role) { + require(ClientLib.hasRole(_role), ACCESS_DENIED); _; } diff --git a/contracts/protocol/bases/ClientExternalAddressesBase.sol b/contracts/protocol/bases/ClientExternalAddressesBase.sol index df0202dac..a3931a9e7 100644 --- a/contracts/protocol/bases/ClientExternalAddressesBase.sol +++ b/contracts/protocol/bases/ClientExternalAddressesBase.sol @@ -20,10 +20,10 @@ contract ClientExternalAddressesBase is IClientExternalAddresses { * * See: {AccessController.hasRole} * - * @param role - the role to check + * @param _role - the role to check */ - modifier onlyRole(bytes32 role) { - require(ClientLib.hasRole(role), "Access denied, caller doesn't have role"); + modifier onlyRole(bytes32 _role) { + require(ClientLib.hasRole(_role), "Access denied, caller doesn't have role"); _; } diff --git a/contracts/protocol/facets/ExchangeHandlerFacet.sol b/contracts/protocol/facets/ExchangeHandlerFacet.sol index 20406cfe6..1a4260c3f 100644 --- a/contracts/protocol/facets/ExchangeHandlerFacet.sol +++ b/contracts/protocol/facets/ExchangeHandlerFacet.sol @@ -653,14 +653,14 @@ contract ExchangeHandlerFacet is IBosonExchangeHandler, BuyerBase, DisputeBase { * Reverts if * - Exchange is not in Committed state * - * @param exchange - the exchange to revoke + * @param _exchange - the exchange to revoke */ - function revokeVoucherInternal(Exchange storage exchange) internal { + function revokeVoucherInternal(Exchange storage _exchange) internal { // Finalize the exchange, burning the voucher - finalizeExchange(exchange, ExchangeState.Revoked); + finalizeExchange(_exchange, ExchangeState.Revoked); // Notify watchers of state change - emit VoucherRevoked(exchange.offerId, exchange.id, msgSender()); + emit VoucherRevoked(_exchange.offerId, _exchange.id, msgSender()); } /** @@ -871,11 +871,11 @@ contract ExchangeHandlerFacet is IBosonExchangeHandler, BuyerBase, DisputeBase { * * @param _buyer buyer address * @param _offer the offer - * @param exchangeId - the exchange id + * @param _exchangeId - the exchange id * * @return bool - true if buyer is authorized to commit */ - function authorizeCommit(address _buyer, Offer storage _offer, uint256 exchangeId) internal returns (bool) { + function authorizeCommit(address _buyer, Offer storage _offer, uint256 _exchangeId) internal returns (bool) { // Cache protocol lookups for reference ProtocolLib.ProtocolLookups storage lookups = protocolLookups(); @@ -904,7 +904,7 @@ contract ExchangeHandlerFacet is IBosonExchangeHandler, BuyerBase, DisputeBase { // Increment number of commits to the group for this address if they are allowed to commit lookups.conditionalCommitsByAddress[_buyer][groupId] = ++commitCount; // Store the condition to be returned afterward on getReceipt function - lookups.exchangeCondition[exchangeId] = condition; + lookups.exchangeCondition[_exchangeId] = condition; } } else { // Buyer has exhausted their allowable commits diff --git a/contracts/protocol/libs/BeaconClientLib.sol b/contracts/protocol/libs/BeaconClientLib.sol index 147b350e4..ef91609e0 100644 --- a/contracts/protocol/libs/BeaconClientLib.sol +++ b/contracts/protocol/libs/BeaconClientLib.sol @@ -52,14 +52,14 @@ library BeaconClientLib { * * See: {AccessController.hasRole} * - * @param role - the role to check - * @return whether caller has role + * @param _role - the role to check + * @return whether caller has role */ - function hasRole(bytes32 role) internal view returns (bool) { + function hasRole(bytes32 _role) internal view returns (bool) { // retrieve accessController from Beacon IAccessControl accessController = IClientExternalAddresses(_beacon()).getAccessController(); // forward the check to accessController - return accessController.hasRole(role, msg.sender); + return accessController.hasRole(_role, msg.sender); } } diff --git a/contracts/protocol/libs/ClientLib.sol b/contracts/protocol/libs/ClientLib.sol index bf31058c6..6a3cda2ca 100644 --- a/contracts/protocol/libs/ClientLib.sol +++ b/contracts/protocol/libs/ClientLib.sol @@ -48,13 +48,13 @@ library ClientLib { * * See: {AccessController.hasRole} * - * @param role - the role to check + * @param _role - the role to check */ - function hasRole(bytes32 role) internal view returns (bool) { + function hasRole(bytes32 _role) internal view returns (bool) { ProxyStorage storage ps = proxyStorage(); IAccessControl accessController = IAccessControl( IBosonConfigHandler(ps.protocolDiamond).getAccessControllerAddress() ); - return accessController.hasRole(role, EIP712Lib.msgSender()); + return accessController.hasRole(_role, EIP712Lib.msgSender()); } }