@etherisc/gif-next 0.0.2-e545d2c-624 → 0.0.2-e5a2253-213
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/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +11 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +11 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +11 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +11 -0
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +16 -5
- 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/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/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +0 -13
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -69
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +2 -2
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +2 -2
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +90 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
- 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/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- 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/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +92 -2
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +114 -16
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +13 -9
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +92 -2
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +114 -16
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +13 -9
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +114 -16
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +13 -9
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +2 -2
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- 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/Versionable.sol/Versionable.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
- 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/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/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- 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/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- 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/BaseComponent.sol +15 -6
- package/contracts/components/Distribution.sol +0 -10
- package/contracts/components/IBaseComponent.sol +3 -2
- package/contracts/components/IProductComponent.sol +2 -2
- package/contracts/components/Pool.sol +3 -17
- package/contracts/components/Product.sol +5 -11
- package/contracts/instance/IInstance.sol +0 -2
- package/contracts/instance/IInstanceBase.sol +0 -1
- package/contracts/instance/Instance.sol +2 -12
- package/contracts/instance/InstanceBase.sol +0 -2
- package/contracts/instance/base/ComponentServiceBase.sol +62 -0
- package/contracts/instance/base/IInstanceBase.sol +0 -2
- package/contracts/instance/service/DistributionService.sol +22 -27
- package/contracts/instance/service/PoolService.sol +21 -24
- package/contracts/instance/service/ProductService.sol +20 -24
- package/contracts/shared/IRegisterable.sol +0 -2
- package/package.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
@@ -8,7 +8,6 @@ import {BundleManager} from "./BundleManager.sol";
|
|
8
8
|
import {InstanceReader} from "./InstanceReader.sol";
|
9
9
|
|
10
10
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
11
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
12
11
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
13
12
|
import {IPoolService} from "./service/IPoolService.sol";
|
14
13
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -26,7 +25,6 @@ import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
|
26
25
|
|
27
26
|
interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
|
28
27
|
|
29
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
30
28
|
function getDistributionService() external view returns (IDistributionService);
|
31
29
|
function getProductService() external view returns (IProductService);
|
32
30
|
function getPoolService() external view returns (IPoolService);
|
@@ -6,7 +6,6 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
6
6
|
import {BundleManager} from "./BundleManager.sol";
|
7
7
|
import {InstanceReader} from "./InstanceReader.sol";
|
8
8
|
|
9
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
10
9
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
11
10
|
import {IPoolService} from "./service/IPoolService.sol";
|
12
11
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -20,14 +20,8 @@ import {BundleManager} from "./BundleManager.sol";
|
|
20
20
|
import {NftId} from "../types/NftId.sol";
|
21
21
|
import {NumberId} from "../types/NumberId.sol";
|
22
22
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT} from "../types/ObjectType.sol";
|
23
|
-
import {RiskId
|
24
|
-
import {
|
25
|
-
import {StateId, ACTIVE} from "../types/StateId.sol";
|
26
|
-
import {TimestampLib} from "../types/Timestamp.sol";
|
27
|
-
import {ERC165} from "../shared/ERC165.sol";
|
28
|
-
import {Registerable} from "../shared/Registerable.sol";
|
29
|
-
import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
30
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
23
|
+
import {RiskId} from "../types/RiskId.sol";
|
24
|
+
import {StateId} from "../types/StateId.sol";
|
31
25
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
32
26
|
import {IPoolService} from "./service/IPoolService.sol";
|
33
27
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -227,10 +221,6 @@ contract Instance is
|
|
227
221
|
return policyNftId.toKey32(POLICY());
|
228
222
|
}
|
229
223
|
|
230
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService) {
|
231
|
-
return ComponentOwnerService(_registry.getServiceAddress(COMPONENT(), VersionPart.wrap(3)));
|
232
|
-
}
|
233
|
-
|
234
224
|
function getDistributionService() external view returns (IDistributionService) {
|
235
225
|
return IDistributionService(_registry.getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
236
226
|
}
|
@@ -22,8 +22,6 @@ import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
|
22
22
|
import {StateId, ACTIVE} from "../types/StateId.sol";
|
23
23
|
import {ERC165} from "../shared/ERC165.sol";
|
24
24
|
import {Registerable} from "../shared/Registerable.sol";
|
25
|
-
import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
26
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
27
25
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
28
26
|
import {IPoolService} from "./service/IPoolService.sol";
|
29
27
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
+
import {IBaseComponent} from "../../components/IBaseComponent.sol";
|
4
5
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
6
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
6
7
|
import {IInstance} from "../../instance/IInstance.sol";
|
@@ -15,6 +16,13 @@ import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
|
15
16
|
|
16
17
|
abstract contract ComponentServiceBase is Service {
|
17
18
|
|
19
|
+
|
20
|
+
error ErrorComponentServiceAlreadyRegistered(address component, NftId nftId);
|
21
|
+
error ErrorComponentServiceNotComponent(address component);
|
22
|
+
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
23
|
+
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
24
|
+
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
25
|
+
|
18
26
|
error ErrorComponentServiceBaseComponentLocked(address componentAddress);
|
19
27
|
error ExpectedRoleMissing(RoleId expected, address caller);
|
20
28
|
error ComponentTypeInvalid(ObjectType componentType);
|
@@ -39,6 +47,60 @@ abstract contract ComponentServiceBase is Service {
|
|
39
47
|
return InstanceService(service);
|
40
48
|
}
|
41
49
|
|
50
|
+
// internal functions
|
51
|
+
function _checkComponentForRegistration(
|
52
|
+
address componentAddress,
|
53
|
+
ObjectType requiredType,
|
54
|
+
RoleId requiredRole
|
55
|
+
)
|
56
|
+
internal
|
57
|
+
returns (
|
58
|
+
IBaseComponent component,
|
59
|
+
address owner,
|
60
|
+
IInstance instance,
|
61
|
+
NftId instanceNftId
|
62
|
+
)
|
63
|
+
{
|
64
|
+
// component may only be registerd by initial owner of component
|
65
|
+
owner = msg.sender;
|
66
|
+
|
67
|
+
// check component has not already been registerd
|
68
|
+
NftId compoentNftId = _registry.getNftId(componentAddress);
|
69
|
+
if(compoentNftId.gtz()) {
|
70
|
+
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
71
|
+
}
|
72
|
+
|
73
|
+
// check this is a component
|
74
|
+
component = IBaseComponent(componentAddress);
|
75
|
+
if(!component.supportsInterface(type(IBaseComponent).interfaceId)) {
|
76
|
+
revert ErrorComponentServiceNotComponent(componentAddress);
|
77
|
+
}
|
78
|
+
|
79
|
+
// check component is of required type
|
80
|
+
(IRegistry.ObjectInfo memory componentInfo, ) = component.getInitialInfo();
|
81
|
+
if(componentInfo.objectType != requiredType) {
|
82
|
+
revert ErrorComponentServiceInvalidType(componentAddress, requiredType, componentInfo.objectType);
|
83
|
+
}
|
84
|
+
|
85
|
+
// check msg.sender is component owner
|
86
|
+
address initialOwner = componentInfo.initialOwner;
|
87
|
+
if(owner != initialOwner) {
|
88
|
+
revert ErrorComponentServiceSenderNotOwner(componentAddress, componentInfo.initialOwner, owner);
|
89
|
+
}
|
90
|
+
|
91
|
+
// check instance has assigned required role to owner
|
92
|
+
instanceNftId = componentInfo.parentNftId;
|
93
|
+
instance = _getInstance(instanceNftId);
|
94
|
+
bool hasRole = getInstanceService().hasRole(
|
95
|
+
owner,
|
96
|
+
requiredRole,
|
97
|
+
address(instance));
|
98
|
+
|
99
|
+
if(!hasRole) {
|
100
|
+
revert ErrorComponentServiceExpectedRoleMissing(instanceNftId, requiredRole, owner);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
42
104
|
// internal view functions
|
43
105
|
|
44
106
|
function _getInstance(NftId instanceNftId) internal view returns (IInstance) {
|
@@ -6,7 +6,6 @@ import {StateId} from "../../types/StateId.sol";
|
|
6
6
|
|
7
7
|
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
8
8
|
|
9
|
-
import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
|
10
9
|
import {IDistributionService} from "../service/IDistributionService.sol";
|
11
10
|
import {IProductService} from "../service/IProductService.sol";
|
12
11
|
import {IPoolService} from "../service/IPoolService.sol";
|
@@ -16,7 +15,6 @@ interface IInstanceBase {
|
|
16
15
|
function updateState(Key32 key, StateId state) external;
|
17
16
|
function getState(Key32 key) external view returns (StateId state);
|
18
17
|
|
19
|
-
function getComponentOwnerService() external view returns(IComponentOwnerService);
|
20
18
|
function getDistributionService() external view returns(IDistributionService);
|
21
19
|
function getProductService() external view returns(IProductService service);
|
22
20
|
function getPoolService() external view returns(IPoolService service);
|
@@ -59,35 +59,30 @@ contract DistributionService is
|
|
59
59
|
external
|
60
60
|
returns(NftId distributionNftId)
|
61
61
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
if(!hasRole) {
|
79
|
-
revert ExpectedRoleMissing(DISTRIBUTION_OWNER_ROLE(), distributionOwner);
|
80
|
-
}
|
81
|
-
|
82
|
-
distributionNftId = info.nftId;
|
83
|
-
string memory distributionName;
|
84
|
-
ISetup.DistributionSetupInfo memory initialSetup;
|
85
|
-
(distributionName, initialSetup) = _decodeAndVerifyDistributionData(data);
|
86
|
-
instance.createDistributionSetup(distributionNftId, initialSetup);
|
62
|
+
(
|
63
|
+
IBaseComponent distribution,
|
64
|
+
address owner,
|
65
|
+
IInstance instance,
|
66
|
+
NftId instanceNftId
|
67
|
+
) = _checkComponentForRegistration(
|
68
|
+
distributionAddress,
|
69
|
+
DISTRIBUTION(),
|
70
|
+
DISTRIBUTION_OWNER_ROLE());
|
71
|
+
|
72
|
+
(
|
73
|
+
IRegistry.ObjectInfo memory distributionInfo,
|
74
|
+
bytes memory data
|
75
|
+
) = getRegistryService().registerDistribution(distribution, owner);
|
76
|
+
distribution.linkToRegisteredNftId();
|
77
|
+
distributionNftId = distributionInfo.nftId;
|
87
78
|
|
88
|
-
|
79
|
+
(
|
80
|
+
string memory name,
|
81
|
+
ISetup.DistributionSetupInfo memory initialSetup
|
82
|
+
) = _decodeAndVerifyDistributionData(data);
|
83
|
+
instance.createDistributionSetup(distributionNftId, initialSetup);
|
89
84
|
|
90
|
-
|
85
|
+
getInstanceService().createTarget(instanceNftId, distributionAddress, name);
|
91
86
|
}
|
92
87
|
|
93
88
|
function _decodeAndVerifyDistributionData(bytes memory data)
|
@@ -67,33 +67,30 @@ contract PoolService is
|
|
67
67
|
external
|
68
68
|
returns(NftId poolNftId)
|
69
69
|
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
70
|
+
(
|
71
|
+
IBaseComponent pool,
|
72
|
+
address owner,
|
73
|
+
IInstance instance,
|
74
|
+
NftId instanceNftId
|
75
|
+
) = _checkComponentForRegistration(
|
76
|
+
poolAddress,
|
77
|
+
POOL(),
|
78
|
+
POOL_OWNER_ROLE());
|
79
|
+
|
80
|
+
(
|
81
|
+
IRegistry.ObjectInfo memory poolInfo,
|
82
|
+
bytes memory data
|
83
|
+
) = getRegistryService().registerPool(pool, owner);
|
84
|
+
pool.linkToRegisteredNftId();
|
85
|
+
poolNftId = poolInfo.nftId;
|
87
86
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
87
|
+
(
|
88
|
+
string memory name,
|
89
|
+
ISetup.PoolSetupInfo memory initialSetup
|
90
|
+
) = _decodeAndVerifyPoolData(data);
|
92
91
|
instance.createPoolSetup(poolNftId, initialSetup);
|
93
92
|
|
94
|
-
getInstanceService().createTarget(instanceNftId, poolAddress,
|
95
|
-
|
96
|
-
pool.linkToRegisteredNftId();
|
93
|
+
getInstanceService().createTarget(instanceNftId, poolAddress, name);
|
97
94
|
}
|
98
95
|
|
99
96
|
function _decodeAndVerifyPoolData(bytes memory data)
|
@@ -76,34 +76,30 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
76
76
|
external
|
77
77
|
returns(NftId productNftId)
|
78
78
|
{
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
bool hasRole = getInstanceService().hasRole(
|
89
|
-
productOwner,
|
90
|
-
PRODUCT_OWNER_ROLE(),
|
91
|
-
address(instance));
|
92
|
-
|
93
|
-
if(!hasRole) {
|
94
|
-
revert ExpectedRoleMissing(PRODUCT_OWNER_ROLE(), productOwner);
|
95
|
-
}
|
79
|
+
(
|
80
|
+
IBaseComponent product,
|
81
|
+
address productOwner,
|
82
|
+
IInstance instance,
|
83
|
+
NftId instanceNftId
|
84
|
+
) = _checkComponentForRegistration(
|
85
|
+
productAddress,
|
86
|
+
PRODUCT(),
|
87
|
+
PRODUCT_OWNER_ROLE());
|
96
88
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
89
|
+
(
|
90
|
+
IRegistry.ObjectInfo memory productInfo,
|
91
|
+
bytes memory data
|
92
|
+
) = getRegistryService().registerProduct(product, productOwner);
|
93
|
+
product.linkToRegisteredNftId();
|
94
|
+
productNftId = productInfo.nftId;
|
101
95
|
|
96
|
+
(
|
97
|
+
string memory name,
|
98
|
+
ISetup.ProductSetupInfo memory initialSetup
|
99
|
+
) = _decodeAndVerifyProductData(data);
|
102
100
|
instance.createProductSetup(productNftId, initialSetup);
|
103
101
|
|
104
|
-
getInstanceService().createTarget(instanceNftId, productAddress,
|
105
|
-
|
106
|
-
product.linkToRegisteredNftId();
|
102
|
+
getInstanceService().createTarget(instanceNftId, productAddress, name);
|
107
103
|
}
|
108
104
|
|
109
105
|
function _decodeAndVerifyProductData(bytes memory data)
|
@@ -5,8 +5,6 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
5
5
|
|
6
6
|
import {INftOwnable} from "./INftOwnable.sol";
|
7
7
|
import {IRegistry} from "../registry/IRegistry.sol";
|
8
|
-
import {NftId} from "../types/NftId.sol";
|
9
|
-
import {ObjectType} from "../types/ObjectType.sol";
|
10
8
|
|
11
9
|
interface IRegisterable is IERC165, INftOwnable {
|
12
10
|
|
package/package.json
CHANGED