diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d714d444..e558a1444 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,12 +46,11 @@ jobs: - name: Run Forge build run: | forge --version - forge install OpenZeppelin/openzeppelin-foundry-upgrades --no-git forge build --force --sizes --skip test --skip script - name: Run Forge tests run: | - forge test -vvv --fork-url https://gateway.tenderly.co/public/sepolia --fork-block-number 5196000 --ffi --skip build + forge test -vvv --fork-url https://gateway.tenderly.co/public/sepolia --fork-block-number 5196000 id: forge-test - name: Run solhint diff --git a/contracts/modules/dispute/DisputeModule.sol b/contracts/modules/dispute/DisputeModule.sol index 49d9f56c0..3ae0eec7e 100644 --- a/contracts/modules/dispute/DisputeModule.sol +++ b/contracts/modules/dispute/DisputeModule.sol @@ -18,7 +18,14 @@ import { ShortStringOps } from "../../utils/ShortStringOps.sol"; /// @title Dispute Module /// @notice The dispute module acts as an enforcement layer for IP assets that allows raising and resolving disputes /// through arbitration by judges. -contract DisputeModule is IDisputeModule, BaseModule, GovernableUpgradeable, ReentrancyGuardUpgradeable, AccessControlled, UUPSUpgradeable { +contract DisputeModule is + IDisputeModule, + BaseModule, + GovernableUpgradeable, + ReentrancyGuardUpgradeable, + AccessControlled, + UUPSUpgradeable +{ using EnumerableSet for EnumerableSet.Bytes32Set; /// @dev Storage for DisputeModule @@ -44,7 +51,8 @@ contract DisputeModule is IDisputeModule, BaseModule, GovernableUpgradeable, Ree } // keccak256(abi.encode(uint256(keccak256("story-protocol.DisputeModule")) - 1)) & ~bytes32(uint256(0xff)); - bytes32 private constant DisputeModuleStorageLocation = 0x682945c2d364b4630e68ffe0854d372acb0c4ff549a1e3dbc6f878bd8da0c800; + bytes32 private constant DisputeModuleStorageLocation = + 0x682945c2d364b4630e68ffe0854d372acb0c4ff549a1e3dbc6f878bd8da0c800; string public constant override name = DISPUTE_MODULE_KEY; @@ -59,10 +67,7 @@ contract DisputeModule is IDisputeModule, BaseModule, GovernableUpgradeable, Ree /// @param _controller The address of the access controller /// @param _assetRegistry The address of the asset registry /// @custom:oz-upgrades-unsafe-allow constructor - constructor( - address _controller, - address _assetRegistry - ) AccessControlled(_controller, _assetRegistry) { + constructor(address _controller, address _assetRegistry) AccessControlled(_controller, _assetRegistry) { IP_ASSET_REGISTRY = IIPAssetRegistry(_assetRegistry); _disableInitializers(); } @@ -289,17 +294,18 @@ contract DisputeModule is IDisputeModule, BaseModule, GovernableUpgradeable, Ree bytes32 linkToDisputeEvidence, bytes32 targetTag, bytes32 currentTag - ) { - DisputeModuleStorage storage $ = _getDisputeModuleStorage(); - return ( - $.disputes[disputeId].targetIpId, - $.disputes[disputeId].disputeInitiator, - $.disputes[disputeId].arbitrationPolicy, - $.disputes[disputeId].linkToDisputeEvidence, - $.disputes[disputeId].targetTag, - $.disputes[disputeId].currentTag - ); - } + ) + { + DisputeModuleStorage storage $ = _getDisputeModuleStorage(); + return ( + $.disputes[disputeId].targetIpId, + $.disputes[disputeId].disputeInitiator, + $.disputes[disputeId].arbitrationPolicy, + $.disputes[disputeId].linkToDisputeEvidence, + $.disputes[disputeId].targetTag, + $.disputes[disputeId].currentTag + ); + } /// @notice Indicates if a dispute tag is whitelisted /// @param tag The dispute tag @@ -347,5 +353,4 @@ contract DisputeModule is IDisputeModule, BaseModule, GovernableUpgradeable, Ree $.slot := DisputeModuleStorageLocation } } - } diff --git a/contracts/modules/dispute/policies/ArbitrationPolicySP.sol b/contracts/modules/dispute/policies/ArbitrationPolicySP.sol index f6945aa39..91b5db419 100644 --- a/contracts/modules/dispute/policies/ArbitrationPolicySP.sol +++ b/contracts/modules/dispute/policies/ArbitrationPolicySP.sol @@ -37,11 +37,7 @@ contract ArbitrationPolicySP is IArbitrationPolicy, GovernableUpgradeable, UUPSU /// @param _paymentToken The ERC20 payment token address /// @param _arbitrationPrice The arbitration price /// @custom:oz-upgrades-unsafe-allow constructor - constructor( - address _disputeModule, - address _paymentToken, - uint256 _arbitrationPrice - ) { + constructor(address _disputeModule, address _paymentToken, uint256 _arbitrationPrice) { if (_disputeModule == address(0)) revert Errors.ArbitrationPolicySP__ZeroDisputeModule(); if (_paymentToken == address(0)) revert Errors.ArbitrationPolicySP__ZeroPaymentToken(); diff --git a/contracts/modules/licensing/LicensingModule.sol b/contracts/modules/licensing/LicensingModule.sol index e9cc0bb64..fd1b10e9e 100644 --- a/contracts/modules/licensing/LicensingModule.sol +++ b/contracts/modules/licensing/LicensingModule.sol @@ -34,7 +34,14 @@ import { GovernableUpgradeable } from "../../governance/GovernableUpgradeable.so /// - Linking IP to its parent /// - Verifying linking parameters /// - Verifying policy parameters -contract LicensingModule is AccessControlled, ILicensingModule, BaseModule, ReentrancyGuardUpgradeable, GovernableUpgradeable, UUPSUpgradeable { +contract LicensingModule is + AccessControlled, + ILicensingModule, + BaseModule, + ReentrancyGuardUpgradeable, + GovernableUpgradeable, + UUPSUpgradeable +{ using ERC165Checker for address; using IPAccountChecker for IIPAccountRegistry; using EnumerableSet for EnumerableSet.UintSet; @@ -621,10 +628,5 @@ contract LicensingModule is AccessControlled, ILicensingModule, BaseModule, Reen /// @dev Hook to authorize the upgrade according to UUPSUgradeable /// @param newImplementation The address of the new implementation - function _authorizeUpgrade(address newImplementation) - internal - onlyProtocolAdmin - override - {} - + function _authorizeUpgrade(address newImplementation) internal override onlyProtocolAdmin {} } diff --git a/contracts/modules/royalty/RoyaltyModule.sol b/contracts/modules/royalty/RoyaltyModule.sol index 37eb4be2b..8e9d8b038 100644 --- a/contracts/modules/royalty/RoyaltyModule.sol +++ b/contracts/modules/royalty/RoyaltyModule.sol @@ -17,7 +17,13 @@ import { BaseModule } from "../BaseModule.sol"; /// @title Story Protocol Royalty Module /// @notice The Story Protocol royalty module allows to set royalty policies an IP asset and pay royalties as a /// derivative IP. -contract RoyaltyModule is IRoyaltyModule, GovernableUpgradeable, ReentrancyGuardUpgradeable, BaseModule, UUPSUpgradeable { +contract RoyaltyModule is + IRoyaltyModule, + GovernableUpgradeable, + ReentrancyGuardUpgradeable, + BaseModule, + UUPSUpgradeable +{ using ERC165Checker for address; /// @dev Storage structure for the RoyaltyModule @@ -34,8 +40,9 @@ contract RoyaltyModule is IRoyaltyModule, GovernableUpgradeable, ReentrancyGuard } // keccak256(abi.encode(uint256(keccak256("story-protocol.RoyaltyModule")) - 1)) & ~bytes32(uint256(0xff)); - bytes32 private constant RoyaltyModuleStorageLocation = 0x98dd2c34f21d19fd1d178ed731f3db3d03e0b4e39f02dbeb040e80c9427a0300; - + bytes32 private constant RoyaltyModuleStorageLocation = + 0x98dd2c34f21d19fd1d178ed731f3db3d03e0b4e39f02dbeb040e80c9427a0300; + string public constant override name = ROYALTY_MODULE_KEY; /// @notice Constructor @@ -172,7 +179,8 @@ contract RoyaltyModule is IRoyaltyModule, GovernableUpgradeable, ReentrancyGuard // if the payer does not have a royalty policy set, then the payer is not a derivative ip and does not pay // royalties the receiver ip can have a zero royalty policy since that could mean it is an ip a root if (payerRoyaltyPolicy == address(0)) revert Errors.RoyaltyModule__NoRoyaltyPolicySet(); - if (!$.isWhitelistedRoyaltyPolicy[payerRoyaltyPolicy]) revert Errors.RoyaltyModule__NotWhitelistedRoyaltyPolicy(); + if (!$.isWhitelistedRoyaltyPolicy[payerRoyaltyPolicy]) + revert Errors.RoyaltyModule__NotWhitelistedRoyaltyPolicy(); IRoyaltyPolicy(payerRoyaltyPolicy).onRoyaltyPayment(msg.sender, receiverIpId, token, amount); diff --git a/contracts/modules/royalty/policies/RoyaltyPolicyLAP.sol b/contracts/modules/royalty/policies/RoyaltyPolicyLAP.sol index 0987b7a98..899e179c7 100644 --- a/contracts/modules/royalty/policies/RoyaltyPolicyLAP.sol +++ b/contracts/modules/royalty/policies/RoyaltyPolicyLAP.sol @@ -466,7 +466,7 @@ contract RoyaltyPolicyLAP is return splitClone; } - function _getRoyaltyPolicyLAPStorage() private pure returns(RoyaltyPolicyLAPStorage storage $) { + function _getRoyaltyPolicyLAPStorage() private pure returns (RoyaltyPolicyLAPStorage storage $) { assembly { $.slot := RoyaltyPolicyLAPStorageLocation } diff --git a/test/foundry/mocks/licensing/MockPolicyFrameworkManager.sol b/test/foundry/mocks/licensing/MockPolicyFrameworkManager.sol index 77906f683..1bd11140a 100644 --- a/test/foundry/mocks/licensing/MockPolicyFrameworkManager.sol +++ b/test/foundry/mocks/licensing/MockPolicyFrameworkManager.sol @@ -25,9 +25,7 @@ contract MockPolicyFrameworkManager is BasePolicyFrameworkManager { event MockPolicyAdded(uint256 indexed policyId, MockPolicy policy); /// @custom:oz-upgrades-unsafe-allow constructor - constructor( - MockPolicyFrameworkConfig memory conf - ) BasePolicyFrameworkManager(conf.licensingModule) { + constructor(MockPolicyFrameworkConfig memory conf) BasePolicyFrameworkManager(conf.licensingModule) { config = conf; royaltyPolicy = conf.royaltyPolicy; _getBasePolicyFrameworkManagerStorage().name = conf.name; diff --git a/test/foundry/modules/dispute/DisputeModule.t.sol b/test/foundry/modules/dispute/DisputeModule.t.sol index bb4289500..f9ee91a5e 100644 --- a/test/foundry/modules/dispute/DisputeModule.t.sol +++ b/test/foundry/modules/dispute/DisputeModule.t.sol @@ -58,22 +58,9 @@ contract DisputeModuleTest is BaseTest { USDC.mint(ipAccount1, 1000 * 10 ** 6); // second arbitration policy - address impl = address( - new ArbitrationPolicySP( - getDisputeModule(), - address(USDC), - ARBITRATION_PRICE - ) - ); + address impl = address(new ArbitrationPolicySP(getDisputeModule(), address(USDC), ARBITRATION_PRICE)); arbitrationPolicySP2 = ArbitrationPolicySP( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - ArbitrationPolicySP.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(ArbitrationPolicySP.initialize, (getGovernance()))) ); vm.startPrank(u.admin); diff --git a/test/foundry/modules/royalty/RoyaltyModule.t.sol b/test/foundry/modules/royalty/RoyaltyModule.t.sol index 27c9cc5d4..44616a8cd 100644 --- a/test/foundry/modules/royalty/RoyaltyModule.t.sol +++ b/test/foundry/modules/royalty/RoyaltyModule.t.sol @@ -48,22 +48,10 @@ contract TestRoyaltyModule is BaseTest { USDC.mint(ipAccount2, 1000 * 10 ** 6); // 1000 USDC address impl = address( - new RoyaltyPolicyLAP( - getRoyaltyModule(), - getLicensingModule(), - LIQUID_SPLIT_FACTORY, - LIQUID_SPLIT_MAIN - ) + new RoyaltyPolicyLAP(getRoyaltyModule(), getLicensingModule(), LIQUID_SPLIT_FACTORY, LIQUID_SPLIT_MAIN) ); royaltyPolicyLAP2 = RoyaltyPolicyLAP( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - RoyaltyPolicyLAP.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(RoyaltyPolicyLAP.initialize, (getGovernance()))) ); vm.startPrank(u.admin); @@ -136,14 +124,7 @@ contract TestRoyaltyModule is BaseTest { function test_RoyaltyModule_setLicensingModule_revert_ZeroLicensingModule() public { address impl = address(new RoyaltyModule()); RoyaltyModule testRoyaltyModule = RoyaltyModule( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - RoyaltyModule.initialize, ( - address(getGovernance()) - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(RoyaltyModule.initialize, (address(getGovernance())))) ); vm.expectRevert(Errors.RoyaltyModule__ZeroLicensingModule.selector); vm.prank(u.admin); @@ -154,14 +135,7 @@ contract TestRoyaltyModule is BaseTest { vm.startPrank(u.admin); address impl = address(new RoyaltyModule()); RoyaltyModule testRoyaltyModule = RoyaltyModule( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - RoyaltyModule.initialize, ( - address(getGovernance()) - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(RoyaltyModule.initialize, (address(getGovernance())))) ); testRoyaltyModule.setLicensingModule(address(licensingModule)); assertEq(testRoyaltyModule.licensingModule(), address(licensingModule)); diff --git a/test/foundry/modules/royalty/RoyaltyPolicyLAP.t.sol b/test/foundry/modules/royalty/RoyaltyPolicyLAP.t.sol index f9186f93e..94f665ba6 100644 --- a/test/foundry/modules/royalty/RoyaltyPolicyLAP.t.sol +++ b/test/foundry/modules/royalty/RoyaltyPolicyLAP.t.sol @@ -178,23 +178,9 @@ contract TestRoyaltyPolicyLAP is BaseTest { } function test_RoyaltyPolicyLAP_setAncestorsVaultImplementation() public { - address impl = address( - new RoyaltyPolicyLAP( - address(1), - address(2), - address(3), - address(4) - ) - ); + address impl = address(new RoyaltyPolicyLAP(address(1), address(2), address(3), address(4))); RoyaltyPolicyLAP royaltyPolicyLAP2 = RoyaltyPolicyLAP( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - RoyaltyPolicyLAP.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(RoyaltyPolicyLAP.initialize, (getGovernance()))) ); vm.startPrank(u.admin); diff --git a/test/foundry/utils/DeployHelper.t.sol b/test/foundry/utils/DeployHelper.t.sol index cac8e32fc..968bf4f57 100644 --- a/test/foundry/utils/DeployHelper.t.sol +++ b/test/foundry/utils/DeployHelper.t.sol @@ -221,14 +221,7 @@ contract DeployHelper { if (d.accessController) { address impl = address(new AccessController()); accessController = AccessController( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - AccessController.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(AccessController.initialize, (getGovernance()))) ); console2.log("DeployHelper: Using REAL AccessController"); @@ -247,14 +240,7 @@ contract DeployHelper { if (d.moduleRegistry) { address impl = address(new ModuleRegistry()); moduleRegistry = ModuleRegistry( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - AccessController.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(AccessController.initialize, (getGovernance()))) ); console2.log("DeployHelper: Using REAL ModuleRegistry"); postDeployConditions.moduleRegistry_registerModules = true; @@ -299,11 +285,7 @@ contract DeployHelper { royaltyModule = RoyaltyModule( TestProxyHelper.deployUUPSProxy( impl, - abi.encodeCall( - RoyaltyModule.initialize, ( - address(getGovernance()) - ) - ) + abi.encodeCall(RoyaltyModule.initialize, (address(getGovernance()))) ) ); console2.log("DeployHelper: Using REAL RoyaltyModule"); @@ -311,21 +293,9 @@ contract DeployHelper { } if (d.disputeModule) { require(address(ipAssetRegistry) != address(0), "DeployHelper Module: IPAssetRegistry required"); - address impl = address( - new DisputeModule( - address(accessController), - address(ipAssetRegistry) - ) - ); + address impl = address(new DisputeModule(address(accessController), address(ipAssetRegistry))); disputeModule = DisputeModule( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - DisputeModule.initialize, ( - address(governance) - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(DisputeModule.initialize, (address(governance)))) ); console2.log("DeployHelper: Using REAL DisputeModule"); postDeployConditions.disputeModule_configure = true; @@ -342,14 +312,7 @@ contract DeployHelper { ) ); licensingModule = LicensingModule( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - LicensingModule.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(LicensingModule.initialize, (getGovernance()))) ); console2.log("DeployHelper: Using REAL LicensingModule"); } @@ -357,22 +320,9 @@ contract DeployHelper { function _deployPolicyConditionally(DeployPolicyCondition memory d) public { if (d.arbitrationPolicySP) { - address impl = address( - new ArbitrationPolicySP( - getDisputeModule(), - address(erc20), - ARBITRATION_PRICE - ) - ); + address impl = address(new ArbitrationPolicySP(getDisputeModule(), address(erc20), ARBITRATION_PRICE)); arbitrationPolicySP = ArbitrationPolicySP( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - ArbitrationPolicySP.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(ArbitrationPolicySP.initialize, (getGovernance()))) ); console2.log("DeployHelper: Using REAL ArbitrationPolicySP"); } else { @@ -381,22 +331,10 @@ contract DeployHelper { } if (d.royaltyPolicyLAP) { address impl = address( - new RoyaltyPolicyLAP( - getRoyaltyModule(), - getLicensingModule(), - LIQUID_SPLIT_FACTORY, - LIQUID_SPLIT_MAIN - ) + new RoyaltyPolicyLAP(getRoyaltyModule(), getLicensingModule(), LIQUID_SPLIT_FACTORY, LIQUID_SPLIT_MAIN) ); royaltyPolicyLAP = RoyaltyPolicyLAP( - TestProxyHelper.deployUUPSProxy( - impl, - abi.encodeCall( - RoyaltyPolicyLAP.initialize, ( - getGovernance() - ) - ) - ) + TestProxyHelper.deployUUPSProxy(impl, abi.encodeCall(RoyaltyPolicyLAP.initialize, (getGovernance()))) ); console2.log("DeployHelper: Using REAL RoyaltyPolicyLAP");