Skip to content

Commit

Permalink
Refactor Access Controller into access folder (#29)
Browse files Browse the repository at this point in the history
* refactor: Access Controller into access folder
* refactor: Access controller test folder
  • Loading branch information
jdubpark authored Mar 29, 2024
1 parent 5832c61 commit d6ca84f
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion contracts/IPAccountImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/Sig
import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import { IERC6551Account } from "erc6551/interfaces/IERC6551Account.sol";

import { IAccessController } from "./interfaces/IAccessController.sol";
import { IAccessController } from "./interfaces/access/IAccessController.sol";
import { IIPAccount } from "./interfaces/IIPAccount.sol";
import { MetaTx } from "./lib/MetaTx.sol";
import { Errors } from "./lib/Errors.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/AccessControlled.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IAccessController } from "../interfaces/IAccessController.sol";
import { IAccessController } from "../interfaces/access/IAccessController.sol";
import { IPAccountChecker } from "../lib/registries/IPAccountChecker.sol";
import { IIPAccountRegistry } from "../interfaces/registries/IIPAccountRegistry.sol";
import { Errors } from "../lib/Errors.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IModuleRegistry } from "./interfaces/registries/IModuleRegistry.sol";
import { IAccessController } from "./interfaces/IAccessController.sol";
import { IIPAccountRegistry } from "./interfaces/registries/IIPAccountRegistry.sol";
import { IModuleRegistry } from "./interfaces/registries/IModuleRegistry.sol";
import { IPAccountChecker } from "./lib/registries/IPAccountChecker.sol";
import { IIPAccount } from "./interfaces/IIPAccount.sol";
import { AccessPermission } from "./lib/AccessPermission.sol";
import { Errors } from "./lib/Errors.sol";
import { GovernableUpgradeable } from "./governance/GovernableUpgradeable.sol";
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

import { IAccessController } from "../interfaces/access/IAccessController.sol";
import { IModuleRegistry } from "../interfaces/registries/IModuleRegistry.sol";
import { IIPAccountRegistry } from "../interfaces/registries/IIPAccountRegistry.sol";
import { IModuleRegistry } from "../interfaces/registries/IModuleRegistry.sol";
import { IPAccountChecker } from "../lib/registries/IPAccountChecker.sol";
import { IIPAccount } from "../interfaces/IIPAccount.sol";
import { GovernableUpgradeable } from "../governance/GovernableUpgradeable.sol";
import { AccessPermission } from "../lib/AccessPermission.sol";
import { Errors } from "../lib/Errors.sol";

/// @title AccessController
/// @dev This contract is used to control access permissions for different function calls in the protocol.
/// It allows setting permissions for specific function calls, checking permissions, and initializing the contract.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { AccessPermission } from "../lib/AccessPermission.sol";
import { AccessPermission } from "../../lib/AccessPermission.sol";

interface IAccessController {
/// @notice Emitted when a permission is set.
Expand Down
2 changes: 1 addition & 1 deletion script/foundry/deployment/Main.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { stdJson } from "forge-std/StdJson.sol";
import { TestProxyHelper } from "test/foundry/utils/TestProxyHelper.sol";

// contracts
import { AccessController } from "contracts/AccessController.sol";
import { AccessController } from "contracts/access/AccessController.sol";
import { IPAccountImpl } from "contracts/IPAccountImpl.sol";
import { IIPAccount } from "contracts/interfaces/IIPAccount.sol";
import { IRoyaltyPolicyLAP } from "contracts/interfaces/modules/royalty/policies/IRoyaltyPolicyLAP.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IIPAccount } from "../../contracts/interfaces/IIPAccount.sol";
import { AccessPermission } from "../../contracts/lib/AccessPermission.sol";
import { Errors } from "../../contracts/lib/Errors.sol";
import { TOKEN_WITHDRAWAL_MODULE_KEY } from "../../contracts/lib/modules/Module.sol";
import { TokenWithdrawalModule } from "../../contracts/modules/external/TokenWithdrawalModule.sol";

import { MockModule } from "./mocks/module/MockModule.sol";
import { MockOrchestratorModule } from "./mocks/module/MockOrchestratorModule.sol";
import { MockERC1155 } from "./mocks/token/MockERC1155.sol";
import { MockERC20 } from "./mocks/token/MockERC20.sol";
import { BaseTest } from "./utils/BaseTest.t.sol";
import { IIPAccount } from "../../../contracts/interfaces/IIPAccount.sol";
import { AccessPermission } from "../../../contracts/lib/AccessPermission.sol";
import { Errors } from "../../../contracts/lib/Errors.sol";
import { TOKEN_WITHDRAWAL_MODULE_KEY } from "../../../contracts/lib/modules/Module.sol";
import { TokenWithdrawalModule } from "../../../contracts/modules/external/TokenWithdrawalModule.sol";

import { MockModule } from "../mocks/module/MockModule.sol";
import { MockOrchestratorModule } from "../mocks/module/MockOrchestratorModule.sol";
import { MockERC1155 } from "../mocks/token/MockERC1155.sol";
import { MockERC20 } from "../mocks/token/MockERC20.sol";
import { BaseTest } from "../utils/BaseTest.t.sol";

contract AccessControllerTest is BaseTest {
MockModule public mockModule;
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/mocks/access/MockAccessController.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IAccessController } from "contracts/interfaces/IAccessController.sol";
import { IAccessController } from "contracts/interfaces/access/IAccessController.sol";
import { IIPAccount } from "contracts/interfaces/IIPAccount.sol";
import { Errors } from "contracts/lib/Errors.sol";
import { AccessPermission } from "contracts/lib/AccessPermission.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/mocks/module/MockMetaTxModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.23;

import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";

import { IAccessController } from "../../../../contracts/interfaces/IAccessController.sol";
import { IAccessController } from "../../../../contracts/interfaces/access/IAccessController.sol";
import { IIPAccount } from "../../../../contracts/interfaces/IIPAccount.sol";
import { IModule } from "../../../../contracts/interfaces/modules/base/IModule.sol";
import { IIPAccountRegistry } from "../../../../contracts/interfaces/registries/IIPAccountRegistry.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IAccessController } from "contracts/interfaces/IAccessController.sol";
import { IAccessController } from "contracts/interfaces/access/IAccessController.sol";
import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicensingModule.sol";
import { IRoyaltyModule } from "contracts/interfaces/modules/royalty/IRoyaltyModule.sol";
import { Errors } from "contracts/lib/Errors.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IAccessController } from "contracts/interfaces/IAccessController.sol";
import { IAccessController } from "contracts/interfaces/access/IAccessController.sol";
import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicensingModule.sol";
import { IRoyaltyModule } from "contracts/interfaces/modules/royalty/IRoyaltyModule.sol";
import { Errors } from "contracts/lib/Errors.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/modules/licensing/PILPolicyFramework.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.23;

import { IAccessController } from "contracts/interfaces/IAccessController.sol";
import { IAccessController } from "contracts/interfaces/access/IAccessController.sol";
import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicensingModule.sol";
import { Errors } from "contracts/lib/Errors.sol";
import { PILFrameworkErrors } from "contracts/lib/PILFrameworkErrors.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/utils/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { console2 } from "forge-std/console2.sol"; // console to indicate mock d
import { Test } from "forge-std/Test.sol";

// contracts
import { AccessController } from "../../../contracts/AccessController.sol";
import { AccessController } from "../../../contracts/access/AccessController.sol";
// solhint-disable-next-line max-line-length
import { DISPUTE_MODULE_KEY, ROYALTY_MODULE_KEY, LICENSING_MODULE_KEY } from "../../../contracts/lib/modules/Module.sol";
import { AccessPermission } from "../../../contracts/lib/AccessPermission.sol";
Expand Down
4 changes: 2 additions & 2 deletions test/foundry/utils/DeployHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { console2 } from "forge-std/console2.sol"; // console to indicate mock d
import { ERC6551Registry } from "erc6551/ERC6551Registry.sol";

// contracts
import { AccessController } from "../../../contracts/AccessController.sol";
import { AccessController } from "../../../contracts/access/AccessController.sol";
import { Governance } from "../../../contracts/governance/Governance.sol";
import { IAccessController } from "../../../contracts/interfaces/IAccessController.sol";
import { IAccessController } from "../../../contracts/interfaces/access/IAccessController.sol";
import { IGovernance } from "../../../contracts/interfaces/governance/IGovernance.sol";
import { IDisputeModule } from "../../../contracts/interfaces/modules/dispute/IDisputeModule.sol";
import { ILicensingModule } from "../../../contracts/interfaces/modules/licensing/ILicensingModule.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/utils/LicensingHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.23;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

// contract
import { IAccessController } from "../../../contracts/interfaces/IAccessController.sol";
import { IAccessController } from "../../../contracts/interfaces/access/IAccessController.sol";
import { IIPAccountRegistry } from "../../../contracts/interfaces/registries/IIPAccountRegistry.sol";
import { ILicensingModule } from "../../../contracts/interfaces/modules/licensing/ILicensingModule.sol";
import { IRoyaltyModule } from "../../../contracts/interfaces/modules/royalty/IRoyaltyModule.sol";
Expand Down

0 comments on commit d6ca84f

Please sign in to comment.