@etherisc/gif-next 0.0.2-ce87da3-250 → 0.0.2-ceb30b2-601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +78 -102
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +139 -153
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +155 -76
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +181 -125
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +342 -178
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -151
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +286 -245
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +83 -175
- 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 +707 -463
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +167 -76
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +630 -625
- 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 +258 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +291 -238
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +79 -48
- 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 +114 -35
- 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 +322 -99
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +59 -44
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +459 -242
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +90 -39
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +646 -84
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +119 -32
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +673 -129
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +96 -69
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +205 -59
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +253 -185
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +373 -51
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +480 -37
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +170 -102
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +776 -46
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +85 -27
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +255 -222
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +37 -78
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +929 -58
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +84 -37
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +145 -58
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +28 -37
- 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 +5 -37
- 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 +23 -50
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +21 -34
- 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 +10 -23
- 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/INftOwnable.sol/INftOwnable.json +0 -13
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +45 -9
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -13
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +85 -27
- 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 +6 -19
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +47 -24
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +14 -27
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +7 -20
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +92 -29
- 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 +7 -20
- 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 +107 -40
- 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 +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 +39 -27
- package/contracts/instance/IInstanceService.sol +16 -12
- package/contracts/instance/Instance.sol +125 -98
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +36 -12
- package/contracts/instance/InstanceService.sol +220 -212
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +28 -32
- package/contracts/instance/base/KeyValueStore.sol +13 -36
- 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 +38 -7
- package/contracts/instance/module/ISetup.sol +7 -22
- package/contracts/instance/service/ApplicationService.sol +138 -50
- package/contracts/instance/service/BundleService.sol +228 -83
- package/contracts/instance/service/ClaimService.sol +240 -30
- package/contracts/instance/service/DistributionService.sol +179 -114
- package/contracts/instance/service/IApplicationService.sol +9 -13
- package/contracts/instance/service/IBundleService.sol +74 -26
- package/contracts/instance/service/IClaimService.sol +52 -23
- package/contracts/instance/service/IDistributionService.sol +21 -3
- package/contracts/instance/service/IPolicyService.sol +20 -29
- package/contracts/instance/service/IPoolService.sol +127 -3
- package/contracts/instance/service/PolicyService.sol +133 -251
- package/contracts/instance/service/PoolService.sol +258 -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 +2 -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/IPolicyHolder.sol +20 -8
- package/contracts/shared/IRegistryLinked.sol +0 -1
- package/contracts/shared/IService.sol +6 -6
- package/contracts/shared/NftOwnable.sol +0 -2
- package/contracts/shared/PolicyHolder.sol +14 -8
- package/contracts/shared/Registerable.sol +12 -11
- package/contracts/shared/RegistryLinked.sol +0 -5
- 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/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
@@ -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,88 +66,296 @@ 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
|
-
|
77
|
-
function createClaim(
|
81
|
+
function submit(
|
78
82
|
NftId policyNftId,
|
79
|
-
|
83
|
+
Amount claimAmount,
|
80
84
|
bytes memory claimData
|
81
85
|
)
|
82
86
|
external
|
83
87
|
virtual
|
84
|
-
returns (ClaimId)
|
88
|
+
returns (ClaimId claimId)
|
85
89
|
{
|
86
|
-
|
90
|
+
(
|
91
|
+
IInstance instance,
|
92
|
+
InstanceReader instanceReader,
|
93
|
+
IPolicy.PolicyInfo memory policyInfo
|
94
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
95
|
+
|
96
|
+
// check policy is in its active period
|
97
|
+
if(policyInfo.activatedAt.eqz() || TimestampLib.blockTimestamp() >= policyInfo.expiredAt) {
|
98
|
+
revert ErrorClaimServicePolicyNotOpen(policyNftId);
|
99
|
+
}
|
100
|
+
|
101
|
+
// check policy including this claim is still within sum insured
|
102
|
+
if(policyInfo.payoutAmount.toInt() + claimAmount.toInt() > policyInfo.sumInsuredAmount) {
|
103
|
+
revert ErrorClaimServiceClaimExceedsSumInsured(
|
104
|
+
policyNftId,
|
105
|
+
AmountLib.toAmount(policyInfo.sumInsuredAmount),
|
106
|
+
AmountLib.toAmount(policyInfo.payoutAmount.toInt() + claimAmount.toInt()));
|
107
|
+
}
|
108
|
+
|
109
|
+
// create new claim
|
110
|
+
claimId = ClaimIdLib.toClaimId(policyInfo.claimsCount + 1);
|
111
|
+
instance.createClaim(
|
112
|
+
policyNftId,
|
113
|
+
claimId,
|
114
|
+
IPolicy.ClaimInfo(
|
115
|
+
claimAmount,
|
116
|
+
AmountLib.zero(), // paidAmount
|
117
|
+
0, // payoutsCount
|
118
|
+
0, // openPayoutsCount
|
119
|
+
claimData,
|
120
|
+
TimestampLib.zero())); // closedAt
|
121
|
+
|
122
|
+
// update and save policy info with instance
|
123
|
+
policyInfo.claimsCount += 1;
|
124
|
+
policyInfo.openClaimsCount += 1;
|
125
|
+
// policy claim amount is only updated when claim is confirmed
|
126
|
+
instance.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
127
|
+
|
128
|
+
emit LogClaimServiceClaimSubmitted(policyNftId, claimId, claimAmount);
|
87
129
|
}
|
88
130
|
|
89
131
|
|
90
|
-
function
|
132
|
+
function confirm(
|
133
|
+
NftId policyNftId,
|
134
|
+
ClaimId claimId,
|
135
|
+
Amount confirmedAmount
|
136
|
+
)
|
91
137
|
external
|
92
138
|
virtual
|
93
|
-
// solhint-disable-next-line no-empty-blocks
|
94
139
|
{
|
95
|
-
|
140
|
+
(
|
141
|
+
IInstance instance,
|
142
|
+
InstanceReader instanceReader,
|
143
|
+
IPolicy.PolicyInfo memory policyInfo
|
144
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
145
|
+
|
146
|
+
// check/update claim info
|
147
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
148
|
+
claimInfo.claimAmount = confirmedAmount;
|
149
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, CONFIRMED());
|
150
|
+
|
151
|
+
// update and save policy info with instance
|
152
|
+
policyInfo.claimAmount.add(confirmedAmount);
|
153
|
+
instance.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
154
|
+
|
155
|
+
emit LogClaimServiceClaimConfirmed(policyNftId, claimId, confirmedAmount);
|
96
156
|
}
|
97
157
|
|
98
|
-
|
99
|
-
|
158
|
+
function decline(
|
159
|
+
NftId policyNftId,
|
160
|
+
ClaimId claimId
|
161
|
+
)
|
100
162
|
external
|
101
163
|
virtual
|
102
|
-
// solhint-disable-next-line no-empty-blocks
|
103
164
|
{
|
104
|
-
|
165
|
+
(
|
166
|
+
IInstance instance,
|
167
|
+
InstanceReader instanceReader,
|
168
|
+
IPolicy.PolicyInfo memory policyInfo
|
169
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
170
|
+
|
171
|
+
// check/update claim info
|
172
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, SUBMITTED());
|
173
|
+
claimInfo.closedAt = TimestampLib.blockTimestamp();
|
174
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, DECLINED());
|
175
|
+
|
176
|
+
// update and save policy info with instance
|
177
|
+
policyInfo.openClaimsCount -= 1;
|
178
|
+
instance.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
179
|
+
|
180
|
+
emit LogClaimServiceClaimDeclined(policyNftId, claimId);
|
105
181
|
}
|
106
182
|
|
107
|
-
|
108
|
-
|
183
|
+
function close(
|
184
|
+
NftId policyNftId,
|
185
|
+
ClaimId claimId
|
186
|
+
)
|
109
187
|
external
|
110
188
|
virtual
|
111
|
-
// solhint-disable-next-line no-empty-blocks
|
112
189
|
{
|
113
|
-
|
190
|
+
(
|
191
|
+
IInstance instance,
|
192
|
+
InstanceReader instanceReader,
|
193
|
+
IPolicy.PolicyInfo memory policyInfo
|
194
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
195
|
+
|
196
|
+
// check/update claim info
|
197
|
+
IPolicy.ClaimInfo memory claimInfo = _verifyClaim(instanceReader, policyNftId, claimId, CONFIRMED());
|
198
|
+
|
199
|
+
// check claim has no open payouts
|
200
|
+
if(claimInfo.openPayoutsCount > 0) {
|
201
|
+
revert ErrorClaimServiceClaimWithOpenPayouts(
|
202
|
+
policyNftId,
|
203
|
+
claimId,
|
204
|
+
claimInfo.openPayoutsCount);
|
205
|
+
}
|
206
|
+
|
207
|
+
// check claim paid amount matches with claim amount
|
208
|
+
if(claimInfo.paidAmount.toInt() < claimInfo.claimAmount.toInt()) {
|
209
|
+
revert ErrorClaimServiceClaimWithMissingPayouts(
|
210
|
+
policyNftId,
|
211
|
+
claimId,
|
212
|
+
claimInfo.claimAmount,
|
213
|
+
claimInfo.paidAmount);
|
214
|
+
}
|
215
|
+
|
216
|
+
claimInfo.closedAt = TimestampLib.blockTimestamp();
|
217
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, CLOSED());
|
218
|
+
|
219
|
+
// update and save policy info with instance
|
220
|
+
policyInfo.openClaimsCount -= 1;
|
221
|
+
instance.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
222
|
+
|
223
|
+
emit LogClaimServiceClaimClosed(policyNftId, claimId);
|
114
224
|
}
|
115
225
|
|
116
226
|
|
117
227
|
function createPayout(
|
118
228
|
NftId policyNftId,
|
119
229
|
ClaimId claimId,
|
120
|
-
|
121
|
-
bytes
|
230
|
+
Amount amount,
|
231
|
+
bytes memory data
|
122
232
|
)
|
123
233
|
external
|
124
|
-
|
125
|
-
|
126
|
-
// solhint-disable-next-line no-empty-blocks
|
234
|
+
returns (PayoutId payoutId)
|
235
|
+
// TODO add restricted and grant to policy service
|
127
236
|
{
|
128
|
-
|
237
|
+
(
|
238
|
+
IInstance instance,
|
239
|
+
InstanceReader instanceReader,
|
240
|
+
IPolicy.PolicyInfo memory policyInfo
|
241
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
242
|
+
|
243
|
+
IPolicy.ClaimInfo memory claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
|
244
|
+
StateId claimState = instanceReader.getClaimState(policyNftId, claimId);
|
245
|
+
|
246
|
+
// TODO add checks
|
247
|
+
// claim needs to be open
|
248
|
+
// claim.paidAmount + amount <= claim.claimAmount
|
249
|
+
|
250
|
+
// check/update claim info
|
251
|
+
// create payout info with instance
|
252
|
+
uint8 claimNo = claimInfo.payoutsCount + 1;
|
253
|
+
payoutId = PayoutIdLib.toPayoutId(claimId, claimNo);
|
254
|
+
instance.createPayout(
|
255
|
+
policyNftId,
|
256
|
+
payoutId,
|
257
|
+
IPolicy.PayoutInfo(
|
258
|
+
payoutId.toClaimId(),
|
259
|
+
amount,
|
260
|
+
data,
|
261
|
+
TimestampLib.zero()));
|
262
|
+
|
263
|
+
// update and save claim info with instance
|
264
|
+
claimInfo.payoutsCount += 1;
|
265
|
+
claimInfo.openPayoutsCount += 1;
|
266
|
+
instance.updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
|
267
|
+
|
268
|
+
// update and save policy info with instance
|
269
|
+
policyInfo.payoutAmount.add(amount);
|
270
|
+
instance.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
271
|
+
|
272
|
+
emit LogClaimServicePayoutCreated(policyNftId, payoutId, amount);
|
129
273
|
}
|
130
274
|
|
131
275
|
|
132
|
-
function
|
276
|
+
function processPayout(
|
133
277
|
NftId policyNftId,
|
134
278
|
PayoutId payoutId
|
135
279
|
)
|
136
280
|
external
|
137
281
|
virtual
|
138
|
-
//
|
282
|
+
// TODO add restricted and grant to policy service
|
139
283
|
{
|
284
|
+
(
|
285
|
+
IInstance instance,
|
286
|
+
InstanceReader instanceReader,
|
287
|
+
IPolicy.PolicyInfo memory policyInfo
|
288
|
+
) = _verifyCallerWithPolicy(policyNftId);
|
289
|
+
|
290
|
+
// TODO update and save payout info with instance
|
291
|
+
Amount amount = AmountLib.toAmount(0);
|
292
|
+
bool payoutIsClosingClaim = false;
|
293
|
+
|
294
|
+
// TODO update and save claim info with instance
|
295
|
+
|
296
|
+
// update policy info if affected by processed payout
|
297
|
+
if(payoutIsClosingClaim) {
|
298
|
+
policyInfo.openClaimsCount -= 1;
|
299
|
+
instance.updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
|
300
|
+
}
|
140
301
|
|
302
|
+
// TODO callback IPolicyHolder
|
303
|
+
|
304
|
+
emit LogClaimServicePayoutProcessed(policyNftId, payoutId, amount);
|
141
305
|
}
|
142
306
|
|
143
307
|
|
144
308
|
// internal functions
|
145
309
|
|
310
|
+
function _verifyCallerWithPolicy(
|
311
|
+
NftId policyNftId
|
312
|
+
)
|
313
|
+
internal
|
314
|
+
returns (
|
315
|
+
IInstance instance,
|
316
|
+
InstanceReader instanceReader,
|
317
|
+
IPolicy.PolicyInfo memory policyInfo
|
318
|
+
)
|
319
|
+
{
|
320
|
+
NftId productNftId;
|
321
|
+
(productNftId,, instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
322
|
+
instanceReader = instance.getInstanceReader();
|
323
|
+
|
324
|
+
// check caller(product) policy match
|
325
|
+
policyInfo = instanceReader.getPolicyInfo(policyNftId);
|
326
|
+
if(policyInfo.productNftId != productNftId) {
|
327
|
+
revert ErrorClaimServicePolicyProductMismatch(policyNftId,
|
328
|
+
policyInfo.productNftId,
|
329
|
+
productNftId);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
function _verifyClaim(
|
334
|
+
InstanceReader instanceReader,
|
335
|
+
NftId policyNftId,
|
336
|
+
ClaimId claimId,
|
337
|
+
StateId expectedState
|
338
|
+
)
|
339
|
+
internal
|
340
|
+
view
|
341
|
+
returns (
|
342
|
+
IPolicy.ClaimInfo memory claimInfo
|
343
|
+
)
|
344
|
+
{
|
345
|
+
// check claim is created state
|
346
|
+
StateId claimState = instanceReader.getClaimState(policyNftId, claimId);
|
347
|
+
if(claimState != expectedState) {
|
348
|
+
revert ErrorClaimServiceClaimNotInExpectedState(
|
349
|
+
policyNftId, claimId, expectedState, claimState);
|
350
|
+
}
|
351
|
+
|
352
|
+
// get claim info
|
353
|
+
claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
|
354
|
+
}
|
355
|
+
|
146
356
|
function _getAndVerifyInstanceAndProduct() internal view returns (Product product) {
|
147
357
|
IRegistry.ObjectInfo memory productInfo;
|
148
|
-
(productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
358
|
+
(, productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
149
359
|
product = Product(productInfo.objectAddress);
|
150
360
|
}
|
151
361
|
}
|