diff --git a/.changeset/spicy-sheep-eat.md b/.changeset/spicy-sheep-eat.md new file mode 100644 index 00000000000..17b6d558514 --- /dev/null +++ b/.changeset/spicy-sheep-eat.md @@ -0,0 +1,5 @@ +--- +'openzeppelin-solidity': major +--- + +`access`: Move `AccessControl` extensions to a dedicated directory. diff --git a/contracts/access/README.adoc b/contracts/access/README.adoc index 117cd7c9735..b03753d9652 100644 --- a/contracts/access/README.adoc +++ b/contracts/access/README.adoc @@ -8,7 +8,7 @@ This directory provides ways to restrict who can access the functions of a contr - {AccessControl} provides a general role based access control mechanism. Multiple hierarchical roles can be created and assigned each to multiple accounts. - {Ownable} is a simpler mechanism with a single owner "role" that can be assigned to a single account. This simpler mechanism can be useful for quick tests but projects with production concerns are likely to outgrow it. -== Authorization +== Core {{Ownable}} @@ -18,8 +18,12 @@ This directory provides ways to restrict who can access the functions of a contr {{AccessControl}} +== Extensions + {{IAccessControlEnumerable}} {{AccessControlEnumerable}} +{{IAccessControlDefaultAdminRules}} + {{AccessControlDefaultAdminRules}} diff --git a/contracts/access/AccessControlDefaultAdminRules.sol b/contracts/access/extensions/AccessControlDefaultAdminRules.sol similarity index 98% rename from contracts/access/AccessControlDefaultAdminRules.sol rename to contracts/access/extensions/AccessControlDefaultAdminRules.sol index 4572a328d6a..e8820cb4b4f 100644 --- a/contracts/access/AccessControlDefaultAdminRules.sol +++ b/contracts/access/extensions/AccessControlDefaultAdminRules.sol @@ -3,11 +3,11 @@ pragma solidity ^0.8.19; -import {AccessControl, IAccessControl} from "./AccessControl.sol"; import {IAccessControlDefaultAdminRules} from "./IAccessControlDefaultAdminRules.sol"; -import {SafeCast} from "../utils/math/SafeCast.sol"; -import {Math} from "../utils/math/Math.sol"; -import {IERC5313} from "../interfaces/IERC5313.sol"; +import {AccessControl, IAccessControl} from "../AccessControl.sol"; +import {SafeCast} from "../../utils/math/SafeCast.sol"; +import {Math} from "../../utils/math/Math.sol"; +import {IERC5313} from "../../interfaces/IERC5313.sol"; /** * @dev Extension of {AccessControl} that allows specifying special rules to manage diff --git a/contracts/access/AccessControlEnumerable.sol b/contracts/access/extensions/AccessControlEnumerable.sol similarity index 95% rename from contracts/access/AccessControlEnumerable.sol rename to contracts/access/extensions/AccessControlEnumerable.sol index 6f160e4e8ce..2512c43796f 100644 --- a/contracts/access/AccessControlEnumerable.sol +++ b/contracts/access/extensions/AccessControlEnumerable.sol @@ -4,8 +4,8 @@ pragma solidity ^0.8.19; import {IAccessControlEnumerable} from "./IAccessControlEnumerable.sol"; -import {AccessControl} from "./AccessControl.sol"; -import {EnumerableSet} from "../utils/structs/EnumerableSet.sol"; +import {AccessControl} from "../AccessControl.sol"; +import {EnumerableSet} from "../../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. diff --git a/contracts/access/IAccessControlDefaultAdminRules.sol b/contracts/access/extensions/IAccessControlDefaultAdminRules.sol similarity index 99% rename from contracts/access/IAccessControlDefaultAdminRules.sol rename to contracts/access/extensions/IAccessControlDefaultAdminRules.sol index a1afb3d22e5..7dac1c1f276 100644 --- a/contracts/access/IAccessControlDefaultAdminRules.sol +++ b/contracts/access/extensions/IAccessControlDefaultAdminRules.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.19; -import {IAccessControl} from "./IAccessControl.sol"; +import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlDefaultAdminRules declared to support ERC165 detection. diff --git a/contracts/access/IAccessControlEnumerable.sol b/contracts/access/extensions/IAccessControlEnumerable.sol similarity index 95% rename from contracts/access/IAccessControlEnumerable.sol rename to contracts/access/extensions/IAccessControlEnumerable.sol index 1bd88a4f4de..bc59ed58635 100644 --- a/contracts/access/IAccessControlEnumerable.sol +++ b/contracts/access/extensions/IAccessControlEnumerable.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.19; -import {IAccessControl} from "./IAccessControl.sol"; +import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. diff --git a/test/access/AccessControlDefaultAdminRules.test.js b/test/access/extensions/AccessControlDefaultAdminRules.test.js similarity index 95% rename from test/access/AccessControlDefaultAdminRules.test.js rename to test/access/extensions/AccessControlDefaultAdminRules.test.js index b8eae322088..af34143f198 100644 --- a/test/access/AccessControlDefaultAdminRules.test.js +++ b/test/access/extensions/AccessControlDefaultAdminRules.test.js @@ -2,7 +2,7 @@ const { time, constants, expectRevert } = require('@openzeppelin/test-helpers'); const { shouldBehaveLikeAccessControl, shouldBehaveLikeAccessControlDefaultAdminRules, -} = require('./AccessControl.behavior.js'); +} = require('../AccessControl.behavior.js'); const AccessControlDefaultAdminRules = artifacts.require('$AccessControlDefaultAdminRules'); diff --git a/test/access/AccessControlEnumerable.test.js b/test/access/extensions/AccessControlEnumerable.test.js similarity index 92% rename from test/access/AccessControlEnumerable.test.js rename to test/access/extensions/AccessControlEnumerable.test.js index 429f22f8f1a..7dfb0bce8b1 100644 --- a/test/access/AccessControlEnumerable.test.js +++ b/test/access/extensions/AccessControlEnumerable.test.js @@ -2,7 +2,7 @@ const { DEFAULT_ADMIN_ROLE, shouldBehaveLikeAccessControl, shouldBehaveLikeAccessControlEnumerable, -} = require('./AccessControl.behavior.js'); +} = require('../AccessControl.behavior.js'); const AccessControlEnumerable = artifacts.require('$AccessControlEnumerable');