@etherisc/gif-next 0.0.2-f29e479-370 → 0.0.2-f2df3e2-873
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +78 -89
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +139 -140
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +156 -64
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +181 -112
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +353 -176
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -138
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +299 -245
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +83 -162
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +527 -400
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +175 -51
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +500 -612
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +253 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +305 -211
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +71 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +86 -31
- 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 +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- 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 +291 -100
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +46 -22
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +422 -252
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +78 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +373 -87
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +55 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +579 -123
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +71 -47
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +200 -46
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +241 -188
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +251 -58
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +444 -25
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +430 -76
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +511 -14
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +544 -153
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -27
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +562 -52
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +24 -12
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +115 -52
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -24
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- 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 +18 -37
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- 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/IService.sol/IService.json +80 -14
- 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 +3 -3
- 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/Service.sol/Service.json +87 -16
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- 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/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +3 -3
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +102 -27
- 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/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- 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 +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +185 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- 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/Fee.sol/FeeLib.json +40 -9
- 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 +17 -4
- 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 +23 -4
- 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 +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- 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 +38 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +99 -87
- package/contracts/components/Distribution.sol +18 -21
- package/contracts/components/IComponent.sol +40 -18
- package/contracts/components/IDistributionComponent.sol +1 -22
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +178 -130
- package/contracts/components/Product.sol +157 -71
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +10 -9
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +37 -27
- package/contracts/instance/IInstanceService.sol +18 -9
- package/contracts/instance/Instance.sol +117 -98
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +36 -12
- package/contracts/instance/InstanceService.sol +193 -191
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +17 -30
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +23 -6
- package/contracts/instance/module/IAccess.sol +21 -14
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +37 -7
- package/contracts/instance/module/ISetup.sol +7 -22
- package/contracts/instance/service/ApplicationService.sol +137 -50
- package/contracts/instance/service/BundleService.sol +221 -83
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +174 -118
- package/contracts/instance/service/IApplicationService.sol +9 -13
- package/contracts/instance/service/IBundleService.sol +68 -26
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +20 -4
- package/contracts/instance/service/IPolicyService.sol +69 -21
- package/contracts/instance/service/IPoolService.sol +82 -3
- package/contracts/instance/service/PolicyService.sol +297 -232
- package/contracts/instance/service/PoolService.sol +214 -20
- package/contracts/instance/service/ProductService.sol +31 -54
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +4 -3
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +15 -16
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/shared/Service.sol +21 -7
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +65 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +13 -6
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -1,22 +1,21 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
5
5
|
import {IService} from "../../shared/IService.sol";
|
6
6
|
|
7
7
|
import {NftId} from "../../types/NftId.sol";
|
8
|
+
import {ObjectType} from "../../types/ObjectType.sol";
|
8
9
|
import {ReferralId} from "../../types/Referral.sol";
|
9
10
|
import {RiskId} from "../../types/RiskId.sol";
|
10
|
-
import {
|
11
|
-
import {Timestamp} from "../../types/Timestamp.sol";
|
12
|
-
import {UFixed} from "../../types/UFixed.sol";
|
13
|
-
import {Fee} from "../../types/Fee.sol";
|
11
|
+
import {Seconds} from "../../types/Seconds.sol";
|
14
12
|
|
15
13
|
/// @dev gif service responsible for creating applications
|
16
14
|
/// only product components may call transaction functions
|
17
15
|
interface IApplicationService is IService {
|
18
16
|
|
19
|
-
error
|
17
|
+
error ErrorApplicationServiceNotProduct(NftId callerNftId, ObjectType callerType);
|
18
|
+
error ErrorApplicationServiceBundlePoolMismatch(NftId bundleNftId, NftId bundlePoolNftId, NftId poolNftId);
|
20
19
|
|
21
20
|
/// @dev creates a new application based on the specified attributes
|
22
21
|
/// may only be called by a product component
|
@@ -24,7 +23,7 @@ interface IApplicationService is IService {
|
|
24
23
|
address applicationOwner,
|
25
24
|
RiskId riskId,
|
26
25
|
uint256 sumInsuredAmount,
|
27
|
-
|
26
|
+
Seconds lifetime,
|
28
27
|
NftId bundleNftId,
|
29
28
|
ReferralId referralId,
|
30
29
|
bytes memory applicationData
|
@@ -63,9 +62,10 @@ interface IApplicationService is IService {
|
|
63
62
|
/// @dev calculates the premium amount for the specified attributes
|
64
63
|
/// also returns the various fee components involved with creating a policy
|
65
64
|
function calculatePremium(
|
65
|
+
NftId productNftId,
|
66
66
|
RiskId riskId,
|
67
67
|
uint256 sumInsuredAmount,
|
68
|
-
|
68
|
+
Seconds lifetime,
|
69
69
|
bytes memory applicationData,
|
70
70
|
NftId bundleNftId,
|
71
71
|
ReferralId referralId
|
@@ -73,10 +73,6 @@ interface IApplicationService is IService {
|
|
73
73
|
external
|
74
74
|
view
|
75
75
|
returns (
|
76
|
-
|
77
|
-
uint256 distributionFeeAmount,
|
78
|
-
uint256 productFeeAmount,
|
79
|
-
uint256 poolFeeAmount,
|
80
|
-
uint256 bundleFeeAmount
|
76
|
+
IPolicy.Premium memory premium
|
81
77
|
);
|
82
78
|
}
|
@@ -1,54 +1,96 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
+
import {Amount} from "../../types/Amount.sol";
|
4
5
|
import {NftId} from "../../types/NftId.sol";
|
5
6
|
import {Fee} from "../../types/Fee.sol";
|
6
|
-
import {StateId} from "../../types/StateId.sol";
|
7
7
|
import {IService} from "../../shared/IService.sol";
|
8
8
|
import {IBundle} from "../module/IBundle.sol";
|
9
9
|
import {IInstance} from "../../instance/IInstance.sol";
|
10
|
+
import {Seconds} from "../../types/Seconds.sol";
|
11
|
+
import {StateId} from "../../types/StateId.sol";
|
12
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
10
13
|
|
11
14
|
interface IBundleService is IService {
|
12
|
-
error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
event LogBundleServiceBundleActivated(NftId bundleNftId);
|
17
|
+
event LogBundleServiceBundleLocked(NftId bundleNftId);
|
18
|
+
|
19
|
+
error ErrorBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
|
20
|
+
error ErrorBundleServiceBundleNotOpen(NftId bundleNftId, StateId state, Timestamp expiredAt);
|
21
|
+
error ErrorBundleServiceCapacityInsufficient(NftId bundleNftId, uint capacityAmount, uint collateralAmount);
|
22
|
+
error ErrorBundleServiceBundleWithOpenPolicies(NftId bundleNftId, uint256 openPoliciesCount);
|
23
|
+
|
24
|
+
error ErrorBundleServiceBundleUnknown(NftId bundleNftId);
|
25
|
+
error ErrorBundleServiceBundlePoolMismatch(NftId expectedPoolNftId, NftId bundlePoolNftId);
|
26
|
+
|
27
|
+
/// @dev create a new bundle for the specified attributes
|
28
|
+
/// may only be called by pool service
|
29
|
+
function create(
|
30
|
+
IInstance instance, // instance relevant for bundle
|
31
|
+
NftId poolNftId, // the pool the bundle will be linked to
|
32
|
+
address owner, // initial bundle owner
|
33
|
+
Fee memory fee, // fees deducted from premium that go to bundle owner
|
34
|
+
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
35
|
+
Seconds lifetime, // initial duration for which new policies are covered
|
36
|
+
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
37
|
+
)
|
38
|
+
external
|
39
|
+
returns(NftId bundleNftId); // the nft id of the newly created bundle
|
40
|
+
|
41
|
+
/// @dev locks the specified bundle, locked bundles are not available to collateralize new policies
|
42
|
+
/// only active bundles may be locked
|
43
|
+
/// may only be called by registered and unlocked pool components
|
44
|
+
function lock(NftId bundleNftId) external;
|
45
|
+
|
46
|
+
/// @dev activates the specified bundle
|
47
|
+
/// only locked bundles may be unlocked
|
48
|
+
/// may only be called by registered and unlocked pool components
|
49
|
+
function unlock(NftId bundleNftId) external;
|
50
|
+
|
51
|
+
/// @dev closes the specified bundle
|
52
|
+
/// only open bundles (active or locked) may be closed
|
53
|
+
/// to close a bundle it may not have any non-closed polices attached to it
|
54
|
+
/// may only be called by registered and unlocked pool components
|
55
|
+
function close(
|
56
|
+
IInstance instance,
|
57
|
+
NftId bundleNftId
|
58
|
+
) external;
|
21
59
|
|
22
|
-
|
60
|
+
/// @dev set bundle fee to provided value
|
61
|
+
/// may only be called by registered and unlocked pool components
|
62
|
+
function setFee(
|
23
63
|
NftId bundleNftId,
|
24
64
|
Fee memory fee
|
25
65
|
) external;
|
26
66
|
|
27
|
-
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
28
67
|
|
68
|
+
/// @dev locks the specified collateral in the bundle
|
69
|
+
/// the locked collateral is added to the bundle locked capital
|
70
|
+
/// the bundles' fees are updated with the fees for this premium
|
71
|
+
/// the premium (minus bundle fee) is added to the bundle capital
|
72
|
+
/// may only be called by pool service
|
29
73
|
function lockCollateral(
|
30
74
|
IInstance instanceNftId,
|
31
75
|
NftId policyNftId,
|
32
76
|
NftId bundleNftId,
|
33
77
|
uint256 collateralAmount,
|
34
|
-
uint256
|
35
|
-
)
|
36
|
-
external
|
37
|
-
returns (
|
38
|
-
IBundle.BundleInfo memory bundleInfo
|
39
|
-
);
|
40
|
-
|
41
|
-
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
42
|
-
|
43
|
-
function closePolicy(IInstance instance, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount) external;
|
78
|
+
uint256 premium // premium amount after pool fee
|
79
|
+
) external;
|
44
80
|
|
45
|
-
// function fundBundle(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
46
81
|
|
47
|
-
|
82
|
+
/// @dev releases the specified collateral in the bundle
|
83
|
+
/// may only be called by pool service
|
84
|
+
function releaseCollateral(
|
85
|
+
IInstance instance,
|
86
|
+
NftId policyNftId,
|
87
|
+
NftId bundleNftId,
|
88
|
+
uint256 collateralAmount
|
89
|
+
) external;
|
48
90
|
|
49
|
-
function
|
91
|
+
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
50
92
|
|
51
|
-
function
|
93
|
+
// function stake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
52
94
|
|
53
|
-
// function
|
95
|
+
// function unstake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
54
96
|
}
|
@@ -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
|
}
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
6
7
|
import {IService} from "../../shared/IService.sol";
|
7
8
|
import {UFixed} from "../../types/UFixed.sol";
|
8
9
|
import {DistributorType} from "../../types/DistributorType.sol";
|
@@ -11,6 +12,7 @@ import {Timestamp} from "../../types/Timestamp.sol";
|
|
11
12
|
|
12
13
|
|
13
14
|
interface IDistributionService is IService {
|
15
|
+
error ErrorDistributionServiceCallerNotRegistered(address caller);
|
14
16
|
error ErrorIDistributionServiceParentNftIdNotInstance(NftId nftId, NftId parentNftId);
|
15
17
|
error ErrorIDistributionServiceCallerNotDistributor(address caller);
|
16
18
|
error ErrorIDistributionServiceInvalidReferralId(ReferralId referralId);
|
@@ -21,9 +23,21 @@ interface IDistributionService is IService {
|
|
21
23
|
error ErrorIDistributionServiceInvalidReferral(string code);
|
22
24
|
error ErrorIDistributionServiceExpirationInvalid(Timestamp expiryAt);
|
23
25
|
error ErrorIDistributionServiceCommissionTooHigh(uint256 commissionPercentage, uint256 maxCommissionPercentage);
|
24
|
-
error
|
26
|
+
error ErrorIDistributionServiceMinFeeTooHigh(uint256 minFee, uint256 limit);
|
27
|
+
error ErrorIDistributionServiceMaxDiscountTooHigh(uint256 maxDiscountPercentage, uint256 limit);
|
28
|
+
error ErrorIDistributionServiceFeeCalculationMismatch(
|
29
|
+
uint256 distributionFeeFixAmount,
|
30
|
+
uint256 distributionFeeVarAmount,
|
31
|
+
uint256 distributionOwnerFeeFixAmount,
|
32
|
+
uint256 distributionOwnerFeeVarAmount,
|
33
|
+
uint256 commissionAmount,
|
34
|
+
uint256 discountAmount
|
35
|
+
);
|
36
|
+
error ErrorIDistributionServiceReferralInvalid(NftId distributionNftId, ReferralId referralId);
|
37
|
+
error ErrorIDistributionServiceInvalidFeeTransferred(uint256 transferredDistributionFeeAmount, uint256 expectedDistributionFeeAmount);
|
25
38
|
|
26
39
|
function setFees(
|
40
|
+
Fee memory minDistributionOwnerFee,
|
27
41
|
Fee memory distributionFee
|
28
42
|
) external;
|
29
43
|
|
@@ -66,15 +80,17 @@ interface IDistributionService is IService {
|
|
66
80
|
|
67
81
|
/// @dev callback from product service when selling a policy for a specific referralId
|
68
82
|
function processSale(
|
83
|
+
NftId distributionNftId,
|
69
84
|
ReferralId referralId,
|
70
|
-
|
85
|
+
IPolicy.Premium memory premium,
|
86
|
+
uint256 transferredDistributionFeeAmount
|
71
87
|
) external;
|
72
88
|
|
73
89
|
function calculateFeeAmount(
|
74
90
|
NftId distributionNftId,
|
75
91
|
ReferralId referralId,
|
76
|
-
|
77
|
-
) external view returns (
|
92
|
+
IPolicy.Premium memory premium
|
93
|
+
) external view returns (IPolicy.Premium memory finalPremium);
|
78
94
|
|
79
95
|
function referralIsValid(
|
80
96
|
NftId distributorNftId,
|
@@ -4,16 +4,32 @@ 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";
|
13
|
+
import {Seconds} from "../../types/Seconds.sol";
|
10
14
|
import {StateId} from "../../types/StateId.sol";
|
11
15
|
import {Timestamp} from "../../types/Timestamp.sol";
|
12
16
|
import {UFixed} from "../../types/UFixed.sol";
|
13
17
|
import {Fee} from "../../types/Fee.sol";
|
14
18
|
|
15
19
|
interface IPolicyService is IService {
|
16
|
-
|
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 ErrorPolicyServicePolicyProductMismatch(NftId policyNftId, NftId expectedProduct, NftId actualProduct);
|
30
|
+
error ErrorPolicyServicePolicyNotOpen(NftId policyNftId);
|
31
|
+
error ErrorPolicyServiceClaimExceedsSumInsured(NftId policyNftId, Amount sumInsured, Amount payoutsIncludingClaimAmount);
|
32
|
+
|
17
33
|
error ErrorIPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
|
18
34
|
error ErrorIPolicyServicePremiumAlreadyPaid(NftId policyNftId, uint256 premiumPaidAmount);
|
19
35
|
error ErrorIPolicyServicePolicyNotActivated(NftId policyNftId);
|
@@ -23,20 +39,22 @@ interface IPolicyService is IService {
|
|
23
39
|
error ErrorIPolicyServiceOpenClaims(NftId policyNftId, uint16 openClaimsCount);
|
24
40
|
error ErrorIPolicyServicePolicyHasNotExpired(NftId policyNftId, Timestamp expiredAt);
|
25
41
|
|
42
|
+
error ErrorIPolicyServicePremiumMismatch(NftId policyNftId, uint256 expectedPremiumAmount, uint256 recalculatedPremiumAmount);
|
43
|
+
|
26
44
|
/// @dev declines an application represented by {policyNftId}
|
27
45
|
/// an application can only be declined in applied state
|
28
46
|
/// only the related product may decline an application
|
29
47
|
function decline(NftId policyNftId) external;
|
30
48
|
|
31
|
-
/// @dev
|
49
|
+
/// @dev collateralizes the policy represented by {policyNftId}
|
32
50
|
/// sets the policy state to underwritten
|
33
51
|
/// may set the policy state to activated and set the activation date
|
34
52
|
/// optionally collects premiums and activates the policy.
|
35
53
|
/// - premium payment is only attempted if requirePremiumPayment is set to true
|
36
54
|
/// - activation is only done if activateAt is a non-zero timestamp
|
37
55
|
/// an application can only be underwritten in applied state
|
38
|
-
/// only the related product may
|
39
|
-
function
|
56
|
+
/// only the related product may collateralize an application
|
57
|
+
function collateralize(
|
40
58
|
NftId policyNftId,
|
41
59
|
bool requirePremiumPayment,
|
42
60
|
Timestamp activateAt
|
@@ -60,25 +78,55 @@ interface IPolicyService is IService {
|
|
60
78
|
/// this function can only be called by a product. the policy needs to match with the calling product
|
61
79
|
function close(NftId policyNftId) external;
|
62
80
|
|
63
|
-
/// @dev
|
64
|
-
///
|
65
|
-
function
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
bytes memory
|
70
|
-
|
71
|
-
|
81
|
+
/// @dev create a new claim for the specified policy
|
82
|
+
/// returns the id of the newly created claim
|
83
|
+
/// function can only be called by product, policy needs to match with calling product
|
84
|
+
function submitClaim(
|
85
|
+
NftId policyNftId,
|
86
|
+
Amount claimAmount,
|
87
|
+
bytes memory claimData
|
88
|
+
) external returns (ClaimId claimId);
|
89
|
+
|
90
|
+
/// @dev declines the specified claim
|
91
|
+
/// function can only be called by product, policy needs to match with calling product
|
92
|
+
function declineClaim(
|
93
|
+
NftId policyNftId,
|
94
|
+
ClaimId claimId) external;
|
95
|
+
|
96
|
+
/// @dev confirms the specified claim and specifies the payout amount
|
97
|
+
/// function can only be called by product, policy needs to match with calling product
|
98
|
+
function confirmClaim(
|
99
|
+
NftId policyNftId,
|
100
|
+
ClaimId claimId,
|
101
|
+
Amount confirmedAmount
|
102
|
+
) external;
|
103
|
+
|
104
|
+
/// @dev closes the specified claim
|
105
|
+
/// function can only be called by product, policy needs to match with calling product
|
106
|
+
function closeClaim(
|
107
|
+
NftId policyNftId,
|
108
|
+
ClaimId claimId
|
109
|
+
) external;
|
110
|
+
|
111
|
+
/// @dev creates a new payout for the specified claim
|
112
|
+
/// returns the id of the newly created payout, this id is unique for the specified policy
|
113
|
+
/// function can only be called by product, policy needs to match with calling product
|
114
|
+
function createPayout(
|
115
|
+
NftId policyNftId,
|
116
|
+
ClaimId claimId,
|
117
|
+
Amount amount,
|
118
|
+
bytes memory data
|
72
119
|
)
|
73
120
|
external
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
121
|
+
returns (PayoutId payoutId);
|
122
|
+
|
123
|
+
/// @dev processes the specified payout
|
124
|
+
/// this includes moving the payout token to the beneficiary (default: policy holder)
|
125
|
+
/// function can only be called by product, policy needs to match with calling product
|
126
|
+
function processPayout(
|
127
|
+
NftId policyNftId,
|
128
|
+
PayoutId payoutId
|
129
|
+
) external;
|
82
130
|
|
83
131
|
// TODO move function to pool service
|
84
132
|
function calculateRequiredCollateral(
|
@@ -1,20 +1,99 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {Amount} from "../../types/Amount.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
-
import {
|
7
|
-
import {IService} from "../../shared/IService.sol";
|
6
|
+
import {NftId} from "../../types/NftId.sol";
|
8
7
|
import {IBundle} from "../module/IBundle.sol";
|
9
8
|
import {IInstance} from "../../instance/IInstance.sol";
|
9
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
10
|
+
import {IService} from "../../shared/IService.sol";
|
11
|
+
import {RoleId} from "../../types/RoleId.sol";
|
12
|
+
import {Seconds} from "../../types/Seconds.sol";
|
13
|
+
import {StateId} from "../../types/StateId.sol";
|
10
14
|
|
11
15
|
interface IPoolService is IService {
|
12
16
|
|
17
|
+
event LogPoolServiceMaxCapitalAmountUpdated(NftId poolNftId, uint256 previousMaxCapitalAmount, uint256 currentMaxCapitalAmount);
|
18
|
+
event LogPoolServiceBundleOwnerRoleSet(NftId poolNftId, RoleId bundleOwnerRole);
|
19
|
+
|
20
|
+
event LogPoolServiceBundleCreated(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
|
21
|
+
event LogPoolServiceBundleClosed(NftId instanceNftId, NftId poolNftId, NftId bundleNftId);
|
22
|
+
|
23
|
+
error ErrorPoolServiceBundleOwnerRoleAlreadySet(NftId poolNftId);
|
24
|
+
error ErrorPoolServiceBundlePoolMismatch(NftId bundlePoolNftId, NftId productPoolNftId);
|
25
|
+
|
26
|
+
/// @dev registers a new pool with the registry service
|
13
27
|
function register(address poolAddress) external returns(NftId);
|
14
28
|
|
29
|
+
/// @dev defines the required role for bundle owners for the calling pool
|
30
|
+
/// default implementation returns PUBLIC ROLE
|
31
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole) external;
|
32
|
+
|
33
|
+
/// @dev sets the max capital amount for the calling pool
|
34
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount) external;
|
35
|
+
|
36
|
+
/// @dev set pool sepecific fees
|
15
37
|
function setFees(
|
16
38
|
Fee memory poolFee,
|
17
39
|
Fee memory stakingFee,
|
18
40
|
Fee memory performanceFee
|
19
41
|
) external;
|
42
|
+
|
43
|
+
|
44
|
+
/// @dev locks required collateral to cover the specified application (and turn it into a policy)
|
45
|
+
/// - retention level == 1: the full collateral amount will be locked by the specified bundle
|
46
|
+
/// - retention level < 1: a part of the coverage is provided by the specified bundle, the rest by the pool component
|
47
|
+
/// in which case the pool component might hold a re-insurance policy
|
48
|
+
/// may only be called by the policy service for unlocked pool components
|
49
|
+
function lockCollateral(
|
50
|
+
IInstance instance,
|
51
|
+
NftId productNftId,
|
52
|
+
NftId applicationNftId,
|
53
|
+
IPolicy.PolicyInfo memory applicationInfo,
|
54
|
+
uint256 premiumAmount
|
55
|
+
) external;
|
56
|
+
|
57
|
+
|
58
|
+
/// @dev releases the remaining collateral linked to the specified policy
|
59
|
+
/// may only be called by the policy service for unlocked pool components
|
60
|
+
function releaseCollateral(
|
61
|
+
IInstance instance,
|
62
|
+
NftId policyNftId,
|
63
|
+
IPolicy.PolicyInfo memory policyInfo
|
64
|
+
) external;
|
65
|
+
|
66
|
+
|
67
|
+
/// @dev create a new bundle for the provided parameters
|
68
|
+
/// staking fees will be deducted by the pool service from the staking amount
|
69
|
+
/// may only be called by registered and unlocked pool components
|
70
|
+
function createBundle(
|
71
|
+
address owner, // initial bundle owner
|
72
|
+
Fee memory fee, // fees deducted from premium that go to bundle owner
|
73
|
+
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
74
|
+
Seconds lifetime, // initial duration for which new policies are covered
|
75
|
+
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
76
|
+
)
|
77
|
+
external
|
78
|
+
returns(NftId bundleNftId); // the nft id of the newly created bundle
|
79
|
+
|
80
|
+
|
81
|
+
/// @dev closes the specified bundle
|
82
|
+
/// only open bundles (active or locked) may be closed
|
83
|
+
/// to close a bundle it may not have any non-closed polices attached to it
|
84
|
+
/// bundle fees and remaining capital (after deduction of the performance fee) will be transferred to the bundle owner
|
85
|
+
/// may only be called by registered and unlocked pool components
|
86
|
+
function closeBundle(NftId bundleNftId) external;
|
87
|
+
|
88
|
+
|
89
|
+
/// @dev increase stakes for bundle
|
90
|
+
/// staking fees will be deducted by the pool service from the staking amount
|
91
|
+
/// may only be called by registered and unlocked pool components
|
92
|
+
// function stake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
93
|
+
|
94
|
+
|
95
|
+
/// @dev decrease stakes for bundle
|
96
|
+
/// performance fees will be deducted by the pool service from the staking amount
|
97
|
+
/// may only be called by registered and unlocked pool components
|
98
|
+
// function unstake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
20
99
|
}
|