diff --git a/packages/asset/contracts/Asset.sol b/packages/asset/contracts/Asset.sol index 964f35add2..38eebde71f 100644 --- a/packages/asset/contracts/Asset.sol +++ b/packages/asset/contracts/Asset.sol @@ -336,7 +336,7 @@ contract Asset is return TokenIdUtils.isBridged(tokenId); } - /// @notice This function is used to register Asset contract on the Operator Filterer Registry of Opensea.can only be called by admin. + /// @notice This function is used to register Asset contract on the Operator Filterer Registry of OpenSea.can only be called by admin. /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list. /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe. /// @param subscribe bool to signify subscription "true"" or to copy the list "false". diff --git a/packages/asset/contracts/Catalyst.sol b/packages/asset/contracts/Catalyst.sol index 36a3491046..fd6f23e3fa 100644 --- a/packages/asset/contracts/Catalyst.sol +++ b/packages/asset/contracts/Catalyst.sol @@ -30,7 +30,7 @@ import {ICatalyst} from "./interfaces/ICatalyst.sol"; /// @title Catalyst /// @author The Sandbox -/// @notice THis contract manages catalysts which are used to mint new assets. +/// @notice This contract manages catalysts which are used to mint new assets. /// @dev An ERC1155 contract that manages catalysts, extends multiple OpenZeppelin contracts to /// provide a variety of features including, AccessControl, URIStorage, Burnable and more. /// The contract includes support for meta transactions. @@ -77,7 +77,7 @@ contract Catalyst is address _defaultMinter, string[] memory _catalystIpfsCID, address _royaltyManager - ) public initializer { + ) external initializer { require(bytes(_baseUri).length != 0, "Catalyst: base uri can't be empty"); require(_trustedForwarder != address(0), "Catalyst: trusted forwarder can't be zero"); require(_subscription != address(0), "Catalyst: subscription can't be zero"); @@ -235,7 +235,7 @@ contract Catalyst is /// @param to address to which the token will be transfered. /// @param id the token type transfered. /// @param value amount of token transfered. - /// @param data aditional data accompanying the transfer. + /// @param data additional data accompanying the transfer. function safeTransferFrom( address from, address to, @@ -252,7 +252,7 @@ contract Catalyst is /// @param to address to which the token will be transfered. /// @param ids ids of each token type transfered. /// @param values amount of each token type transfered. - /// @param data aditional data accompanying the transfer. + /// @param data additional data accompanying the transfer. function safeBatchTransferFrom( address from, address to, @@ -293,7 +293,7 @@ contract Catalyst is return super.supportsInterface(interfaceId); } - /// @notice This function is used to register Catalyst contract on the Operator Filterer Registry of Opensea.can only be called by admin. + /// @notice This function is used to register Catalyst contract on the Operator Filterer Registry of OpenSea. Can only be called by admin. /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list. /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe. /// @param subscribe bool to signify subscription "true"" or to copy the list "false". diff --git a/packages/asset/docs/Asset.md b/packages/asset/docs/Asset.md index 678f8249de..aede9fb989 100644 --- a/packages/asset/docs/Asset.md +++ b/packages/asset/docs/Asset.md @@ -176,6 +176,7 @@ Sets a new trusted forwarder for meta-transactions. Parameters: - `trustedForwarder` - The new trusted forwarder. + ### setTokenRoyalties ```solidity @@ -183,7 +184,7 @@ function setTokenRoyalties( uint256 tokenId, address payable recipient, address creator -) external override onlyRole(DEFAULT_ADMIN_ROLE) +) external override onlyRole(DEFAULT_ADMIN_ROLE) ``` Sets token royalty i.e. the creator splitter address as EIP2981 royalty recipient. deploys a splitter if there is none deployed for a creator. Only admin can call it. @@ -254,7 +255,6 @@ Parameters: - `tokenId` - the id of the token. - ### isBridged ```solidity @@ -275,7 +275,7 @@ function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subsc onlyRole(DEFAULT_ADMIN_ROLE) ``` -Used to register and subscribe on the operator filter registry of Opensea +Used to register and subscribe on the operator filter registry of OpenSea Parameters: @@ -286,7 +286,7 @@ Parameters: ```solidity function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) -```fu +``` Used to the address of the operator filter registry diff --git a/packages/dependency-operator-filter/contracts/OperatorFilterRegistrant.md b/packages/dependency-operator-filter/contracts/OperatorFilterRegistrant.md index 7c3b8b98c4..020a8fe519 100644 --- a/packages/dependency-operator-filter/contracts/OperatorFilterRegistrant.md +++ b/packages/dependency-operator-filter/contracts/OperatorFilterRegistrant.md @@ -1,19 +1,20 @@ -# OperatorFilterRegistry -Opensea in an attempt to regularize market places and creator earnings deployed a registry(https://github.com/ProjectOpenSea/operator-filter-registry) and asked NFT token contract to add filter logic(https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol). +# OperatorFilterRegistry -These filter has two modifier -1st : onlyAllowedOperator +OpenSea in an attempt to regularize market places and creator earnings deployed a registry(https://github.com/ProjectOpenSea/operator-filter-registry) and asked NFT token contract to add filter logic(https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol). + +These filter has two modifier +1st : onlyAllowedOperator 2nd : onlyAllowedOperatorApproval -These modifiers are added to to the transfer functions(onlyAllowedOperator) and approval function(onlyAllowedOperatorApproval) such that the when not an owner tried to transfer a Token(ex: Marketplace) or owner approves an operator(ex : Marketplace) they would be filtered on the OperatorFilterRegistry. +These modifiers are added to to the transfer functions(onlyAllowedOperator) and approval function(onlyAllowedOperatorApproval) such that the when not an owner tried to transfer a Token(ex: Marketplace) or owner approves an operator(ex : Marketplace) they would be filtered on the OperatorFilterRegistry. If the operator or the token transfer is not approved by the registry the transaction would be reverted. -On OperatorFilterRegistry a contract owner or the contract can register and maintain there own blacklist or subscribe to other blacklists but that blacklist should contain the default marketplaces blacklisted by Opensea. +On OperatorFilterRegistry a contract owner or the contract can register and maintain there own blacklist or subscribe to other blacklists but that blacklist should contain the default marketplaces blacklisted by OpenSea. -# OperatorFiltererRegistrant +# OperatorFiltererRegistrant -The OperatorFiltererRegistrant contract is made to be registered on the OperatorFilterRegistry and copy the default blacklist of the openSea. This contract would then be subscribed by the contract such as AssetERC721 and AssetERC1155. +The OperatorFiltererRegistrant contract is made to be registered on the OperatorFilterRegistry and copy the default blacklist of the OpenSea. This contract would then be subscribed by the contract such as AssetERC721 and AssetERC1155. The OperatorFiltererRegistrant would be the subscription for our token contracts on a layer(layer-1 : Ethereum , layer-2: Polygon), such that when a address is added or removed from OperatorFiltererRegistrant's blacklist it would be come in affect for each contact which subscribe to the OperatorFiltererRegistrant's blacklist. @@ -21,7 +22,7 @@ The OperatorFiltererRegistrant would be the subscription for our token contracts The OperatorFiltererRegistrant is so that sandbox will have a common blacklist that would be utilized by every Token contract on a layer. This would create a single list that would be subscribed by each contract to provide uniformity to which market places sandbox wants to blacklist. This would also provide a focal point to remove and add market places such that it would be applicable to every contract that subscribe to it. -# Implementation +# Implementation We didn't use the npm package as its solidity pragma(solidity version) doesn't match the one we have for our Asset contracts and updating our solidity version for Assets would have been to time consuming. diff --git a/packages/dependency-operator-filter/contracts/OperatorFilterSubscription.sol b/packages/dependency-operator-filter/contracts/OperatorFilterSubscription.sol index 4e192c87af..f5f41c7def 100644 --- a/packages/dependency-operator-filter/contracts/OperatorFilterSubscription.sol +++ b/packages/dependency-operator-filter/contracts/OperatorFilterSubscription.sol @@ -6,16 +6,16 @@ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; /// @title OperatorFilterSubription /// @author The Sandbox -/// @notice This contract is meant to register and copy the default subscription of the OpenSea for the operator filter and our Token contract are supposed to subscribe to this contract on openSea operator filter registry +/// @notice This contract is meant to register and copy the default subscription of the OpenSea for the operator filter and our Token contract are supposed to subscribe to this contract on OpenSea operator filter registry contract OperatorFilterSubscription is Ownable { - address public constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); + address public constant DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6; // solhint-disable-next-line const-name-snakecase IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor() Ownable() { - // Subscribe and copy the entries of the Default subscription list of open sea. + // Subscribe and copy the entries of the Default subscription list of OpenSea. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), DEFAULT_SUBSCRIPTION); } diff --git a/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol b/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol index 562b309742..526e18846a 100644 --- a/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol +++ b/packages/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol @@ -6,8 +6,8 @@ import {IOperatorFilterRegistry} from "./interfaces/IOperatorFilterRegistry.sol" import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; ///@title OperatorFiltererUpgradeable -///@author The SandBox -///@notice This contract would subscibe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's addess could be set using a setter which could be implemented in inherting contract +///@author The Sandbox +///@notice This contract would subscribe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's address could be set using a setter which could be implemented in inheriting contract abstract contract OperatorFiltererUpgradeable is Initializable, ContextUpgradeable { event OperatorFilterRegistrySet(address indexed registry); diff --git a/packages/dependency-operator-filter/contracts/mock/MockOperatorFilterRegistry.sol b/packages/dependency-operator-filter/contracts/mock/MockOperatorFilterRegistry.sol index 2fd476ba1e..bfcb5019e3 100644 --- a/packages/dependency-operator-filter/contracts/mock/MockOperatorFilterRegistry.sol +++ b/packages/dependency-operator-filter/contracts/mock/MockOperatorFilterRegistry.sol @@ -11,7 +11,7 @@ import { /** * @title MockOperatorFilterRegistry - * @notice Made based on the OperatorFilterRegistry of openSea at https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterRegistry.sol + * @notice Made based on the OperatorFilterRegistry of OpenSea at https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterRegistry.sol * @notice This contracts allows tokens or token owners to register specific addresses or codeHashes that may be * * restricted according to the isOperatorAllowed function. */ diff --git a/packages/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol b/packages/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol index 3d5357597c..50078e5be9 100644 --- a/packages/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol +++ b/packages/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol @@ -10,10 +10,10 @@ import { import {IEIP2981} from "@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol"; import {IRoyaltyManager, Recipient} from "./interfaces/IRoyaltyManager.sol"; -/// @title MultiRoyaltyDistributer +/// @title MultiRoyaltyDistributor /// @author The Sandbox -/// @dev The MultiRoyaltyDistributer contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters. -/// @dev This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to slip its royalty between the creator and Sandbox and use it for every token minted by that creator. +/// @dev The MultiRoyaltyDistributor contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters. +/// @dev This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to split its royalty between the creator and Sandbox and use it for every token minted by that creator. abstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, ERC165Upgradeable { uint16 internal constant TOTAL_BASIS_POINTS = 10000; address private royaltyManager; @@ -24,6 +24,7 @@ abstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, // solhint-disable-next-line func-name-mixedcase function __MultiRoyaltyDistributor_init(address _royaltyManager) internal onlyInitializing { _setRoyaltyManager(_royaltyManager); + __ERC165_init_unchained(); } /// @notice Query if a contract implements interface `id`. diff --git a/packages/dependency-royalty-management/contracts/RoyaltyDistributor.sol b/packages/dependency-royalty-management/contracts/RoyaltyDistributor.sol index ac5c57b26b..0fa83a271e 100644 --- a/packages/dependency-royalty-management/contracts/RoyaltyDistributor.sol +++ b/packages/dependency-royalty-management/contracts/RoyaltyDistributor.sol @@ -19,6 +19,7 @@ abstract contract RoyaltyDistributor is IERC2981Upgradeable, ERC165Upgradeable { // solhint-disable-next-line func-name-mixedcase function __RoyaltyDistributor_init(address _royaltyManager) internal onlyInitializing { _setRoyaltyManager(_royaltyManager); + __ERC165_init_unchained(); } /// @notice Returns how much royalty is owed and to whom based on ERC2981 diff --git a/packages/dependency-royalty-management/contracts/RoyaltyManager.sol b/packages/dependency-royalty-management/contracts/RoyaltyManager.sol index a5f8f8b2a7..1c93b36acf 100644 --- a/packages/dependency-royalty-management/contracts/RoyaltyManager.sol +++ b/packages/dependency-royalty-management/contracts/RoyaltyManager.sol @@ -90,7 +90,7 @@ contract RoyaltyManager is AccessControlUpgradeable, IRoyaltyManager { /// @notice get the current trustedForwarder address /// @return trustedForwarder address of current TrustedForwarder - function getTrustedForwarder() public view returns (address trustedForwarder) { + function getTrustedForwarder() external view returns (address trustedForwarder) { return _trustedForwarder; } diff --git a/packages/dependency-royalty-management/contracts/RoyaltySplitter.sol b/packages/dependency-royalty-management/contracts/RoyaltySplitter.sol index 85f7a4b401..ff9a0e2204 100644 --- a/packages/dependency-royalty-management/contracts/RoyaltySplitter.sol +++ b/packages/dependency-royalty-management/contracts/RoyaltySplitter.sol @@ -38,9 +38,6 @@ contract RoyaltySplitter is using SafeERC20 for IERC20; uint256 internal constant TOTAL_BASIS_POINTS = 10000; - uint256 internal constant IERC20_APPROVE_SELECTOR = - 0x095ea7b300000000000000000000000000000000000000000000000000000000; - uint256 internal constant SELECTOR_MASK = 0xffffffff00000000000000000000000000000000000000000000000000000000; address payable public recipient; IRoyaltyManager public royaltyManager; @@ -72,10 +69,11 @@ contract RoyaltySplitter is /// @dev can only be run once. /// @param recipientAddress the wallet of the creator when the contract is deployed /// @param _royaltyManager the address of the royalty manager contract - function initialize(address payable recipientAddress, address _royaltyManager) public initializer { + function initialize(address payable recipientAddress, address _royaltyManager) external initializer { royaltyManager = IRoyaltyManager(_royaltyManager); // set manager before Ownable_init for _isTrustedForwarder _setRecipient(recipientAddress); __Ownable_init(); + __ERC165_init(); } /// @notice sets recipient for the splitter @@ -87,7 +85,6 @@ contract RoyaltySplitter is } function _setRecipient(address payable recipientAddress) private { - delete recipient; recipient = recipientAddress; emit RecipientSet(recipientAddress); } @@ -112,7 +109,7 @@ contract RoyaltySplitter is /// @notice Splits and forwards ETH to the royalty receivers /// @dev normally ETH should be split automatically by receive function. - function splitETH() public payable { + function splitETH() external payable { _splitETH(address(this).balance); } @@ -145,7 +142,7 @@ contract RoyaltySplitter is /// @notice split ERC20 Tokens owned by this contract. /// @dev can only be called by one of the recipients /// @param erc20Contract the address of the tokens to be split. - function splitERC20Tokens(IERC20 erc20Contract) public { + function splitERC20Tokens(IERC20 erc20Contract) external { require(_splitERC20Tokens(erc20Contract), "Split: ERC20 split failed"); } diff --git a/packages/deploy/deploy/400_asset/400_asset_operator_filter_setup.ts b/packages/deploy/deploy/400_asset/400_asset_operator_filter_setup.ts index a04b80f56a..8441e7963f 100644 --- a/packages/deploy/deploy/400_asset/400_asset_operator_filter_setup.ts +++ b/packages/deploy/deploy/400_asset/400_asset_operator_filter_setup.ts @@ -27,7 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { DEFAULT_SUBSCRIPTION ); console.log( - "common subscription registered on operator filter registry and opensea's blacklist copied" + "common subscription registered on operator filter registry and OpenSea's blacklist copied" ); } }