Skip to content

Commit

Permalink
Addendum [Q-12]: fully comply with ERC7201
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrishang committed Oct 4, 2023
1 parent e994c83 commit 72edf45
Show file tree
Hide file tree
Showing 24 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/AccountPermissions.sol
Expand Up @@ -10,7 +10,7 @@ import "../../external-deps/openzeppelin/utils/structs/EnumerableSet.sol";
library AccountPermissionsStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant ACCOUNT_PERMISSIONS_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("account.permissions.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("account.permissions.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev The set of all admins of the wallet.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/BatchMintMetadata.sol
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
library BatchMintMetadataStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant BATCH_MINT_METADATA_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("batch.mint.metadata.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("batch.mint.metadata.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev Largest tokenId of each batch of tokens with the same baseURI.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/BurnToClaim.sol
Expand Up @@ -14,7 +14,7 @@ import "../interface/IBurnToClaim.sol";
library BurnToClaimStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant BURN_TO_CLAIM_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("burn.to.claim.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("burn.to.claim.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
IBurnToClaim.BurnToClaimInfo burnToClaimInfo;
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/ContractMetadata.sol
Expand Up @@ -17,7 +17,7 @@ import "../interface/IContractMetadata.sol";
library ContractMetadataStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant CONTRACT_METADATA_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("contract.metadata.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("contract.metadata.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @notice Returns the contract metadata URI.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/DelayedReveal.sol
Expand Up @@ -8,7 +8,7 @@ import "../interface/IDelayedReveal.sol";
library DelayedRevealStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant DELAYED_REVEAL_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("delayed.reveal.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("delayed.reveal.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev Mapping from tokenId of a batch of tokens => to delayed reveal data.
Expand Down
3 changes: 2 additions & 1 deletion contracts/extension/upgradeable/Drop.sol
Expand Up @@ -8,7 +8,8 @@ import "../../lib/MerkleProof.sol";

library DropStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant DROP_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256("drop.storage")) - 1));
bytes32 public constant DROP_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("drop.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev The active conditions for claiming tokens.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/ERC2771Context.sol
Expand Up @@ -10,7 +10,7 @@ import "../interface/IERC2771Context.sol";
library ERC2771ContextStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant ERC2771_CONTEXT_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("erc2771.context.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("erc2771.context.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
mapping(address => bool) trustedForwarder;
Expand Down
Expand Up @@ -11,7 +11,7 @@ import "./Initializable.sol";
library ERC2771ContextStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant ERC2771_CONTEXT_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("erc2771.context.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("erc2771.context.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
mapping(address => bool) trustedForwarder;
Expand Down
3 changes: 2 additions & 1 deletion contracts/extension/upgradeable/Initializable.sol
Expand Up @@ -5,7 +5,8 @@ import "../../lib/TWAddress.sol";

library InitStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 constant INIT_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256("init.storage")) - 1));
bytes32 constant INIT_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("init.storage")) - 1)) & ~bytes32(uint256(0xff));

