@etherisc/gif-next 0.0.2-efdb520-159 → 0.0.2-efef0ea-320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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
@@ -2,10 +2,13 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
+
import {IProductComponent} from "../../components/IProductComponent.sol";
|
5
6
|
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
7
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
6
8
|
import {IInstance} from "../../instance/IInstance.sol";
|
7
9
|
import {IPolicy, IPolicyModule} from "../module/policy/IPolicy.sol";
|
8
10
|
import {IPool} from "../module/pool/IPoolModule.sol";
|
11
|
+
import {IRisk} from "../module/risk/IRisk.sol";
|
9
12
|
import {IBundle} from "../module/bundle/IBundle.sol";
|
10
13
|
import {IProductService} from "./IProductService.sol";
|
11
14
|
import {ITreasury, ITreasuryModule, TokenHandler} from "../../instance/module/treasury/ITreasury.sol";
|
@@ -15,14 +18,17 @@ import {Versionable} from "../../shared/Versionable.sol";
|
|
15
18
|
|
16
19
|
import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
17
20
|
import {UFixed, UFixedMathLib} from "../../types/UFixed.sol";
|
21
|
+
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
18
22
|
import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol";
|
19
23
|
import {APPLIED, UNDERWRITTEN, ACTIVE} from "../../types/StateId.sol";
|
20
24
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
21
|
-
import {
|
22
|
-
import {
|
23
|
-
import {
|
25
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
26
|
+
import {ReferralId} from "../../types/ReferralId.sol";
|
27
|
+
import {RiskId} from "../../types/RiskId.sol";
|
28
|
+
import {StateId} from "../../types/StateId.sol";
|
29
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
24
30
|
|
25
|
-
import {ComponentServiceBase} from "
|
31
|
+
import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
|
26
32
|
import {IProductService} from "./IProductService.sol";
|
27
33
|
|
28
34
|
// TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
|
@@ -47,10 +53,7 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
47
53
|
virtual override (IVersionable, Versionable)
|
48
54
|
returns(Version)
|
49
55
|
{
|
50
|
-
return toVersion(
|
51
|
-
toVersionPart(3),
|
52
|
-
toVersionPart(0),
|
53
|
-
toVersionPart(0));
|
56
|
+
return VersionLib.toVersion(3,0,0);
|
54
57
|
}
|
55
58
|
|
56
59
|
function getName() external pure override returns(string memory name) {
|
@@ -58,37 +61,168 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
58
61
|
}
|
59
62
|
|
60
63
|
function setFees(
|
61
|
-
Fee memory
|
64
|
+
Fee memory productFee,
|
62
65
|
Fee memory processingFee
|
63
66
|
)
|
64
67
|
external
|
65
68
|
override
|
66
69
|
{
|
67
70
|
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
68
|
-
|
71
|
+
NftId productNftId = productInfo.nftId;
|
72
|
+
ITreasury.TreasuryInfo memory treasuryInfo = instance.getTreasuryInfo(productNftId);
|
73
|
+
treasuryInfo.productFee = productFee;
|
74
|
+
treasuryInfo.processingFee = processingFee;
|
75
|
+
instance.setTreasuryInfo(productNftId, treasuryInfo);
|
76
|
+
}
|
77
|
+
|
78
|
+
function createRisk(
|
79
|
+
RiskId riskId,
|
80
|
+
bytes memory data
|
81
|
+
) external override {
|
82
|
+
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
83
|
+
NftId productNftId = productInfo.nftId;
|
84
|
+
instance.createRisk(
|
85
|
+
riskId,
|
86
|
+
productNftId,
|
87
|
+
data
|
88
|
+
);
|
89
|
+
}
|
90
|
+
|
91
|
+
function setRiskInfo(
|
92
|
+
RiskId riskId,
|
93
|
+
IRisk.RiskInfo memory info
|
94
|
+
) external {
|
95
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
96
|
+
instance.setRiskInfo(
|
97
|
+
riskId,
|
98
|
+
info
|
99
|
+
);
|
100
|
+
}
|
101
|
+
|
102
|
+
function updateRiskState(
|
103
|
+
RiskId riskId,
|
104
|
+
StateId state
|
105
|
+
) external {
|
106
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
107
|
+
instance.updateRiskState(
|
108
|
+
riskId,
|
109
|
+
state
|
110
|
+
);
|
111
|
+
}
|
112
|
+
|
113
|
+
function _getAndVerifyInstanceAndProduct() internal view returns (IProductComponent product) {
|
114
|
+
IRegistry.ObjectInfo memory productInfo;
|
115
|
+
(productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
116
|
+
product = IProductComponent(productInfo.objectAddress);
|
117
|
+
}
|
118
|
+
|
119
|
+
function calculatePremium(
|
120
|
+
RiskId riskId,
|
121
|
+
uint256 sumInsuredAmount,
|
122
|
+
uint256 lifetime,
|
123
|
+
bytes memory applicationData,
|
124
|
+
NftId bundleNftId,
|
125
|
+
ReferralId referralId
|
126
|
+
)
|
127
|
+
public
|
128
|
+
view
|
129
|
+
override
|
130
|
+
returns (
|
131
|
+
uint256 premiumAmount,
|
132
|
+
uint256 productFeeAmount,
|
133
|
+
uint256 poolFeeAmount,
|
134
|
+
uint256 bundleFeeAmount,
|
135
|
+
uint256 distributionFeeAmount
|
136
|
+
)
|
137
|
+
{
|
138
|
+
IProductComponent product = _getAndVerifyInstanceAndProduct();
|
139
|
+
uint256 netPremiumAmount = product.calculateNetPremium(
|
140
|
+
sumInsuredAmount,
|
141
|
+
riskId,
|
142
|
+
lifetime,
|
143
|
+
applicationData
|
144
|
+
);
|
145
|
+
|
146
|
+
(
|
147
|
+
productFeeAmount,
|
148
|
+
poolFeeAmount,
|
149
|
+
bundleFeeAmount,
|
150
|
+
distributionFeeAmount
|
151
|
+
) = _calculateFeeAmounts(
|
152
|
+
netPremiumAmount,
|
153
|
+
product,
|
154
|
+
bundleNftId,
|
155
|
+
referralId
|
156
|
+
);
|
157
|
+
|
158
|
+
premiumAmount = netPremiumAmount + productFeeAmount;
|
159
|
+
premiumAmount += poolFeeAmount + bundleFeeAmount;
|
160
|
+
premiumAmount += distributionFeeAmount;
|
161
|
+
}
|
162
|
+
|
163
|
+
function _calculateFeeAmounts(
|
164
|
+
uint256 netPremiumAmount,
|
165
|
+
IProductComponent product,
|
166
|
+
NftId bundleNftId,
|
167
|
+
ReferralId referralId
|
168
|
+
)
|
169
|
+
internal
|
170
|
+
view
|
171
|
+
returns (
|
172
|
+
uint256 productFeeAmount,
|
173
|
+
uint256 poolFeeAmount,
|
174
|
+
uint256 bundleFeeAmount,
|
175
|
+
uint256 distributionFeeAmount
|
176
|
+
)
|
177
|
+
{
|
178
|
+
IInstance instance = product.getInstance();
|
179
|
+
ITreasury.TreasuryInfo memory treasuryInfo = instance.getTreasuryInfo(product.getNftId());
|
180
|
+
IBundle.BundleInfo memory bundleInfo = instance.getBundleInfo(bundleNftId);
|
181
|
+
require(bundleInfo.poolNftId == treasuryInfo.poolNftId,"ERROR:PRS-035:BUNDLE_POOL_MISMATCH");
|
182
|
+
|
183
|
+
(productFeeAmount,) = FeeLib.calculateFee(treasuryInfo.productFee, netPremiumAmount);
|
184
|
+
(poolFeeAmount,) = FeeLib.calculateFee(treasuryInfo.poolFee, netPremiumAmount);
|
185
|
+
(bundleFeeAmount,) = FeeLib.calculateFee(bundleInfo.fee, netPremiumAmount);
|
186
|
+
|
187
|
+
IRegistry.ObjectInfo memory distributionInfo = _registry.getObjectInfo(treasuryInfo.distributionNftId);
|
188
|
+
IDistributionComponent distribution = IDistributionComponent(distributionInfo.objectAddress);
|
189
|
+
distributionFeeAmount = distribution.calculateFeeAmount(referralId, netPremiumAmount);
|
69
190
|
}
|
70
191
|
|
192
|
+
|
71
193
|
function createApplication(
|
72
194
|
address applicationOwner,
|
195
|
+
RiskId riskId,
|
73
196
|
uint256 sumInsuredAmount,
|
74
|
-
uint256 premiumAmount,
|
75
197
|
uint256 lifetime,
|
76
|
-
|
198
|
+
bytes memory applicationData,
|
199
|
+
NftId bundleNftId,
|
200
|
+
ReferralId referralId
|
77
201
|
) external override returns (NftId policyNftId) {
|
78
202
|
(IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
79
|
-
NftId productNftId = productInfo.nftId;
|
80
203
|
// TODO add validations (see create bundle in pool service)
|
81
204
|
|
82
205
|
policyNftId = this.getRegistry().registerObjectForInstance(
|
83
|
-
|
206
|
+
productInfo.nftId,
|
84
207
|
POLICY(),
|
85
208
|
applicationOwner,
|
86
209
|
""
|
87
210
|
);
|
88
211
|
|
89
|
-
|
90
|
-
|
212
|
+
(uint256 premiumAmount,,,,) = calculatePremium(
|
213
|
+
riskId,
|
214
|
+
sumInsuredAmount,
|
215
|
+
lifetime,
|
216
|
+
applicationData,
|
217
|
+
bundleNftId,
|
218
|
+
referralId
|
219
|
+
);
|
220
|
+
|
221
|
+
instance.createPolicyInfo(
|
91
222
|
policyNftId,
|
223
|
+
productInfo.nftId,
|
224
|
+
referralId,
|
225
|
+
riskId,
|
92
226
|
sumInsuredAmount,
|
93
227
|
premiumAmount,
|
94
228
|
lifetime,
|
@@ -105,30 +239,29 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
105
239
|
internal
|
106
240
|
view
|
107
241
|
returns (
|
108
|
-
ITreasury.
|
242
|
+
ITreasury.TreasuryInfo memory treasuryInfo,
|
243
|
+
NftId bundleNftId,
|
109
244
|
IBundle.BundleInfo memory bundleInfo,
|
110
|
-
uint256 collateralAmount
|
111
|
-
bool poolIsVerifying,
|
112
|
-
bytes memory bundleFilter
|
245
|
+
uint256 collateralAmount
|
113
246
|
)
|
114
247
|
{
|
115
248
|
// check match between policy and bundle (via pool)
|
116
|
-
|
117
|
-
|
118
|
-
|
249
|
+
treasuryInfo = instance.getTreasuryInfo(policyInfo.productNftId);
|
250
|
+
bundleNftId = policyInfo.bundleNftId;
|
251
|
+
bundleInfo = instance.getBundleInfo(bundleNftId);
|
252
|
+
require(bundleInfo.poolNftId == treasuryInfo.poolNftId, "POLICY_BUNDLE_MISMATCH");
|
119
253
|
|
120
254
|
// calculate required collateral
|
121
|
-
NftId poolNftId =
|
255
|
+
NftId poolNftId = treasuryInfo.poolNftId;
|
122
256
|
IPool.PoolInfo memory poolInfo = instance.getPoolInfo(poolNftId);
|
123
257
|
|
124
258
|
// obtain remaining return values
|
125
|
-
poolIsVerifying = poolInfo.isVerifying;
|
126
259
|
collateralAmount = calculateRequiredCollateral(poolInfo.collateralizationLevel, policyInfo.sumInsuredAmount);
|
127
|
-
bundleFilter = bundleInfo.filter;
|
128
260
|
}
|
129
261
|
|
130
262
|
function _lockCollateralInBundle(
|
131
263
|
IInstance instance,
|
264
|
+
NftId bundleNftId,
|
132
265
|
IBundle.BundleInfo memory bundleInfo,
|
133
266
|
NftId policyNftId,
|
134
267
|
uint256 collateralAmount
|
@@ -137,29 +270,39 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
137
270
|
returns (IBundle.BundleInfo memory)
|
138
271
|
{
|
139
272
|
bundleInfo.lockedAmount += collateralAmount;
|
140
|
-
|
141
|
-
instance.collateralizePolicy(bundleInfo.nftId, policyNftId, collateralAmount);
|
273
|
+
instance.collateralizePolicy(bundleNftId, policyNftId, collateralAmount);
|
142
274
|
return bundleInfo;
|
143
275
|
}
|
144
276
|
|
145
277
|
function _underwriteByPool(
|
146
|
-
ITreasury.
|
278
|
+
ITreasury.TreasuryInfo memory treasuryInfo,
|
279
|
+
NftId policyNftId,
|
147
280
|
IPolicy.PolicyInfo memory policyInfo,
|
148
281
|
bytes memory bundleFilter,
|
149
282
|
uint256 collateralAmount
|
150
283
|
)
|
151
284
|
internal
|
152
285
|
{
|
153
|
-
address poolAddress = _registry.getObjectInfo(
|
286
|
+
address poolAddress = _registry.getObjectInfo(treasuryInfo.poolNftId).objectAddress;
|
154
287
|
IPoolComponent pool = IPoolComponent(poolAddress);
|
155
288
|
pool.underwrite(
|
156
|
-
|
157
|
-
policyInfo.
|
289
|
+
policyNftId,
|
290
|
+
policyInfo.applicationData,
|
158
291
|
bundleFilter,
|
159
292
|
collateralAmount);
|
160
293
|
}
|
161
294
|
|
162
295
|
|
296
|
+
function revoke(
|
297
|
+
NftId policyNftId
|
298
|
+
)
|
299
|
+
external
|
300
|
+
override
|
301
|
+
{
|
302
|
+
require(false, "ERROR:PRS-234:NOT_YET_IMPLEMENTED");
|
303
|
+
}
|
304
|
+
|
305
|
+
|
163
306
|
function underwrite(
|
164
307
|
NftId policyNftId,
|
165
308
|
bool requirePremiumPayment,
|
@@ -178,14 +321,18 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
178
321
|
NftId productNftId = productInfo.nftId;
|
179
322
|
IPolicy.PolicyInfo memory policyInfo = instance.getPolicyInfo(policyNftId);
|
180
323
|
require(policyInfo.productNftId == productNftId, "POLICY_PRODUCT_MISMATCH");
|
181
|
-
require(
|
324
|
+
require(instance.getState(policyNftId.toKey32(POLICY())) == APPLIED(), "ERROR:PRS-021:STATE_NOT_APPLIED");
|
325
|
+
|
326
|
+
ITreasury.TreasuryInfo memory treasuryInfo;
|
327
|
+
NftId bundleNftId;
|
328
|
+
IBundle.BundleInfo memory bundleInfo;
|
329
|
+
uint256 collateralAmount;
|
182
330
|
|
183
331
|
(
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
bytes memory bundleFilter
|
332
|
+
treasuryInfo,
|
333
|
+
bundleNftId,
|
334
|
+
bundleInfo,
|
335
|
+
collateralAmount
|
189
336
|
) = _getAndVerifyUnderwritingSetup(
|
190
337
|
instance,
|
191
338
|
policyInfo
|
@@ -194,15 +341,28 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
194
341
|
// lock bundle collateral
|
195
342
|
bundleInfo = _lockCollateralInBundle(
|
196
343
|
instance,
|
344
|
+
bundleNftId,
|
197
345
|
bundleInfo,
|
198
346
|
policyNftId,
|
199
347
|
collateralAmount);
|
200
348
|
|
201
|
-
//
|
349
|
+
// set policy state to underwritten
|
350
|
+
instance.updatePolicyState(policyNftId, UNDERWRITTEN());
|
351
|
+
|
352
|
+
// optional activation of policy
|
353
|
+
if(activateAt > zeroTimestamp()) {
|
354
|
+
policyInfo.activatedAt = activateAt;
|
355
|
+
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
356
|
+
|
357
|
+
instance.updatePolicyState(policyNftId, ACTIVE());
|
358
|
+
}
|
359
|
+
|
360
|
+
// optional collection of premium
|
202
361
|
if(requirePremiumPayment) {
|
203
362
|
uint256 netPremiumAmount = _processPremiumByTreasury(
|
204
363
|
instance,
|
205
|
-
|
364
|
+
productInfo.nftId,
|
365
|
+
treasuryInfo,
|
206
366
|
policyNftId,
|
207
367
|
policyInfo.premiumAmount);
|
208
368
|
|
@@ -210,31 +370,23 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
210
370
|
bundleInfo.balanceAmount += netPremiumAmount;
|
211
371
|
}
|
212
372
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
// integrate pool component
|
231
|
-
if(poolIsVerifying) {
|
232
|
-
_underwriteByPool(
|
233
|
-
productSetup,
|
234
|
-
policyInfo,
|
235
|
-
bundleFilter,
|
236
|
-
collateralAmount
|
237
|
-
);
|
373
|
+
instance.setPolicyInfo(policyNftId, policyInfo);
|
374
|
+
instance.setBundleInfo(bundleNftId, bundleInfo);
|
375
|
+
|
376
|
+
// involve pool if necessary
|
377
|
+
{
|
378
|
+
NftId poolNftId = treasuryInfo.poolNftId;
|
379
|
+
IPool.PoolInfo memory poolInfo = instance.getPoolInfo(poolNftId);
|
380
|
+
|
381
|
+
if(poolInfo.isVerifying) {
|
382
|
+
_underwriteByPool(
|
383
|
+
treasuryInfo,
|
384
|
+
policyNftId,
|
385
|
+
policyInfo,
|
386
|
+
bundleInfo.filter,
|
387
|
+
collateralAmount
|
388
|
+
);
|
389
|
+
}
|
238
390
|
}
|
239
391
|
|
240
392
|
// TODO add logging
|
@@ -252,14 +404,13 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
252
404
|
|
253
405
|
// perform actual token transfers
|
254
406
|
IPolicy.PolicyInfo memory policyInfo = instance.getPolicyInfo(policyNftId);
|
255
|
-
ITreasury.
|
407
|
+
ITreasury.TreasuryInfo memory treasuryInfo = instance.getTreasuryInfo(productInfo.nftId);
|
256
408
|
|
257
409
|
uint256 premiumAmount = policyInfo.premiumAmount;
|
258
|
-
_processPremiumByTreasury(instance,
|
410
|
+
_processPremiumByTreasury(instance, productInfo.nftId, treasuryInfo, policyNftId, premiumAmount);
|
259
411
|
|
260
412
|
// policy level book keeping for premium paid
|
261
413
|
policyInfo.premiumPaidAmount += premiumAmount;
|
262
|
-
policyInfo.updatedIn = blockNumber();
|
263
414
|
|
264
415
|
// optional activation of policy
|
265
416
|
if(activateAt > zeroTimestamp()) {
|
@@ -270,11 +421,10 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
270
421
|
policyInfo.activatedAt = activateAt;
|
271
422
|
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
272
423
|
|
273
|
-
|
274
|
-
policyInfo.state = ACTIVE();
|
424
|
+
instance.updatePolicyState(policyNftId, ACTIVE());
|
275
425
|
}
|
276
426
|
|
277
|
-
instance.setPolicyInfo(policyInfo);
|
427
|
+
instance.setPolicyInfo(policyNftId, policyInfo);
|
278
428
|
|
279
429
|
// TODO add logging
|
280
430
|
}
|
@@ -292,10 +442,8 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
292
442
|
policyInfo.activatedAt = activateAt;
|
293
443
|
policyInfo.expiredAt = activateAt.addSeconds(policyInfo.lifetime);
|
294
444
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
instance.setPolicyInfo(policyInfo);
|
445
|
+
instance.setPolicyInfo(policyNftId, policyInfo);
|
446
|
+
instance.updatePolicyState(policyNftId, ACTIVE());
|
299
447
|
|
300
448
|
// TODO add logging
|
301
449
|
}
|
@@ -315,12 +463,14 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
315
463
|
view
|
316
464
|
returns (NftId poolNftid)
|
317
465
|
{
|
318
|
-
return instance.
|
466
|
+
return instance.getTreasuryInfo(productNftId).poolNftId;
|
319
467
|
}
|
320
468
|
|
469
|
+
|
321
470
|
function _processPremiumByTreasury(
|
322
471
|
IInstance instance,
|
323
|
-
|
472
|
+
NftId productNftId,
|
473
|
+
ITreasury.TreasuryInfo memory treasuryInfo,
|
324
474
|
NftId policyNftId,
|
325
475
|
uint256 premiumAmount
|
326
476
|
)
|
@@ -329,13 +479,13 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
329
479
|
{
|
330
480
|
// process token transfer(s)
|
331
481
|
if(premiumAmount > 0) {
|
332
|
-
TokenHandler tokenHandler =
|
482
|
+
TokenHandler tokenHandler = instance.getTokenHandler(productNftId);
|
333
483
|
address policyOwner = _registry.getOwner(policyNftId);
|
334
|
-
address poolWallet = instance.
|
484
|
+
address poolWallet = instance.getComponentWallet(treasuryInfo.poolNftId);
|
335
485
|
netPremiumAmount = premiumAmount;
|
336
|
-
Fee memory
|
486
|
+
Fee memory productFee = treasuryInfo.productFee;
|
337
487
|
|
338
|
-
if (feeIsZero(
|
488
|
+
if (FeeLib.feeIsZero(productFee)) {
|
339
489
|
tokenHandler.transfer(
|
340
490
|
policyOwner,
|
341
491
|
poolWallet,
|
@@ -344,10 +494,11 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
344
494
|
} else {
|
345
495
|
(uint256 feeAmount, uint256 netAmount) = instance.calculateFeeAmount(
|
346
496
|
premiumAmount,
|
347
|
-
|
497
|
+
productFee
|
348
498
|
);
|
349
499
|
|
350
|
-
|
500
|
+
address productWallet = instance.getComponentWallet(productNftId);
|
501
|
+
tokenHandler.transfer(policyOwner, productWallet, feeAmount);
|
351
502
|
tokenHandler.transfer(policyOwner, poolWallet, netAmount);
|
352
503
|
netPremiumAmount = netAmount;
|
353
504
|
}
|
@@ -2,14 +2,14 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
5
|
-
import {IService} from "../instance/
|
5
|
+
import {IService} from "../instance/base/IService.sol";
|
6
6
|
|
7
7
|
import {IChainNft} from "./IChainNft.sol";
|
8
8
|
import {ChainNft} from "./ChainNft.sol";
|
9
9
|
import {IRegistry} from "./IRegistry.sol";
|
10
10
|
import {NftId, toNftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
11
11
|
import {VersionPart} from "../types/Version.sol";
|
12
|
-
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT,
|
12
|
+
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
13
13
|
|
14
14
|
// TODO make registry upgradable
|
15
15
|
contract Registry is
|
@@ -21,7 +21,6 @@ contract Registry is
|
|
21
21
|
string public constant EMPTY_URI = "";
|
22
22
|
|
23
23
|
mapping(NftId nftId => ObjectInfo info) private _info;
|
24
|
-
mapping(NftId nftId => address owner) private _owner;
|
25
24
|
mapping(address object => NftId nftId) private _nftIdByAddress;
|
26
25
|
mapping(ObjectType objectType => bool) private _isValidType;
|
27
26
|
mapping(ObjectType objectType => mapping(ObjectType objectParentType => bool)) private _isValidParentType;
|
@@ -280,6 +279,7 @@ contract Registry is
|
|
280
279
|
_isValidType[PRODUCT()] = true;
|
281
280
|
_isValidType[ORACLE()] = true;
|
282
281
|
_isValidType[POOL()] = true;
|
282
|
+
_isValidType[DISTRIBUTION()] = true;
|
283
283
|
_isValidType[POLICY()] = true;
|
284
284
|
_isValidType[BUNDLE()] = true;
|
285
285
|
}
|
@@ -293,7 +293,7 @@ contract Registry is
|
|
293
293
|
|
294
294
|
// instance as parent
|
295
295
|
_isValidParentType[PRODUCT()][INSTANCE()] = true;
|
296
|
-
_isValidParentType[
|
296
|
+
_isValidParentType[DISTRIBUTION()][INSTANCE()] = true;
|
297
297
|
_isValidParentType[ORACLE()][INSTANCE()] = true;
|
298
298
|
_isValidParentType[POOL()][INSTANCE()] = true;
|
299
299
|
|