diff --git a/src/diamonds/nayms/facets/SimplePolicyFacet.sol b/src/diamonds/nayms/facets/SimplePolicyFacet.sol index 9cdddca3..0901a866 100644 --- a/src/diamonds/nayms/facets/SimplePolicyFacet.sol +++ b/src/diamonds/nayms/facets/SimplePolicyFacet.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.17; import { Modifiers } from "../Modifiers.sol"; -import { Entity, SimplePolicy, SimplePolicyInfo, PolicyCommissionsBasisPoints } from "../AppStorage.sol"; +import { Entity, SimplePolicy, PolicyCommissionsBasisPoints } from "../AppStorage.sol"; import { LibObject } from "../libs/LibObject.sol"; import { LibHelpers } from "../libs/LibHelpers.sol"; import { LibSimplePolicy } from "../libs/LibSimplePolicy.sol"; @@ -48,19 +48,8 @@ contract SimplePolicyFacet is ISimplePolicyFacet, Modifiers { * @param _policyId Id of the simple policy * @return Simple policy metadata */ - function getSimplePolicyInfo(bytes32 _policyId) external view returns (SimplePolicyInfo memory) { - SimplePolicy memory p = LibSimplePolicy._getSimplePolicyInfo(_policyId); - return - SimplePolicyInfo({ - startDate: p.startDate, - maturationDate: p.maturationDate, - asset: p.asset, - limit: p.limit, - fundsLocked: p.fundsLocked, - cancelled: p.cancelled, - claimsPaid: p.claimsPaid, - premiumsPaid: p.premiumsPaid - }); + function getSimplePolicyInfo(bytes32 _policyId) external view returns (SimplePolicy memory) { + return LibSimplePolicy._getSimplePolicyInfo(_policyId); } function getPremiumCommissionBasisPoints() external view returns (PolicyCommissionsBasisPoints memory bp) { diff --git a/src/diamonds/nayms/interfaces/FreeStructs.sol b/src/diamonds/nayms/interfaces/FreeStructs.sol index 7f90df7b..1642c672 100644 --- a/src/diamonds/nayms/interfaces/FreeStructs.sol +++ b/src/diamonds/nayms/interfaces/FreeStructs.sol @@ -53,17 +53,6 @@ struct SimplePolicy { uint256[] commissionBasisPoints; } -struct SimplePolicyInfo { - uint256 startDate; - uint256 maturationDate; - bytes32 asset; - uint256 limit; - bool fundsLocked; - bool cancelled; - uint256 claimsPaid; - uint256 premiumsPaid; -} - struct PolicyCommissionsBasisPoints { uint16 premiumCommissionNaymsLtdBP; uint16 premiumCommissionNDFBP; diff --git a/src/diamonds/nayms/interfaces/ISimplePolicyFacet.sol b/src/diamonds/nayms/interfaces/ISimplePolicyFacet.sol index e127538d..b1bbc4ca 100644 --- a/src/diamonds/nayms/interfaces/ISimplePolicyFacet.sol +++ b/src/diamonds/nayms/interfaces/ISimplePolicyFacet.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import { SimplePolicy, SimplePolicyInfo, PolicyCommissionsBasisPoints } from "./FreeStructs.sol"; +import { SimplePolicy, PolicyCommissionsBasisPoints } from "./FreeStructs.sol"; /** * @title Simple Policies @@ -52,7 +52,7 @@ interface ISimplePolicyFacet { * @param _id Id of the simple policy * @return Simple policy metadata */ - function getSimplePolicyInfo(bytes32 _id) external view returns (SimplePolicyInfo memory); + function getSimplePolicyInfo(bytes32 _id) external view returns (SimplePolicy memory); /** * @notice Get the policy premium commissions basis points. diff --git a/test/T04Entity.t.sol b/test/T04Entity.t.sol index 0d4eefb7..1c9871c4 100644 --- a/test/T04Entity.t.sol +++ b/test/T04Entity.t.sol @@ -4,13 +4,15 @@ pragma solidity 0.8.17; import { Vm } from "forge-std/Vm.sol"; import { D03ProtocolDefaults, console2, LibConstants, LibHelpers, LibObject } from "./defaults/D03ProtocolDefaults.sol"; -import { Entity, MarketInfo, SimplePolicy, SimplePolicyInfo, Stakeholders } from "src/diamonds/nayms/interfaces/FreeStructs.sol"; +import { Entity, MarketInfo, SimplePolicy, Stakeholders } from "src/diamonds/nayms/interfaces/FreeStructs.sol"; import { INayms, IDiamondCut } from "src/diamonds/nayms/INayms.sol"; import { LibACL } from "src/diamonds/nayms/libs/LibACL.sol"; import { LibTokenizedVault } from "src/diamonds/nayms/libs/LibTokenizedVault.sol"; import { LibFeeRouterFixture } from "test/fixtures/LibFeeRouterFixture.sol"; import { SimplePolicyFixture } from "test/fixtures/SimplePolicyFixture.sol"; + +// solhint-disable no-global-import import "src/diamonds/nayms/interfaces/CustomErrors.sol"; // solhint-disable no-console @@ -460,7 +462,7 @@ contract T04EntityTest is D03ProtocolDefaults { // create it successfully nayms.createSimplePolicy(policyId1, entityId1, stakeholders, simplePolicy, testPolicyDataHash); - SimplePolicyInfo memory simplePolicyInfo = nayms.getSimplePolicyInfo(policyId1); + SimplePolicy memory simplePolicyInfo = nayms.getSimplePolicyInfo(policyId1); assertEq(simplePolicyInfo.startDate, simplePolicy.startDate, "Start dates should match"); assertEq(simplePolicyInfo.maturationDate, simplePolicy.maturationDate, "Maturation dates should match"); assertEq(simplePolicyInfo.asset, simplePolicy.asset, "Assets should match"); @@ -972,7 +974,7 @@ contract T04EntityTest is D03ProtocolDefaults { "utilized capacity should change" ); - SimplePolicyInfo memory simplePolicyInfo = nayms.getSimplePolicyInfo(policyId1); + SimplePolicy memory simplePolicyInfo = nayms.getSimplePolicyInfo(policyId1); assertEq(simplePolicyInfo.cancelled, true, "Simple policy should be cancelled"); vm.expectRevert("Policy already cancelled"); diff --git a/test/T04Market.t.sol b/test/T04Market.t.sol index f790cb9c..9071f08e 100644 --- a/test/T04Market.t.sol +++ b/test/T04Market.t.sol @@ -6,7 +6,7 @@ import { Vm } from "forge-std/Vm.sol"; import { MockAccounts } from "./utils/users/MockAccounts.sol"; -import { Entity, FeeRatio, MarketInfo, TradingCommissions, SimplePolicy, SimplePolicyInfo, Stakeholders } from "src/diamonds/nayms/interfaces/FreeStructs.sol"; +import { Entity, FeeRatio, MarketInfo, TradingCommissions, SimplePolicy, Stakeholders } from "src/diamonds/nayms/interfaces/FreeStructs.sol"; import { INayms, IDiamondCut } from "src/diamonds/nayms/INayms.sol"; import { IERC20 } from "src/erc20/IERC20.sol"; diff --git a/test/defaults/D03ProtocolDefaults.sol b/test/defaults/D03ProtocolDefaults.sol index d23dbbdc..32c4c690 100644 --- a/test/defaults/D03ProtocolDefaults.sol +++ b/test/defaults/D03ProtocolDefaults.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.17; import { D02TestSetup, console2, LibHelpers, LibConstants, LibAdmin, LibObject, LibSimplePolicy } from "./D02TestSetup.sol"; import { ERC20 } from "solmate/tokens/ERC20.sol"; -import { Entity, SimplePolicy, SimplePolicyInfo, Stakeholders } from "src/diamonds/nayms/interfaces/FreeStructs.sol"; +import { Entity, SimplePolicy, Stakeholders } from "src/diamonds/nayms/interfaces/FreeStructs.sol"; import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";