From a026eddc58d9feb993bd8d58207835332fdafb0b Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Wed, 13 Mar 2024 18:06:42 +0700 Subject: [PATCH] chore: update solc, remove stuff --- src/facets/ACLFacet.sol | 22 +--------------------- src/facets/GovernanceFacet.sol | 2 +- src/facets/NaymsOwnershipFacet.sol | 2 +- src/facets/NaymsTokenFacet.sol | 2 +- src/facets/PhasedDiamondCutFacet.sol | 13 +++++++------ src/libs/LibACL.sol | 2 +- src/libs/LibConstants.sol | 2 +- src/libs/LibGovernance.sol | 12 ++++++++++-- src/libs/LibHelpers.sol | 2 +- src/libs/LibInitDiamond.sol | 2 +- src/libs/LibNaymsToken.sol | 2 +- src/shared/AppStorage.sol | 3 +-- src/shared/CustomErrors.sol | 27 ++++++++++++++++++--------- src/shared/FreeStructs.sol | 2 +- src/shared/Modifiers.sol | 2 +- 15 files changed, 47 insertions(+), 50 deletions(-) diff --git a/src/facets/ACLFacet.sol b/src/facets/ACLFacet.sol index 1d8f681..8abd755 100644 --- a/src/facets/ACLFacet.sol +++ b/src/facets/ACLFacet.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { LibACL, LibHelpers } from "../libs/LibACL.sol"; import { LibConstants as LC } from "../libs/LibConstants.sol"; @@ -64,26 +64,6 @@ contract ACLFacet is Modifiers { return LibACL._isInGroup(_objectId, _contextId, LibHelpers._stringToBytes32(_group)); } - /** - * @notice Check whether a parent object belongs to the `_group` group in given context - * @dev Objects can have a parent object, i.e. entity is a parent of a user - * @param _objectId ID of an object whose parent is being checked for role group membership - * @param _contextId Context in which the role group membership is being checked - * @param _group name of the role group - * @return true if object's parent is a member of this role group, false otherwise - */ - function isParentInGroup( - bytes32 _objectId, - bytes32 _contextId, - string memory _group - ) - external - view - returns (bool) - { - return LibACL._isParentInGroup(_objectId, _contextId, LibHelpers._stringToBytes32(_group)); - } - /** * @notice Check whether a user can assign specific object to the `_role` role in given context * @dev Check permission to assign to a role diff --git a/src/facets/GovernanceFacet.sol b/src/facets/GovernanceFacet.sol index dd988de..d1129dd 100644 --- a/src/facets/GovernanceFacet.sol +++ b/src/facets/GovernanceFacet.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { IDiamondCut } from "lib/diamond-2-hardhat/contracts/interfaces/IDiamondCut.sol"; import { Modifiers } from "../shared/Modifiers.sol"; diff --git a/src/facets/NaymsOwnershipFacet.sol b/src/facets/NaymsOwnershipFacet.sol index d416828..b09277e 100644 --- a/src/facets/NaymsOwnershipFacet.sol +++ b/src/facets/NaymsOwnershipFacet.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { LibDiamond } from "lib/diamond-2-hardhat/contracts/libraries/LibDiamond.sol"; import { IERC173 } from "lib/diamond-2-hardhat/contracts/interfaces/IERC173.sol"; diff --git a/src/facets/NaymsTokenFacet.sol b/src/facets/NaymsTokenFacet.sol index 9defc03..de54426 100644 --- a/src/facets/NaymsTokenFacet.sol +++ b/src/facets/NaymsTokenFacet.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { AppStorage, LibAppStorage } from "../shared/AppStorage.sol"; import { Modifiers } from "../shared/Modifiers.sol"; diff --git a/src/facets/PhasedDiamondCutFacet.sol b/src/facets/PhasedDiamondCutFacet.sol index be1f544..f383278 100644 --- a/src/facets/PhasedDiamondCutFacet.sol +++ b/src/facets/PhasedDiamondCutFacet.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; - -/******************************************************************************\ -* Author: Nick Mudge (https://twitter.com/mudgen) -* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 -/******************************************************************************/ +pragma solidity 0.8.24; +/** + * \ + * Author: Nick Mudge (https://twitter.com/mudgen) + * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 + * /***************************************************************************** + */ import { IDiamondCut } from "lib/diamond-2-hardhat/contracts/interfaces/IDiamondCut.sol"; import { LibDiamond } from "lib/diamond-2-hardhat/contracts/libraries/LibDiamond.sol"; import { AppStorage, LibAppStorage } from "src/shared/AppStorage.sol"; diff --git a/src/libs/LibACL.sol b/src/libs/LibACL.sol index b547e25..bab2098 100644 --- a/src/libs/LibACL.sol +++ b/src/libs/LibACL.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { AppStorage, LibAppStorage } from "../shared/AppStorage.sol"; import { LibDiamond } from "lib/diamond-2-hardhat/contracts/libraries/LibDiamond.sol"; diff --git a/src/libs/LibConstants.sol b/src/libs/LibConstants.sol index 25bfbbc..daefecb 100644 --- a/src/libs/LibConstants.sol +++ b/src/libs/LibConstants.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; /** * @dev Settings keys. diff --git a/src/libs/LibGovernance.sol b/src/libs/LibGovernance.sol index 92f699a..8e19d3f 100644 --- a/src/libs/LibGovernance.sol +++ b/src/libs/LibGovernance.sol @@ -1,11 +1,19 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { IDiamondCut } from "lib/diamond-2-hardhat/contracts/interfaces/IDiamondCut.sol"; /// @notice Contains internal methods for upgrade functionality library LibGovernance { - function _calculateUpgradeId(IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata) internal pure returns (bytes32) { + function _calculateUpgradeId( + IDiamondCut.FacetCut[] memory _diamondCut, + address _init, + bytes memory _calldata + ) + internal + pure + returns (bytes32) + { return keccak256(abi.encode(_diamondCut, _init, _calldata)); } } diff --git a/src/libs/LibHelpers.sol b/src/libs/LibHelpers.sol index 90bde36..50f39fb 100644 --- a/src/libs/LibHelpers.sol +++ b/src/libs/LibHelpers.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; /// @notice Pure functions library LibHelpers { diff --git a/src/libs/LibInitDiamond.sol b/src/libs/LibInitDiamond.sol index 234a07c..4e655c7 100644 --- a/src/libs/LibInitDiamond.sol +++ b/src/libs/LibInitDiamond.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { AppStorage, LibAppStorage } from "../shared/AppStorage.sol"; import { LibConstants as LC } from "./LibConstants.sol"; diff --git a/src/libs/LibNaymsToken.sol b/src/libs/LibNaymsToken.sol index bcb100d..79cd583 100644 --- a/src/libs/LibNaymsToken.sol +++ b/src/libs/LibNaymsToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; import { AppStorage, LibAppStorage } from "../shared/AppStorage.sol"; diff --git a/src/shared/AppStorage.sol b/src/shared/AppStorage.sol index 7f42fda..0f53486 100644 --- a/src/shared/AppStorage.sol +++ b/src/shared/AppStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; /// @notice storage for NAYM coin @@ -26,7 +26,6 @@ struct AppStorage { mapping(bytes32 objectId => bytes32 objectsDataHash) objectDataHashes; mapping(bytes32 objectId => string tokenSymbol) objectTokenSymbol; mapping(bytes32 objectId => string tokenName) objectTokenName; - mapping(bytes32 objectId => address tokenWrapperAddress) objectTokenWrapper; //// ACL Configuration//// mapping(bytes32 roleId => mapping(bytes32 groupId => bool isRoleInGroup)) groups; //role => (group => isRoleInGroup) mapping(bytes32 roleId => bytes32 assignerGroupId) canAssign; //role => Group that can assign/unassign that role diff --git a/src/shared/CustomErrors.sol b/src/shared/CustomErrors.sol index cf39012..8a37283 100644 --- a/src/shared/CustomErrors.sol +++ b/src/shared/CustomErrors.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; /// @dev The Nayms Diamond (proxy contract) owner (address) must be mutually exclusive with the system admin role. error OwnerCannotBeSystemAdmin(); @@ -17,8 +17,10 @@ error AssignerGroupIsMissing(); /// @param roleInContext Role that is being assigned error AssignerCannotUnassignRole(bytes32 assigner, bytes32 assignee, bytes32 context, string roleInContext); -/// @notice Error message for when a sender is not authorized to perform an action with their assigned role in a given context of a group -/// @dev In the assertPrivilege modifier, this error message returns the context and the role in the context, not the user's role in the system context. +/// @notice Error message for when a sender is not authorized to perform an action with their assigned role in a given +/// context of a group +/// @dev In the assertPrivilege modifier, this error message returns the context and the role in the context, not the +/// user's role in the system context. /// @param msgSenderId Id of the sender /// @param context Context in which the sender is trying to perform an action /// @param roleInContext Role of the sender in the context @@ -53,7 +55,8 @@ error EntityExistsAlready(bytes32 entityId); /// @dev The object type is not supported in this function call. error InvalidObjectType(bytes32 objectId, bytes12 objectType); -/// @dev The object ID being passed in is expected to be an address type, but the bottom (least significant) 12 bytes are not empty. +/// @dev The object ID being passed in is expected to be an address type, but the bottom (least significant) 12 bytes +/// are not empty. error InvalidObjectIdForAddress(bytes32 objectId); /// @dev (non specific) the object is not enabled to be tokenized. @@ -74,7 +77,8 @@ error ExternalDepositAmountCannotBeZero(); /// @dev Passing in 0 amount for withdraws is not allowed. error ExternalWithdrawAmountCannotBeZero(); -/// @dev The receiver of the withdraw must haveGroupPriviledge with the roles entity admin, comptroller combined, or comptroller withdraw. +/// @dev The receiver of the withdraw must haveGroupPriviledge with the roles entity admin, comptroller combined, or +/// comptroller withdraw. error ExternalWithdrawInvalidReceiver(address receiver); /// @dev Cannot create a simple policy with policyId of 0 @@ -83,8 +87,10 @@ error PolicyIdCannotBeZero(); /// @dev Policy commissions among commission receivers cannot sum to be greater than 10_000 basis points. error PolicyCommissionsBasisPointsCannotBeGreaterThan10000(uint256 calculatedTotalBp); -/// @dev The total basis points for a fee schedule, policy fee receivers at policy creation, or maker bp cannot be greater than half of LibConstants.BP_FACTOR. -/// This is to prevent the total basis points of a fee schedule with additional fee receivers (policy fee receivers for fee payments on premiums) from being greater than 100%. +/// @dev The total basis points for a fee schedule, policy fee receivers at policy creation, or maker bp cannot be +/// greater than half of LibConstants.BP_FACTOR. +/// This is to prevent the total basis points of a fee schedule with additional fee receivers (policy fee receivers +/// for fee payments on premiums) from being greater than 100%. error FeeBasisPointsExceedHalfMax(uint256 actual, uint256 expected); /// @dev The total fees can never exceed the premium payment or the marketplace trade. @@ -94,7 +100,9 @@ error FeeBasisPointsExceedMax(uint256 actual, uint256 expected); error UtilizedCapacityGreaterThanMaxCapacity(uint256 utilizedCapacity, uint256 maxCapacity); /// @dev Policy stakeholder signature validation failed -error SimplePolicyStakeholderSignatureInvalid(bytes32 signingHash, bytes signature, bytes32 signerId, bytes32 signersParent, bytes32 entityId); +error SimplePolicyStakeholderSignatureInvalid( + bytes32 signingHash, bytes signature, bytes32 signerId, bytes32 signersParent, bytes32 entityId +); /// @dev When creating a simple policy, the total claims paid should start at 0. error SimplePolicyClaimsPaidShouldStartAtZero(); @@ -111,7 +119,8 @@ error PolicyDoesNotExist(bytes32 policyId); /// @dev It is not possible to cancel policyId after maturation date has passed error PolicyCannotCancelAfterMaturation(bytes32 policyId); -/// @dev There is a duplicate address in the list of signers (the previous signer in the list is not < the next signer in the list). +/// @dev There is a duplicate address in the list of signers (the previous signer in the list is not < the next signer +/// in the list). error DuplicateSignerCreatingSimplePolicy(address previousSigner, address nextSigner); /// @dev The minimum sell amount on the marketplace cannot be zero. diff --git a/src/shared/FreeStructs.sol b/src/shared/FreeStructs.sol index 7764a04..72f41ee 100644 --- a/src/shared/FreeStructs.sol +++ b/src/shared/FreeStructs.sol @@ -1,2 +1,2 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; \ No newline at end of file +pragma solidity 0.8.24; diff --git a/src/shared/Modifiers.sol b/src/shared/Modifiers.sol index 890f1df..eba43ce 100644 --- a/src/shared/Modifiers.sol +++ b/src/shared/Modifiers.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.20; +pragma solidity 0.8.24; /// @notice modifiers