While not part of the core components of the network, these contracts play pivotal parts in setting up certain values, control plane settings for the network to function. The power of this is that new core mechanics can be built on top of them due to Web3 composability by anyone and adopted into the core network.
Marketplace Settings
The marketplace settings provides Rare Protocol with various information that influences the payment amounts such as: network fee (3%), primary sale fee (15%), and whether or not a token has previously sold (sale is a primary vs secondary sale).
Interface
interface IMarketplaceSettings {/** * @dev Get the max value to be used with the marketplace. * @return uint256 wei value. */functiongetMarketplaceMaxValue() externalviewreturns (uint256);/** * @dev Get the max value to be used with the marketplace. * @return uint256 wei value. */functiongetMarketplaceMinValue() externalviewreturns (uint256);/** * @dev Get the marketplace fee percentage. * @return uint8 wei fee. */functiongetMarketplaceFeePercentage() externalviewreturns (uint8); /** * @dev Utility function for calculating the marketplace fee for given amount of wei. * @param _amount uint256 wei amount. * @return uint256 wei fee. */functioncalculateMarketplaceFee(uint256_amount)externalviewreturns (uint256);/** * @dev Get the primary sale fee percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @return uint8 wei primary sale fee. */functiongetERC721ContractPrimarySaleFeePercentage(address_contractAddress)externalviewreturns (uint8);/** * @dev Utility function for calculating the primary sale fee for given amount of wei * @param _contractAddress address ERC721Contract address. * @param _amount uint256 wei amount. * @return uint256 wei fee. */functioncalculatePrimarySaleFee(address_contractAddress,uint256_amount)externalviewreturns (uint256);/** * @dev Check whether the ERC721 token has sold at least once. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @return bool of whether the token has sold. */functionhasERC721TokenSold(address_contractAddress,uint256_tokenId)externalviewreturns (bool);/** * @dev Mark a token as sold. * Requirements: * * - `_contractAddress` cannot be the zero address. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @param _hasSold bool of whether the token should be marked sold or not. */functionmarkERC721Token(address_contractAddress,uint256_tokenId,bool_hasSold ) external;}
Approved Token Registry
This registry holds the list of ERC20 tokens that are approved by the network to be used in the SuperRare ecosystem. This is an important aspect as we can guarantee that only the tokens agreed upon by the network (through the SIP procedure) are able to be used by our supporting contracts.
Interface
interface IApprovedTokenRegistry {/// @notice Returns if a token has been approved or not./// @param _tokenContract Contract of token being checked./// @return True if the token is allowed, false otherwise.functionisApprovedToken(address_tokenContract)externalviewreturns (bool);/// @notice Adds a token to the list of approved tokens./// @param _tokenContract Contract of token being approved.functionaddApprovedToken(address_tokenContract) external;/// @notice Removes a token from the approved tokens list./// @param _tokenContract Contract of token being approved.functionremoveApprovedToken(address_tokenContract) external;/// @notice Sets whether all token contracts should be approved./// @param _allTokensApproved Bool denoting if all tokens should be approved.functionsetAllTokensApproved(bool_allTokensApproved) external;}
Space Operator Registry
The Space Operator Registry provides the network with a nice interface to determine whether or not an address is a SuperRare Network approved Operator and what the platform commission is for that Operator (this is in place of the 15% on primary sales of other pieces).
As the ERC721 is a minimal standard for what constitutes an NFT we came up with our own way of denoting who the creator of an individual token is and being able to override it in the event that a wallet gets compromised (for the purpose of royalties). This registry encompasses all of that and is used by SuperRare Royalty Registry and transitively by the global one as well.
Before ERC-2981: The Royalty Standard existed, the SuperRare Network created a registry to store information on the royalty amount that needed to be paid for a given token and who it should be paid for. Currently we call the global royalty registry directly which under the hood will use the 2981 standard or this registry (only for SuperRareV1 and SuperRareV2 tokens).
Interface
interface IRoyaltyRegistry {/** * @dev Get the royalty fee percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @return uint8 wei royalty fee. */functiongetERC721TokenRoyaltyPercentage(address_contractAddress,uint256_tokenId ) externalviewreturns (uint8);/** * @dev Utililty function to calculate the royalty fee for a token. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @param _amount uint256 wei amount. * @return uint256 wei fee. */functioncalculateRoyaltyFee(address_contractAddress,uint256_tokenId,uint256_amount ) externalviewreturns (uint256);/** * @dev Utililty function to set the royalty percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @param _percentage percentage for royalty */functionsetPercentageForSetERC721ContractRoyalty(address_contractAddress,uint8_percentage ) external;functiontokenCreator(address_contractAddress,uint256_tokenId)externalviewreturns (address payable);}
Payments
Payments is, for the most part, a stateless contract whose only job is to facilitate the sending of eth from the market to an address. This utilizes the OpenZeppelin PullPayment contract in order to handle failed payments. If an eth transfer fails for whatever reason, the amount is escrowed within the contract allowing for a user to go in and claim their balance. This helps us mitigate against certain Denial of Service attacks.
Collector royalties is a program where previous owners from a token are able to partake in future sales of that token (starting once they are not involved in the sale). In order to have this done in an efficient manner, the total amounts are accumulated off-chain and bundled up into a single claim. This contract uses merkle proofs to keep both the cost down and the logic simple.