Skip to content

Commit

Permalink
v4.0.2 (#19)
Browse files Browse the repository at this point in the history
removed blocklist abstract contracts as the iheritance tree gets tricky
and this is a registry more than anything so doesn't make sense to
include those abstract contracts. Especially as this will stay at 0.8.19
for the foreseeable future to avoid deploying a new factory.
  • Loading branch information
mpeyfuss committed Dec 25, 2023
2 parents 9534625 + 4c9d5e7 commit 804c4b4
Show file tree
Hide file tree
Showing 25 changed files with 43 additions and 719 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/tl-sol-tools"]
path = lib/tl-sol-tools
url = https://github.com/Transient-Labs/tl-sol-tools
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ remove:
# Install the Modules
install:
forge install foundry-rs/forge-std
forge install OpenZeppelin/openzeppelin-contracts@v4.8.3
forge install OpenZeppelin/openzeppelin-contracts-upgradeable@v4.8.3
forge install Transient-Labs/tl-sol-tools@2.2.1

# Update modules
Expand Down
4 changes: 1 addition & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ libs = ['lib'] # a list of librar
libraries = [] # a list of deployed libraries to link against
cache = true # whether to cache builds or not
force = false # whether to ignore the cache (clean build)
evm_version = 'london' # the evm version (by hardfork name)
#solc_version = '0.8.17' # override for the solc version (setting this ignores `auto_detect_solc`)
auto_detect_solc = true # enable auto-detection of the appropriate solc version to use
offline = false # disable downloading of missing solc version(s)
optimizer = true # enable or disable the solc optimizer
Expand All @@ -18,4 +16,4 @@ gas_reports = ["*"]
fs_permissions = [{ access = 'read', path = './test/file_utils'}]

[fuzz]
runs = 2000
runs = 20000
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from 0a25c1
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts-upgradeable
Submodule openzeppelin-contracts-upgradeable deleted from 58fa0f
6 changes: 3 additions & 3 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src
openzeppelin/=lib/openzeppelin-contracts/contracts/
openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
forge-std/=lib/forge-std/src/
openzeppelin-upgradeable/=lib/tl-sol-tools/lib/openzeppelin-contracts-upgradeable/contracts/
openzeppelin/=lib/tl-sol-tools/lib/openzeppelin-contracts/contracts/
tl-sol-tools/=lib/tl-sol-tools/src/
7 changes: 3 additions & 4 deletions src/BlockAllRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {IBlockListRegistry} from "./IBlockListRegistry.sol";
import {IBlockListRegistry} from "src/IBlockListRegistry.sol";

/// @title BlockAllRegistry
/// @notice BlockList that blocks all approvals
/// can be used as a semi-soulbound token
/// @notice BlockList that blocks all approvals and can be used as a semi-soulbound token
/// @author transientlabs.xyz
/// @custom:version 4.1.0
/// @custom:version 4.0.2
contract BlockAllRegistry is IBlockListRegistry {

/// @inheritdoc IBlockListRegistry
Expand Down
82 changes: 0 additions & 82 deletions src/BlockList.sol

This file was deleted.

42 changes: 18 additions & 24 deletions src/BlockListRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ pragma solidity 0.8.19;

import {ERC165Upgradeable} from "openzeppelin-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import {OwnableAccessControlUpgradeable} from "tl-sol-tools/upgradeable/access/OwnableAccessControlUpgradeable.sol";
import {IBlockListRegistry} from "./IBlockListRegistry.sol";
import {IBlockListRegistry} from "src/IBlockListRegistry.sol";

/// @title BlockList
/// @notice abstract contract that can be inherited to block
/// approvals from non-royalty paying marketplaces
/// @title BlockListRegistry
/// @notice Registry that can be used to block approvals from non-royalty paying marketplaces
/// @author transientlabs.xyz
/// @custom:version 4.0.0
contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeable, ERC165Upgradeable {

/*//////////////////////////////////////////////////////////////////////////
Constants
//////////////////////////////////////////////////////////////////////////*/

bytes32 public constant BLOCK_LIST_ADMIN_ROLE = keccak256("BLOCK_LIST_ADMIN_ROLE");

/*//////////////////////////////////////////////////////////////////////////
Expand All @@ -27,13 +28,14 @@ contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeabl
Constructor
//////////////////////////////////////////////////////////////////////////*/

/// @param disable - disable the initalizer on deployment
/// @param disable Disable the initalizer on deployment
constructor(bool disable) {
if (disable) _disableInitializers();
}

/// @param newOwner - the initial owner of this contract
/// @param initBlockList - initial list of addresses to add to the blocklist
/// @notice Function that can be called once to initialize the registry
/// @param newOwner The initial owner of this contract
/// @param initBlockList Initial list of addresses to add to the blocklist
function initialize(address newOwner, address[] memory initBlockList) external initializer {
uint256 len = initBlockList.length;
for (uint8 i = 0; i < len; i++) {
Expand All @@ -46,11 +48,8 @@ contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeabl
Admin Functions
//////////////////////////////////////////////////////////////////////////*/

/// @notice function to clear the block list status
/// @dev must be called by the blockList owner or admin
/// @dev the blockList owner is likely the same as the owner of the token contract
/// but this could be different under certain applications. This implementation
/// makes no assumption of this though as it is standalone from the token contract.
/// @inheritdoc IBlockListRegistry
/// @dev Must be called by the blockList owner or blocklist admin
function clearBlockList() external onlyRoleOrOwner(BLOCK_LIST_ADMIN_ROLE) {
_c++;
emit BlockListCleared(msg.sender);
Expand All @@ -60,8 +59,7 @@ contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeabl
Public Read Functions
//////////////////////////////////////////////////////////////////////////*/

/// @notice function to get blocklist status with True meaning that the operator is blocked
/// @param operator - the address to check on the BlockList
/// @inheritdoc IBlockListRegistry
function getBlockListStatus(address operator) public view returns (bool) {
return _getBlockListStatus(operator);
}
Expand All @@ -75,11 +73,7 @@ contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeabl
Public Write Functions
//////////////////////////////////////////////////////////////////////////*/

/// @notice function to set the block list status for multiple operators
/// @dev must be called by the blockList owner or admin
/// @dev the blockList owner is likely the same as the owner of the token contract
/// but this could be different under certain applications. This implementation
/// makes no assumption of this though as it is standalone from the token contract.
/// @inheritdoc IBlockListRegistry
function setBlockListStatus(address[] calldata operators, bool status)
external
onlyRoleOrOwner(BLOCK_LIST_ADMIN_ROLE)
Expand All @@ -93,15 +87,15 @@ contract BlockListRegistry is IBlockListRegistry, OwnableAccessControlUpgradeabl
Internal Functions
//////////////////////////////////////////////////////////////////////////*/

/// @notice internal function to get blockList status
/// @param operator - the address for which to get the BlockList status
/// @notice Internal function to get blockList status
/// @param operator The address for which to get the BlockList status
function _getBlockListStatus(address operator) internal view returns (bool) {
return _blockList[_c][operator];
}

/// @notice internal function to set blockList status for one operator
/// @param operator - address to set the status for
/// @param status - True means add to the BlockList
/// @notice Internal function to set blockList status for one operator
/// @param operator Address to set the status for
/// @param status True means add to the BlockList
function _setBlockListStatus(address operator, bool status) internal {
_blockList[_c][operator] = status;
emit BlockListStatusChange(msg.sender, operator, status);
Expand Down
7 changes: 4 additions & 3 deletions src/BlockListRegistryFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity 0.8.19;

import {Ownable} from "openzeppelin/access/Ownable.sol";
import {Clones} from "openzeppelin/proxy/Clones.sol";
import {BlockListRegistry} from "./BlockListRegistry.sol";
import {BlockListRegistry} from "src/BlockListRegistry.sol";

/// @title BlockListFactory
/// @notice contract factory to deploy blocklist registries.
/// @notice Contract factory to deploy blocklist registries.
/// @author transientlabs.xyz
/// @custom:version 4.0.0
contract BlockListRegistryFactory is Ownable {
Expand All @@ -26,6 +26,7 @@ contract BlockListRegistryFactory is Ownable {
/*//////////////////////////////////////////////////////////////////////////
Constructor
//////////////////////////////////////////////////////////////////////////*/

constructor(address initRegistryTemplate) Ownable() {
blockListRegistryTemplate = initRegistryTemplate;
}
Expand All @@ -35,8 +36,8 @@ contract BlockListRegistryFactory is Ownable {
//////////////////////////////////////////////////////////////////////////*/

/// @notice Update the address of the blocklist registry template used.
/// @param newBlockListRegistryTemplate Address of template to be used by clones.
/// @dev Must be contract owner to call.
/// @param newBlockListRegistryTemplate Address of template to be used by clones.
function setBlockListRegistryTemplate(address newBlockListRegistryTemplate) external onlyOwner {
blockListRegistryTemplate = newBlockListRegistryTemplate;
}
Expand Down
95 changes: 0 additions & 95 deletions src/BlockListUpgradeable.sol

This file was deleted.

Loading

0 comments on commit 804c4b4

Please sign in to comment.