diff --git a/contracts/sales/FixedPriceSeller.sol b/contracts/sales/FixedPriceSeller.sol index 102c029..cdbfb22 100644 --- a/contracts/sales/FixedPriceSeller.sol +++ b/contracts/sales/FixedPriceSeller.sol @@ -22,7 +22,7 @@ abstract contract FixedPriceSeller is Seller { uint256 public price; /// @notice Sets the per-item price. - function setPrice(uint256 _price) public onlyOwner { + function setPrice(uint256 _price) public onlyRole(DEFAULT_STEERING_ROLE) { price = _price; } diff --git a/contracts/sales/LinearDutchAuction.sol b/contracts/sales/LinearDutchAuction.sol index fdd7e5a..f60fcd7 100644 --- a/contracts/sales/LinearDutchAuction.sol +++ b/contracts/sales/LinearDutchAuction.sol @@ -72,7 +72,7 @@ abstract contract LinearDutchAuction is Seller { function setAuctionConfig( DutchAuctionConfig memory config, uint256 expectedReserve - ) public onlyOwner { + ) public onlyRole(DEFAULT_STEERING_ROLE) { // Underflow might occur is size/num decreases is too large. unchecked { require( @@ -98,7 +98,10 @@ abstract contract LinearDutchAuction is Seller { @dev The auction can be toggle on and off with this function, without the cost of having to update the entire config. */ - function setAuctionStartPoint(uint256 startPoint) public onlyOwner { + function setAuctionStartPoint(uint256 startPoint) + public + onlyRole(DEFAULT_STEERING_ROLE) + { dutchAuctionConfig.startPoint = startPoint; } diff --git a/contracts/sales/Seller.sol b/contracts/sales/Seller.sol index cea77f0..f8c4322 100644 --- a/contracts/sales/Seller.sol +++ b/contracts/sales/Seller.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../utils/Monotonic.sol"; -import "../utils/OwnerPausable.sol"; +import "../utils/AccessControlPausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; @@ -15,7 +15,7 @@ import "@openzeppelin/contracts/utils/Strings.sol"; - Enforce per-wallet / per-transaction limits - Calculate required cost, forwarding to a beneficiary, and refunding extra */ -abstract contract Seller is OwnerPausable, ReentrancyGuard { +abstract contract Seller is AccessControlPausable, ReentrancyGuard { using Address for address payable; using Monotonic for Monotonic.Increaser; using Strings for uint256; @@ -53,7 +53,10 @@ abstract contract Seller is OwnerPausable, ReentrancyGuard { SellerConfig public sellerConfig; /// @notice Sets the seller config. - function setSellerConfig(SellerConfig memory config) public onlyOwner { + function setSellerConfig(SellerConfig memory config) + public + onlyRole(DEFAULT_STEERING_ROLE) + { require( config.totalInventory >= config.freeQuota, "Seller: excessive free quota" @@ -85,7 +88,10 @@ abstract contract Seller is OwnerPausable, ReentrancyGuard { address payable public beneficiary; /// @notice Sets the recipient of revenues. - function setBeneficiary(address payable _beneficiary) public onlyOwner { + function setBeneficiary(address payable _beneficiary) + public + onlyRole(DEFAULT_STEERING_ROLE) + { beneficiary = _beneficiary; } @@ -179,7 +185,7 @@ abstract contract Seller is OwnerPausable, ReentrancyGuard { */ function purchaseFreeOfCharge(address to, uint256 n) public - onlyOwner + onlyRole(DEFAULT_STEERING_ROLE) whenNotPaused { /** diff --git a/contracts/utils/AccessControlPausable.sol b/contracts/utils/AccessControlPausable.sol index 5e8028d..cc761bb 100644 --- a/contracts/utils/AccessControlPausable.sol +++ b/contracts/utils/AccessControlPausable.sol @@ -9,12 +9,12 @@ import {AccessControlEnumerable} from "./AccessControlEnumerable.sol"; /// STEERING role. contract AccessControlPausable is AccessControlEnumerable, Pausable { /// @notice Pauses the contract. - function pause() public onlyRole(DEFAULT_STEERING_ROLE) { + function pause() public virtual onlyRole(DEFAULT_STEERING_ROLE) { Pausable._pause(); } /// @notice Unpauses the contract. - function unpause() public onlyRole(DEFAULT_STEERING_ROLE) { + function unpause() public virtual onlyRole(DEFAULT_STEERING_ROLE) { Pausable._unpause(); } }