@etherisc/gif-next 0.0.2-db1e1e4-828 → 0.0.2-db81915-875
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +16 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +346 -102
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +276 -289
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +154 -40
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +62 -101
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +32 -32
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +8 -8
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +6 -6
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +71 -50
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +18 -10
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +79 -44
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +27 -23
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +284 -61
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +52 -8
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +42 -66
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +22 -34
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +37 -32
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +27 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +173 -46
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +353 -22
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +4 -4
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +481 -62
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +65 -21
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +12 -12
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +5 -5
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +2 -2
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +28 -4
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +83 -4
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +116 -7
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +17 -4
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Distribution.sol +6 -2
- package/contracts/components/IPoolComponent.sol +1 -1
- package/contracts/components/Pool.sol +3 -4
- package/contracts/components/Product.sol +137 -59
- package/contracts/instance/BundleManager.sol +3 -4
- package/contracts/instance/IInstance.sol +25 -21
- package/contracts/instance/IInstanceService.sol +0 -4
- package/contracts/instance/Instance.sol +85 -103
- package/contracts/instance/InstanceReader.sol +30 -4
- package/contracts/instance/InstanceService.sol +11 -28
- package/contracts/instance/base/Lifecycle.sol +12 -4
- package/contracts/instance/module/IPolicy.sol +11 -6
- package/contracts/instance/service/ApplicationService.sol +10 -5
- package/contracts/instance/service/BundleService.sol +8 -3
- package/contracts/instance/service/ClaimService.sol +111 -23
- package/contracts/instance/service/DistributionService.sol +14 -18
- package/contracts/instance/service/IApplicationService.sol +3 -7
- package/contracts/instance/service/IBundleService.sol +3 -0
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IPolicyService.sol +70 -5
- package/contracts/instance/service/PolicyService.sol +219 -40
- package/contracts/instance/service/ProductService.sol +1 -1
- package/contracts/types/Amount.sol +5 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/ObjectType.sol +5 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/StateId.sol +6 -2
- package/contracts/types/Timestamp.sol +5 -0
- package/package.json +1 -1
@@ -3,6 +3,10 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
+
import {Amount} from "../types/Amount.sol";
|
7
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
8
|
+
import {Component} from "./Component.sol";
|
9
|
+
import {Fee} from "../types/Fee.sol";
|
6
10
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
11
|
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
8
12
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
@@ -10,14 +14,13 @@ import {IProductService} from "../instance/service/IProductService.sol";
|
|
10
14
|
import {IClaimService} from "../instance/service/IClaimService.sol";
|
11
15
|
import {IProductComponent} from "./IProductComponent.sol";
|
12
16
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
17
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
13
18
|
import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
|
14
19
|
import {ReferralId} from "../types/Referral.sol";
|
15
20
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
21
|
import {Seconds} from "../types/Seconds.sol";
|
17
22
|
import {StateId} from "../types/StateId.sol";
|
18
23
|
import {Timestamp} from "../types/Timestamp.sol";
|
19
|
-
import {Fee} from "../types/Fee.sol";
|
20
|
-
import {Component} from "./Component.sol";
|
21
24
|
|
22
25
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
23
26
|
|
@@ -70,7 +73,7 @@ abstract contract Product is
|
|
70
73
|
|
71
74
|
ProductStorage storage $ = _getProductStorage();
|
72
75
|
// TODO add validation
|
73
|
-
// TODO refactor to go via registry
|
76
|
+
// TODO refactor to go via registry ?
|
74
77
|
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
75
78
|
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
76
79
|
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
@@ -86,50 +89,17 @@ abstract contract Product is
|
|
86
89
|
registerInterface(type(IProductComponent).interfaceId);
|
87
90
|
}
|
88
91
|
|
89
|
-
|
90
|
-
function
|
91
|
-
|
92
|
-
|
93
|
-
Seconds lifetime,
|
94
|
-
bytes memory applicationData,
|
95
|
-
NftId bundleNftId,
|
96
|
-
ReferralId referralId
|
97
|
-
)
|
98
|
-
external
|
99
|
-
view
|
100
|
-
override
|
101
|
-
returns (uint256 premiumAmount)
|
102
|
-
{
|
103
|
-
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
104
|
-
getNftId(),
|
105
|
-
riskId,
|
106
|
-
sumInsuredAmount,
|
107
|
-
lifetime,
|
108
|
-
applicationData,
|
109
|
-
bundleNftId,
|
110
|
-
referralId
|
111
|
-
);
|
112
|
-
premiumAmount = premium.premiumAmount;
|
113
|
-
}
|
114
|
-
|
115
|
-
|
116
|
-
function calculateNetPremium(
|
117
|
-
uint256 sumInsuredAmount,
|
118
|
-
RiskId riskId,
|
119
|
-
Seconds lifetime,
|
120
|
-
bytes memory applicationData
|
92
|
+
// from product component
|
93
|
+
function setFees(
|
94
|
+
Fee memory productFee,
|
95
|
+
Fee memory processingFee
|
121
96
|
)
|
122
97
|
external
|
123
|
-
|
124
|
-
|
125
|
-
|
98
|
+
onlyOwner
|
99
|
+
restricted()
|
100
|
+
override
|
126
101
|
{
|
127
|
-
|
128
|
-
return sumInsuredAmount / 10;
|
129
|
-
}
|
130
|
-
|
131
|
-
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
132
|
-
return RiskIdLib.toRiskId(riskName);
|
102
|
+
_getProductService().setFees(productFee, processingFee);
|
133
103
|
}
|
134
104
|
|
135
105
|
function _createRisk(
|
@@ -189,14 +159,14 @@ abstract contract Product is
|
|
189
159
|
);
|
190
160
|
}
|
191
161
|
|
192
|
-
function
|
162
|
+
function _collateralize(
|
193
163
|
NftId policyNftId,
|
194
164
|
bool requirePremiumPayment,
|
195
165
|
Timestamp activateAt
|
196
166
|
)
|
197
167
|
internal
|
198
168
|
{
|
199
|
-
_getProductStorage()._policyService.
|
169
|
+
_getProductStorage()._policyService.collateralize(
|
200
170
|
policyNftId,
|
201
171
|
requirePremiumPayment,
|
202
172
|
activateAt);
|
@@ -229,28 +199,136 @@ abstract contract Product is
|
|
229
199
|
)
|
230
200
|
internal
|
231
201
|
{
|
232
|
-
_getProductStorage()._policyService.close(
|
202
|
+
_getProductStorage()._policyService.close(
|
203
|
+
policyNftId);
|
233
204
|
}
|
234
205
|
|
235
|
-
function
|
236
|
-
|
206
|
+
function _submitClaim(
|
207
|
+
NftId policyNftId,
|
208
|
+
Amount claimAmount,
|
209
|
+
bytes memory claimData
|
210
|
+
)
|
211
|
+
internal
|
212
|
+
returns(ClaimId)
|
213
|
+
{
|
214
|
+
return _getProductStorage()._policyService.submitClaim(
|
215
|
+
policyNftId,
|
216
|
+
claimAmount,
|
217
|
+
claimData);
|
237
218
|
}
|
238
219
|
|
239
|
-
function
|
240
|
-
|
220
|
+
function _confirmClaim(
|
221
|
+
NftId policyNftId,
|
222
|
+
ClaimId claimId,
|
223
|
+
Amount confirmedAmount
|
224
|
+
)
|
225
|
+
internal
|
226
|
+
{
|
227
|
+
_getProductStorage()._policyService.confirmClaim(
|
228
|
+
policyNftId,
|
229
|
+
claimId,
|
230
|
+
confirmedAmount);
|
241
231
|
}
|
242
232
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
233
|
+
function _declineClaim(
|
234
|
+
NftId policyNftId,
|
235
|
+
ClaimId claimId
|
236
|
+
)
|
237
|
+
internal
|
238
|
+
{
|
239
|
+
_getProductStorage()._policyService.declineClaim(
|
240
|
+
policyNftId,
|
241
|
+
claimId);
|
242
|
+
}
|
243
|
+
|
244
|
+
function _closeClaim(
|
245
|
+
NftId policyNftId,
|
246
|
+
ClaimId claimId
|
247
|
+
)
|
248
|
+
internal
|
249
|
+
{
|
250
|
+
_getProductStorage()._policyService.closeClaim(
|
251
|
+
policyNftId,
|
252
|
+
claimId);
|
253
|
+
}
|
254
|
+
|
255
|
+
function _createPayout(
|
256
|
+
NftId policyNftId,
|
257
|
+
ClaimId claimId,
|
258
|
+
Amount amount,
|
259
|
+
bytes memory data
|
260
|
+
)
|
261
|
+
internal
|
262
|
+
returns (PayoutId)
|
263
|
+
{
|
264
|
+
return _getProductStorage()._policyService.createPayout(
|
265
|
+
policyNftId,
|
266
|
+
claimId,
|
267
|
+
amount,
|
268
|
+
data);
|
269
|
+
}
|
270
|
+
|
271
|
+
function _processPayout(
|
272
|
+
NftId policyNftId,
|
273
|
+
PayoutId payoutId
|
274
|
+
)
|
275
|
+
internal
|
276
|
+
{
|
277
|
+
_getProductStorage()._policyService.processPayout(
|
278
|
+
policyNftId,
|
279
|
+
payoutId);
|
280
|
+
}
|
281
|
+
|
282
|
+
function calculatePremium(
|
283
|
+
uint256 sumInsuredAmount,
|
284
|
+
RiskId riskId,
|
285
|
+
Seconds lifetime,
|
286
|
+
bytes memory applicationData,
|
287
|
+
NftId bundleNftId,
|
288
|
+
ReferralId referralId
|
289
|
+
)
|
290
|
+
external
|
291
|
+
view
|
292
|
+
override
|
293
|
+
returns (uint256 premiumAmount)
|
294
|
+
{
|
295
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
296
|
+
getNftId(),
|
297
|
+
riskId,
|
298
|
+
sumInsuredAmount,
|
299
|
+
lifetime,
|
300
|
+
applicationData,
|
301
|
+
bundleNftId,
|
302
|
+
referralId
|
303
|
+
);
|
304
|
+
premiumAmount = premium.premiumAmount;
|
305
|
+
}
|
306
|
+
|
307
|
+
function calculateNetPremium(
|
308
|
+
uint256 sumInsuredAmount,
|
309
|
+
RiskId riskId,
|
310
|
+
Seconds lifetime,
|
311
|
+
bytes memory applicationData
|
247
312
|
)
|
248
313
|
external
|
249
|
-
|
250
|
-
|
251
|
-
|
314
|
+
view
|
315
|
+
virtual override
|
316
|
+
returns (uint256 netPremiumAmount)
|
252
317
|
{
|
253
|
-
|
318
|
+
// default 10% of sum insured
|
319
|
+
return sumInsuredAmount / 10;
|
320
|
+
}
|
321
|
+
|
322
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
323
|
+
return RiskIdLib.toRiskId(riskName);
|
324
|
+
}
|
325
|
+
|
326
|
+
function getPoolNftId() external view override returns (NftId poolNftId) {
|
327
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
328
|
+
}
|
329
|
+
|
330
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
331
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
254
332
|
}
|
255
333
|
|
256
334
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
@@ -34,8 +34,7 @@ contract BundleManager is
|
|
34
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
35
35
|
|
36
36
|
/// @dev links a policy to its bundle
|
37
|
-
// to link a policy it MUST NOT yet have been
|
38
|
-
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
37
|
+
// to link a policy it MUST NOT yet have been linked
|
39
38
|
function linkPolicy(NftId policyNftId) external restricted() {
|
40
39
|
NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
|
41
40
|
// decision will likely depend on the decision what to check here and what in the service
|
@@ -87,14 +86,14 @@ contract BundleManager is
|
|
87
86
|
}
|
88
87
|
|
89
88
|
|
90
|
-
/// @dev unlocked (active) bundles are available to
|
89
|
+
/// @dev unlocked (active) bundles are available to collateralize new policies
|
91
90
|
function unlock(NftId bundleNftId) external restricted() {
|
92
91
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
93
92
|
_activate(poolNftId, bundleNftId);
|
94
93
|
emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
|
95
94
|
}
|
96
95
|
|
97
|
-
/// @dev locked (deactivated) bundles may not
|
96
|
+
/// @dev locked (deactivated) bundles may not collateralize any new policies
|
98
97
|
function lock(NftId bundleNftId) external restricted() {
|
99
98
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
100
99
|
_deactivate(poolNftId, bundleNftId);
|
@@ -3,8 +3,12 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
5
|
|
6
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
7
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
8
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
6
9
|
import {NftId} from "../types/NftId.sol";
|
7
10
|
import {StateId} from "../types/StateId.sol";
|
11
|
+
import {ReferralId} from "../types/Referral.sol";
|
8
12
|
import {RiskId} from "../types/RiskId.sol";
|
9
13
|
import {VersionPart} from "../types/Version.sol";
|
10
14
|
import {Key32} from "../types/Key32.sol";
|
@@ -20,16 +24,10 @@ import {InstanceReader} from "./InstanceReader.sol";
|
|
20
24
|
import {IBundle} from "./module/IBundle.sol";
|
21
25
|
import {IBundleService} from "./service/IBundleService.sol";
|
22
26
|
import {IComponents} from "./module/IComponents.sol";
|
23
|
-
import {IDistributionService} from "./service/IDistributionService.sol";
|
24
27
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
25
28
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
26
29
|
import {IPolicy} from "./module/IPolicy.sol";
|
27
30
|
import {IDistribution} from "./module/IDistribution.sol";
|
28
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
29
|
-
import {IPoolService} from "./service/IPoolService.sol";
|
30
|
-
import {IProductService} from "./service/IProductService.sol";
|
31
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
32
|
-
import {IBundleService} from "./service/IBundleService.sol";
|
33
31
|
import {IRisk} from "./module/IRisk.sol";
|
34
32
|
import {ISetup} from "./module/ISetup.sol";
|
35
33
|
|
@@ -41,11 +39,14 @@ interface IInstance is
|
|
41
39
|
IAccessManaged,
|
42
40
|
IKeyValueStore
|
43
41
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
error ErrorInstanceInstanceAccessManagerAlreadySet(address instanceAccessManager);
|
43
|
+
error ErrorInstanceInstanceAccessManagerAuthorityMismatch(address instanceAuthority);
|
44
|
+
|
45
|
+
error ErrorInstanceBundleManagerAlreadySet(address instanceBundleManager);
|
46
|
+
error ErrorInstanceBundleManagerInstanceMismatch(address instance);
|
47
|
+
error ErrorInstanceBundleManagerAuthorityMismatch(address instanceAuthority);
|
48
|
+
|
49
|
+
error ErrorInstanceInstanceReaderInstanceMismatch(address instanceAuthority);
|
49
50
|
|
50
51
|
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
|
51
52
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
@@ -63,17 +64,17 @@ interface IInstance is
|
|
63
64
|
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
|
64
65
|
function updateProductSetupState(NftId productNftId, StateId newState) external;
|
65
66
|
|
66
|
-
function createDistributorType(
|
67
|
-
function updateDistributorType(
|
68
|
-
function updateDistributorTypeState(
|
67
|
+
function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external;
|
68
|
+
function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external;
|
69
|
+
function updateDistributorTypeState(DistributorType distributorType, StateId newState) external;
|
69
70
|
|
70
71
|
function createDistributor(NftId nftId, IDistribution.DistributorInfo memory info) external;
|
71
72
|
function updateDistributor(NftId nftId, IDistribution.DistributorInfo memory info, StateId newState) external;
|
72
73
|
function updateDistributorState(NftId nftId, StateId newState) external;
|
73
74
|
|
74
|
-
function createReferral(
|
75
|
-
function updateReferral(
|
76
|
-
function updateReferralState(
|
75
|
+
function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external;
|
76
|
+
function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external;
|
77
|
+
function updateReferralState(ReferralId referralId, StateId newState) external;
|
77
78
|
|
78
79
|
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
|
79
80
|
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
@@ -86,13 +87,16 @@ interface IInstance is
|
|
86
87
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
87
88
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external;
|
91
|
+
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external;
|
92
|
+
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external;
|
93
|
+
|
94
|
+
function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory claim) external;
|
95
|
+
function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory claim, StateId newState) external;
|
96
|
+
function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external;
|
91
97
|
|
92
98
|
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
93
99
|
function getInstanceReader() external view returns (InstanceReader);
|
94
100
|
function getBundleManager() external view returns (BundleManager);
|
95
|
-
|
96
|
-
function setInstanceAccessManager(InstanceAccessManager accessManager) external;
|
97
101
|
function getInstanceAccessManager() external view returns (InstanceAccessManager);
|
98
102
|
}
|
@@ -5,10 +5,6 @@ import {NftId} from "../types/NftId.sol";
|
|
5
5
|
import {ObjectType} from "../types/ObjectType.sol";
|
6
6
|
import {RoleId} from "../types/RoleId.sol";
|
7
7
|
import {IService} from "../shared/IService.sol";
|
8
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
9
|
-
|
10
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
|
-
import {IComponent} from "../components/IComponent.sol";
|
12
8
|
|
13
9
|
import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
|
14
10
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|