@etherisc/gif-next 0.0.2-da77c50-824 → 0.0.2-de0a1d3-009
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +58 -11
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +405 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +340 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +131 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +109 -18
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +194 -3
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +160 -21
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +697 -671
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +928 -744
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{InstanceBase.sol/InstanceBase.json → base/ComponentServiceBase.sol/ComponentServiceBase.json} +107 -33
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +560 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/{module/lifecycle/ILifecycle.sol/ILifecycleModule.json → base/ILifecycle.sol/ILifecycle.json} +10 -77
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/IService.sol/IService.json +63 -22
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +463 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +710 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{module/product/ProductModule.sol/ProductModule.json → base/ModuleBase.sol/ModuleBase.json} +2 -2
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/ServiceBase.sol/ServiceBase.json +93 -6
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +71 -50
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +71 -50
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +22 -93
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +22 -93
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +61 -38
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +61 -38
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -5
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -5
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{product/IProductModule.sol/IProductModule.json → risk/IRisk.sol/IRisk.json} +2 -2
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +113 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +131 -0
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +209 -236
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +209 -236
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +141 -42
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +507 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +62 -21
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{ComponentServiceBase.sol/ComponentServiceBase.json → IDistributionService.sol/IDistributionService.json} +96 -30
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +127 -22
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +215 -21
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +177 -46
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +322 -62
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.json +724 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +58 -17
- package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.dbg.json +4 -0
- package/artifacts/contracts/shared/Proxy.sol/ProxyDeployer.json +248 -0
- package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.dbg.json +4 -0
- package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.json +129 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +92 -5
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.dbg.json +4 -0
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.json +228 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +4 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +405 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +28 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +194 -3
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +209 -27
- 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 +38 -4
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +102 -43
- 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 +14 -18
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +102 -39
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.json +338 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +257 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +111 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -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/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +99 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +30 -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/UFixed.sol/UFixedMathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +34 -8
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +101 -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/BaseComponent.sol +7 -2
- package/contracts/components/Distribution.sol +132 -0
- package/contracts/components/IDistributionComponent.sol +47 -0
- package/contracts/components/IPoolComponent.sol +14 -0
- package/contracts/components/IProductComponent.sol +24 -5
- package/contracts/components/Pool.sol +64 -3
- package/contracts/components/Product.sol +123 -13
- package/contracts/instance/IInstance.sol +16 -13
- package/contracts/instance/Instance.sol +22 -10
- package/contracts/instance/{service → base}/ComponentServiceBase.sol +1 -0
- package/contracts/instance/base/IInstanceBase.sol +22 -0
- package/contracts/instance/base/IKeyValueStore.sol +50 -0
- package/contracts/instance/base/ILifecycle.sol +30 -0
- package/contracts/instance/{InstanceBase.sol → base/InstanceBase.sol} +34 -17
- package/contracts/instance/base/KeyValueStore.sol +161 -0
- package/contracts/instance/{module/lifecycle/LifecycleModule.sol → base/Lifecycle.sol} +50 -39
- package/contracts/instance/base/ModuleBase.sol +57 -0
- package/contracts/instance/{service → base}/ServiceBase.sol +1 -3
- package/contracts/instance/module/access/Access.sol +6 -6
- package/contracts/instance/module/bundle/BundleModule.sol +24 -118
- package/contracts/instance/module/bundle/IBundle.sol +9 -9
- package/contracts/instance/module/component/ComponentModule.sol +27 -61
- package/contracts/instance/module/component/IComponent.sol +5 -30
- package/contracts/instance/module/distribution/DistributionModule.sol +17 -0
- package/contracts/instance/module/distribution/IDistribution.sol +10 -0
- package/contracts/instance/module/policy/IPolicy.sol +12 -9
- package/contracts/instance/module/policy/PolicyModule.sol +33 -26
- package/contracts/instance/module/pool/IPoolModule.sol +0 -1
- package/contracts/instance/module/pool/PoolModule.sol +12 -9
- package/contracts/instance/module/risk/IRisk.sol +26 -0
- package/contracts/instance/module/risk/RiskModule.sol +62 -0
- package/contracts/instance/module/treasury/ITreasury.sol +30 -52
- package/contracts/instance/module/treasury/TreasuryModule.sol +74 -84
- package/contracts/instance/service/ComponentOwnerService.sol +33 -50
- package/contracts/instance/service/DistributionService.sol +59 -0
- package/contracts/instance/service/IComponentOwnerService.sol +1 -1
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +8 -1
- package/contracts/instance/service/IProductService.sol +56 -7
- package/contracts/instance/service/PoolService.sol +64 -13
- package/contracts/instance/service/ProductService.sol +234 -83
- package/contracts/registry/Registry.sol +4 -4
- package/contracts/registry/RegistryUpgradeable.sol +473 -0
- package/contracts/shared/IVersionable.sol +19 -6
- package/contracts/shared/Proxy.sol +94 -0
- package/contracts/shared/Versionable.sol +16 -9
- package/contracts/shared/VersionableUpgradeable.sol +133 -0
- package/contracts/test/TestDistribution.sol +21 -0
- package/contracts/test/TestFee.sol +3 -3
- package/contracts/test/TestPool.sol +6 -3
- package/contracts/test/TestProduct.sol +36 -8
- package/contracts/test/TestRoleId.sol +2 -2
- package/contracts/test/TestService.sol +3 -6
- package/contracts/test/TestVersion.sol +4 -7
- package/contracts/test/TestVersionable.sol +2 -5
- package/contracts/test/Usdc.sol +26 -0
- package/contracts/types/Fee.sol +44 -20
- package/contracts/types/Key32.sol +45 -0
- package/contracts/types/NftId.sol +16 -1
- package/contracts/types/ObjectType.sol +24 -8
- package/contracts/types/ReferralId.sol +48 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +12 -10
- package/contracts/types/StateId.sol +7 -1
- package/contracts/types/UFixed.sol +19 -16
- package/contracts/types/Version.sol +37 -25
- package/package.json +1 -1
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.json +0 -50
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- package/artifacts/contracts/instance/module/product/IProductModule.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/product/ProductModule.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/contracts/instance/IServiceLinked.sol +0 -12
- package/contracts/instance/module/lifecycle/ILifecycle.sol +0 -47
- package/contracts/instance/module/product/IProductModule.sol +0 -6
- package/contracts/instance/module/product/ProductModule.sol +0 -8
- /package/contracts/instance/{service → base}/IService.sol +0 -0
@@ -3,32 +3,33 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
5
5
|
|
6
|
-
import {LifecycleModule} from "../lifecycle/LifecycleModule.sol";
|
7
6
|
import {IProductService} from "../../service/IProductService.sol";
|
8
7
|
import {IPoolService} from "../../service/IPoolService.sol";
|
9
8
|
|
9
|
+
import {Fee} from "../../../types/Fee.sol";
|
10
10
|
import {NftId} from "../../../types/NftId.sol";
|
11
|
+
import {Key32, KeyId} from "../../../types/Key32.sol";
|
11
12
|
import {LibNftIdSet} from "../../../types/NftIdSet.sol";
|
12
13
|
import {ObjectType, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "../../../types/ObjectType.sol";
|
13
14
|
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, REVOKED, DECLINED} from "../../../types/StateId.sol";
|
14
15
|
import {Timestamp, blockTimestamp, zeroTimestamp} from "../../../types/Timestamp.sol";
|
15
16
|
import {Blocknumber, blockNumber} from "../../../types/Blocknumber.sol";
|
16
17
|
|
17
|
-
import {
|
18
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
19
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
20
|
+
|
18
21
|
import {IBundleModule} from "./IBundle.sol";
|
19
22
|
|
20
|
-
abstract contract BundleModule is
|
23
|
+
abstract contract BundleModule is
|
24
|
+
ModuleBase,
|
21
25
|
IBundleModule
|
22
26
|
{
|
23
27
|
|
24
28
|
using LibNftIdSet for LibNftIdSet.Set;
|
25
29
|
|
26
|
-
mapping(NftId bundleNftId => BundleInfo info) private _bundleInfo;
|
27
30
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) private _collateralizedPolicies;
|
28
31
|
mapping(NftId bundleNftId => mapping(NftId policyNftId => uint256 amount)) private _collateralizationAmount;
|
29
32
|
|
30
|
-
LifecycleModule private _lifecycleModule;
|
31
|
-
|
32
33
|
modifier onlyBundlePoolService() {
|
33
34
|
require(
|
34
35
|
msg.sender == address(this.getPoolService()),
|
@@ -54,13 +55,14 @@ abstract contract BundleModule is
|
|
54
55
|
_;
|
55
56
|
}
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
function initializeBundleModule(IKeyValueStore keyValueStore) internal {
|
59
|
+
_initialize(keyValueStore);
|
59
60
|
}
|
60
61
|
|
61
62
|
function createBundleInfo(
|
62
63
|
NftId bundleNftId,
|
63
64
|
NftId poolNftId,
|
65
|
+
Fee memory fee,
|
64
66
|
uint256 amount,
|
65
67
|
uint256 lifetime,
|
66
68
|
bytes calldata filter
|
@@ -69,101 +71,35 @@ abstract contract BundleModule is
|
|
69
71
|
onlyBundlePoolService
|
70
72
|
override
|
71
73
|
{
|
72
|
-
|
73
|
-
_bundleInfo[bundleNftId] = BundleInfo(
|
74
|
-
bundleNftId,
|
74
|
+
BundleInfo memory info = BundleInfo(
|
75
75
|
poolNftId,
|
76
|
-
|
76
|
+
fee,
|
77
77
|
filter,
|
78
78
|
amount, // capital
|
79
79
|
0, // locked capital
|
80
80
|
amount, // balance
|
81
|
-
blockTimestamp(), // createdAt
|
82
81
|
blockTimestamp().addSeconds(lifetime), // expiredAt
|
83
|
-
zeroTimestamp()
|
84
|
-
blockNumber() // updatedIn
|
82
|
+
zeroTimestamp() // closedAt
|
85
83
|
);
|
86
84
|
|
87
|
-
|
85
|
+
_create(BUNDLE(), bundleNftId, abi.encode(info));
|
88
86
|
}
|
89
87
|
|
90
|
-
function setBundleInfo(BundleInfo memory
|
88
|
+
function setBundleInfo(NftId bundleNftId, BundleInfo memory info)
|
91
89
|
external
|
92
90
|
override
|
93
91
|
onlyPoolOrProductService
|
94
92
|
{
|
95
|
-
|
93
|
+
_updateData(BUNDLE(), bundleNftId, abi.encode(info));
|
96
94
|
}
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
// {
|
106
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
107
|
-
// info.state = newState;
|
108
|
-
// info.updatedIn = blockNumber();
|
109
|
-
// }
|
110
|
-
|
111
|
-
// function extendBundle(
|
112
|
-
// NftId bundleNftId,
|
113
|
-
// uint256 lifetimeExtension
|
114
|
-
// )
|
115
|
-
// external
|
116
|
-
// onlyBundlePoolService
|
117
|
-
// override
|
118
|
-
// {
|
119
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
120
|
-
// info.expiredAt = info.expiredAt.addSeconds(lifetimeExtension);
|
121
|
-
// info.updatedIn = blockNumber();
|
122
|
-
// }
|
123
|
-
|
124
|
-
// function closeBundle(
|
125
|
-
// NftId bundleNftId
|
126
|
-
// )
|
127
|
-
// external
|
128
|
-
// onlyBundlePoolService
|
129
|
-
// override
|
130
|
-
// {
|
131
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
132
|
-
// info.state = CLOSED();
|
133
|
-
// info.closedAt = blockTimestamp();
|
134
|
-
// info.updatedIn = blockNumber();
|
135
|
-
// }
|
136
|
-
|
137
|
-
// function processStake(
|
138
|
-
// NftId nftId,
|
139
|
-
// uint256 amount
|
140
|
-
// )
|
141
|
-
// external
|
142
|
-
// onlyBundlePoolService
|
143
|
-
// override
|
144
|
-
// {
|
145
|
-
// BundleInfo storage info = _bundleInfo[nftId];
|
146
|
-
// info.capitalAmount += amount;
|
147
|
-
// info.balanceAmount += amount;
|
148
|
-
// info.updatedIn = blockNumber();
|
149
|
-
// }
|
150
|
-
|
151
|
-
// function processUnstake(
|
152
|
-
// NftId nftId,
|
153
|
-
// uint256 amount
|
154
|
-
// )
|
155
|
-
// external
|
156
|
-
// onlyBundlePoolService
|
157
|
-
// override
|
158
|
-
// {
|
159
|
-
// BundleInfo storage info = _bundleInfo[nftId];
|
160
|
-
// // TODO fix book keeping in a way that provides
|
161
|
-
// // continuous infor regarding profitability
|
162
|
-
// // this is needed to properly apply performance fees
|
163
|
-
// info.capitalAmount -= amount;
|
164
|
-
// info.balanceAmount -= amount;
|
165
|
-
// info.updatedIn = blockNumber();
|
166
|
-
// }
|
96
|
+
function updateBundleState(NftId bundleNftId, StateId state)
|
97
|
+
external
|
98
|
+
override
|
99
|
+
onlyBundlePoolService
|
100
|
+
{
|
101
|
+
_updateState(BUNDLE(), bundleNftId, state);
|
102
|
+
}
|
167
103
|
|
168
104
|
function collateralizePolicy(
|
169
105
|
NftId bundleNftId,
|
@@ -187,42 +123,12 @@ abstract contract BundleModule is
|
|
187
123
|
override
|
188
124
|
returns(uint256 collateralAmount)
|
189
125
|
{
|
190
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
191
|
-
// info.lockedAmount -= collateralAmount;
|
192
|
-
// info.updatedIn = blockNumber();
|
193
|
-
|
194
126
|
collateralAmount = _collateralizationAmount[bundleNftId][policyNftId];
|
195
127
|
delete _collateralizationAmount[bundleNftId][policyNftId];
|
196
128
|
_collateralizedPolicies[bundleNftId].remove(policyNftId);
|
197
129
|
}
|
198
130
|
|
199
|
-
// function addPremium(NftId bundleNftId, uint256 amount)
|
200
|
-
// external
|
201
|
-
// onlyBundleProductService
|
202
|
-
// override
|
203
|
-
// {
|
204
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
205
|
-
// info.capitalAmount += amount;
|
206
|
-
// info.balanceAmount += amount;
|
207
|
-
// info.updatedIn = blockNumber();
|
208
|
-
// }
|
209
|
-
|
210
|
-
// function subtractPayout(NftId bundleNftId, NftId policyNftId, uint256 amount)
|
211
|
-
// external
|
212
|
-
// onlyBundleProductService
|
213
|
-
// override
|
214
|
-
// {
|
215
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
216
|
-
// info.capitalAmount -= amount;
|
217
|
-
// info.lockedAmount -= amount;
|
218
|
-
// info.balanceAmount -= amount;
|
219
|
-
// info.updatedIn = blockNumber();
|
220
|
-
|
221
|
-
// // deduct amount from sum insured for this policy
|
222
|
-
// _collateralizationAmount[bundleNftId][policyNftId] -= amount;
|
223
|
-
// }
|
224
|
-
|
225
131
|
function getBundleInfo(NftId bundleNftId) external view override returns(BundleInfo memory bundleInfo) {
|
226
|
-
return
|
132
|
+
return abi.decode(_getData(BUNDLE(), bundleNftId), (BundleInfo));
|
227
133
|
}
|
228
134
|
}
|
@@ -3,28 +3,28 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
5
5
|
import {IInstance} from "../../IInstance.sol";
|
6
|
+
import {Fee} from "../../../types/Fee.sol";
|
7
|
+
import {Key32} from "../../../types/Key32.sol";
|
6
8
|
import {NftId} from "../../../types/NftId.sol";
|
7
9
|
import {StateId} from "../../../types/StateId.sol";
|
8
10
|
import {Timestamp} from "../../../types/Timestamp.sol";
|
9
11
|
import {Blocknumber} from "../../../types/Blocknumber.sol";
|
10
12
|
|
13
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
11
14
|
import {IProductService} from "../../service/IProductService.sol";
|
12
15
|
import {IPoolService} from "../../service/IPoolService.sol";
|
13
16
|
|
14
17
|
interface IBundle {
|
15
18
|
|
16
19
|
struct BundleInfo {
|
17
|
-
NftId nftId;
|
18
20
|
NftId poolNftId;
|
19
|
-
|
21
|
+
Fee fee; // bundle fee on net premium amounts
|
20
22
|
bytes filter; // required conditions for applications to be considered for collateralization by this bundle
|
21
23
|
uint256 capitalAmount; // net investment capital amount (<= balance)
|
22
24
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
23
25
|
uint256 balanceAmount; // total amount of funds: net investment capital + net premiums - payouts
|
24
|
-
Timestamp createdAt;
|
25
26
|
Timestamp expiredAt; // no new policies
|
26
27
|
Timestamp closedAt;
|
27
|
-
Blocknumber updatedIn;
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
@@ -33,19 +33,19 @@ interface IBundleModule is IBundle {
|
|
33
33
|
function createBundleInfo(
|
34
34
|
NftId bundleNftId,
|
35
35
|
NftId poolNftId,
|
36
|
+
Fee memory fee,
|
36
37
|
uint256 amount,
|
37
38
|
uint256 lifetime,
|
38
39
|
bytes calldata filter
|
39
40
|
) external;
|
40
41
|
|
41
|
-
function setBundleInfo(BundleInfo memory bundleInfo) external;
|
42
|
+
function setBundleInfo(NftId nftId, BundleInfo memory bundleInfo) external;
|
43
|
+
function updateBundleState(NftId nftId, StateId state) external;
|
44
|
+
|
42
45
|
function collateralizePolicy(NftId bundleNftId, NftId policyNftId, uint256 amount) external;
|
43
46
|
function releasePolicy(NftId bundleNftId, NftId policyNftId) external returns(uint256 collateralAmount);
|
44
47
|
|
45
|
-
function getBundleInfo(NftId
|
46
|
-
|
47
|
-
// repeat registry linked signature
|
48
|
-
function getRegistry() external view returns (IRegistry registry);
|
48
|
+
function getBundleInfo(NftId nftId) external view returns(BundleInfo memory bundleInfo);
|
49
49
|
|
50
50
|
// repeat service linked signatures to avoid linearization issues
|
51
51
|
function getProductService() external returns(IProductService);
|
@@ -2,32 +2,21 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
6
|
+
import {IComponentModule} from "./IComponent.sol";
|
5
7
|
|
6
|
-
import {
|
7
|
-
import {
|
8
|
+
import {NftId} from "../../../types/NftId.sol";
|
9
|
+
import {ObjectType, COMPONENT} from "../../../types/ObjectType.sol";
|
10
|
+
import {StateId} from "../../../types/StateId.sol";
|
11
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
12
|
-
import {ObjectType, PRODUCT, ORACLE, POOL} from "../../../types/ObjectType.sol";
|
13
|
-
import {StateId, ACTIVE, PAUSED} from "../../../types/StateId.sol";
|
14
|
-
import {NftId, NftIdLib, zeroNftId} from "../../../types/NftId.sol";
|
15
|
-
import {Fee, zeroFee} from "../../../types/Fee.sol";
|
16
|
-
// import {IBaseComponent} from "../../../components/IBaseComponent.sol";
|
17
|
-
|
18
|
-
abstract contract ComponentModule is
|
13
|
+
abstract contract ComponentModule is
|
14
|
+
ModuleBase,
|
19
15
|
IComponentModule
|
20
16
|
{
|
21
|
-
using NftIdLib for NftId;
|
22
17
|
|
23
|
-
mapping(NftId nftId => ComponentInfo info) private _componentInfo;
|
24
18
|
NftId[] private _nftIds;
|
25
19
|
|
26
|
-
mapping(ObjectType cType => bytes32 role) private _componentOwnerRole;
|
27
|
-
|
28
|
-
// TODO maybe move this to Instance contract as internal variable?
|
29
|
-
LifecycleModule private _lifecycleModule;
|
30
|
-
|
31
20
|
modifier onlyComponentOwnerService() {
|
32
21
|
require(
|
33
22
|
msg.sender == address(this.getComponentOwnerService()),
|
@@ -36,49 +25,32 @@ abstract contract ComponentModule is
|
|
36
25
|
_;
|
37
26
|
}
|
38
27
|
|
39
|
-
|
40
|
-
|
41
|
-
_lifecycleModule = LifecycleModule(componentAddress);
|
28
|
+
function initializeComponentModule(IKeyValueStore keyValueStore) internal {
|
29
|
+
_initialize(keyValueStore);
|
42
30
|
}
|
43
31
|
|
44
32
|
function registerComponent(
|
45
33
|
NftId nftId,
|
46
|
-
|
47
|
-
|
48
|
-
)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
token
|
55
|
-
);
|
56
|
-
|
34
|
+
IERC20Metadata token,
|
35
|
+
address wallet
|
36
|
+
)
|
37
|
+
external
|
38
|
+
onlyComponentOwnerService
|
39
|
+
override
|
40
|
+
{
|
41
|
+
ComponentInfo memory info = ComponentInfo(token, wallet);
|
57
42
|
_nftIds.push(nftId);
|
58
|
-
|
59
|
-
// TODO add logging
|
43
|
+
_create(COMPONENT(), nftId, abi.encode(info));
|
60
44
|
}
|
61
45
|
|
62
|
-
function
|
63
|
-
ComponentInfo memory info
|
64
|
-
|
65
|
-
|
66
|
-
require(
|
67
|
-
nftId.gtz() && _componentInfo[nftId].nftId.eq(nftId),
|
68
|
-
"ERROR:CMP-006:COMPONENT_UNKNOWN"
|
69
|
-
);
|
46
|
+
function getComponentToken(NftId nftId) external view override returns(IERC20Metadata token) {
|
47
|
+
ComponentInfo memory info = abi.decode(_getData(COMPONENT(), nftId), (ComponentInfo));
|
48
|
+
return info.token;
|
49
|
+
}
|
70
50
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
ObjectType objectType = this.getRegistry().getObjectInfo(nftId).objectType;
|
75
|
-
_lifecycleModule.checkAndLogTransition(
|
76
|
-
nftId,
|
77
|
-
objectType,
|
78
|
-
_componentInfo[nftId].state,
|
79
|
-
info.state
|
80
|
-
);
|
81
|
-
_componentInfo[nftId] = info;
|
51
|
+
function getComponentWallet(NftId nftId) external view override returns (address wallet) {
|
52
|
+
ComponentInfo memory info = abi.decode(_getData(COMPONENT(), nftId), (ComponentInfo));
|
53
|
+
return info.wallet;
|
82
54
|
}
|
83
55
|
|
84
56
|
function getComponentCount()
|
@@ -95,10 +67,4 @@ abstract contract ComponentModule is
|
|
95
67
|
) external view override returns (NftId componentNftId) {
|
96
68
|
return _nftIds[idx];
|
97
69
|
}
|
98
|
-
|
99
|
-
function getComponentInfo(
|
100
|
-
NftId nftId
|
101
|
-
) external view override returns (ComponentInfo memory) {
|
102
|
-
return _componentInfo[nftId];
|
103
|
-
}
|
104
|
-
}
|
70
|
+
}
|
@@ -2,52 +2,27 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
5
6
|
|
6
|
-
|
7
|
-
import {IRegistry} from "../../../registry/IRegistry.sol";
|
8
|
-
import {IInstance} from "../../IInstance.sol";
|
9
7
|
import {StateId} from "../../../types/StateId.sol";
|
10
8
|
import {NftId} from "../../../types/NftId.sol";
|
11
|
-
import {ObjectType} from "../../../types/ObjectType.sol";
|
12
|
-
import {RoleId} from "../../../types/RoleId.sol";
|
13
|
-
import {Fee} from "../../../types/Fee.sol";
|
14
|
-
import {UFixed} from "../../../types/UFixed.sol";
|
15
|
-
|
16
|
-
import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
17
|
-
// import {IComponentBase} from "../../../components/IComponentBase.sol";
|
18
9
|
|
19
10
|
interface IComponent {
|
20
|
-
// component dynamic info (static info kept in registry)
|
21
11
|
struct ComponentInfo {
|
22
|
-
NftId nftId;
|
23
|
-
StateId state;
|
24
12
|
IERC20Metadata token;
|
13
|
+
address wallet;
|
25
14
|
}
|
26
15
|
}
|
27
16
|
|
28
17
|
interface IComponentModule is IComponent {
|
29
|
-
function getRegistry() external view returns (IRegistry registry);
|
30
18
|
|
31
|
-
function registerComponent(
|
32
|
-
|
33
|
-
|
34
|
-
IERC20Metadata token
|
35
|
-
) external;
|
36
|
-
|
37
|
-
function setComponentInfo(
|
38
|
-
ComponentInfo memory info
|
39
|
-
) external returns (NftId componentNftId);
|
40
|
-
|
41
|
-
function getComponentInfo(
|
42
|
-
NftId nftId
|
43
|
-
) external view returns (ComponentInfo memory info);
|
19
|
+
function registerComponent(NftId nftId, IERC20Metadata token, address wallet) external;
|
20
|
+
function getComponentToken(NftId nftId) external view returns (IERC20Metadata token);
|
21
|
+
function getComponentWallet(NftId nftId) external view returns (address wallet);
|
44
22
|
|
45
23
|
function getComponentCount() external view returns (uint256 numberOfCompnents);
|
46
|
-
|
47
24
|
function getComponentId(uint256 idx) external view returns (NftId nftId);
|
48
25
|
|
49
26
|
// repeat service linked signaturea to avoid linearization issues
|
50
27
|
function getComponentOwnerService() external view returns(IComponentOwnerService);
|
51
|
-
|
52
|
-
function hasRole(RoleId role, address member) external view returns (bool);
|
53
28
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IDistributionModule} from "./IDistribution.sol";
|
5
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
6
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
7
|
+
|
8
|
+
contract DistributionModule is
|
9
|
+
ModuleBase,
|
10
|
+
IDistributionModule
|
11
|
+
{
|
12
|
+
|
13
|
+
function initializeDistributionModule(IKeyValueStore keyValueStore) internal {
|
14
|
+
_initialize(keyValueStore);
|
15
|
+
}
|
16
|
+
|
17
|
+
}
|
@@ -5,42 +5,45 @@ import {IRegistry} from "../../../registry/IRegistry.sol";
|
|
5
5
|
import {IInstance} from "../../IInstance.sol";
|
6
6
|
import {IProductService} from "../../service/IProductService.sol";
|
7
7
|
import {NftId} from "../../../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../../../types/ReferralId.sol";
|
9
|
+
import {RiskId} from "../../../types/RiskId.sol";
|
8
10
|
import {StateId} from "../../../types/StateId.sol";
|
9
11
|
import {Timestamp} from "../../../types/Timestamp.sol";
|
10
|
-
import {Blocknumber} from "../../../types/Blocknumber.sol";
|
11
12
|
|
12
13
|
// TODO check if there is value to introuce IContract and let IPolicy derive from IContract
|
13
14
|
interface IPolicy {
|
14
15
|
struct PolicyInfo {
|
15
|
-
NftId nftId;
|
16
16
|
NftId productNftId;
|
17
17
|
NftId bundleNftId;
|
18
|
+
ReferralId referralId;
|
18
19
|
address beneficiary;
|
19
|
-
|
20
|
+
RiskId riskId;
|
20
21
|
uint256 sumInsuredAmount;
|
21
22
|
uint256 premiumAmount;
|
22
23
|
uint256 premiumPaidAmount;
|
23
24
|
uint256 lifetime;
|
24
|
-
bytes
|
25
|
-
|
25
|
+
bytes applicationData;
|
26
|
+
bytes policyData;
|
26
27
|
Timestamp activatedAt; // time of underwriting
|
27
28
|
Timestamp expiredAt; // no new claims (activatedAt + lifetime)
|
28
29
|
Timestamp closedAt; // no locked capital
|
29
|
-
Blocknumber updatedIn; // write log entries in a way to support backtracking of all state changes
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
33
|
interface IPolicyModule is IPolicy {
|
34
|
-
function
|
35
|
-
NftId productNftId,
|
34
|
+
function createPolicyInfo(
|
36
35
|
NftId policyNftId,
|
36
|
+
NftId productNftId,
|
37
|
+
ReferralId referralId,
|
38
|
+
RiskId riskId,
|
37
39
|
uint256 sumInsuredAmount,
|
38
40
|
uint256 premiumAmount,
|
39
41
|
uint256 lifetime,
|
40
42
|
NftId bundleNftId
|
41
43
|
) external;
|
42
44
|
|
43
|
-
function setPolicyInfo(PolicyInfo memory
|
45
|
+
function setPolicyInfo(NftId policyNftId, PolicyInfo memory info) external;
|
46
|
+
function updatePolicyState(NftId nftId, StateId state) external;
|
44
47
|
|
45
48
|
// function underwrite(NftId nftId) external;
|
46
49
|
|
@@ -3,23 +3,22 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
5
5
|
|
6
|
-
import {LifecycleModule} from "../../module/lifecycle/LifecycleModule.sol";
|
7
6
|
import {IProductService} from "../../service/IProductService.sol";
|
8
7
|
import {IPolicy, IPolicyModule} from "./IPolicy.sol";
|
9
8
|
import {ObjectType, POLICY} from "../../../types/ObjectType.sol";
|
10
|
-
import {APPLIED, ACTIVE, UNDERWRITTEN} from "../../../types/StateId.sol";
|
11
9
|
import {NftId, NftIdLib} from "../../../types/NftId.sol";
|
10
|
+
import {ReferralId} from "../../../types/ReferralId.sol";
|
11
|
+
import {RiskId} from "../../../types/RiskId.sol";
|
12
|
+
import {StateId} from "../../../types/StateId.sol";
|
12
13
|
import {Timestamp, blockTimestamp, zeroTimestamp} from "../../../types/Timestamp.sol";
|
13
|
-
import {Blocknumber, blockNumber} from "../../../types/Blocknumber.sol";
|
14
14
|
|
15
|
-
import {
|
15
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
16
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
16
17
|
|
17
|
-
abstract contract PolicyModule is
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
LifecycleModule private _lifecycleModule;
|
18
|
+
abstract contract PolicyModule is
|
19
|
+
ModuleBase,
|
20
|
+
IPolicyModule
|
21
|
+
{
|
23
22
|
|
24
23
|
// TODO find a better place to avoid dupliation
|
25
24
|
modifier onlyProductService2() {
|
@@ -30,13 +29,15 @@ abstract contract PolicyModule is IPolicyModule {
|
|
30
29
|
_;
|
31
30
|
}
|
32
31
|
|
33
|
-
|
34
|
-
|
32
|
+
function initializePolicyModule(IKeyValueStore keyValueStore) internal {
|
33
|
+
_initialize(keyValueStore);
|
35
34
|
}
|
36
35
|
|
37
|
-
function
|
38
|
-
NftId productNftId,
|
36
|
+
function createPolicyInfo(
|
39
37
|
NftId policyNftId,
|
38
|
+
NftId productNftId,
|
39
|
+
ReferralId referralId,
|
40
|
+
RiskId riskId,
|
40
41
|
uint256 sumInsuredAmount,
|
41
42
|
uint256 premiumAmount,
|
42
43
|
uint256 lifetime,
|
@@ -46,39 +47,45 @@ abstract contract PolicyModule is IPolicyModule {
|
|
46
47
|
onlyProductService2
|
47
48
|
override
|
48
49
|
{
|
49
|
-
|
50
|
-
policyNftId,
|
50
|
+
PolicyInfo memory info = PolicyInfo(
|
51
51
|
productNftId,
|
52
52
|
bundleNftId,
|
53
|
+
referralId,
|
53
54
|
address(0), // beneficiary = policy nft holder
|
54
|
-
|
55
|
+
riskId,
|
55
56
|
sumInsuredAmount,
|
56
57
|
premiumAmount,
|
57
58
|
0, // premium paid amount
|
58
59
|
lifetime,
|
59
|
-
"", //
|
60
|
-
|
60
|
+
"", // applicationData
|
61
|
+
"", // policyData
|
61
62
|
zeroTimestamp(), // activatedAt
|
62
63
|
zeroTimestamp(), // expiredAt
|
63
|
-
zeroTimestamp()
|
64
|
-
blockNumber() // updatedIn
|
64
|
+
zeroTimestamp() // closedAt
|
65
65
|
);
|
66
66
|
|
67
|
-
|
67
|
+
_create(POLICY(), policyNftId, abi.encode(info));
|
68
68
|
}
|
69
69
|
|
70
|
-
function setPolicyInfo(PolicyInfo memory
|
70
|
+
function setPolicyInfo(NftId policyNftId, PolicyInfo memory info)
|
71
71
|
external
|
72
72
|
override
|
73
73
|
onlyProductService2
|
74
74
|
{
|
75
|
-
|
75
|
+
_updateData(POLICY(), policyNftId, abi.encode(info));
|
76
|
+
}
|
77
|
+
|
78
|
+
function updatePolicyState(NftId bundleNftId, StateId state)
|
79
|
+
external
|
80
|
+
override
|
81
|
+
onlyProductService2
|
82
|
+
{
|
83
|
+
_updateState(POLICY(), bundleNftId, state);
|
76
84
|
}
|
77
85
|
|
78
86
|
function getPolicyInfo(
|
79
87
|
NftId nftId
|
80
88
|
) external view returns (PolicyInfo memory info) {
|
81
|
-
return
|
89
|
+
return abi.decode(_getData(POLICY(), nftId), (PolicyInfo));
|
82
90
|
}
|
83
|
-
|
84
91
|
}
|