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

feat: use enumerable version of access control #1209

Merged
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
11 changes: 6 additions & 5 deletions packages/marketplace/contracts/exchange/Exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.21;

import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import {ERC2771HandlerUpgradeable} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol";
Expand All @@ -19,7 +19,7 @@ import {ExchangeCore} from "./ExchangeCore.sol";
/// @dev TransferManager is used to execute token transfers
contract Exchange is
Initializable,
AccessControlUpgradeable,
AccessControlEnumerableUpgradeable,
ExchangeCore,
TransferManager,
ERC2771HandlerUpgradeable,
Expand Down Expand Up @@ -62,7 +62,7 @@ contract Exchange is
IOrderValidator orderValidatorAddress
) external initializer {
__ERC2771Handler_init_unchained(newTrustedForwarder);
__AccessControl_init_unchained();
__AccessControlEnumerable_init_unchained();
__Pausable_init_unchained();
__TransferManager_init_unchained(
newProtocolFeePrimary,
Expand Down Expand Up @@ -148,9 +148,10 @@ contract Exchange is
/// @param interfaceId interface id to check
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC165Upgradeable, AccessControlUpgradeable) returns (bool) {
) public view virtual override(ERC165Upgradeable, AccessControlEnumerableUpgradeable) returns (bool) {
return
ERC165Upgradeable.supportsInterface(interfaceId) || AccessControlUpgradeable.supportsInterface(interfaceId);
ERC165Upgradeable.supportsInterface(interfaceId) ||
AccessControlEnumerableUpgradeable.supportsInterface(interfaceId);
}

/// @dev Apply the fees & royalties only for users NOT granted with the role EXCHANGE_ADMIN_ROLE
Expand Down
6 changes: 3 additions & 3 deletions packages/marketplace/contracts/exchange/WhiteList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

pragma solidity 0.8.21;

import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import {IWhiteList} from "../interfaces/IWhiteList.sol";

/// @title WhiteList contract
/// @dev controls which tokens are accepted in the marketplace
contract WhiteList is IWhiteList, AccessControlUpgradeable {
contract WhiteList is IWhiteList, AccessControlEnumerableUpgradeable {
/// @notice role for The Sandbox tokens
/// @return hash for TSB_ROLE
bytes32 public constant TSB_ROLE = keccak256("TSB_ROLE");
Expand Down Expand Up @@ -61,7 +61,7 @@ contract WhiteList is IWhiteList, AccessControlUpgradeable {
bool newOpen,
bool newErc20List
) internal initializer {
__AccessControl_init_unchained();
__AccessControlEnumerable_init_unchained();
_grantRole(DEFAULT_ADMIN_ROLE, admin);
tsbOnly = newTsbOnly;
partners = newPartners;
Expand Down
Loading