/// @dev Layout of the entrypoint contract's storage.
struct Data {
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/LazyMint.sol
Expand Up @@ -9,7 +9,7 @@ import "./BatchMintMetadata.sol";
library LazyMintStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant LAZY_MINT_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("lazy.mint.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("lazy.mint.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @notice The tokenId assigned to the next new NFT to be lazy minted.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/OperatorFilterToggle.sol
Expand Up @@ -8,7 +8,7 @@ import "../interface/IOperatorFilterToggle.sol";
library OperatorFilterToggleStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant OPERATOR_FILTER_TOGGLE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("operator.filter.toggle.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("operator.filter.toggle.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
bool operatorRestriction;
Expand Down
3 changes: 2 additions & 1 deletion contracts/extension/upgradeable/Ownable.sol
Expand Up @@ -14,7 +14,8 @@ import "../interface/IOwnable.sol";

library OwnableStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant OWNABLE_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256("ownable.storage")) - 1));
bytes32 public constant OWNABLE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("ownable.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev Owner of the contract (purpose: OpenSea compatibility)
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/Permissions.sol
Expand Up @@ -14,7 +14,7 @@ import "../../lib/TWStrings.sol";
library PermissionsStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant PERMISSIONS_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("permissions.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("permissions.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev Map from keccak256 hash of a role => a map from address => whether address has role.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/PermissionsEnumerable.sol
Expand Up @@ -15,7 +15,7 @@ import "./Permissions.sol";
library PermissionsEnumerableStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant PERMISSIONS_ENUMERABLE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("permissions.enumerable.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("permissions.enumerable.storage")) - 1)) & ~bytes32(uint256(0xff));

/**
* @notice A data structure to store data of members for a given role.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/PlatformFee.sol
Expand Up @@ -11,7 +11,7 @@ import "../interface/IPlatformFee.sol";
library PlatformFeeStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant PLATFORM_FEE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("platform.fee.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("platform.fee.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev The address that receives all platform fees from all sales.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/PrimarySale.sol
Expand Up @@ -8,7 +8,7 @@ import "../interface/IPrimarySale.sol";
library PrimarySaleStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant PRIMARY_SALE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("primary.sale.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("primary.sale.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
address recipient;
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/ReentrancyGuard.sol
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.8.0;
library ReentrancyGuardStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant REENTRANCY_GUARD_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("reentrancy.guard.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("reentrancy.guard.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
uint256 _status;
Expand Down
3 changes: 2 additions & 1 deletion contracts/extension/upgradeable/Royalty.sol
Expand Up @@ -7,7 +7,8 @@ import "../interface/IRoyalty.sol";

library RoyaltyStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant ROYALTY_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256("royalty.storage")) - 1));
bytes32 public constant ROYALTY_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("royalty.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev The (default) address that receives all royalty value.
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/RulesEngine.sol
Expand Up @@ -15,7 +15,7 @@ import "../../external-deps/openzeppelin/utils/structs/EnumerableSet.sol";
library RulesEngineStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant RULES_ENGINE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("rules.engine.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("rules.engine.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
address rulesEngineOverride;
Expand Down
2 changes: 1 addition & 1 deletion contracts/extension/upgradeable/SharedMetadataBatch.sol
Expand Up @@ -14,7 +14,7 @@ import "../../external-deps/openzeppelin/utils/EnumerableSet.sol";
library SharedMetadataBatchStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant SHARED_METADATA_BATCH_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("shared.metadata.batch.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("shared.metadata.batch.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
EnumerableSet.Bytes32Set ids;
Expand Down
Expand Up @@ -11,7 +11,7 @@ import { IDirectListings } from "../IMarketplace.sol";
library DirectListingsStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant DIRECT_LISTINGS_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("direct.listings.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("direct.listings.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
uint256 totalListings;
Expand Down
Expand Up @@ -11,7 +11,7 @@ import { IEnglishAuctions } from "../IMarketplace.sol";
library EnglishAuctionsStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant ENGLISH_AUCTIONS_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("english.auctions.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("english.auctions.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
uint256 totalAuctions;
Expand Down
3 changes: 2 additions & 1 deletion contracts/prebuilts/marketplace/offers/OffersStorage.sol
Expand Up @@ -10,7 +10,8 @@ import { IOffers } from "../IMarketplace.sol";
*/
library OffersStorage {
/// @custom:storage-location erc7201:extension.manager.storage
bytes32 public constant OFFERS_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256("offers.storage")) - 1));
bytes32 public constant OFFERS_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("offers.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
uint256 totalOffers;
Expand Down
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
library BurnToClaimDrop721Storage {
/// @custom:storage-location erc7201:burn.to.claim.drop.721.storage
bytes32 public constant BURN_TO_CLAIM_DROP_721_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("burn.to.claim.drop.721.storage")) - 1));
keccak256(abi.encode(uint256(keccak256("burn.to.claim.drop.721.storage")) - 1)) & ~bytes32(uint256(0xff));

struct Data {
/// @dev Global max total NFTs that can be minted.
Expand Down

0 comments on commit 72edf45

Please sign in to comment.