Skip to content

Commit 39ac9c9

Browse files
authored
Correct ERC-7201 support (#525)
1 parent 964ac86 commit 39ac9c9

33 files changed

+111
-53
lines changed

contracts/eip/ERC721AUpgradeable.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import "./ERC165.sol";
1515
import "../extension/upgradeable/Initializable.sol";
1616

1717
library ERC721AStorage {
18-
bytes32 public constant ERC721A_STORAGE_POSITION = keccak256("erc721.a.storage");
18+
/// @custom:storage-location erc7201:erc721.a.storage
19+
/// @dev keccak256(abi.encode(uint256(keccak256("erc721.a.storage")) - 1)) & ~bytes32(uint256(0xff))
20+
bytes32 public constant ERC721A_STORAGE_POSITION =
21+
0xe2efff925b8936e8a3471e86ad87942375e24de600ddfb2b841647ce1379ed00;
1922

2023
struct Data {
2124
// The tokenId of the next token to be minted.

contracts/extension/plugin/ContractMetadataStorage.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ pragma solidity ^0.8.0;
77
* @author thirdweb.com
88
*/
99
library ContractMetadataStorage {
10-
bytes32 public constant CONTRACT_METADATA_STORAGE_POSITION = keccak256("contract.metadata.storage");
10+
/// @custom:storage-location erc7201:contract.metadata.storage
11+
/// @dev keccak256(abi.encode(uint256(keccak256("contract.metadata.storage")) - 1)) & ~bytes32(uint256(0xff))
12+
bytes32 public constant CONTRACT_METADATA_STORAGE_POSITION =
13+
0x4bc804ba64359c0e35e5ed5d90ee596ecaa49a3a930ddcb1470ea0dd625da900;
1114

1215
struct Data {
1316
string contractURI;

contracts/extension/plugin/ERC2771ContextStorage.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ pragma solidity ^0.8.0;
44
/// @author thirdweb
55

66
library ERC2771ContextStorage {
7-
bytes32 public constant ERC2771_CONTEXT_STORAGE_POSITION = keccak256("erc2771.context.storage");
7+
/// @custom:storage-location erc7201:erc2771.context.storage
8+
/// @dev keccak256(abi.encode(uint256(keccak256("erc2771.context.storage")) - 1)) & ~bytes32(uint256(0xff))
9+
bytes32 public constant ERC2771_CONTEXT_STORAGE_POSITION =
10+
0x82aadcdf5bea62fd30615b6c0754b644e71b6c1e8c55b71bb927ad005b504f00;
811

912
struct Data {
1013
mapping(address => bool) _trustedForwarder;

contracts/extension/plugin/PermissionsEnumerableStorage.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import "../interface/IPermissionsEnumerable.sol";
99
* @author thirdweb.com
1010
*/
1111
library PermissionsEnumerableStorage {
12-
bytes32 public constant PERMISSIONS_ENUMERABLE_STORAGE_POSITION = keccak256("permissions.enumerable.storage");
12+
/// @custom:storage-location erc7201:permissions.enumerable.storage
13+
/// @dev keccak256(abi.encode(uint256(keccak256("permissions.enumerable.storage")) - 1)) & ~bytes32(uint256(0xff))
14+
bytes32 public constant PERMISSIONS_ENUMERABLE_STORAGE_POSITION =
15+
0x1ea2ed6cf13bfad376ba49bede85b663fef0b40eac197c5ac8e6f92ec4076100;
1316

1417
/**
1518
* @notice A data structure to store data of members for a given role.

contracts/extension/plugin/PermissionsStorage.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ pragma solidity ^0.8.0;
77
* @author thirdweb.com
88
*/
99
library PermissionsStorage {
10-
bytes32 public constant PERMISSIONS_STORAGE_POSITION = keccak256("permissions.storage");
10+
/// @custom:storage-location erc7201:permissions.storage
11+
/// @dev keccak256(abi.encode(uint256(keccak256("permissions.storage")) - 1)) & ~bytes32(uint256(0xff))
12+
bytes32 public constant PERMISSIONS_STORAGE_POSITION =
13+
0x0a7b0f5c59907924802379ebe98cdc23e2ee7820f63d30126e10b3752010e500;
1114

1215
struct Data {
1316
/// @dev Map from keccak256 hash of a role => a map from address => whether address has role.

contracts/extension/plugin/PlatformFeeStorage.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ pragma solidity ^0.8.0;
77
* @author thirdweb.com
88
*/
99
library PlatformFeeStorage {
10-
bytes32 public constant PLATFORM_FEE_STORAGE_POSITION = keccak256("platform.fee.storage");
10+
/// @custom:storage-location erc7201:platform.fee.storage
11+
/// @dev keccak256(abi.encode(uint256(keccak256("platform.fee.storage")) - 1)) & ~bytes32(uint256(0xff))
12+
bytes32 public constant PLATFORM_FEE_STORAGE_POSITION =
13+
0xc0c34308b4a2f4c5ee9af8ba82541cfb3c33b076d1fd05c65f9ce7060c64c400;
1114

1215
struct Data {
1316
/// @dev The address that receives all platform fees from all sales.

contracts/extension/plugin/ReentrancyGuardStorage.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ pragma solidity ^0.8.0;
44
/// @author thirdweb
55

66
library ReentrancyGuardStorage {
7-
bytes32 public constant REENTRANCY_GUARD_STORAGE_POSITION = keccak256("reentrancy.guard.storage");
7+
/// @custom:storage-location erc7201:reentrancy.guard.storage
8+
/// @dev keccak256(abi.encode(uint256(keccak256("reentrancy.guard.storage")) - 1)) & ~bytes32(uint256(0xff))
9+
bytes32 public constant REENTRANCY_GUARD_STORAGE_POSITION =
10+
0x1d281c488dae143b6ea4122e80c65059929950b9c32f17fc57be22089d9c3b00;
811

912
struct Data {
1013
uint256 _status;

contracts/extension/plugin/Router.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import "../../external-deps/openzeppelin/utils/EnumerableSet.sol";
1212
* @author thirdweb.com
1313
*/
1414
library RouterStorage {
15-
bytes32 public constant ROUTER_STORAGE_POSITION = keccak256("router.storage");
15+
/// @custom:storage-location erc7201:router.storage
16+
/// @dev keccak256(abi.encode(uint256(keccak256("router.storage")) - 1)) & ~bytes32(uint256(0xff))
17+
bytes32 public constant ROUTER_STORAGE_POSITION =
18+
0x012ef321094c8c682aa635dfdfcd754624a7473f08ad6ac415bb7f35eb12a100;
1619

1720
struct Data {
1821
EnumerableSet.Bytes32Set allSelectors;

contracts/extension/plugin/RoyaltyPayments.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import "../interface/IRoyaltyEngineV1.sol";
88
import { IERC2981 } from "../../eip/interface/IERC2981.sol";
99

1010
library RoyaltyPaymentsStorage {
11-
bytes32 public constant ROYALTY_PAYMENTS_STORAGE_POSITION = keccak256("royalty.payments.storage");
11+
/// @custom:storage-location erc7201:royalty.payments.storage
12+
/// @dev keccak256(abi.encode(uint256(keccak256("royalty.payments.storage")) - 1)) & ~bytes32(uint256(0xff))
13+
bytes32 public constant ROYALTY_PAYMENTS_STORAGE_POSITION =
14+
0xc802b338f3fb784853cf3c808df5ff08335200e394ea2c687d12571a91045000;
1215

1316
struct Data {
1417
/// @dev The address of RoyaltyEngineV1, replacing the one set during construction.

contracts/extension/upgradeable/AccountPermissions.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import "../../external-deps/openzeppelin/utils/cryptography/EIP712.sol";
88
import "../../external-deps/openzeppelin/utils/structs/EnumerableSet.sol";
99

1010
library AccountPermissionsStorage {
11-
/// @custom:storage-location erc7201:extension.manager.storage
11+
/// @custom:storage-location erc7201:account.permissions.storage
12+
/// @dev keccak256(abi.encode(uint256(keccak256("account.permissions.storage")) - 1)) & ~bytes32(uint256(0xff))
1213
bytes32 public constant ACCOUNT_PERMISSIONS_STORAGE_POSITION =
13-
keccak256(abi.encode(uint256(keccak256("account.permissions.storage")) - 1)) & ~bytes32(uint256(0xff));
14+
0x3181e78fc1b109bc611fd2406150bf06e33faa75f71cba12c3e1fd670f2def00;
1415

1516
struct Data {
1617
/// @dev The set of all admins of the wallet.

0 commit comments

Comments
 (0)