Skip to content

Commit

Permalink
This cleans up some local variable names (#607)
Browse files Browse the repository at this point in the history
Co-authored-by: Klemen <64400885+zajck@users.noreply.github.com>
  • Loading branch information
mischat and zajck committed May 29, 2023
1 parent ba7a204 commit 1d6d831
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions contracts/protocol/bases/BeaconClientBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
_;
}

Expand Down
16 changes: 8 additions & 8 deletions contracts/protocol/bases/BundleBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contracts/protocol/bases/ClientBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
_;
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/protocol/bases/ClientExternalAddressesBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
_;
}

Expand Down
14 changes: 7 additions & 7 deletions contracts/protocol/facets/ExchangeHandlerFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions contracts/protocol/libs/BeaconClientLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 3 additions & 3 deletions contracts/protocol/libs/ClientLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 1d6d831

Please sign in to comment.