@etherisc/gif-next 0.0.2-fb8d07b-779 → 0.0.2-fbe22f0-239
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +136 -2
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +858 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +588 -92
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → components/IComponent.sol/IComponent.json} +208 -143
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +543 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +663 -31
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +648 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +818 -273
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +657 -181
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- 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/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- 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/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1371 -129
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +132 -21
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +293 -656
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +211 -144
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +89 -91
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +395 -122
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +149 -57
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +243 -55
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1091 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1292 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +560 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +272 -91
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +140 -40
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IApplicationService.sol/IApplicationService.json} +217 -58
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +785 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +20 -20
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +771 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +22 -84
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +32 -247
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1352 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +616 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +256 -180
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +140 -52
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +981 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +548 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +208 -224
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +228 -95
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +222 -330
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +197 -109
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +162 -112
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +124 -29
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +24 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +5 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +20 -20
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +130 -11
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +172 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +130 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +126 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +153 -20
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -2
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +126 -11
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +171 -38
- 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/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -8
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +230 -0
- package/contracts/components/Distribution.sol +53 -57
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +5 -2
- package/contracts/components/IPoolComponent.sol +54 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +153 -142
- package/contracts/components/Product.sol +109 -128
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +41 -8
- package/contracts/instance/IInstanceService.sol +15 -4
- package/contracts/instance/Instance.sol +65 -240
- package/contracts/instance/InstanceAccessManager.sol +87 -78
- package/contracts/instance/InstanceReader.sol +12 -25
- package/contracts/instance/InstanceService.sol +347 -95
- package/contracts/instance/InstanceServiceManager.sol +10 -12
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/IAccess.sol +27 -18
- package/contracts/instance/module/ISetup.sol +7 -4
- package/contracts/instance/service/ApplicationService.sol +268 -0
- package/contracts/instance/service/BundleService.sol +298 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +45 -27
- package/contracts/instance/service/DistributionServiceManager.sol +10 -12
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +54 -0
- package/contracts/instance/service/IPolicyService.sol +88 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +524 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +40 -124
- package/contracts/instance/service/PoolServiceManager.sol +10 -12
- package/contracts/instance/service/ProductService.sol +233 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +38 -33
- package/contracts/registry/IRegistryService.sol +45 -13
- package/contracts/registry/Registry.sol +223 -250
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +86 -224
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +11 -9
- package/contracts/shared/ERC165.sol +12 -11
- package/contracts/shared/INftOwnable.sol +6 -1
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -6
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/NftOwnable.sol +93 -42
- package/contracts/shared/PolicyHolder.sol +52 -0
- package/contracts/shared/ProxyManager.sol +6 -5
- package/contracts/shared/Registerable.sol +15 -24
- package/contracts/shared/Service.sol +18 -13
- package/contracts/shared/Versionable.sol +3 -2
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +4 -3
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/ObjectType.sol +5 -1
- package/contracts/types/RoleId.sol +10 -9
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -327
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -280
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -91
- package/contracts/components/IBaseComponent.sol +0 -25
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/base/ComponentServiceBase.sol +0 -125
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -7,38 +7,39 @@ import {IInstance} from "../../instance/IInstance.sol";
|
|
7
7
|
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
8
|
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
9
|
import {ISetup} from "../module/ISetup.sol";
|
10
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
10
11
|
|
11
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
12
13
|
import {Versionable} from "../../shared/Versionable.sol";
|
13
14
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
14
15
|
|
15
16
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
16
|
-
import {POOL, BUNDLE} from "../../types/ObjectType.sol";
|
17
|
+
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
17
18
|
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
18
19
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
19
20
|
import {Version, VersionLib} from "../../types/Version.sol";
|
20
|
-
import {KEEP_STATE} from "../../types/StateId.sol";
|
21
|
-
import {zeroTimestamp} from "../../types/Timestamp.sol";
|
21
|
+
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
22
|
+
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
22
23
|
|
23
24
|
import {IService} from "../../shared/IService.sol";
|
24
25
|
import {Service} from "../../shared/Service.sol";
|
25
|
-
import {
|
26
|
+
import {BundleManager} from "../BundleManager.sol";
|
27
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
26
28
|
import {IPoolService} from "./IPoolService.sol";
|
27
29
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
28
30
|
import {InstanceService} from "../InstanceService.sol";
|
29
31
|
import {InstanceReader} from "../InstanceReader.sol";
|
30
|
-
|
32
|
+
import {IComponent} from "../../components/IComponent.sol";
|
33
|
+
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
31
34
|
|
32
35
|
string constant POOL_SERVICE_NAME = "PoolService";
|
33
36
|
|
34
37
|
contract PoolService is
|
35
|
-
|
38
|
+
ComponentService,
|
36
39
|
IPoolService
|
37
40
|
{
|
38
41
|
using NftIdLib for NftId;
|
39
42
|
|
40
|
-
string public constant NAME = "PoolService";
|
41
|
-
|
42
43
|
address internal _registryAddress;
|
43
44
|
|
44
45
|
function _initialize(
|
@@ -49,25 +50,41 @@ contract PoolService is
|
|
49
50
|
initializer
|
50
51
|
virtual override
|
51
52
|
{
|
52
|
-
address
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
address registryAddress;
|
54
|
+
address initialOwner;
|
55
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
56
|
+
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
57
|
+
// owner is PoolServiceManager deployer
|
58
|
+
initializeService(registryAddress, owner);
|
59
|
+
registerInterface(type(IPoolService).interfaceId);
|
59
60
|
}
|
60
61
|
|
61
|
-
function
|
62
|
-
return
|
62
|
+
function getDomain() public pure override(Service, IService) returns(ObjectType) {
|
63
|
+
return POOL();
|
63
64
|
}
|
64
65
|
|
65
|
-
function
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
function register(address poolAddress)
|
67
|
+
external
|
68
|
+
returns(NftId poolNftId)
|
69
|
+
{
|
70
|
+
(
|
71
|
+
IComponent component,
|
72
|
+
address owner,
|
73
|
+
IInstance instance,
|
74
|
+
NftId instanceNftId
|
75
|
+
) = _checkComponentForRegistration(
|
76
|
+
poolAddress,
|
77
|
+
POOL(),
|
78
|
+
POOL_OWNER_ROLE());
|
79
|
+
|
80
|
+
IPoolComponent pool = IPoolComponent(poolAddress);
|
81
|
+
IRegistry.ObjectInfo memory poolInfo = getRegistryService().registerPool(pool, owner);
|
82
|
+
pool.linkToRegisteredNftId();
|
83
|
+
poolNftId = poolInfo.nftId;
|
84
|
+
|
85
|
+
instance.createPoolSetup(poolNftId, pool.getSetupInfo());
|
86
|
+
getInstanceService().createGifTarget(instanceNftId, poolAddress, pool.getName());
|
87
|
+
getInstanceService().grantPoolDefaultPermissions(instanceNftId, poolAddress, pool.getName());
|
71
88
|
}
|
72
89
|
|
73
90
|
function setFees(
|
@@ -89,105 +106,4 @@ contract PoolService is
|
|
89
106
|
|
90
107
|
instance.updatePoolSetup(poolNftId, poolSetupInfo, KEEP_STATE());
|
91
108
|
}
|
92
|
-
|
93
|
-
function createBundle(
|
94
|
-
address owner,
|
95
|
-
Fee memory fee,
|
96
|
-
uint256 stakingAmount,
|
97
|
-
uint256 lifetime,
|
98
|
-
bytes calldata filter
|
99
|
-
)
|
100
|
-
external
|
101
|
-
override
|
102
|
-
returns(NftId bundleNftId)
|
103
|
-
{
|
104
|
-
(IRegistry.ObjectInfo memory info, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
105
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
106
|
-
NftId poolNftId = info.nftId;
|
107
|
-
|
108
|
-
IBundle.BundleInfo memory bundleInfo = IBundle.BundleInfo(
|
109
|
-
poolNftId,
|
110
|
-
FeeLib.zeroFee(),
|
111
|
-
filter,
|
112
|
-
stakingAmount,
|
113
|
-
0,
|
114
|
-
stakingAmount,
|
115
|
-
lifetime,
|
116
|
-
zeroTimestamp(),
|
117
|
-
zeroTimestamp()
|
118
|
-
);
|
119
|
-
|
120
|
-
// register bundle with registry
|
121
|
-
bundleNftId = getRegistryService().registerBundle(
|
122
|
-
IRegistry.ObjectInfo(
|
123
|
-
zeroNftId(),
|
124
|
-
poolNftId,
|
125
|
-
BUNDLE(),
|
126
|
-
false, // intercepting property for bundles is defined on pool
|
127
|
-
address(0),
|
128
|
-
owner,
|
129
|
-
abi.encode(bundleInfo)
|
130
|
-
)
|
131
|
-
);
|
132
|
-
|
133
|
-
// create bundle info in instance
|
134
|
-
instance.createBundle(bundleNftId, bundleInfo);
|
135
|
-
|
136
|
-
// TODO add bundle to pool in instance
|
137
|
-
|
138
|
-
// TODO collect capital
|
139
|
-
// _processStakingByTreasury(
|
140
|
-
// instanceReader,
|
141
|
-
// zeroNftId(),
|
142
|
-
// poolNftId,
|
143
|
-
// bundleNftId,
|
144
|
-
// stakingAmount);
|
145
|
-
|
146
|
-
// TODO add logging
|
147
|
-
}
|
148
|
-
|
149
|
-
function setBundleFee(
|
150
|
-
NftId bundleNftId,
|
151
|
-
Fee memory fee
|
152
|
-
)
|
153
|
-
external
|
154
|
-
override
|
155
|
-
{
|
156
|
-
(IRegistry.ObjectInfo memory info , IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
157
|
-
InstanceReader instanceReader = instance.getInstanceReader();
|
158
|
-
NftId poolNftId = info.nftId;
|
159
|
-
|
160
|
-
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
161
|
-
require(bundleInfo.poolNftId.gtz(), "ERROR:PLS-010:BUNDLE_UNKNOWN");
|
162
|
-
require(poolNftId == bundleInfo.poolNftId, "ERROR:PLS-011:BUNDLE_POOL_MISMATCH");
|
163
|
-
|
164
|
-
bundleInfo.fee = fee;
|
165
|
-
|
166
|
-
instance.updateBundle(bundleNftId, bundleInfo, KEEP_STATE());
|
167
|
-
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
function _processStakingByTreasury(
|
172
|
-
InstanceReader instanceReader,
|
173
|
-
NftId productNftId,
|
174
|
-
NftId poolNftId,
|
175
|
-
NftId bundleNftId,
|
176
|
-
uint256 stakingAmount
|
177
|
-
)
|
178
|
-
internal
|
179
|
-
{
|
180
|
-
// process token transfer(s)
|
181
|
-
if(stakingAmount > 0) {
|
182
|
-
TokenHandler tokenHandler = TokenHandler(instanceReader.getTokenHandler(productNftId));
|
183
|
-
address bundleOwner = getRegistry().ownerOf(bundleNftId);
|
184
|
-
ISetup.PoolSetupInfo memory poolInfo = instanceReader.getPoolSetupInfo(poolNftId);
|
185
|
-
|
186
|
-
tokenHandler.transfer(
|
187
|
-
bundleOwner,
|
188
|
-
poolInfo.wallet,
|
189
|
-
stakingAmount
|
190
|
-
);
|
191
|
-
}
|
192
|
-
}
|
193
109
|
}
|
@@ -6,7 +6,7 @@ import {ProxyManager} from "../../shared/ProxyManager.sol";
|
|
6
6
|
import {PoolService} from "./PoolService.sol";
|
7
7
|
import {Registry} from "../../registry/Registry.sol";
|
8
8
|
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
-
import {
|
9
|
+
import {REGISTRY} from "../../types/ObjectType.sol";
|
10
10
|
|
11
11
|
contract PoolServiceManager is ProxyManager {
|
12
12
|
|
@@ -26,19 +26,17 @@ contract PoolServiceManager is ProxyManager {
|
|
26
26
|
|
27
27
|
_poolService = PoolService(address(versionable));
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
registryService.registerService(_poolService);
|
29
|
+
// TODO `this` must have a role or own nft to register service
|
30
|
+
//Registry registry = Registry(registryAddress);
|
31
|
+
//address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _poolService.getMajorVersion());
|
32
|
+
//RegistryService registryService = RegistryService(registryServiceAddress);
|
33
|
+
//registryService.registerService(_poolService);
|
34
34
|
|
35
|
+
// TODO no nft to link yet
|
35
36
|
// link ownership of instance service manager ot nft owner of instance service
|
36
|
-
_linkToNftOwnable(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
// implies that after this constructor call only upgrade functionality is available
|
41
|
-
_isDeployed = true;
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_poolService));
|
42
40
|
}
|
43
41
|
|
44
42
|
//--- view functions ----------------------------------------------------//
|
@@ -0,0 +1,233 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
+
import {IProductComponent} from "../../components/IProductComponent.sol";
|
6
|
+
import {Product} from "../../components/Product.sol";
|
7
|
+
import {IComponent} from "../../components/IComponent.sol";
|
8
|
+
import {IPoolComponent} from "../../components/IPoolComponent.sol";
|
9
|
+
import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
|
10
|
+
import {IInstance} from "../IInstance.sol";
|
11
|
+
import {IPolicy} from "../module/IPolicy.sol";
|
12
|
+
import {IRisk} from "../module/IRisk.sol";
|
13
|
+
import {IBundle} from "../module/IBundle.sol";
|
14
|
+
import {IProductService} from "./IProductService.sol";
|
15
|
+
import {ITreasury} from "../module/ITreasury.sol";
|
16
|
+
import {ISetup} from "../module/ISetup.sol";
|
17
|
+
|
18
|
+
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
19
|
+
|
20
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
21
|
+
import {Versionable} from "../../shared/Versionable.sol";
|
22
|
+
|
23
|
+
import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
24
|
+
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
25
|
+
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
26
|
+
import {ObjectType, PRODUCT, POOL, POLICY} from "../../types/ObjectType.sol";
|
27
|
+
import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
|
28
|
+
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
29
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
30
|
+
import {ReferralId} from "../../types/Referral.sol";
|
31
|
+
import {RiskId} from "../../types/RiskId.sol";
|
32
|
+
import {StateId} from "../../types/StateId.sol";
|
33
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
34
|
+
import {RoleId, PRODUCT_OWNER_ROLE} from "../../types/RoleId.sol";
|
35
|
+
|
36
|
+
import {IService} from "../../shared/IService.sol";
|
37
|
+
import {Service} from "../../shared/Service.sol";
|
38
|
+
import {ComponentService} from "../base/ComponentService.sol";
|
39
|
+
import {IProductService} from "./IProductService.sol";
|
40
|
+
import {InstanceReader} from "../InstanceReader.sol";
|
41
|
+
import {IPoolService} from "./PoolService.sol";
|
42
|
+
|
43
|
+
// TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
|
44
|
+
contract ProductService is ComponentService, IProductService {
|
45
|
+
using NftIdLib for NftId;
|
46
|
+
|
47
|
+
IPoolService internal _poolService;
|
48
|
+
|
49
|
+
event LogProductServiceSender(address sender);
|
50
|
+
|
51
|
+
function _initialize(
|
52
|
+
address owner,
|
53
|
+
bytes memory data
|
54
|
+
)
|
55
|
+
internal
|
56
|
+
initializer
|
57
|
+
virtual override
|
58
|
+
{
|
59
|
+
address registryAddress;
|
60
|
+
address initialOwner;
|
61
|
+
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
62
|
+
|
63
|
+
initializeService(registryAddress, owner);
|
64
|
+
|
65
|
+
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getMajorVersion()));
|
66
|
+
|
67
|
+
registerInterface(type(IProductService).interfaceId);
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
function register(address productAddress)
|
72
|
+
external
|
73
|
+
returns(NftId productNftId)
|
74
|
+
{
|
75
|
+
(
|
76
|
+
IComponent component,
|
77
|
+
address owner,
|
78
|
+
IInstance instance,
|
79
|
+
NftId instanceNftId
|
80
|
+
) = _checkComponentForRegistration(
|
81
|
+
productAddress,
|
82
|
+
PRODUCT(),
|
83
|
+
PRODUCT_OWNER_ROLE());
|
84
|
+
|
85
|
+
IProductComponent product = IProductComponent(productAddress);
|
86
|
+
IRegistry.ObjectInfo memory productInfo = getRegistryService().registerProduct(product, owner);
|
87
|
+
productNftId = productInfo.nftId;
|
88
|
+
_createProductSetup(
|
89
|
+
instance,
|
90
|
+
product,
|
91
|
+
productNftId);
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
function _createProductSetup(
|
96
|
+
IInstance instance,
|
97
|
+
IProductComponent product,
|
98
|
+
NftId productNftId
|
99
|
+
)
|
100
|
+
internal
|
101
|
+
returns (string memory name)
|
102
|
+
{
|
103
|
+
// wire distribution and pool components to product component
|
104
|
+
ISetup.ProductSetupInfo memory setup = product.getSetupInfo();
|
105
|
+
IComponent distribution = IComponent(getRegistry().getObjectInfo(setup.distributionNftId).objectAddress);
|
106
|
+
IComponent pool = IComponent(getRegistry().getObjectInfo(setup.poolNftId).objectAddress);
|
107
|
+
|
108
|
+
distribution.setProductNftId(productNftId);
|
109
|
+
pool.setProductNftId(productNftId);
|
110
|
+
product.setProductNftId(productNftId);
|
111
|
+
product.linkToRegisteredNftId();
|
112
|
+
|
113
|
+
// create product setup in instance
|
114
|
+
instance.createProductSetup(productNftId, product.getSetupInfo());
|
115
|
+
|
116
|
+
// create target for instane access manager
|
117
|
+
getInstanceService().createGifTarget(
|
118
|
+
getRegistry().getNftId(address(instance)),
|
119
|
+
address(product),
|
120
|
+
product.getName());
|
121
|
+
getInstanceService().grantProductDefaultPermissions(instance.getNftId(), address(product), product.getName());
|
122
|
+
}
|
123
|
+
|
124
|
+
function getDomain() public pure override(IService, Service) returns(ObjectType) {
|
125
|
+
return PRODUCT();
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
function _decodeAndVerifyProductData(bytes memory data)
|
130
|
+
internal
|
131
|
+
returns(string memory name, ISetup.ProductSetupInfo memory setup)
|
132
|
+
{
|
133
|
+
(name, setup) = abi.decode(
|
134
|
+
data,
|
135
|
+
(string, ISetup.ProductSetupInfo)
|
136
|
+
);
|
137
|
+
|
138
|
+
// TODO add checks
|
139
|
+
// if(wallet == address(0)) {
|
140
|
+
// revert WalletIsZero();
|
141
|
+
// }
|
142
|
+
|
143
|
+
// IRegistry.ObjectInfo memory tokenInfo = getRegistry().getObjectInfo(address(info.token));
|
144
|
+
|
145
|
+
// if(tokenInfo.objectType != TOKEN()) {
|
146
|
+
// revert InvalidToken();
|
147
|
+
// }
|
148
|
+
|
149
|
+
// IRegistry.ObjectInfo memory poolInfo = getRegistry().getObjectInfo(info.poolNftId);
|
150
|
+
|
151
|
+
// if(poolInfo.objectType != POOL()) {
|
152
|
+
// revert InvalidPool();
|
153
|
+
// }
|
154
|
+
|
155
|
+
// if(poolInfo.parentNftId != instanceNftId) {
|
156
|
+
// revert InvalidPoolsInstance();
|
157
|
+
// }
|
158
|
+
// // TODO pool have the same token
|
159
|
+
// //ITreasury.PoolSetup memory poolSetup = instance.getPoolSetup(info.poolNftId);
|
160
|
+
// //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
|
161
|
+
// // TODO pool is not linked
|
162
|
+
|
163
|
+
// IRegistry.ObjectInfo memory distributionInfo = getRegistry().getObjectInfo(info.distributionNftId);
|
164
|
+
|
165
|
+
// if(distributionInfo.objectType != DISTRIBUTION()) {
|
166
|
+
// revert InvalidDistribution();
|
167
|
+
// }
|
168
|
+
|
169
|
+
// if(distributionInfo.parentNftId != instanceNftId) {
|
170
|
+
// revert InvalidDistributionsInstance();
|
171
|
+
// }
|
172
|
+
// // TODO distribution have the same token
|
173
|
+
// // TODO distribution is not linked
|
174
|
+
}
|
175
|
+
|
176
|
+
function setFees(
|
177
|
+
Fee memory productFee,
|
178
|
+
Fee memory processingFee
|
179
|
+
)
|
180
|
+
external
|
181
|
+
{
|
182
|
+
// TODO check args
|
183
|
+
|
184
|
+
(
|
185
|
+
IRegistry.ObjectInfo memory productInfo,
|
186
|
+
IInstance instance
|
187
|
+
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
188
|
+
|
189
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
190
|
+
NftId productNftId = productInfo.nftId;
|
191
|
+
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(productNftId);
|
192
|
+
|
193
|
+
productSetupInfo.productFee = productFee;
|
194
|
+
productSetupInfo.processingFee = processingFee;
|
195
|
+
|
196
|
+
instance.updateProductSetup(productNftId, productSetupInfo, KEEP_STATE());
|
197
|
+
}
|
198
|
+
|
199
|
+
function createRisk(
|
200
|
+
RiskId riskId,
|
201
|
+
bytes memory data
|
202
|
+
) external override {
|
203
|
+
(
|
204
|
+
IRegistry.ObjectInfo memory productInfo,
|
205
|
+
IInstance instance
|
206
|
+
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
207
|
+
NftId productNftId = productInfo.nftId;
|
208
|
+
IRisk.RiskInfo memory riskInfo = IRisk.RiskInfo(productNftId, data);
|
209
|
+
instance.createRisk(
|
210
|
+
riskId,
|
211
|
+
riskInfo
|
212
|
+
);
|
213
|
+
}
|
214
|
+
|
215
|
+
function updateRisk(
|
216
|
+
RiskId riskId,
|
217
|
+
bytes memory data
|
218
|
+
) external {
|
219
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
220
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
221
|
+
IRisk.RiskInfo memory riskInfo = instanceReader.getRiskInfo(riskId);
|
222
|
+
riskInfo.data = data;
|
223
|
+
instance.updateRisk(riskId, riskInfo, KEEP_STATE());
|
224
|
+
}
|
225
|
+
|
226
|
+
function updateRiskState(
|
227
|
+
RiskId riskId,
|
228
|
+
StateId state
|
229
|
+
) external {
|
230
|
+
(, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
231
|
+
instance.updateRiskState(riskId, state);
|
232
|
+
}
|
233
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {IVersionable} from "../../shared/IVersionable.sol";
|
5
|
+
import {ProxyManager} from "../../shared/ProxyManager.sol";
|
6
|
+
import {ProductService} from "./ProductService.sol";
|
7
|
+
import {Registry} from "../../registry/Registry.sol";
|
8
|
+
import {RegistryService} from "../../registry/RegistryService.sol";
|
9
|
+
import {VersionLib} from "../../types/Version.sol";
|
10
|
+
|
11
|
+
contract ProductServiceManager is ProxyManager {
|
12
|
+
|
13
|
+
ProductService private _productService;
|
14
|
+
|
15
|
+
/// @dev initializes proxy manager with product service implementation
|
16
|
+
constructor(
|
17
|
+
address registryAddress
|
18
|
+
)
|
19
|
+
ProxyManager()
|
20
|
+
{
|
21
|
+
ProductService svc = new ProductService();
|
22
|
+
bytes memory data = abi.encode(registryAddress, address(this));
|
23
|
+
IVersionable versionable = deploy(
|
24
|
+
address(svc),
|
25
|
+
data);
|
26
|
+
|
27
|
+
_productService = ProductService(address(versionable));
|
28
|
+
|
29
|
+
// Registry registry = Registry(registryAddress);
|
30
|
+
// address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
|
31
|
+
// RegistryService registryService = RegistryService(registryServiceAddress);
|
32
|
+
// TODO this must have a role or own nft to register service
|
33
|
+
//registryService.registerService(_productService);
|
34
|
+
|
35
|
+
// TODO no nft to link yet
|
36
|
+
// link ownership of instance service manager ot nft owner of instance service
|
37
|
+
//_linkToNftOwnable(
|
38
|
+
// address(registryAddress),
|
39
|
+
// address(_productService));
|
40
|
+
|
41
|
+
// implies that after this constructor call only upgrade functionality is available
|
42
|
+
_isDeployed = true;
|
43
|
+
}
|
44
|
+
|
45
|
+
//--- view functions ----------------------------------------------------//
|
46
|
+
function getProductService()
|
47
|
+
external
|
48
|
+
view
|
49
|
+
returns (ProductService productService)
|
50
|
+
{
|
51
|
+
return _productService;
|
52
|
+
}
|
53
|
+
|
54
|
+
}
|
@@ -3,40 +3,31 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
5
|
|
6
|
-
import {ChainNft} from "./ChainNft.sol";
|
7
6
|
import {NftId} from "../types/NftId.sol";
|
8
7
|
import {ObjectType} from "../types/ObjectType.sol";
|
9
8
|
import {VersionPart} from "../types/Version.sol";
|
9
|
+
import {Timestamp} from "../types/Timestamp.sol";
|
10
10
|
|
11
11
|
interface IRegistry is IERC165 {
|
12
12
|
|
13
|
-
event
|
14
|
-
event
|
15
|
-
event LogRegistration(ObjectInfo info);
|
16
|
-
event LogTokenStateSet(address token, VersionPart majorVersion, bool active);
|
17
|
-
event LogServiceNameRegistration(string serviceName, VersionPart majorVersion);
|
13
|
+
event LogRegistration(NftId nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner);
|
14
|
+
event LogServiceRegistration(VersionPart majorVersion, ObjectType domain);
|
18
15
|
|
19
|
-
//
|
20
|
-
error
|
16
|
+
// registerService()
|
17
|
+
error CallerNotReleaseManager();
|
18
|
+
error ServiceAlreadyRegistered(address service);
|
21
19
|
|
22
|
-
//
|
23
|
-
error
|
24
|
-
error
|
25
|
-
error TokenMajorVersionInvalid(VersionPart majorVersion);
|
20
|
+
// register()
|
21
|
+
error CallerNotRegistryService();
|
22
|
+
error ServiceRegistration();
|
26
23
|
|
27
|
-
//
|
28
|
-
error
|
24
|
+
// registerWithCustomTypes()
|
25
|
+
error CoreTypeRegistration();
|
26
|
+
|
27
|
+
// _register()
|
29
28
|
error ZeroParentAddress();
|
30
|
-
error ContractAlreadyRegistered(address objectAddress);
|
31
|
-
error InvalidServiceVersion(VersionPart majorVersion);
|
32
|
-
error ServiceNameAlreadyRegistered(string name, VersionPart majorVersion);
|
33
|
-
|
34
|
-
// approve
|
35
|
-
error NotOwner(address account);
|
36
|
-
error NotRegisteredContract(NftId registrarNftId);
|
37
|
-
error NotService(NftId registrarNftId);
|
38
29
|
error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
|
39
|
-
|
30
|
+
error ContractAlreadyRegistered(address objectAddress);
|
40
31
|
|
41
32
|
struct ObjectInfo {
|
42
33
|
NftId nftId;
|
@@ -49,17 +40,29 @@ interface IRegistry is IERC165 {
|
|
49
40
|
}// TODO delete nftId and initialOwner(if not used) from struct
|
50
41
|
// TODO strong disagree, keep nftId there (lets keep get object info return object consistent)
|
51
42
|
|
52
|
-
|
43
|
+
struct ReleaseInfo {
|
44
|
+
ObjectType[] domains;
|
45
|
+
Timestamp createdAt;
|
46
|
+
//Timestamp updatedAt;
|
47
|
+
}
|
48
|
+
|
49
|
+
function registerService(
|
50
|
+
ObjectInfo memory serviceInfo,
|
51
|
+
VersionPart serviceVersion,
|
52
|
+
ObjectType serviceDomain
|
53
|
+
) external returns(NftId nftId);
|
53
54
|
|
54
55
|
function register(ObjectInfo memory info) external returns (NftId nftId);
|
55
56
|
|
56
|
-
function
|
57
|
+
function registerWithCustomType(ObjectInfo memory info) external returns (NftId nftId);
|
58
|
+
|
59
|
+
function getInitialVersion() external view returns (VersionPart);
|
57
60
|
|
58
|
-
function
|
61
|
+
function getNextVersion() external view returns (VersionPart);
|
59
62
|
|
60
|
-
function
|
63
|
+
function getLatestVersion() external view returns (VersionPart);
|
61
64
|
|
62
|
-
function
|
65
|
+
function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory);
|
63
66
|
|
64
67
|
function getObjectCount() external view returns (uint256);
|
65
68
|
|
@@ -79,16 +82,18 @@ interface IRegistry is IERC165 {
|
|
79
82
|
|
80
83
|
function isRegistered(address contractAddress) external view returns (bool);
|
81
84
|
|
82
|
-
function
|
85
|
+
function isRegisteredService(address contractAddress) external view returns (bool);
|
83
86
|
|
84
|
-
function
|
87
|
+
function isValidRelease(VersionPart version) external view returns (bool);
|
85
88
|
|
86
89
|
function getServiceAddress(
|
87
|
-
|
88
|
-
VersionPart
|
90
|
+
ObjectType serviceDomain,
|
91
|
+
VersionPart releaseVersion
|
89
92
|
) external view returns (address serviceAddress);
|
90
93
|
|
91
|
-
function
|
94
|
+
function getReleaseManagerAddress() external view returns (address);
|
95
|
+
|
96
|
+
function getChainNftAddress() external view returns (address);
|
92
97
|
|
93
98
|
function getOwner() external view returns (address);
|
94
99
|
}
|