Skip to content
Open
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
20 changes: 10 additions & 10 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ OperatorFilterRegistryTest:testUpdateOperators_CannotUpdateWhileSubscribed() (ga
OperatorFilterRegistryTest:testUpdateOperators_OnlyAddressOrOwner() (gas: 18782)
OperatorFilterRegistryTest:testUpdateOperators_notRegistered() (gas: 13599)
OperatorFilterRegistryTest:testUpdateOperators_unfilter() (gas: 133965)
OperatorFiltererTest:testConstructor_copy() (gas: 238316)
OperatorFiltererTest:testConstructor_subscribe() (gas: 157548)
OperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 308570)
OperatorFiltererTest:testConstructor_copy() (gas: 238315)
OperatorFiltererTest:testConstructor_subscribe() (gas: 157547)
OperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 308569)
OperatorFiltererTest:testFilter() (gas: 40886)
OperatorFiltererTest:testFilterWithMsgSenderGas() (gas: 5589)
OperatorFiltererTest:testFilterWithMsgSenderOriginalGas() (gas: 8268)
OperatorFiltererTest:testFilterWithOperatorGas() (gas: 18132)
OperatorFiltererTest:testFilterWithOperatorOriginalGas() (gas: 18498)
OperatorFiltererTest:testRegisterNonExistentRegistryDoesNotRevert() (gas: 103746)
OperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 278432)
OperatorFiltererTest:testRegisterNonExistentRegistryDoesNotRevert() (gas: 103744)
OperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 278431)
OperatorFiltererTest:testConstructor() (gas: 87287)
PriorityOperatorFiltererTest:testPriorityFilter() (gas: 100485)
PriorityOperatorFiltererTest:testPriorityFilterWithMsgSenderGas() (gas: 5568)
Expand All @@ -105,30 +105,30 @@ ExampleERC721Test:testExclusionExceptionDoesNotApplyToOperators() (gas: 151947)
ExampleERC721Test:testFilter() (gas: 55543)
ExampleERC721Test:testOwnersNotExcluded() (gas: 124039)
ExampleERC721Test:testOwnersNotExcludedSafeTransfer() (gas: 162272)
ExampleERC721Test:testRepeatRegistrationOk() (gas: 5914480)
ExampleERC721Test:testRepeatRegistrationOk() (gas: 5914479)
ExampleERC721Test:testSetOperatorFilteringEnabled() (gas: 6246860)
ExampleERC721ATest:testExcludeApprovals() (gas: 149484)
ExampleERC721ATest:testExclusionExceptionDoesNotApplyToOperators() (gas: 173534)
ExampleERC721ATest:testFilter() (gas: 55426)
ExampleERC721ATest:testOwnersNotExcluded() (gas: 164799)
ExampleERC721ATest:testOwnersNotExcludedSafeTransfer() (gas: 203104)
ExampleERC721ATest:testRepeatRegistrationOk() (gas: 4941288)
ExampleERC721ATest:testRepeatRegistrationOk() (gas: 4941287)
ExampleERC721ATest:testSetOperatorFilteringEnabled() (gas: 5273669)
ExampleER1155UpgradeableTest:testExcludeApprovals() (gas: 99556)
ExampleER1155UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 131416)
ExampleER1155UpgradeableTest:testFilter() (gas: 38684)
ExampleER1155UpgradeableTest:testOwnersNotExcluded() (gas: 106349)
ExampleER1155UpgradeableTest:testOwnersNotExcludedBatch() (gas: 109587)
ExampleER1155UpgradeableTest:testUpgradeable() (gas: 1709546)
ExampleER1155UpgradeableTest:testUpgradeable() (gas: 1709545)
ExampleERC721AUpgradeableTest:testExcludeApprovals() (gas: 145158)
ExampleERC721AUpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 171273)
ExampleERC721AUpgradeableTest:testFilter() (gas: 49268)
ExampleERC721AUpgradeableTest:testOwnersNotExcluded() (gas: 164886)
ExampleERC721AUpgradeableTest:testOwnersNotExcludedSafeTransfer() (gas: 203226)
ExampleERC721AUpgradeableTest:testUpgradeable() (gas: 1756936)
ExampleERC721AUpgradeableTest:testUpgradeable() (gas: 1756935)
ExampleERC721UpgradeableTest:testExcludeApprovals() (gas: 123499)
ExampleERC721UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 149690)
ExampleERC721UpgradeableTest:testFilter() (gas: 49296)
ExampleERC721UpgradeableTest:testOwnersNotExcluded() (gas: 124107)
ExampleERC721UpgradeableTest:testOwnersNotExcludedSafeTransfer() (gas: 162453)
ExampleERC721UpgradeableTest:testUpgradeable() (gas: 1604287)
ExampleERC721UpgradeableTest:testUpgradeable() (gas: 1604286)
5 changes: 4 additions & 1 deletion src/OperatorFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ abstract contract OperatorFilterer {
/// @dev The OpenSea operator filter registry.
address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;

/// @dev The bit mask used to remove any dirty bits in an address.
uint256 private constant _CLEAN_ADDR_MASK = (1 << 160) - 1;

/// @dev Registers the current contract to OpenSea's operator filter,
/// and subscribe to the default OpenSea operator blocklist.
/// Note: Will not revert nor update existing settings for repeated registration.
Expand All @@ -31,7 +34,7 @@ abstract contract OperatorFilterer {
let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.

// Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
subscriptionOrRegistrantToCopy := and(subscriptionOrRegistrantToCopy, _CLEAN_ADDR_MASK)

for {} iszero(subscribe) {} {
if iszero(subscriptionOrRegistrantToCopy) {
Expand Down