@etherisc/gif-next 0.0.2-efdb520-159 → 0.0.2-efef0ea-320
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 +488 -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 +136 -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
@@ -10,15 +10,27 @@ interface IPoolComponent is IBaseComponent {
|
|
10
10
|
|
11
11
|
event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
|
12
12
|
|
13
|
+
function setFees(
|
14
|
+
Fee memory poolFee,
|
15
|
+
Fee memory stakingFee,
|
16
|
+
Fee memory performanceFee
|
17
|
+
) external;
|
18
|
+
|
13
19
|
/**
|
14
20
|
* @dev creates a new bundle for this pool.
|
15
21
|
*/
|
16
22
|
function createBundle(
|
23
|
+
Fee memory fee,
|
17
24
|
uint256 initialAmount,
|
18
25
|
uint256 lifetime,
|
19
26
|
bytes memory filter
|
20
27
|
) external returns(NftId bundleNftId);
|
21
28
|
|
29
|
+
function setBundleFee(
|
30
|
+
NftId policyNftId,
|
31
|
+
Fee memory fee
|
32
|
+
) external;
|
33
|
+
|
22
34
|
/**
|
23
35
|
* @dev this is a callback function that is called by the product service when underwriting a policy.
|
24
36
|
* the pool has the option to check the details and object to underwriting by reverting.
|
@@ -48,6 +60,8 @@ interface IPoolComponent is IBaseComponent {
|
|
48
60
|
|
49
61
|
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
50
62
|
|
63
|
+
function getPoolFee() external view returns (Fee memory poolFee);
|
64
|
+
|
51
65
|
function getStakingFee() external view returns (Fee memory stakingFee);
|
52
66
|
|
53
67
|
function getPerformanceFee()
|
@@ -1,19 +1,38 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {NftId} from "../types/NftId.sol";
|
5
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {NftId} from "../types/NftId.sol";
|
6
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
7
|
+
import {RiskId} from "../types/RiskId.sol";
|
8
|
+
|
6
9
|
import {IBaseComponent} from "./IBaseComponent.sol";
|
7
10
|
|
8
11
|
interface IProductComponent is IBaseComponent {
|
9
12
|
function setFees(
|
10
|
-
Fee memory
|
13
|
+
Fee memory productFee,
|
11
14
|
Fee memory processingFee
|
12
15
|
) external;
|
13
16
|
|
14
|
-
function
|
15
|
-
|
16
|
-
|
17
|
+
function calculatePremium(
|
18
|
+
uint256 sumInsuredAmount,
|
19
|
+
RiskId riskId,
|
20
|
+
uint256 lifetime,
|
21
|
+
bytes memory applicationData,
|
22
|
+
ReferralId referralId,
|
23
|
+
NftId bundleNftId
|
24
|
+
) external view returns (uint256 premiumAmount);
|
17
25
|
|
26
|
+
function calculateNetPremium(
|
27
|
+
uint256 sumInsuredAmount,
|
28
|
+
RiskId riskId,
|
29
|
+
uint256 lifetime,
|
30
|
+
bytes memory applicationData
|
31
|
+
) external view returns (uint256 netPremiumAmount);
|
32
|
+
|
33
|
+
function getProductFee() external view returns (Fee memory productFee);
|
18
34
|
function getProcessingFee() external view returns (Fee memory processingFee);
|
35
|
+
|
36
|
+
function getPoolNftId() external view returns (NftId poolNftId);
|
37
|
+
function getDistributionNftId() external view returns (NftId distributionNftId);
|
19
38
|
}
|
@@ -15,6 +15,10 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
15
15
|
bool internal _isVerifying;
|
16
16
|
UFixed internal _collateralizationLevel;
|
17
17
|
|
18
|
+
Fee internal _initialPoolFee;
|
19
|
+
Fee internal _initialStakingFee;
|
20
|
+
Fee internal _initialPerformanceFee;
|
21
|
+
|
18
22
|
// may be used to interact with instance by derived contracts
|
19
23
|
IPoolService internal _poolService;
|
20
24
|
|
@@ -41,19 +45,38 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
41
45
|
// TODO refactor into tokenNftId
|
42
46
|
address token,
|
43
47
|
bool verifying,
|
44
|
-
UFixed collateralizationLevel
|
48
|
+
UFixed collateralizationLevel,
|
49
|
+
Fee memory poolFee,
|
50
|
+
Fee memory stakingFee,
|
51
|
+
Fee memory performanceFee
|
45
52
|
)
|
46
53
|
BaseComponent(registry, instanceNftId, token)
|
47
54
|
{
|
48
55
|
_isVerifying = verifying;
|
49
56
|
// TODO add validation
|
50
57
|
_collateralizationLevel = collateralizationLevel;
|
58
|
+
_initialPoolFee = poolFee;
|
59
|
+
_initialStakingFee = stakingFee;
|
60
|
+
_initialPerformanceFee = performanceFee;
|
51
61
|
|
52
62
|
_poolService = _instance.getPoolService();
|
53
63
|
_productService = _instance.getProductService();
|
54
64
|
}
|
55
65
|
|
66
|
+
function setFees(
|
67
|
+
Fee memory poolFee,
|
68
|
+
Fee memory stakingFee,
|
69
|
+
Fee memory performanceFee
|
70
|
+
)
|
71
|
+
external
|
72
|
+
onlyOwner
|
73
|
+
override
|
74
|
+
{
|
75
|
+
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
76
|
+
}
|
77
|
+
|
56
78
|
function createBundle(
|
79
|
+
Fee memory fee,
|
57
80
|
uint256 initialAmount,
|
58
81
|
uint256 lifetime,
|
59
82
|
bytes memory filter
|
@@ -65,6 +88,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
65
88
|
address owner = msg.sender;
|
66
89
|
bundleNftId = _poolService.createBundle(
|
67
90
|
owner,
|
91
|
+
fee,
|
68
92
|
initialAmount,
|
69
93
|
lifetime,
|
70
94
|
filter
|
@@ -73,6 +97,17 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
73
97
|
// TODO add logging
|
74
98
|
}
|
75
99
|
|
100
|
+
function setBundleFee(
|
101
|
+
NftId bundleNftId,
|
102
|
+
Fee memory fee
|
103
|
+
)
|
104
|
+
external
|
105
|
+
override
|
106
|
+
// TODO add onlyBundleOwner
|
107
|
+
{
|
108
|
+
_poolService.setBundleFee(bundleNftId, fee);
|
109
|
+
}
|
110
|
+
|
76
111
|
/**
|
77
112
|
* @dev see {IPool.underwrite}.
|
78
113
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
@@ -133,6 +168,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
133
168
|
|
134
169
|
function _createBundle(
|
135
170
|
address bundleOwner,
|
171
|
+
Fee memory fee,
|
136
172
|
uint256 amount,
|
137
173
|
uint256 lifetime,
|
138
174
|
bytes calldata filter
|
@@ -142,6 +178,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
142
178
|
{
|
143
179
|
bundleNftId = _poolService.createBundle(
|
144
180
|
bundleOwner,
|
181
|
+
fee,
|
145
182
|
amount,
|
146
183
|
lifetime,
|
147
184
|
filter
|
@@ -149,13 +186,32 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
149
186
|
}
|
150
187
|
|
151
188
|
// from pool component
|
189
|
+
function getPoolFee()
|
190
|
+
external
|
191
|
+
view
|
192
|
+
override
|
193
|
+
returns (Fee memory poolFee)
|
194
|
+
{
|
195
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
196
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
197
|
+
return _instance.getTreasuryInfo(productNftId).poolFee;
|
198
|
+
} else {
|
199
|
+
return _initialPoolFee;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
152
203
|
function getStakingFee()
|
153
204
|
external
|
154
205
|
view
|
155
206
|
override
|
156
207
|
returns (Fee memory stakingFee)
|
157
208
|
{
|
158
|
-
|
209
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
210
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
211
|
+
return _instance.getTreasuryInfo(productNftId).stakingFee;
|
212
|
+
} else {
|
213
|
+
return _initialStakingFee;
|
214
|
+
}
|
159
215
|
}
|
160
216
|
|
161
217
|
function getPerformanceFee()
|
@@ -164,7 +220,12 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
164
220
|
override
|
165
221
|
returns (Fee memory performanceFee)
|
166
222
|
{
|
167
|
-
|
223
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
224
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
225
|
+
return _instance.getTreasuryInfo(productNftId).performanceFee;
|
226
|
+
} else {
|
227
|
+
return _initialPerformanceFee;
|
228
|
+
}
|
168
229
|
}
|
169
230
|
|
170
231
|
// from registerable
|
@@ -1,42 +1,138 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
+
import {IRisk} from "../instance/module/risk/IRisk.sol";
|
5
|
+
import {ITreasury} from "../instance/module/treasury/ITreasury.sol";
|
4
6
|
import {IProductService} from "../instance/service/IProductService.sol";
|
5
7
|
import {IProductComponent} from "./IProductComponent.sol";
|
6
8
|
import {NftId} from "../types/NftId.sol";
|
7
9
|
import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
|
10
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
11
|
+
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
12
|
+
import {StateId} from "../types/StateId.sol";
|
8
13
|
import {Timestamp} from "../types/Timestamp.sol";
|
9
14
|
import {Fee} from "../types/Fee.sol";
|
10
15
|
import {BaseComponent} from "./BaseComponent.sol";
|
11
16
|
|
12
17
|
contract Product is BaseComponent, IProductComponent {
|
13
|
-
IProductService
|
14
|
-
address
|
18
|
+
IProductService internal _productService;
|
19
|
+
address internal _pool;
|
20
|
+
address internal _distribution;
|
21
|
+
Fee internal _initialProductFee;
|
22
|
+
Fee internal _initialProcessingFee;
|
15
23
|
|
16
24
|
constructor(
|
17
25
|
address registry,
|
18
26
|
NftId instanceNftid,
|
19
27
|
address token,
|
20
|
-
address pool
|
28
|
+
address pool,
|
29
|
+
address distribution,
|
30
|
+
Fee memory productFee,
|
31
|
+
Fee memory processingFee
|
21
32
|
) BaseComponent(registry, instanceNftid, token) {
|
22
33
|
// TODO add validation
|
23
34
|
_productService = _instance.getProductService();
|
24
35
|
_pool = pool;
|
36
|
+
_distribution = distribution;
|
37
|
+
_initialProductFee = productFee;
|
38
|
+
_initialProcessingFee = processingFee;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
function calculatePremium(
|
43
|
+
uint256 sumInsuredAmount,
|
44
|
+
RiskId riskId,
|
45
|
+
uint256 lifetime,
|
46
|
+
bytes memory applicationData,
|
47
|
+
ReferralId referralId,
|
48
|
+
NftId bundleNftId
|
49
|
+
)
|
50
|
+
external
|
51
|
+
view
|
52
|
+
override
|
53
|
+
returns (uint256 premiumAmount)
|
54
|
+
{
|
55
|
+
(premiumAmount,,,,) = _productService.calculatePremium(
|
56
|
+
riskId,
|
57
|
+
sumInsuredAmount,
|
58
|
+
lifetime,
|
59
|
+
applicationData,
|
60
|
+
bundleNftId,
|
61
|
+
referralId
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
function calculateNetPremium(
|
67
|
+
uint256 sumInsuredAmount,
|
68
|
+
RiskId riskId,
|
69
|
+
uint256 lifetime,
|
70
|
+
bytes memory applicationData
|
71
|
+
)
|
72
|
+
external
|
73
|
+
view
|
74
|
+
virtual override
|
75
|
+
returns (uint256 netPremiumAmount)
|
76
|
+
{
|
77
|
+
// default 10% of sum insured
|
78
|
+
return sumInsuredAmount / 10;
|
79
|
+
}
|
80
|
+
|
81
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
82
|
+
return RiskIdLib.toRiskId(riskName);
|
83
|
+
}
|
84
|
+
|
85
|
+
function _createRisk(
|
86
|
+
RiskId id,
|
87
|
+
bytes memory data
|
88
|
+
) internal {
|
89
|
+
_productService.createRisk(
|
90
|
+
id,
|
91
|
+
data
|
92
|
+
);
|
93
|
+
}
|
94
|
+
|
95
|
+
function _setRiskInfo(
|
96
|
+
RiskId id,
|
97
|
+
IRisk.RiskInfo memory info
|
98
|
+
) internal {
|
99
|
+
_productService.setRiskInfo(
|
100
|
+
id,
|
101
|
+
info
|
102
|
+
);
|
103
|
+
}
|
104
|
+
|
105
|
+
function _updateRiskState(
|
106
|
+
RiskId id,
|
107
|
+
StateId state
|
108
|
+
) internal {
|
109
|
+
_productService.updateRiskState(
|
110
|
+
id,
|
111
|
+
state
|
112
|
+
);
|
113
|
+
}
|
114
|
+
|
115
|
+
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
116
|
+
return _instance.getRiskInfo(id);
|
25
117
|
}
|
26
118
|
|
27
119
|
function _createApplication(
|
28
120
|
address applicationOwner,
|
121
|
+
RiskId riskId,
|
29
122
|
uint256 sumInsuredAmount,
|
30
|
-
uint256 premiumAmount,
|
31
123
|
uint256 lifetime,
|
32
|
-
|
124
|
+
bytes memory applicationData,
|
125
|
+
NftId bundleNftId,
|
126
|
+
ReferralId referralId
|
33
127
|
) internal returns (NftId nftId) {
|
34
128
|
nftId = _productService.createApplication(
|
35
129
|
applicationOwner,
|
130
|
+
riskId,
|
36
131
|
sumInsuredAmount,
|
37
|
-
premiumAmount,
|
38
132
|
lifetime,
|
39
|
-
|
133
|
+
applicationData,
|
134
|
+
bundleNftId,
|
135
|
+
referralId
|
40
136
|
);
|
41
137
|
}
|
42
138
|
|
@@ -79,26 +175,35 @@ contract Product is BaseComponent, IProductComponent {
|
|
79
175
|
return _registry.getNftId(_pool);
|
80
176
|
}
|
81
177
|
|
178
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
179
|
+
return _registry.getNftId(_distribution);
|
180
|
+
}
|
181
|
+
|
82
182
|
// from product component
|
83
183
|
function setFees(
|
84
|
-
Fee memory
|
184
|
+
Fee memory productFee,
|
85
185
|
Fee memory processingFee
|
86
186
|
)
|
87
187
|
external
|
88
188
|
onlyOwner
|
89
189
|
override
|
90
190
|
{
|
91
|
-
_productService.setFees(
|
191
|
+
_productService.setFees(productFee, processingFee);
|
92
192
|
}
|
93
193
|
|
94
194
|
|
95
|
-
function
|
195
|
+
function getProductFee()
|
96
196
|
external
|
97
197
|
view
|
98
198
|
override
|
99
|
-
returns (Fee memory
|
199
|
+
returns (Fee memory productFee)
|
100
200
|
{
|
101
|
-
|
201
|
+
NftId productNftId = getNftId();
|
202
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
203
|
+
return _instance.getTreasuryInfo(productNftId).productFee;
|
204
|
+
} else {
|
205
|
+
return _initialProductFee;
|
206
|
+
}
|
102
207
|
}
|
103
208
|
|
104
209
|
function getProcessingFee()
|
@@ -107,7 +212,12 @@ contract Product is BaseComponent, IProductComponent {
|
|
107
212
|
override
|
108
213
|
returns (Fee memory processingFee)
|
109
214
|
{
|
110
|
-
|
215
|
+
NftId productNftId = getNftId();
|
216
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
217
|
+
return _instance.getTreasuryInfo(productNftId).processingFee;
|
218
|
+
} else {
|
219
|
+
return _initialProcessingFee;
|
220
|
+
}
|
111
221
|
}
|
112
222
|
|
113
223
|
// from registerable
|
@@ -3,27 +3,28 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
5
|
|
6
|
-
|
7
6
|
import {IVersionable} from "../shared/IVersionable.sol";
|
8
7
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
9
8
|
import {IOwnable} from "../shared/IOwnable.sol";
|
10
9
|
import {RoleId} from "../types/RoleId.sol";
|
11
10
|
|
12
11
|
import {IAccessModule} from "./module/access/IAccess.sol";
|
13
|
-
import {
|
12
|
+
import {IBundleModule} from "./module/bundle/IBundle.sol";
|
13
|
+
import {IDistributionModule} from "./module/distribution/IDistribution.sol";
|
14
14
|
import {IComponentModule} from "./module/component/IComponent.sol";
|
15
15
|
import {IPolicyModule} from "./module/policy/IPolicy.sol";
|
16
16
|
import {IPoolModule} from "./module/pool/IPoolModule.sol";
|
17
|
-
import {
|
17
|
+
import {IRiskModule} from "./module/risk/IRisk.sol";
|
18
18
|
import {ITreasuryModule} from "./module/treasury/ITreasury.sol";
|
19
19
|
|
20
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
20
21
|
import {IRegistry, IRegistryLinked} from "../registry/IRegistryLinked.sol";
|
21
|
-
import {IServiceLinked} from "./IServiceLinked.sol";
|
22
22
|
|
23
23
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
24
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
24
25
|
import {IProductService} from "./service/IProductService.sol";
|
25
26
|
import {IPoolService} from "./service/IPoolService.sol";
|
26
|
-
|
27
|
+
import {IInstanceBase} from "./base/IInstanceBase.sol";
|
27
28
|
|
28
29
|
// solhint-disable-next-line no-empty-blocks
|
29
30
|
interface IInstance is
|
@@ -31,20 +32,22 @@ interface IInstance is
|
|
31
32
|
IVersionable,
|
32
33
|
IRegisterable,
|
33
34
|
IAccessModule,
|
34
|
-
ILifecycleModule,
|
35
35
|
IPolicyModule,
|
36
36
|
IPoolModule,
|
37
|
+
IRiskModule,
|
37
38
|
IBundleModule,
|
38
39
|
IComponentModule,
|
39
40
|
ITreasuryModule,
|
40
|
-
|
41
|
+
IDistributionModule,
|
42
|
+
IInstanceBase
|
41
43
|
{
|
42
|
-
function getRegistry() external view override (
|
43
|
-
function
|
44
|
+
function getRegistry() external view override (IPolicyModule, IRegisterable) returns (IRegistry registry);
|
45
|
+
function getOwner() external view override (IOwnable, IAccessModule) returns(address owner);
|
44
46
|
|
45
|
-
function
|
46
|
-
function
|
47
|
-
function
|
47
|
+
function getKeyValueStore() external view override (IInstanceBase) returns (IKeyValueStore keyValueStore);
|
48
|
+
function getComponentOwnerService() external view override (IInstanceBase, IComponentModule) returns(IComponentOwnerService);
|
49
|
+
function getDistributionService() external view override returns(IDistributionService);
|
50
|
+
function getProductService() external view override (IInstanceBase, IBundleModule, IPolicyModule) returns(IProductService);
|
51
|
+
function getPoolService() external view override (IInstanceBase, IBundleModule, IPoolModule) returns(IPoolService);
|
48
52
|
|
49
|
-
function getOwner() external view override (IOwnable, IAccessModule) returns(address owner);
|
50
53
|
}
|
@@ -4,12 +4,13 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {NftId} from "../types/NftId.sol";
|
5
5
|
import {RoleId} from "../types/RoleId.sol";
|
6
6
|
|
7
|
-
import {InstanceBase} from "./InstanceBase.sol";
|
7
|
+
import {InstanceBase} from "./base/InstanceBase.sol";
|
8
8
|
import {AccessModule} from "./module/access/Access.sol";
|
9
|
-
import {LifecycleModule} from "./module/lifecycle/LifecycleModule.sol";
|
10
9
|
import {ComponentModule} from "./module/component/ComponentModule.sol";
|
10
|
+
import {DistributionModule} from "./module/distribution/DistributionModule.sol";
|
11
11
|
import {PolicyModule} from "./module/policy/PolicyModule.sol";
|
12
12
|
import {PoolModule} from "./module/pool/PoolModule.sol";
|
13
|
+
import {RiskModule} from "./module/risk/RiskModule.sol";
|
13
14
|
import {BundleModule} from "./module/bundle/BundleModule.sol";
|
14
15
|
import {TreasuryModule} from "./module/treasury/TreasuryModule.sol";
|
15
16
|
|
@@ -20,20 +21,24 @@ import {IBundleModule} from "./module/bundle/IBundle.sol";
|
|
20
21
|
import {IComponentModule} from "./module/component/IComponent.sol";
|
21
22
|
import {IPoolModule} from "./module/pool/IPoolModule.sol";
|
22
23
|
import {IPolicyModule} from "./module/policy/IPolicy.sol";
|
23
|
-
import {
|
24
|
+
import {IInstanceBase} from "./base/IInstanceBase.sol";
|
24
25
|
|
25
26
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
27
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
26
28
|
import {IProductService} from "./service/IProductService.sol";
|
27
29
|
import {IPoolService} from "./service/IPoolService.sol";
|
28
30
|
|
31
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
32
|
+
|
29
33
|
contract Instance is
|
30
34
|
InstanceBase,
|
31
35
|
AccessModule,
|
32
36
|
BundleModule,
|
33
37
|
ComponentModule,
|
34
|
-
|
38
|
+
DistributionModule,
|
35
39
|
PolicyModule,
|
36
40
|
PoolModule,
|
41
|
+
RiskModule,
|
37
42
|
TreasuryModule
|
38
43
|
{
|
39
44
|
constructor(
|
@@ -43,20 +48,27 @@ contract Instance is
|
|
43
48
|
InstanceBase(registry, registryNftId)
|
44
49
|
AccessModule()
|
45
50
|
BundleModule()
|
51
|
+
DistributionModule()
|
46
52
|
ComponentModule()
|
47
53
|
PolicyModule()
|
48
54
|
PoolModule()
|
49
55
|
TreasuryModule()
|
50
56
|
{
|
57
|
+
initializeBundleModule(_keyValueStore);
|
58
|
+
initializeComponentModule(_keyValueStore);
|
59
|
+
initializeDistributionModule(_keyValueStore);
|
60
|
+
initializePolicyModule(_keyValueStore);
|
61
|
+
initializePoolModule(_keyValueStore);
|
62
|
+
initializeRiskModule(_keyValueStore);
|
51
63
|
}
|
52
64
|
|
53
|
-
function getRegistry() public view override (Registerable,
|
54
|
-
|
55
|
-
function hasRole(RoleId role, address member) public view override (AccessModule, IComponentModule) returns (bool) { return super.hasRole(role, member); }
|
65
|
+
function getRegistry() public view override (Registerable, IPolicyModule) returns (IRegistry registry) { return super.getRegistry(); }
|
66
|
+
function getKeyValueStore() public view override (InstanceBase) returns (IKeyValueStore keyValueStore) { return super.getKeyValueStore(); }
|
56
67
|
|
57
|
-
function getComponentOwnerService() external view override (IComponentModule,
|
58
|
-
function
|
59
|
-
function
|
68
|
+
function getComponentOwnerService() external view override (IComponentModule, IInstanceBase) returns(IComponentOwnerService service) { return _componentOwnerService; }
|
69
|
+
function getDistributionService() external view override (IInstanceBase) returns(IDistributionService service) { return _distributionService; }
|
70
|
+
function getProductService() external view override (IBundleModule, IPolicyModule, IInstanceBase) returns(IProductService service) { return _productService; }
|
71
|
+
function getPoolService() external view override (IBundleModule, IPoolModule, IInstanceBase) returns(IPoolService service) { return _poolService; }
|
60
72
|
|
61
73
|
function getOwner() public view override (IAccessModule, Registerable) returns(address owner) { return super.getOwner(); }
|
62
74
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Key32} from "../../types/Key32.sol";
|
5
|
+
import {StateId} from "../../types/StateId.sol";
|
6
|
+
|
7
|
+
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
8
|
+
import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
|
9
|
+
import {IDistributionService} from "../service/IDistributionService.sol";
|
10
|
+
import {IProductService} from "../service/IProductService.sol";
|
11
|
+
import {IPoolService} from "../service/IPoolService.sol";
|
12
|
+
|
13
|
+
interface IInstanceBase {
|
14
|
+
function getKeyValueStore() external view returns (IKeyValueStore keyValueStore);
|
15
|
+
function updateState(Key32 key, StateId state) external;
|
16
|
+
function getState(Key32 key) external view returns (StateId state);
|
17
|
+
|
18
|
+
function getComponentOwnerService() external view returns(IComponentOwnerService service);
|
19
|
+
function getDistributionService() external view returns(IDistributionService);
|
20
|
+
function getProductService() external view returns(IProductService service);
|
21
|
+
function getPoolService() external view returns(IPoolService service);
|
22
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Blocknumber, blockBlocknumber, zeroBlocknumber} from "../../types/Blocknumber.sol";
|
5
|
+
import {Key32, KeyId} from "../../types/Key32.sol";
|
6
|
+
import {NftId} from "../../types/NftId.sol";
|
7
|
+
import {ObjectType} from "../../types/ObjectType.sol";
|
8
|
+
import {StateId} from "../../types/StateId.sol";
|
9
|
+
|
10
|
+
import {ILifecycle} from "./ILifecycle.sol";
|
11
|
+
|
12
|
+
interface IKeyValueStore is ILifecycle {
|
13
|
+
|
14
|
+
struct Key {
|
15
|
+
ObjectType objectType;
|
16
|
+
KeyId id;
|
17
|
+
}
|
18
|
+
|
19
|
+
struct Value {
|
20
|
+
Metadata metadata;
|
21
|
+
bytes data;
|
22
|
+
}
|
23
|
+
|
24
|
+
struct Metadata {
|
25
|
+
ObjectType objectType;
|
26
|
+
StateId state;
|
27
|
+
address updatedBy;
|
28
|
+
Blocknumber updatedIn;
|
29
|
+
Blocknumber createdIn;
|
30
|
+
}
|
31
|
+
|
32
|
+
event LogInfoCreated(Key key, StateId state, address createdBy, address txOrigin);
|
33
|
+
event LogInfoUpdated(Key key, StateId state, address updatedBy, address txOrigin, Blocknumber lastUpdatedIn);
|
34
|
+
event LogStateUpdated(Key key, StateId stateOld, StateId stateNew, address updatedBy, address txOrigin, Blocknumber lastUpdatedIn);
|
35
|
+
|
36
|
+
// generic state changing functions
|
37
|
+
function create(Key32 key, ObjectType objectType, bytes memory data) external;
|
38
|
+
function update(Key32 key, StateId state, bytes memory data) external;
|
39
|
+
function updateData(Key32 key, bytes memory data) external;
|
40
|
+
function updateState(Key32 key, StateId state) external;
|
41
|
+
|
42
|
+
function exists(Key32 key) external view returns (bool);
|
43
|
+
function get(Key32 key) external view returns (Value memory value);
|
44
|
+
function getData(Key32 key) external view returns (bytes memory data);
|
45
|
+
function getMetadata(Key32 key) external view returns (Metadata memory metadata);
|
46
|
+
function getState(Key32 key) external view returns (StateId state);
|
47
|
+
|
48
|
+
function toKey32(ObjectType objectType, KeyId id) external pure returns(Key32);
|
49
|
+
function toKey(Key32 key32) external pure returns(Key memory key);
|
50
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {ObjectType} from "../../types/ObjectType.sol";
|
5
|
+
import {StateId, toStateId, zeroStateId} from "../../types/StateId.sol";
|
6
|
+
import {NftId} from "../../types/NftId.sol";
|
7
|
+
|
8
|
+
interface ILifecycle {
|
9
|
+
|
10
|
+
error ErrorNoLifecycle(NftId nftId, ObjectType objectType);
|
11
|
+
error ErrorInvalidStateTransition(
|
12
|
+
ObjectType objectType,
|
13
|
+
StateId fromStateId,
|
14
|
+
StateId toStateId
|
15
|
+
);
|
16
|
+
|
17
|
+
function hasLifecycle(
|
18
|
+
ObjectType objectType
|
19
|
+
) external view returns (bool);
|
20
|
+
|
21
|
+
function getInitialState(
|
22
|
+
ObjectType objectType
|
23
|
+
) external view returns (StateId);
|
24
|
+
|
25
|
+
function isValidTransition(
|
26
|
+
ObjectType objectType,
|
27
|
+
StateId fromId,
|
28
|
+
StateId toId
|
29
|
+
) external view returns (bool);
|
30
|
+
}
|