@etherisc/gif-next 0.0.2-b16cd64-952 → 0.0.2-b20ce14-335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +108 -50
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +30 -26
- 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 +50 -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 +385 -22
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +120 -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 +513 -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 +238 -26
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +60 -12
- 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 +52 -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 -102
- 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 +21 -9
- 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 +9 -0
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IPolicyService.sol +72 -5
- package/contracts/instance/service/IPoolService.sol +3 -0
- package/contracts/instance/service/PolicyService.sol +282 -73
- package/contracts/instance/service/PoolService.sol +34 -1
- package/contracts/instance/service/ProductService.sol +1 -1
- package/contracts/types/Amount.sol +10 -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
@@ -182,8 +182,13 @@ contract BundleService is
|
|
182
182
|
InstanceReader instanceReader = instance.getInstanceReader();
|
183
183
|
|
184
184
|
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
185
|
-
|
186
|
-
|
185
|
+
if(bundleInfo.poolNftId.eqz()) {
|
186
|
+
revert ErrorBundleServiceBundleUnknown(bundleNftId);
|
187
|
+
}
|
188
|
+
|
189
|
+
if(bundleInfo.poolNftId != poolNftId) {
|
190
|
+
revert ErrorBundleServiceBundlePoolMismatch(poolNftId, bundleInfo.poolNftId );
|
191
|
+
}
|
187
192
|
|
188
193
|
bundleInfo.fee = fee;
|
189
194
|
|
@@ -242,23 +247,30 @@ contract BundleService is
|
|
242
247
|
if(premiumAmount > 0) {
|
243
248
|
// calculate fees and net premium amounts
|
244
249
|
(
|
245
|
-
|
250
|
+
,
|
246
251
|
uint256 netPremiumAmount
|
247
252
|
) = FeeLib.calculateFee(bundleInfo.fee, premiumAmount);
|
248
253
|
|
249
254
|
// update bundle info with additional capital
|
250
255
|
bundleInfo.capitalAmount = AmountLib.toAmount(bundleInfo.capitalAmount.toInt() + netPremiumAmount);
|
251
|
-
|
252
|
-
// update bundle info with additional fees
|
253
|
-
if(feeAmount > 0) {
|
254
|
-
bundleInfo.feeAmount = AmountLib.toAmount(bundleInfo.feeAmount.toInt() + feeAmount);
|
255
|
-
}
|
256
256
|
}
|
257
257
|
|
258
258
|
// save updated bundle info
|
259
259
|
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
260
260
|
}
|
261
261
|
|
262
|
+
function updateBundleFees(
|
263
|
+
IInstance instance,
|
264
|
+
NftId bundleNftId,
|
265
|
+
Amount feeAmount
|
266
|
+
)
|
267
|
+
external
|
268
|
+
{
|
269
|
+
IBundle.BundleInfo memory bundleInfo = instance.getInstanceReader().getBundleInfo(bundleNftId);
|
270
|
+
bundleInfo.feeAmount = bundleInfo.feeAmount.add(feeAmount);
|
271
|
+
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
272
|
+
}
|
273
|
+
|
262
274
|
|
263
275
|
function lock(NftId bundleNftId)
|
264
276
|
external
|
@@ -385,7 +397,7 @@ contract BundleService is
|
|
385
397
|
|
386
398
|
// ensure policy is closeable
|
387
399
|
if ( TimestampLib.blockTimestamp() < policyInfo.expiredAt
|
388
|
-
&& policyInfo.payoutAmount < policyInfo.sumInsuredAmount)
|
400
|
+
&& policyInfo.payoutAmount.toInt() < policyInfo.sumInsuredAmount)
|
389
401
|
{
|
390
402
|
revert BundleManager.ErrorBundleManagerPolicyNotCloseable(policyNftId);
|
391
403
|
}
|
@@ -22,18 +22,19 @@ import {TokenHandler} from "../../shared/TokenHandler.sol";
|
|
22
22
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
23
23
|
import {Versionable} from "../../shared/Versionable.sol";
|
24
24
|
|
25
|
+
import {Amount, AmountLib} from "../../types/Amount.sol";
|
25
26
|
import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
26
27
|
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
27
28
|
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
28
29
|
import {ObjectType, INSTANCE, PRODUCT, POOL, APPLICATION, POLICY, CLAIM, BUNDLE} from "../../types/ObjectType.sol";
|
29
|
-
import {
|
30
|
+
import {SUBMITTED, ACTIVE, KEEP_STATE, DECLINED, CONFIRMED, CLOSED} from "../../types/StateId.sol";
|
30
31
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
31
32
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
32
33
|
import {ReferralId} from "../../types/Referral.sol";
|
33
34
|
import {RiskId} from "../../types/RiskId.sol";
|
34
35
|
import {StateId} from "../../types/StateId.sol";
|
35
|
-
import {ClaimId} from "../../types/ClaimId.sol";
|
36
|
-
import {PayoutId} from "../../types/PayoutId.sol";
|
36
|
+
import {ClaimId, ClaimIdLib} from "../../types/ClaimId.sol";
|
37
|
+
import {PayoutId, PayoutIdLib} from "../../types/PayoutId.sol";
|
37
38
|
import {Version, VersionLib} from "../../types/Version.sol";
|
38
39
|
|
39
40
|
import {ComponentService} from "../base/ComponentService.sol";
|
@@ -50,6 +51,7 @@ contract ClaimService is
|
|
50
51
|
IClaimService
|
51
52
|
{
|
52
53
|
|
54
|
+
IPoolService internal _poolService;
|
53
55
|
|
54
56
|
function _initialize(
|
55
57
|
address owner,
|
@@ -65,6 +67,9 @@ contract ClaimService is
|
|
65
67
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
66
68
|
|
67
69
|
initializeService(registryAddress, address(0), owner);
|
70
|
+
|
71
|
+
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
|
72
|
+
|
68
73
|
registerInterface(type(IClaimService).interfaceId);
|
69
74
|
}
|
70
75
|
|
@@ -74,67 +79,127 @@ contract ClaimService is
|
|
74
79
|
}
|
75
80
|
|
76
81
|
|
77
|
-
function
|
82
|
+
function submit(
|
83
|
+
IInstance instance,
|
78
84
|
NftId policyNftId,
|
79
|
-
|
85
|
+
ClaimId claimId,
|
86
|
+
Amount claimAmount,
|
80
87
|
bytes memory claimData
|
81
88
|
)
|
82
89
|
external
|
83
90
|
virtual
|
84
|
-
|
91
|
+
// TODO add restricted and grant to policy service
|
85
92
|
{
|
86
|
-
|
93
|
+
instance.createClaim(
|
94
|
+
policyNftId,
|
95
|
+
claimId,
|
96
|
+
IPolicy.ClaimInfo(
|
97
|
+
claimAmount,
|
98
|
+
AmountLib.zero(), // paidAmount
|
99
|
+
0, // payoutsCount
|
100
|
+
0, // openPayoutsCount
|
101
|
+
claimData,
|
102
|
+
TimestampLib.zero())); // closedAt
|
87
103
|
}
|
88
104
|
|
89
105
|
|
90
|
-
function
|
106
|
+
function confirm(
|
107
|
+
IInstance instance,
|
108
|
+
InstanceReader instanceReader,
|
109
|
+
NftId policyNftId,
|
110
|
+
ClaimId claimId,
|
111
|
+
Amount confirmedAmount
|
112
|
+
)
|
91
113
|
external
|
92
114
|
virtual
|
93
|
-
// solhint-disable-next-line no-empty-blocks
|
94
115
|
{
|
95
|
-
|
116
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
117
|
+
claimInfo.claimAmount = confirmedAmount;
|
118
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, CONFIRMED());
|
96
119
|
}
|
97
120
|
|
98
|
-
|
99
|
-
|
121
|
+
function decline(
|
122
|
+
IInstance instance,
|
123
|
+
InstanceReader instanceReader,
|
124
|
+
NftId policyNftId,
|
125
|
+
ClaimId claimId
|
126
|
+
)
|
100
127
|
external
|
101
128
|
virtual
|
102
|
-
// solhint-disable-next-line no-empty-blocks
|
103
129
|
{
|
104
|
-
|
130
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
131
|
+
claimInfo.closedAt = TimestampLib.blockTimestamp();
|
132
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, DECLINED());
|
105
133
|
}
|
106
134
|
|
107
135
|
|
108
|
-
function
|
136
|
+
function close(
|
137
|
+
IInstance instance,
|
138
|
+
InstanceReader instanceReader,
|
139
|
+
NftId policyNftId,
|
140
|
+
ClaimId claimId
|
141
|
+
)
|
109
142
|
external
|
110
143
|
virtual
|
111
|
-
// solhint-disable-next-line no-empty-blocks
|
112
144
|
{
|
113
|
-
|
145
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, CONFIRMED());
|
146
|
+
|
147
|
+
// check claim has no open payouts
|
148
|
+
if(claimInfo.openPayoutsCount > 0) {
|
149
|
+
revert ErrorClaimServiceClaimWithOpenPayouts(
|
150
|
+
policyNftId,
|
151
|
+
claimId,
|
152
|
+
claimInfo.openPayoutsCount);
|
153
|
+
}
|
154
|
+
|
155
|
+
// check claim paid amount matches with claim amount
|
156
|
+
if(claimInfo.paidAmount.toInt() < claimInfo.claimAmount.toInt()) {
|
157
|
+
revert ErrorClaimServiceClaimWithMissingPayouts(
|
158
|
+
policyNftId,
|
159
|
+
claimId,
|
160
|
+
claimInfo.claimAmount,
|
161
|
+
claimInfo.paidAmount);
|
162
|
+
}
|
163
|
+
|
164
|
+
claimInfo.closedAt = TimestampLib.blockTimestamp();
|
165
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, CLOSED());
|
114
166
|
}
|
115
167
|
|
116
168
|
|
117
169
|
function createPayout(
|
170
|
+
IInstance instance,
|
118
171
|
NftId policyNftId,
|
119
|
-
|
120
|
-
|
172
|
+
PayoutId payoutId,
|
173
|
+
Amount payoutAmount,
|
121
174
|
bytes calldata payoutData
|
122
175
|
)
|
123
176
|
external
|
124
177
|
virtual
|
125
|
-
|
126
|
-
// solhint-disable-next-line no-empty-blocks
|
178
|
+
// TODO add restricted and grant to policy service
|
127
179
|
{
|
128
|
-
|
180
|
+
instance.createPayout(
|
181
|
+
policyNftId,
|
182
|
+
payoutId,
|
183
|
+
IPolicy.PayoutInfo(
|
184
|
+
payoutId.toClaimId(),
|
185
|
+
payoutAmount,
|
186
|
+
payoutData,
|
187
|
+
TimestampLib.zero()));
|
129
188
|
}
|
130
189
|
|
131
190
|
|
132
|
-
function
|
191
|
+
function processPayout(
|
192
|
+
IInstance instance,
|
193
|
+
InstanceReader instanceReader,
|
133
194
|
NftId policyNftId,
|
134
195
|
PayoutId payoutId
|
135
196
|
)
|
136
197
|
external
|
137
198
|
virtual
|
199
|
+
returns (
|
200
|
+
Amount amount,
|
201
|
+
bool payoutIsClosingClaim
|
202
|
+
)
|
138
203
|
// solhint-disable-next-line no-empty-blocks
|
139
204
|
{
|
140
205
|
|
@@ -143,6 +208,29 @@ contract ClaimService is
|
|
143
208
|
|
144
209
|
// internal functions
|
145
210
|
|
211
|
+
function _verifyClaim(
|
212
|
+
InstanceReader instanceReader,
|
213
|
+
NftId policyNftId,
|
214
|
+
ClaimId claimId,
|
215
|
+
StateId expectedState
|
216
|
+
)
|
217
|
+
internal
|
218
|
+
view
|
219
|
+
returns (
|
220
|
+
IPolicy.ClaimInfo memory claimInfo
|
221
|
+
)
|
222
|
+
{
|
223
|
+
// check claim is created state
|
224
|
+
StateId claimState = instanceReader.getClaimState(policyNftId, claimId);
|
225
|
+
if(claimState != expectedState) {
|
226
|
+
revert ErrorClaimServiceClaimNotInExpectedState(
|
227
|
+
policyNftId, claimId, expectedState, claimState);
|
228
|
+
}
|
229
|
+
|
230
|
+
// get claim info
|
231
|
+
claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
|
232
|
+
}
|
233
|
+
|
146
234
|
function _getAndVerifyInstanceAndProduct() internal view returns (Product product) {
|
147
235
|
IRegistry.ObjectInfo memory productInfo;
|
148
236
|
(, productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
@@ -155,22 +155,18 @@ contract DistributionService is
|
|
155
155
|
}
|
156
156
|
|
157
157
|
distributorType = DistributorTypeLib.toDistributorType(distributionNftId, name);
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
data);
|
171
|
-
|
172
|
-
instance.createDistributorType(key32, info);
|
173
|
-
}
|
158
|
+
IDistribution.DistributorTypeInfo memory info = IDistribution.DistributorTypeInfo(
|
159
|
+
name,
|
160
|
+
minDiscountPercentage,
|
161
|
+
maxDiscountPercentage,
|
162
|
+
commissionPercentage,
|
163
|
+
maxReferralCount,
|
164
|
+
maxReferralLifetime,
|
165
|
+
allowSelfReferrals,
|
166
|
+
allowRenewals,
|
167
|
+
data);
|
168
|
+
|
169
|
+
instance.createDistributorType(distributorType, info);
|
174
170
|
}
|
175
171
|
|
176
172
|
function createDistributor(
|
@@ -267,7 +263,7 @@ contract DistributionService is
|
|
267
263
|
data
|
268
264
|
);
|
269
265
|
|
270
|
-
instance.createReferral(referralId
|
266
|
+
instance.createReferral(referralId, info);
|
271
267
|
return referralId;
|
272
268
|
}
|
273
269
|
|
@@ -308,7 +304,7 @@ contract DistributionService is
|
|
308
304
|
|
309
305
|
if (isReferral) {
|
310
306
|
referralInfo.usedReferrals += 1;
|
311
|
-
instance.updateReferral(referralId
|
307
|
+
instance.updateReferral(referralId, referralInfo, KEEP_STATE());
|
312
308
|
|
313
309
|
if (commissionAmount > 0) {
|
314
310
|
distributorInfo.sumCommisions += commissionAmount;
|
@@ -2,24 +2,20 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IPolicy} from "../module/IPolicy.sol";
|
5
|
-
import {IRisk} from "../module/IRisk.sol";
|
6
5
|
import {IService} from "../../shared/IService.sol";
|
7
6
|
|
8
7
|
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ObjectType} from "../../types/ObjectType.sol";
|
9
9
|
import {ReferralId} from "../../types/Referral.sol";
|
10
10
|
import {RiskId} from "../../types/RiskId.sol";
|
11
11
|
import {Seconds} from "../../types/Seconds.sol";
|
12
|
-
import {StateId} from "../../types/StateId.sol";
|
13
|
-
import {Timestamp} from "../../types/Timestamp.sol";
|
14
|
-
import {UFixed} from "../../types/UFixed.sol";
|
15
|
-
import {Fee} from "../../types/Fee.sol";
|
16
12
|
|
17
13
|
/// @dev gif service responsible for creating applications
|
18
14
|
/// only product components may call transaction functions
|
19
15
|
interface IApplicationService is IService {
|
20
16
|
|
21
|
-
error
|
22
|
-
error
|
17
|
+
error ErrorApplicationServiceNotProduct(NftId callerNftId, ObjectType callerType);
|
18
|
+
error ErrorApplicationServiceBundlePoolMismatch(NftId bundleNftId, NftId bundlePoolNftId, NftId poolNftId);
|
23
19
|
|
24
20
|
/// @dev creates a new application based on the specified attributes
|
25
21
|
/// may only be called by a product component
|
@@ -21,6 +21,9 @@ interface IBundleService is IService {
|
|
21
21
|
error ErrorBundleServiceCapacityInsufficient(NftId bundleNftId, uint capacityAmount, uint collateralAmount);
|
22
22
|
error ErrorBundleServiceBundleWithOpenPolicies(NftId bundleNftId, uint256 openPoliciesCount);
|
23
23
|
|
24
|
+
error ErrorBundleServiceBundleUnknown(NftId bundleNftId);
|
25
|
+
error ErrorBundleServiceBundlePoolMismatch(NftId expectedPoolNftId, NftId bundlePoolNftId);
|
26
|
+
|
24
27
|
/// @dev create a new bundle for the specified attributes
|
25
28
|
/// may only be called by pool service
|
26
29
|
function create(
|
@@ -75,6 +78,12 @@ interface IBundleService is IService {
|
|
75
78
|
uint256 premium // premium amount after pool fee
|
76
79
|
) external;
|
77
80
|
|
81
|
+
/// @dev updates the bundle's fees of with the provided fee amount
|
82
|
+
function updateBundleFees(
|
83
|
+
IInstance instance,
|
84
|
+
NftId bundleNftId,
|
85
|
+
Amount feeAmount
|
86
|
+
) external;
|
78
87
|
|
79
88
|
/// @dev releases the specified collateral in the bundle
|
80
89
|
/// may only be called by pool service
|
@@ -1,14 +1,14 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {IInstance} from "../IInstance.sol";
|
5
|
+
import {InstanceReader} from "../InstanceReader.sol";
|
5
6
|
import {IService} from "../../shared/IService.sol";
|
6
7
|
|
8
|
+
import {Amount} from "../../types/Amount.sol";
|
7
9
|
import {ClaimId} from "../../types/ClaimId.sol";
|
8
10
|
import {PayoutId} from "../../types/PayoutId.sol";
|
9
11
|
import {NftId} from "../../types/NftId.sol";
|
10
|
-
import {ReferralId} from "../../types/Referral.sol";
|
11
|
-
import {RiskId} from "../../types/RiskId.sol";
|
12
12
|
import {StateId} from "../../types/StateId.sol";
|
13
13
|
import {Timestamp} from "../../types/Timestamp.sol";
|
14
14
|
import {UFixed} from "../../types/UFixed.sol";
|
@@ -20,42 +20,73 @@ interface IClaimService is
|
|
20
20
|
IService
|
21
21
|
{
|
22
22
|
|
23
|
+
error ErrorClaimServiceClaimWithOpenPayouts(NftId policyNftId, ClaimId claimId, uint8 openPayouts);
|
24
|
+
error ErrorClaimServiceClaimWithMissingPayouts(NftId policyNftId, ClaimId claimId, Amount claimAmount, Amount paidAmount);
|
25
|
+
error ErrorClaimServiceClaimNotInExpectedState(NftId policyNftId, ClaimId claimId, StateId expectedState, StateId actualState);
|
26
|
+
|
23
27
|
/// @dev create a new claim for the specified policy
|
24
28
|
/// function can only be called by product, policy needs to match with calling product
|
25
|
-
function
|
29
|
+
function submit(
|
30
|
+
IInstance instance,
|
26
31
|
NftId policyNftId,
|
27
|
-
|
32
|
+
ClaimId claimId,
|
33
|
+
Amount claimAmount,
|
28
34
|
bytes memory claimData
|
29
|
-
) external
|
35
|
+
) external;
|
30
36
|
|
31
37
|
/// @dev confirms the specified claim and fixes the final claim amount
|
32
38
|
/// function can only be called by product, policy needs to match with calling product
|
33
|
-
function
|
39
|
+
function confirm(
|
40
|
+
IInstance instance,
|
41
|
+
InstanceReader instanceReader,
|
42
|
+
NftId policyNftId,
|
43
|
+
ClaimId claimId,
|
44
|
+
Amount claimAmount
|
45
|
+
) external;
|
34
46
|
|
35
47
|
/// @dev declares the claim as invalid, no payout(s) will be made
|
36
48
|
/// function can only be called by product, policy needs to match with calling product
|
37
|
-
function
|
49
|
+
function decline(
|
50
|
+
IInstance instance,
|
51
|
+
InstanceReader instanceReader,
|
52
|
+
NftId policyNftId,
|
53
|
+
ClaimId claimId
|
54
|
+
) external;
|
38
55
|
|
39
56
|
/// @dev closes the claim
|
40
57
|
/// a claim may only be closed once all existing payouts have been executed and the sum of the paid out amounts has reached the claim amount
|
41
58
|
/// function can only be called by product, policy needs to match with calling product
|
42
|
-
function
|
59
|
+
function close(
|
60
|
+
IInstance instance,
|
61
|
+
InstanceReader instanceReader,
|
62
|
+
NftId policyNftId,
|
63
|
+
ClaimId claimId
|
64
|
+
) external;
|
43
65
|
|
44
|
-
/// @dev create a new payout for the specified policy
|
66
|
+
/// @dev create a new payout for the specified policy
|
67
|
+
/// payoutId may be constructed using PayoutIdLib(claimId, payoutNo)
|
45
68
|
/// function can only be called by product, policy needs to match with calling product
|
46
69
|
function createPayout(
|
70
|
+
IInstance instance,
|
47
71
|
NftId policyNftId,
|
48
|
-
|
49
|
-
|
72
|
+
PayoutId payoutId,
|
73
|
+
Amount payoutAmount,
|
50
74
|
bytes calldata payoutData
|
51
|
-
) external
|
75
|
+
) external;
|
52
76
|
|
53
77
|
/// @dev callback function to confirm transfer of payout token to beneficiary
|
54
78
|
/// allows claim service to update claims/payout book keeping
|
55
79
|
/// only pool service can confirm executed payout
|
56
|
-
function
|
80
|
+
function processPayout(
|
81
|
+
IInstance instance,
|
82
|
+
InstanceReader instanceReader,
|
57
83
|
NftId policyNftId,
|
58
84
|
PayoutId payoutId
|
59
|
-
)
|
85
|
+
)
|
86
|
+
external
|
87
|
+
returns (
|
88
|
+
Amount amount,
|
89
|
+
bool payoutIsClosingClaim
|
90
|
+
);
|
60
91
|
|
61
92
|
}
|
@@ -4,7 +4,10 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IRisk} from "../module/IRisk.sol";
|
5
5
|
import {IService} from "../../shared/IService.sol";
|
6
6
|
|
7
|
+
import {Amount} from "../../types/Amount.sol";
|
8
|
+
import {ClaimId} from "../../types/ClaimId.sol";
|
7
9
|
import {NftId} from "../../types/NftId.sol";
|
10
|
+
import {PayoutId} from "../../types/PayoutId.sol";
|
8
11
|
import {ReferralId} from "../../types/Referral.sol";
|
9
12
|
import {RiskId} from "../../types/RiskId.sol";
|
10
13
|
import {Seconds} from "../../types/Seconds.sol";
|
@@ -14,7 +17,20 @@ import {UFixed} from "../../types/UFixed.sol";
|
|
14
17
|
import {Fee} from "../../types/Fee.sol";
|
15
18
|
|
16
19
|
interface IPolicyService is IService {
|
17
|
-
|
20
|
+
|
21
|
+
event LogPolicyServiceClaimSubmitted(NftId policyNftId, ClaimId claimId, Amount claimAmount);
|
22
|
+
event LogPolicyServiceClaimConfirmed(NftId policyNftId, ClaimId claimId, Amount confirmedAmount);
|
23
|
+
event LogPolicyServiceClaimDeclined(NftId policyNftId, ClaimId claimId);
|
24
|
+
event LogPolicyServiceClaimClosed(NftId policyNftId, ClaimId claimId);
|
25
|
+
|
26
|
+
event LogPolicyServicePayoutCreated(NftId policyNftId, PayoutId payoutId, Amount amount);
|
27
|
+
event LogPolicyServicePayoutProcessed(NftId policyNftId, PayoutId payoutId, Amount amount);
|
28
|
+
|
29
|
+
error ErrorPolicyServiceProductMismatch(NftId policyNftId, NftId expectedProduct, NftId actualProduct);
|
30
|
+
error ErrorPolicyServicePolicyNotOpen(NftId policyNftId);
|
31
|
+
error ErrorPolicyServiceClaimExceedsSumInsured(NftId policyNftId, Amount sumInsured, Amount payoutsIncludingClaimAmount);
|
32
|
+
error ErrorPolicyServicePolicyStateNotApplied(NftId applicationNftId);
|
33
|
+
|
18
34
|
error ErrorIPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
|
19
35
|
error ErrorIPolicyServicePremiumAlreadyPaid(NftId policyNftId, uint256 premiumPaidAmount);
|
20
36
|
error ErrorIPolicyServicePolicyNotActivated(NftId policyNftId);
|
@@ -24,22 +40,23 @@ interface IPolicyService is IService {
|
|
24
40
|
error ErrorIPolicyServiceOpenClaims(NftId policyNftId, uint16 openClaimsCount);
|
25
41
|
error ErrorIPolicyServicePolicyHasNotExpired(NftId policyNftId, Timestamp expiredAt);
|
26
42
|
|
27
|
-
error ErrorIPolicyServicePremiumMismatch(NftId policyNftId, uint256
|
43
|
+
error ErrorIPolicyServicePremiumMismatch(NftId policyNftId, uint256 expectedPremiumAmount, uint256 recalculatedPremiumAmount);
|
44
|
+
error ErrorPolicyServiceTransferredPremiumMismatch(NftId policyNftId, uint256 expectedPremiumAmount, uint256 transferredPremiumAmount);
|
28
45
|
|
29
46
|
/// @dev declines an application represented by {policyNftId}
|
30
47
|
/// an application can only be declined in applied state
|
31
48
|
/// only the related product may decline an application
|
32
49
|
function decline(NftId policyNftId) external;
|
33
50
|
|
34
|
-
/// @dev
|
51
|
+
/// @dev collateralizes the policy represented by {policyNftId}
|
35
52
|
/// sets the policy state to underwritten
|
36
53
|
/// may set the policy state to activated and set the activation date
|
37
54
|
/// optionally collects premiums and activates the policy.
|
38
55
|
/// - premium payment is only attempted if requirePremiumPayment is set to true
|
39
56
|
/// - activation is only done if activateAt is a non-zero timestamp
|
40
57
|
/// an application can only be underwritten in applied state
|
41
|
-
/// only the related product may
|
42
|
-
function
|
58
|
+
/// only the related product may collateralize an application
|
59
|
+
function collateralize(
|
43
60
|
NftId policyNftId,
|
44
61
|
bool requirePremiumPayment,
|
45
62
|
Timestamp activateAt
|
@@ -63,6 +80,56 @@ interface IPolicyService is IService {
|
|
63
80
|
/// this function can only be called by a product. the policy needs to match with the calling product
|
64
81
|
function close(NftId policyNftId) external;
|
65
82
|
|
83
|
+
/// @dev create a new claim for the specified policy
|
84
|
+
/// returns the id of the newly created claim
|
85
|
+
/// function can only be called by product, policy needs to match with calling product
|
86
|
+
function submitClaim(
|
87
|
+
NftId policyNftId,
|
88
|
+
Amount claimAmount,
|
89
|
+
bytes memory claimData
|
90
|
+
) external returns (ClaimId claimId);
|
91
|
+
|
92
|
+
/// @dev declines the specified claim
|
93
|
+
/// function can only be called by product, policy needs to match with calling product
|
94
|
+
function declineClaim(
|
95
|
+
NftId policyNftId,
|
96
|
+
ClaimId claimId) external;
|
97
|
+
|
98
|
+
/// @dev confirms the specified claim and specifies the payout amount
|
99
|
+
/// function can only be called by product, policy needs to match with calling product
|
100
|
+
function confirmClaim(
|
101
|
+
NftId policyNftId,
|
102
|
+
ClaimId claimId,
|
103
|
+
Amount confirmedAmount
|
104
|
+
) external;
|
105
|
+
|
106
|
+
/// @dev closes the specified claim
|
107
|
+
/// function can only be called by product, policy needs to match with calling product
|
108
|
+
function closeClaim(
|
109
|
+
NftId policyNftId,
|
110
|
+
ClaimId claimId
|
111
|
+
) external;
|
112
|
+
|
113
|
+
/// @dev creates a new payout for the specified claim
|
114
|
+
/// returns the id of the newly created payout, this id is unique for the specified policy
|
115
|
+
/// function can only be called by product, policy needs to match with calling product
|
116
|
+
function createPayout(
|
117
|
+
NftId policyNftId,
|
118
|
+
ClaimId claimId,
|
119
|
+
Amount amount,
|
120
|
+
bytes memory data
|
121
|
+
)
|
122
|
+
external
|
123
|
+
returns (PayoutId payoutId);
|
124
|
+
|
125
|
+
/// @dev processes the specified payout
|
126
|
+
/// this includes moving the payout token to the beneficiary (default: policy holder)
|
127
|
+
/// function can only be called by product, policy needs to match with calling product
|
128
|
+
function processPayout(
|
129
|
+
NftId policyNftId,
|
130
|
+
PayoutId payoutId
|
131
|
+
) external;
|
132
|
+
|
66
133
|
// TODO move function to pool service
|
67
134
|
function calculateRequiredCollateral(
|
68
135
|
UFixed collateralizationLevel,
|
@@ -22,6 +22,7 @@ interface IPoolService is IService {
|
|
22
22
|
|
23
23
|
error ErrorPoolServiceBundleOwnerRoleAlreadySet(NftId poolNftId);
|
24
24
|
error ErrorPoolServiceBundlePoolMismatch(NftId bundlePoolNftId, NftId productPoolNftId);
|
25
|
+
error ErrorPoolServiceInvalidTransferAmount(Amount expectedAmount, Amount actualAmount);
|
25
26
|
|
26
27
|
/// @dev registers a new pool with the registry service
|
27
28
|
function register(address poolAddress) external returns(NftId);
|
@@ -85,6 +86,8 @@ interface IPoolService is IService {
|
|
85
86
|
/// may only be called by registered and unlocked pool components
|
86
87
|
function closeBundle(NftId bundleNftId) external;
|
87
88
|
|
89
|
+
/// @dev processes the sale of a bundle and track the pool fee and bundle fee amounts
|
90
|
+
function processSale(NftId bundleNftId, IPolicy.Premium memory premium, uint256 actualAmountTransferred) external;
|
88
91
|
|
89
92
|
/// @dev increase stakes for bundle
|
90
93
|
/// staking fees will be deducted by the pool service from the staking amount
|