@etherisc/gif-next 0.0.2-e922e07-736 → 0.0.2-e94f4c7-084
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 +68 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +84 -0
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +158 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +158 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +184 -149
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +158 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +114 -189
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +68 -0
- 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 +457 -268
- 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 +426 -476
- 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 +217 -169
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +304 -210
- 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 +85 -30
- 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 +175 -83
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +29 -13
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +426 -233
- 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 +372 -86
- 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 +189 -139
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +48 -56
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +111 -40
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +246 -170
- 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 +101 -24
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +470 -41
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +627 -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 +607 -85
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +71 -19
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +777 -55
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +72 -12
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +114 -51
- 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 +17 -36
- 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 +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/Service.sol/Service.json +86 -15
- 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 +2 -2
- 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 +101 -26
- 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 +209 -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 +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/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 +42 -10
- package/contracts/components/Distribution.sol +6 -2
- package/contracts/components/IComponent.sol +9 -1
- package/contracts/components/IPoolComponent.sol +6 -44
- package/contracts/components/Pool.sol +50 -126
- package/contracts/components/Product.sol +141 -59
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +9 -8
- 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 -204
- 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 +6 -4
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IPolicy.sol +11 -6
- package/contracts/instance/module/ISetup.sol +3 -16
- package/contracts/instance/service/ApplicationService.sol +25 -19
- package/contracts/instance/service/BundleService.sol +224 -80
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +58 -77
- package/contracts/instance/service/IApplicationService.sol +3 -7
- package/contracts/instance/service/IBundleService.sol +72 -25
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +1 -0
- package/contracts/instance/service/IPolicyService.sol +72 -5
- package/contracts/instance/service/IPoolService.sol +85 -3
- package/contracts/instance/service/PolicyService.sol +320 -143
- package/contracts/instance/service/PoolService.sol +245 -18
- 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 +10 -11
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- 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 +70 -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/RoleId.sol +6 -4
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +6 -0
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -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,
|
@@ -64,77 +66,140 @@ contract ClaimService is
|
|
64
66
|
address initialOwner;
|
65
67
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
66
68
|
|
67
|
-
initializeService(registryAddress, owner);
|
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
|
|
71
76
|
|
72
|
-
function getDomain() public pure override
|
77
|
+
function getDomain() public pure override returns(ObjectType) {
|
73
78
|
return CLAIM();
|
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,9 +208,32 @@ 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
|
-
(productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
236
|
+
(, productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
149
237
|
product = Product(productInfo.objectAddress);
|
150
238
|
}
|
151
239
|
}
|
@@ -10,10 +10,11 @@ import {IPolicy} from "../module/IPolicy.sol";
|
|
10
10
|
|
11
11
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
12
12
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
13
|
-
import {DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
|
13
|
+
import {PRODUCT_SERVICE_ROLE, DISTRIBUTION_OWNER_ROLE} from "../../types/RoleId.sol";
|
14
14
|
import {KEEP_STATE} from "../../types/StateId.sol";
|
15
15
|
import {ObjectType, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR} from "../../types/ObjectType.sol";
|
16
16
|
import {Version, VersionLib} from "../../types/Version.sol";
|
17
|
+
import {RoleId} from "../../types/RoleId.sol";
|
17
18
|
|
18
19
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
19
20
|
import {Versionable} from "../../shared/Versionable.sol";
|
@@ -59,11 +60,11 @@ contract DistributionService is
|
|
59
60
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
60
61
|
// TODO while DistributionService is not deployed in DistributionServiceManager constructor
|
61
62
|
// owner is DistributionServiceManager deployer
|
62
|
-
initializeService(registryAddress, owner);
|
63
|
+
initializeService(registryAddress, address(0), owner);
|
63
64
|
registerInterface(type(IDistributionService).interfaceId);
|
64
65
|
}
|
65
66
|
|
66
|
-
function getDomain() public pure override
|
67
|
+
function getDomain() public pure override returns(ObjectType) {
|
67
68
|
return DISTRIBUTION();
|
68
69
|
}
|
69
70
|
|
@@ -87,8 +88,24 @@ contract DistributionService is
|
|
87
88
|
distributionNftId = distributionInfo.nftId;
|
88
89
|
|
89
90
|
instance.createDistributionSetup(distributionNftId, distribution.getSetupInfo());
|
90
|
-
|
91
|
-
|
91
|
+
// TODO move to distribution?
|
92
|
+
bytes4[][] memory selectors = new bytes4[][](2);
|
93
|
+
selectors[0] = new bytes4[](1);
|
94
|
+
selectors[1] = new bytes4[](2);
|
95
|
+
|
96
|
+
selectors[0][0] = IDistributionComponent.setFees.selector;
|
97
|
+
selectors[1][0] = IDistributionComponent.processRenewal.selector;
|
98
|
+
|
99
|
+
RoleId[] memory roles = new RoleId[](2);
|
100
|
+
roles[0] = DISTRIBUTION_OWNER_ROLE();
|
101
|
+
roles[1] = PRODUCT_SERVICE_ROLE();
|
102
|
+
|
103
|
+
getInstanceService().createGifTarget(
|
104
|
+
instanceNftId,
|
105
|
+
distributionAddress,
|
106
|
+
distribution.getName(),
|
107
|
+
selectors,
|
108
|
+
roles);
|
92
109
|
}
|
93
110
|
|
94
111
|
function setFees(
|
@@ -102,9 +119,8 @@ contract DistributionService is
|
|
102
119
|
revert ErrorIDistributionServiceMinFeeTooHigh(minDistributionOwnerFee.fractionalFee.toInt(), distributionFee.fractionalFee.toInt());
|
103
120
|
}
|
104
121
|
|
105
|
-
(IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(DISTRIBUTION());
|
122
|
+
(NftId distributionNftId, IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(DISTRIBUTION());
|
106
123
|
InstanceReader instanceReader = instance.getInstanceReader();
|
107
|
-
NftId distributionNftId = info.nftId;
|
108
124
|
|
109
125
|
ISetup.DistributionSetupInfo memory distSetupInfo = instanceReader.getDistributionSetupInfo(distributionNftId);
|
110
126
|
distSetupInfo.minDistributionOwnerFee = minDistributionOwnerFee;
|
@@ -127,7 +143,7 @@ contract DistributionService is
|
|
127
143
|
external
|
128
144
|
returns (DistributorType distributorType)
|
129
145
|
{
|
130
|
-
(
|
146
|
+
(NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
|
131
147
|
|
132
148
|
{
|
133
149
|
ISetup.DistributionSetupInfo memory setupInfo = instance.getInstanceReader().getDistributionSetupInfo(distributionNftId);
|
@@ -139,22 +155,18 @@ contract DistributionService is
|
|
139
155
|
}
|
140
156
|
|
141
157
|
distributorType = DistributorTypeLib.toDistributorType(distributionNftId, name);
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
data);
|
155
|
-
|
156
|
-
instance.createDistributorType(key32, info);
|
157
|
-
}
|
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);
|
158
170
|
}
|
159
171
|
|
160
172
|
function createDistributor(
|
@@ -163,7 +175,7 @@ contract DistributionService is
|
|
163
175
|
bytes memory data
|
164
176
|
) external returns (NftId distributorNftId)
|
165
177
|
{
|
166
|
-
(
|
178
|
+
(NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
|
167
179
|
|
168
180
|
distributorNftId = getRegistryService().registerDistributor(
|
169
181
|
IRegistry.ObjectInfo(
|
@@ -192,7 +204,7 @@ contract DistributionService is
|
|
192
204
|
bytes memory data
|
193
205
|
) external virtual
|
194
206
|
{
|
195
|
-
(
|
207
|
+
(, IInstance instance) = _getAndVerifyCallingDistribution();
|
196
208
|
InstanceReader instanceReader = instance.getInstanceReader();
|
197
209
|
IDistribution.DistributorInfo memory distributorInfo = instanceReader.getDistributorInfo(distributorNftId);
|
198
210
|
distributorInfo.distributorType = distributorType;
|
@@ -213,7 +225,7 @@ contract DistributionService is
|
|
213
225
|
virtual
|
214
226
|
returns (ReferralId referralId)
|
215
227
|
{
|
216
|
-
(
|
228
|
+
(NftId distributionNftId, IInstance instance) = _getAndVerifyCallingDistribution();
|
217
229
|
|
218
230
|
if (bytes(code).length == 0) {
|
219
231
|
revert ErrorIDistributionServiceInvalidReferral(code);
|
@@ -251,7 +263,7 @@ contract DistributionService is
|
|
251
263
|
data
|
252
264
|
);
|
253
265
|
|
254
|
-
instance.createReferral(referralId
|
266
|
+
instance.createReferral(referralId, info);
|
255
267
|
return referralId;
|
256
268
|
}
|
257
269
|
|
@@ -271,7 +283,7 @@ contract DistributionService is
|
|
271
283
|
revert ErrorIDistributionServiceReferralInvalid(distributionNftId, referralId);
|
272
284
|
}
|
273
285
|
|
274
|
-
|
286
|
+
IInstance instance = _getInstanceForDistribution(distributionNftId);
|
275
287
|
InstanceReader reader = instance.getInstanceReader();
|
276
288
|
IDistribution.ReferralInfo memory referralInfo = reader.getReferralInfo(referralId);
|
277
289
|
IDistribution.DistributorInfo memory distributorInfo = reader.getDistributorInfo(referralInfo.distributorNftId);
|
@@ -292,7 +304,7 @@ contract DistributionService is
|
|
292
304
|
|
293
305
|
if (isReferral) {
|
294
306
|
referralInfo.usedReferrals += 1;
|
295
|
-
instance.updateReferral(referralId
|
307
|
+
instance.updateReferral(referralId, referralInfo, KEEP_STATE());
|
296
308
|
|
297
309
|
if (commissionAmount > 0) {
|
298
310
|
distributorInfo.sumCommisions += commissionAmount;
|
@@ -312,7 +324,7 @@ contract DistributionService is
|
|
312
324
|
view
|
313
325
|
returns (IPolicy.Premium memory finalPremium)
|
314
326
|
{
|
315
|
-
|
327
|
+
IInstance instance = _getInstanceForDistribution(distributionNftId);
|
316
328
|
InstanceReader reader = instance.getInstanceReader();
|
317
329
|
|
318
330
|
// first calculate all fixed and variable fees for the distribution - this will defined the fullPremium
|
@@ -373,7 +385,7 @@ contract DistributionService is
|
|
373
385
|
|
374
386
|
// TODO: zero should return false
|
375
387
|
function referralIsValid(NftId distributionNftId, ReferralId referralId) public view returns (bool isValid) {
|
376
|
-
|
388
|
+
IInstance instance = _getInstanceForDistribution(distributionNftId);
|
377
389
|
IDistribution.ReferralInfo memory info = instance.getInstanceReader().getReferralInfo(referralId);
|
378
390
|
|
379
391
|
if (info.distributorNftId.eqz()) {
|
@@ -388,63 +400,32 @@ contract DistributionService is
|
|
388
400
|
internal
|
389
401
|
view
|
390
402
|
returns(
|
391
|
-
address distributionAddress,
|
392
403
|
NftId distributionNftId,
|
393
404
|
IInstance instance
|
394
405
|
)
|
395
406
|
{
|
396
|
-
|
397
|
-
(
|
398
|
-
|
399
|
-
distributionNftId,
|
400
|
-
objectType,
|
401
|
-
instance
|
402
|
-
) = _getAndVerifyCaller();
|
403
|
-
|
404
|
-
if(objectType != DISTRIBUTION()) {
|
405
|
-
revert ErrorIDistributionServiceCallerNotDistributor(msg.sender);
|
407
|
+
distributionNftId = getRegistry().getNftId(msg.sender);
|
408
|
+
if (distributionNftId.eqz()) {
|
409
|
+
revert ErrorDistributionServiceCallerNotRegistered(msg.sender);
|
406
410
|
}
|
407
|
-
}
|
408
411
|
|
409
|
-
function _getAndVerifyDistribution(NftId distributionNftId)
|
410
|
-
internal
|
411
|
-
view
|
412
|
-
returns(
|
413
|
-
address distributionAddress,
|
414
|
-
IInstance instance
|
415
|
-
)
|
416
|
-
{
|
417
412
|
IRegistry.ObjectInfo memory info = getRegistry().getObjectInfo(distributionNftId);
|
418
|
-
|
419
|
-
|
420
|
-
revert ErrorIDistributionServiceParentNftIdNotInstance(distributionNftId, info.parentNftId);
|
413
|
+
if(info.objectType != DISTRIBUTION()) {
|
414
|
+
revert ErrorIDistributionServiceCallerNotDistributor(msg.sender);
|
421
415
|
}
|
422
|
-
|
416
|
+
|
417
|
+
address instanceAddress = getRegistry().getObjectInfo(info.parentNftId).objectAddress;
|
418
|
+
instance = IInstance(instanceAddress);
|
423
419
|
}
|
424
420
|
|
425
|
-
|
421
|
+
|
422
|
+
function _getInstanceForDistribution(NftId distributionNftId)
|
426
423
|
internal
|
427
424
|
view
|
428
|
-
returns(
|
429
|
-
address objectAddress,
|
430
|
-
NftId objectNftId,
|
431
|
-
ObjectType objectType,
|
432
|
-
IInstance instance
|
433
|
-
)
|
425
|
+
returns(IInstance instance)
|
434
426
|
{
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
revert ErrorIServiceCallerUnknown(objectAddress);
|
439
|
-
}
|
440
|
-
IRegistry.ObjectInfo memory info = getRegistry().getObjectInfo(objectNftId);
|
441
|
-
objectType = info.objectType;
|
442
|
-
|
443
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(info.parentNftId);
|
444
|
-
if (parentInfo.objectType != INSTANCE()) {
|
445
|
-
revert ErrorIDistributionServiceParentNftIdNotInstance(objectNftId, info.parentNftId);
|
446
|
-
}
|
447
|
-
instance = IInstance(parentInfo.objectAddress);
|
427
|
+
NftId instanceNftId = getRegistry().getObjectInfo(distributionNftId).parentNftId;
|
428
|
+
address instanceAddress = getRegistry().getObjectInfo(instanceNftId).objectAddress;
|
429
|
+
return IInstance(instanceAddress);
|
448
430
|
}
|
449
|
-
|
450
431
|
}
|
@@ -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
|
@@ -1,6 +1,7 @@
|
|
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
7
|
import {IService} from "../../shared/IService.sol";
|
@@ -8,48 +9,94 @@ import {IBundle} from "../module/IBundle.sol";
|
|
8
9
|
import {IInstance} from "../../instance/IInstance.sol";
|
9
10
|
import {Seconds} from "../../types/Seconds.sol";
|
10
11
|
import {StateId} from "../../types/StateId.sol";
|
12
|
+
import {Timestamp} from "../../types/Timestamp.sol";
|
11
13
|
|
12
14
|
interface IBundleService is IService {
|
13
|
-
error ErrorIBundleServiceInsufficientAllowance(address bundleOwner, address tokenHandlerAddress, uint256 amount);
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
Fee memory fee,
|
18
|
-
uint256 amount,
|
19
|
-
Seconds lifetime,
|
20
|
-
bytes calldata filter
|
21
|
-
) external returns(NftId bundleNftId);
|
16
|
+
event LogBundleServiceBundleActivated(NftId bundleNftId);
|
17
|
+
event LogBundleServiceBundleLocked(NftId bundleNftId);
|
22
18
|
|
23
|
-
|
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;
|
59
|
+
|
60
|
+
/// @dev set bundle fee to provided value
|
61
|
+
/// may only be called by registered and unlocked pool components
|
62
|
+
function setFee(
|
24
63
|
NftId bundleNftId,
|
25
64
|
Fee memory fee
|
26
65
|
) external;
|
27
66
|
|
28
|
-
function updateBundle(NftId instanceNftId, NftId bundleNftId, IBundle.BundleInfo memory bundleInfo, StateId state) external;
|
29
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
|
30
73
|
function lockCollateral(
|
31
74
|
IInstance instanceNftId,
|
32
75
|
NftId policyNftId,
|
33
76
|
NftId bundleNftId,
|
34
77
|
uint256 collateralAmount,
|
35
|
-
uint256
|
36
|
-
)
|
37
|
-
external
|
38
|
-
returns (
|
39
|
-
IBundle.BundleInfo memory bundleInfo
|
40
|
-
);
|
41
|
-
|
42
|
-
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
43
|
-
|
44
|
-
function closePolicy(IInstance instance, NftId policyNftId, NftId bundleNftId, uint256 collateralAmount) external;
|
78
|
+
uint256 premium // premium amount after pool fee
|
79
|
+
) external;
|
45
80
|
|
46
|
-
|
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;
|
47
87
|
|
48
|
-
|
88
|
+
/// @dev releases the specified collateral in the bundle
|
89
|
+
/// may only be called by pool service
|
90
|
+
function releaseCollateral(
|
91
|
+
IInstance instance,
|
92
|
+
NftId policyNftId,
|
93
|
+
NftId bundleNftId,
|
94
|
+
uint256 collateralAmount
|
95
|
+
) external;
|
49
96
|
|
50
|
-
function
|
97
|
+
function increaseBalance(IInstance instance, NftId bundleNftId, uint256 amount) external;
|
51
98
|
|
52
|
-
function
|
99
|
+
// function stake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
53
100
|
|
54
|
-
// function
|
101
|
+
// function unstake(NftId bundleNftId, uint256 amount) external returns(uint256 netAmount);
|
55
102
|
}
|