Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from OpenSeaProtocol/oz-n01
Browse files Browse the repository at this point in the history
OpenZeppelin N-01: Constants not using upper case format
  • Loading branch information
emo-eth committed Jan 19, 2023
2 parents dab3eba + bce3a35 commit f8f76d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/OwnedRegistrant.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {Ownable2Step} from "openzeppelin-contracts/access/Ownable2Step.sol";
*/
contract OwnedRegistrant is Ownable2Step {
/// @dev The default registry address.
address constant registry = 0x000000000000AAeB6D7670E522A718067333cd4E;
address constant REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;

/// @dev The constructor that is called when the contract is being deployed.
constructor(address _owner) {
IOperatorFilterRegistry(registry).register(address(this));
IOperatorFilterRegistry(REGISTRY).register(address(this));
transferOwnership(_owner);
}
}
16 changes: 8 additions & 8 deletions src/upgradeable/OperatorFiltererUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract contract OperatorFiltererUpgradeable is Initializable {
/// @notice Emitted when an operator is not allowed.
error OperatorNotAllowed(address operator);

IOperatorFilterRegistry constant operatorFilterRegistry =
IOperatorFilterRegistry constant OPERATOR_FILTER_REGISTRY =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

/// @dev The upgradeable initialize function that should be called when the contract is being upgraded.
Expand All @@ -27,15 +27,15 @@ abstract contract OperatorFiltererUpgradeable is Initializable {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(operatorFilterRegistry).code.length > 0) {
if (!operatorFilterRegistry.isRegistered(address(this))) {
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (!OPERATOR_FILTER_REGISTRY.isRegistered(address(this))) {
if (subscribe) {
operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
operatorFilterRegistry.register(address(this));
OPERATOR_FILTER_REGISTRY.register(address(this));
}
}
}
Expand Down Expand Up @@ -68,11 +68,11 @@ abstract contract OperatorFiltererUpgradeable is Initializable {
*/
function _checkFilterOperator(address operator) internal view virtual {
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(operatorFilterRegistry).code.length > 0) {
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
// under normal circumstances, this function will revert rather than return false, but inheriting or
// upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave
// differently
if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {
if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
revert OperatorNotAllowed(operator);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/upgradeable/RevokableOperatorFiltererUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ abstract contract RevokableOperatorFiltererUpgradeable is OperatorFiltererUpgrad
// Check registry code length to facilitate testing in environments without a deployed registry.
if (
!RevokableOperatorFiltererUpgradeableStorage.layout()._isOperatorFilterRegistryRevoked
&& address(operatorFilterRegistry).code.length > 0
&& address(OPERATOR_FILTER_REGISTRY).code.length > 0
) {
// under normal circumstances, this function will revert rather than return false, but inheriting or
// upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave
// differently
if (!operatorFilterRegistry.isOperatorAllowed(address(this), operator)) {
if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
revert OperatorNotAllowed(operator);
}
}
Expand Down

0 comments on commit f8f76d0

Please sign in to comment.