@etherisc/gif-next 0.0.2-979c9aa-391 → 0.0.2-984cc08-642

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.
Files changed (232) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  2. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → Component.sol/Component.json} +36 -7
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +38 -119
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  6. package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → IComponent.sol/IComponent.json} +36 -7
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
  11. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  12. package/artifacts/contracts/components/Pool.sol/Pool.json +38 -147
  13. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  14. package/artifacts/contracts/components/Product.sol/Product.json +43 -135
  15. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  35. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
  36. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
  38. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  39. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +261 -26
  41. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +171 -0
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  44. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +42 -13
  45. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  46. package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -82
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  48. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +101 -111
  49. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  50. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +11 -11
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  52. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  54. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +116 -183
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  56. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -90
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  58. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
  59. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  60. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +111 -37
  61. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  63. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  64. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  66. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +11 -0
  69. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  74. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +232 -61
  77. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +20 -24
  79. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  80. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +140 -60
  81. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  82. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +17 -21
  83. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  84. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +64 -13
  85. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
  87. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +120 -13
  89. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +13 -13
  91. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +13 -13
  93. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +321 -86
  95. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -23
  97. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +140 -60
  99. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  100. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -21
  101. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  102. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +146 -66
  103. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  104. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +17 -13
  105. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  106. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  107. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  108. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +132 -133
  109. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  110. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +102 -68
  111. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  112. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  113. package/artifacts/contracts/registry/Registry.sol/Registry.json +145 -227
  114. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  115. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  116. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  117. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +37 -143
  118. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -104
  120. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  121. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +530 -0
  122. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  123. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -27
  124. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  125. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  126. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  127. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  129. package/artifacts/contracts/shared/IService.sol/IService.json +13 -13
  130. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  132. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  133. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  134. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  135. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  137. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  138. package/artifacts/contracts/shared/Service.sol/Service.json +13 -13
  139. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  140. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  141. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  145. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  147. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
  149. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  152. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  153. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  154. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  155. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  159. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  161. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  167. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  173. package/contracts/components/{BaseComponent.sol → Component.sol} +69 -40
  174. package/contracts/components/Distribution.sol +5 -14
  175. package/contracts/components/{IBaseComponent.sol → IComponent.sol} +12 -7
  176. package/contracts/components/IProductComponent.sol +2 -2
  177. package/contracts/components/Pool.sol +7 -20
  178. package/contracts/components/Product.sol +21 -18
  179. package/contracts/instance/BundleManager.sol +7 -11
  180. package/contracts/instance/IInstance.sol +4 -4
  181. package/contracts/instance/IInstanceBase.sol +3 -2
  182. package/contracts/instance/IInstanceService.sol +4 -2
  183. package/contracts/instance/Instance.sol +11 -28
  184. package/contracts/instance/InstanceAccessManager.sol +15 -16
  185. package/contracts/instance/InstanceBase.sol +0 -3
  186. package/contracts/instance/InstanceReader.sol +3 -25
  187. package/contracts/instance/InstanceService.sol +115 -47
  188. package/contracts/instance/InstanceServiceManager.sol +5 -8
  189. package/contracts/instance/ObjectManager.sol +7 -24
  190. package/contracts/instance/base/ComponentService.sol +133 -0
  191. package/contracts/instance/base/IInstanceBase.sol +0 -2
  192. package/contracts/instance/module/IAccess.sol +1 -1
  193. package/contracts/instance/service/BundleService.sol +41 -8
  194. package/contracts/instance/service/BundleServiceManager.sol +5 -8
  195. package/contracts/instance/service/DistributionService.sol +36 -39
  196. package/contracts/instance/service/DistributionServiceManager.sol +6 -9
  197. package/contracts/instance/service/IBundleService.sol +5 -6
  198. package/contracts/instance/service/IPolicyService.sol +7 -0
  199. package/contracts/instance/service/PolicyService.sol +67 -37
  200. package/contracts/instance/service/PoolService.sol +49 -31
  201. package/contracts/instance/service/PoolServiceManager.sol +5 -8
  202. package/contracts/instance/service/ProductService.sol +106 -38
  203. package/contracts/registry/ChainNft.sol +1 -1
  204. package/contracts/registry/IRegistry.sol +26 -16
  205. package/contracts/registry/IRegistryService.sol +17 -10
  206. package/contracts/registry/Registry.sol +149 -201
  207. package/contracts/registry/RegistryAccessManager.sol +210 -0
  208. package/contracts/registry/RegistryService.sol +55 -96
  209. package/contracts/registry/RegistryServiceManager.sol +18 -36
  210. package/contracts/registry/ReleaseManager.sol +342 -0
  211. package/contracts/registry/TokenRegistry.sol +5 -6
  212. package/contracts/shared/IRegisterable.sol +0 -2
  213. package/contracts/shared/IService.sol +2 -1
  214. package/contracts/shared/NftOwnable.sol +2 -0
  215. package/contracts/shared/ProxyManager.sol +1 -1
  216. package/contracts/shared/Service.sol +13 -8
  217. package/contracts/test/TestService.sol +3 -2
  218. package/contracts/types/RoleId.sol +4 -5
  219. package/package.json +1 -1
  220. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  221. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  222. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  223. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  224. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  225. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  226. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  227. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  228. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
  229. package/contracts/instance/base/ComponentServiceBase.sol +0 -72
  230. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  231. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  232. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,40 +1,59 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IBaseComponent} from "./IBaseComponent.sol";
5
- import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
6
- import {IInstanceService} from "../instance/IInstanceService.sol";
4
+ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7
5
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
+
7
+ import {IComponent} from "./IComponent.sol";
8
+ import {IProductService} from "../instance/service/IProductService.sol";
9
+ import {IInstanceService} from "../instance/IInstanceService.sol";
8
10
  import {IInstance} from "../instance/IInstance.sol";
9
11
  import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
10
12
  import {IRegistry} from "../registry/IRegistry.sol";
11
13
  import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
12
- import {ObjectType} from "../types/ObjectType.sol";
14
+ import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
13
15
  import {VersionLib} from "../types/Version.sol";
14
16
  import {Registerable} from "../shared/Registerable.sol";
15
17
  import {RoleId, RoleIdLib} from "../types/RoleId.sol";
16
- import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
18
+ import {IAccess} from "../instance/module/IAccess.sol";
17
19
 
18
- abstract contract BaseComponent is
20
+ // TODO discuss to inherit from oz accessmanaged
21
+ // TODO make contract upgradeable, then add ComponentUpradeable that also intherits from Versionable
22
+ // same pattern as for Service which is also upgradeable
23
+ abstract contract Component is
19
24
  Registerable,
20
- IBaseComponent
25
+ IComponent
21
26
  {
22
- using NftIdLib for NftId;
23
-
24
- IComponentOwnerService internal _componentOwnerService;
25
27
  IInstanceService internal _instanceService;
28
+ IProductService internal _productService;
26
29
 
27
- address internal _deployer;
28
- address internal _wallet;
29
- IERC20Metadata internal _token;
30
30
  IInstance internal _instance;
31
- InstanceAccessManager internal _instanceAccessManager;
31
+ IERC20Metadata internal _token;
32
+ address internal _wallet;
32
33
  NftId internal _productNftId;
33
34
 
35
+ modifier onlyProductService() {
36
+ if(msg.sender != address(_productService)) {
37
+ revert ErrorComponentNotProductService(msg.sender);
38
+ }
39
+ _;
40
+ }
41
+
42
+ // TODO discuss replacement with modifier restricted from accessmanaged
34
43
  modifier onlyInstanceRole(uint64 roleIdNum) {
35
44
  RoleId roleId = RoleIdLib.toRoleId(roleIdNum);
36
- if( !_instanceAccessManager.hasRole(roleId, msg.sender)) {
37
- revert ErrorBaseComponentUnauthorized(msg.sender, roleIdNum);
45
+ InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
46
+ if( !accessManager.hasRole(roleId, msg.sender)) {
47
+ revert ErrorComponentUnauthorized(msg.sender, roleIdNum);
48
+ }
49
+ _;
50
+ }
51
+
52
+ // TODO discuss replacement with modifier restricted from accessmanaged
53
+ modifier isNotLocked() {
54
+ InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
55
+ if (accessManager.isTargetLocked(address(this))) {
56
+ revert IAccess.ErrorIAccessTargetLocked(address(this));
38
57
  }
39
58
  _;
40
59
  }
@@ -51,40 +70,43 @@ abstract contract BaseComponent is
51
70
  bytes memory data = "";
52
71
  _initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
53
72
 
54
- IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
73
+ IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
55
74
  _instance = IInstance(instanceInfo.objectAddress);
56
- _instanceAccessManager = _instance.getInstanceAccessManager();
57
75
  require(
58
76
  _instance.supportsInterface(type(IInstance).interfaceId),
59
77
  ""
60
78
  );
61
79
 
62
- _componentOwnerService = _instance.getComponentOwnerService();
63
- _instanceService = IInstanceService(getRegistry().getServiceAddress("InstanceService", VersionLib.toVersion(3, 0, 0).toMajorPart()));
80
+ _instanceService = IInstanceService(_registry.getServiceAddress(INSTANCE(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
81
+ _productService = IProductService(_registry.getServiceAddress(PRODUCT(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
64
82
  _wallet = address(this);
65
83
  _token = IERC20Metadata(token);
66
84
 
67
- _registerInterface(type(IBaseComponent).interfaceId);
85
+ _registerInterface(type(IComponent).interfaceId);
68
86
  }
69
87
 
70
- // from component contract
71
- // TODO consider to remove/replace with access manager contract locking
88
+ // TODO discuss replacement with modifier restricted from accessmanaged
72
89
  function lock() external onlyOwner override {
73
- _componentOwnerService.lock(this);
90
+ _instanceService.setTargetLocked(getName(), true);
74
91
  }
75
-
76
- // TODO consider to remove/replace with access manager contract locking
92
+
93
+ // TODO discuss replacement with modifier restricted from accessmanaged
77
94
  function unlock() external onlyOwner override {
78
- _componentOwnerService.unlock(this);
95
+ _instanceService.setTargetLocked(getName(), false);
79
96
  }
80
97
 
81
- function getWallet()
98
+ // TODO discuss to split this base contract into a minimal component base (eg oracle)
99
+ // and a component base that is linked to a product component (all others in v3)
100
+ function setProductNftId(NftId productNftId)
82
101
  external
83
- view
84
102
  override
85
- returns (address walletAddress)
103
+ onlyProductService()
86
104
  {
87
- return _wallet;
105
+ if(_productNftId.gtz()) {
106
+ revert ErrorComponentProductNftAlreadySet();
107
+ }
108
+
109
+ _productNftId = productNftId;
88
110
  }
89
111
 
90
112
  /// @dev Sets the wallet address for the component.
@@ -97,7 +119,7 @@ abstract contract BaseComponent is
97
119
 
98
120
  // checks
99
121
  if (newWallet == currentWallet) {
100
- revert ErrorBaseComponentWalletAddressIsSameAsCurrent(newWallet);
122
+ revert ErrorComponentWalletAddressIsSameAsCurrent(newWallet);
101
123
  }
102
124
 
103
125
  if (currentBalance > 0) {
@@ -107,14 +129,14 @@ abstract contract BaseComponent is
107
129
  // move tokens from external wallet to component smart contract or another external wallet
108
130
  uint256 allowance = _token.allowance(currentWallet, address(this));
109
131
  if (allowance < currentBalance) {
110
- revert ErrorBaseComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
132
+ revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
111
133
  }
112
134
  }
113
135
  }
114
136
 
115
137
  // effects
116
138
  _wallet = newWallet;
117
- emit LogBaseComponentWalletAddressChanged(newWallet);
139
+ emit LogComponentWalletAddressChanged(newWallet);
118
140
 
119
141
  // interactions
120
142
  if (currentBalance > 0) {
@@ -125,10 +147,22 @@ abstract contract BaseComponent is
125
147
  }
126
148
 
127
149
  SafeERC20.safeTransferFrom(_token, currentWallet, newWallet, currentBalance);
128
- emit LogBaseComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
150
+ emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
129
151
  }
130
152
  }
131
153
 
154
+ // TODO set name via constructor or initialization, pure function likely too restrictive
155
+ function getName() public pure virtual returns (string memory name);
156
+
157
+ function getWallet()
158
+ external
159
+ view
160
+ override
161
+ returns (address walletAddress)
162
+ {
163
+ return _wallet;
164
+ }
165
+
132
166
  function getToken() public view override returns (IERC20Metadata token) {
133
167
  return _token;
134
168
  }
@@ -137,11 +171,6 @@ abstract contract BaseComponent is
137
171
  return _instance;
138
172
  }
139
173
 
140
- function setProductNftId(NftId productNftId) public override onlyOwner {
141
- require(_productNftId.eq(zeroNftId()), "product nft id already set");
142
- _productNftId = productNftId;
143
- }
144
-
145
174
  function getProductNftId() public view override returns (NftId productNftId) {
146
175
  return _productNftId;
147
176
  }
@@ -7,7 +7,7 @@ import {IProductService} from "../instance/service/IProductService.sol";
7
7
  import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
8
8
  import {ReferralId} from "../types/Referral.sol";
9
9
  import {Fee, FeeLib} from "../types/Fee.sol";
10
- import {BaseComponent} from "./BaseComponent.sol";
10
+ import {Component} from "./Component.sol";
11
11
  import {IDistributionComponent} from "./IDistributionComponent.sol";
12
12
  import {IRegistry} from "../registry/IRegistry.sol";
13
13
  import {IRegisterable} from "../shared/IRegisterable.sol";
@@ -16,8 +16,8 @@ import {Registerable} from "../shared/Registerable.sol";
16
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
17
17
  import {InstanceReader} from "../instance/InstanceReader.sol";
18
18
 
19
- contract Distribution is
20
- BaseComponent,
19
+ abstract contract Distribution is
20
+ Component,
21
21
  IDistributionComponent
22
22
  {
23
23
  using NftIdLib for NftId;
@@ -28,14 +28,6 @@ contract Distribution is
28
28
  TokenHandler internal _tokenHandler;
29
29
 
30
30
  IDistributionService private _distributionService;
31
- IProductService private _productService;
32
-
33
- modifier onlyProductService() {
34
- require(
35
- msg.sender == address(_productService),
36
- "ERROR:POL-002:NOT_PRODUCT_SERVICE");
37
- _;
38
- }
39
31
 
40
32
  constructor(
41
33
  address registry,
@@ -46,15 +38,13 @@ contract Distribution is
46
38
  Fee memory distributionFee,
47
39
  address initialOwner
48
40
  )
49
- BaseComponent(registry, instanceNftId, token, DISTRIBUTION(), true, initialOwner)
41
+ Component(registry, instanceNftId, token, DISTRIBUTION(), true, initialOwner)
50
42
  {
51
43
  _isVerifying = verifying;
52
44
  _initialDistributionFee = distributionFee;
53
45
 
54
46
  _tokenHandler = TokenHandler(token);
55
-
56
47
  _distributionService = _instance.getDistributionService();
57
- _productService = _instance.getProductService();
58
48
 
59
49
  _registerInterface(type(IDistributionComponent).interfaceId);
60
50
  }
@@ -150,6 +140,7 @@ contract Distribution is
150
140
  return (
151
141
  info,
152
142
  abi.encode(
143
+ getName(),
153
144
  ISetup.DistributionSetupInfo(
154
145
  _productNftId,
155
146
  _tokenHandler,
@@ -7,16 +7,21 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
7
7
  import {IInstance} from "../instance/IInstance.sol";
8
8
  import {NftId} from "../types/NftId.sol";
9
9
 
10
- interface IBaseComponent is IRegisterable {
11
- error ErrorBaseComponentWalletAddressIsSameAsCurrent(address newWallet);
12
- error ErrorBaseComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
13
- error ErrorBaseComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
10
+ interface IComponent is IRegisterable {
14
11
 
15
- event LogBaseComponentWalletAddressChanged(address newWallet);
16
- event LogBaseComponentWalletTokensTransferred(address from, address to, uint256 amount);
12
+ error ErrorComponentProductNftAlreadySet();
13
+ error ErrorComponentWalletAddressIsSameAsCurrent(address newWallet);
14
+ error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
15
+ error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
16
+ error ErrorComponentNotProductService(address caller);
17
17
 
18
- function lock() external;
18
+ event LogComponentWalletAddressChanged(address newWallet);
19
+ event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
20
+
21
+ function getName() external pure returns (string memory name);
19
22
 
23
+ // TODO remove and replace with accessmanaged target locking mechanism
24
+ function lock() external;
20
25
  function unlock() external;
21
26
 
22
27
  function getToken() external view returns (IERC20Metadata token);
@@ -18,8 +18,8 @@ interface IProductComponent {
18
18
  RiskId riskId,
19
19
  uint256 lifetime,
20
20
  bytes memory applicationData,
21
- ReferralId referralId,
22
- NftId bundleNftId
21
+ NftId bundleNftId,
22
+ ReferralId referralId
23
23
  ) external view returns (uint256 premiumAmount);
24
24
 
25
25
  function calculateNetPremium(
@@ -1,29 +1,26 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {ObjectType, POOL} from "../types/ObjectType.sol";
5
- import {IProductService} from "../instance/service/IProductService.sol";
4
+ import {POOL} from "../types/ObjectType.sol";
6
5
  import {IPoolService} from "../instance/service/IPoolService.sol";
7
6
  import {IBundleService} from "../instance/service/IBundleService.sol";
8
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
7
+ import {NftId, NftIdLib} from "../types/NftId.sol";
9
8
  import {Fee} from "../types/Fee.sol";
10
9
  import {UFixed} from "../types/UFixed.sol";
11
10
  import {IPoolComponent} from "./IPoolComponent.sol";
12
- import {BaseComponent} from "./BaseComponent.sol";
11
+ import {Component} from "./Component.sol";
13
12
  import {TokenHandler} from "../shared/TokenHandler.sol";
14
13
  import {ISetup} from "../instance/module/ISetup.sol";
15
14
 
16
15
  import {IRegistry} from "../registry/IRegistry.sol";
17
16
 
18
- // import {IPool} from "../instance/module/pool/IPoolModule.sol";
19
- import {ITreasury} from "../instance/module/ITreasury.sol";
20
17
  import {ISetup} from "../instance/module/ISetup.sol";
21
18
  import {InstanceReader} from "../instance/InstanceReader.sol";
22
19
 
23
20
  import {IRegisterable} from "../shared/IRegisterable.sol";
24
21
  import {Registerable} from "../shared/Registerable.sol";
25
22
 
26
- contract Pool is BaseComponent, IPoolComponent {
23
+ abstract contract Pool is Component, IPoolComponent {
27
24
  using NftIdLib for NftId;
28
25
 
29
26
  bool internal _isConfirmingApplication;
@@ -37,10 +34,6 @@ contract Pool is BaseComponent, IPoolComponent {
37
34
 
38
35
  // may be used to interact with instance by derived contracts
39
36
  IPoolService internal _poolService;
40
-
41
- // only relevant to protect callback functions for "active" pools
42
- IProductService private _productService;
43
-
44
37
  IBundleService private _bundleService;
45
38
 
46
39
  modifier onlyPoolService() {
@@ -50,13 +43,6 @@ contract Pool is BaseComponent, IPoolComponent {
50
43
  _;
51
44
  }
52
45
 
53
- modifier onlyProductService() {
54
- require(
55
- msg.sender == address(_productService),
56
- "ERROR:POL-002:NOT_PRODUCT_SERVICE");
57
- _;
58
- }
59
-
60
46
  constructor(
61
47
  address registry,
62
48
  NftId instanceNftId,
@@ -70,7 +56,7 @@ contract Pool is BaseComponent, IPoolComponent {
70
56
  Fee memory performanceFee,
71
57
  address initialOwner
72
58
  )
73
- BaseComponent(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
59
+ Component(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
74
60
  {
75
61
  _isConfirmingApplication = isConfirmingApplication;
76
62
  // TODO add validation
@@ -82,7 +68,7 @@ contract Pool is BaseComponent, IPoolComponent {
82
68
  _tokenHandler = new TokenHandler(token);
83
69
 
84
70
  _poolService = _instance.getPoolService();
85
- _productService = _instance.getProductService();
71
+ // _productService = _instance.getProductService();
86
72
  _bundleService = _instance.getBundleService();
87
73
 
88
74
  _registerInterface(type(IPoolComponent).interfaceId);
@@ -217,6 +203,7 @@ contract Pool is BaseComponent, IPoolComponent {
217
203
  return (
218
204
  info,
219
205
  abi.encode(
206
+ getName(),
220
207
  ISetup.PoolSetupInfo(
221
208
  _productNftId,
222
209
  _tokenHandler,
@@ -4,18 +4,16 @@ pragma solidity ^0.8.19;
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
 
6
6
  import {IRisk} from "../instance/module/IRisk.sol";
7
- import {ITreasury} from "../instance/module/ITreasury.sol";
8
- import {IProductService} from "../instance/service/IProductService.sol";
9
7
  import {IPolicyService} from "../instance/service/IPolicyService.sol";
10
8
  import {IProductComponent} from "./IProductComponent.sol";
11
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
12
- import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
9
+ import {NftId, NftIdLib} from "../types/NftId.sol";
10
+ import {PRODUCT} from "../types/ObjectType.sol";
13
11
  import {ReferralId} from "../types/Referral.sol";
14
12
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
15
13
  import {StateId} from "../types/StateId.sol";
16
14
  import {Timestamp} from "../types/Timestamp.sol";
17
- import {Fee, FeeLib} from "../types/Fee.sol";
18
- import {BaseComponent} from "./BaseComponent.sol";
15
+ import {Fee} from "../types/Fee.sol";
16
+ import {Component} from "./Component.sol";
19
17
 
20
18
  import {IRegistry} from "../registry/IRegistry.sol";
21
19
  import {IRegisterable} from "../shared/IRegisterable.sol";
@@ -27,12 +25,9 @@ import {ISetup} from "../instance/module/ISetup.sol";
27
25
  import {Pool} from "../components/Pool.sol";
28
26
  import {Distribution} from "../components/Distribution.sol";
29
27
 
30
- import {zeroNftId} from "../types/NftId.sol";
31
-
32
- contract Product is BaseComponent, IProductComponent {
28
+ abstract contract Product is Component, IProductComponent {
33
29
  using NftIdLib for NftId;
34
30
 
35
- IProductService internal _productService;
36
31
  IPolicyService internal _policyService;
37
32
  Pool internal _pool;
38
33
  Distribution internal _distribution;
@@ -53,9 +48,8 @@ contract Product is BaseComponent, IProductComponent {
53
48
  Fee memory productFee,
54
49
  Fee memory processingFee,
55
50
  address initialOwner
56
- ) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
51
+ ) Component(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
57
52
  // TODO add validation
58
- _productService = _instance.getProductService();
59
53
  _policyService = _instance.getPolicyService();
60
54
  _pool = Pool(pool);
61
55
  _distribution = Distribution(distribution);
@@ -76,8 +70,8 @@ contract Product is BaseComponent, IProductComponent {
76
70
  RiskId riskId,
77
71
  uint256 lifetime,
78
72
  bytes memory applicationData,
79
- ReferralId referralId,
80
- NftId bundleNftId
73
+ NftId bundleNftId,
74
+ ReferralId referralId
81
75
  )
82
76
  external
83
77
  view
@@ -203,6 +197,14 @@ contract Product is BaseComponent, IProductComponent {
203
197
  activateAt);
204
198
  }
205
199
 
200
+ function _close(
201
+ NftId policyNftId
202
+ )
203
+ internal
204
+ {
205
+ _policyService.close(policyNftId);
206
+ }
207
+
206
208
  function getPoolNftId() external view override returns (NftId poolNftId) {
207
209
  return getRegistry().getNftId(address(_pool));
208
210
  }
@@ -256,8 +258,8 @@ contract Product is BaseComponent, IProductComponent {
256
258
  ) = _pool.getInitialInfo();
257
259
 
258
260
  (
259
- ISetup.PoolSetupInfo memory poolSetupInfo
260
- ) = abi.decode(poolData, (ISetup.PoolSetupInfo));
261
+ , ISetup.PoolSetupInfo memory poolSetupInfo
262
+ ) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
261
263
 
262
264
  // from DistributionComponent
263
265
  (
@@ -266,12 +268,13 @@ contract Product is BaseComponent, IProductComponent {
266
268
  ) = _distribution.getInitialInfo();
267
269
 
268
270
  (
269
- ISetup.DistributionSetupInfo memory distributionSetupInfo
270
- ) = abi.decode(distributionData, (ISetup.DistributionSetupInfo));
271
+ , ISetup.DistributionSetupInfo memory distributionSetupInfo
272
+ ) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
271
273
 
272
274
  return (
273
275
  productInfo,
274
276
  abi.encode(
277
+ getName(),
275
278
  ISetup.ProductSetupInfo(
276
279
  _token,
277
280
  _tokenHandler,
@@ -32,17 +32,13 @@ contract BundleManager is
32
32
 
33
33
  mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
34
34
 
35
- constructor() ObjectManager() {
36
- }
37
-
38
-
39
35
  /// @dev links a policy with its bundle
40
36
  // to link a policy it MUST NOT yet have been activated
41
37
  // the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
42
38
  function linkPolicy(NftId policyNftId) external restricted() {
43
- NftId bundleNftId = _instanceReader.getPolicyInfo(policyNftId).bundleNftId;
39
+ NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
44
40
  // decision will likely depend on the decision what to check here and what in the service
45
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
41
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
46
42
 
47
43
  // ensure bundle is unlocked (in active set) and registered with this instance
48
44
  if (!_isActive(poolNftId, bundleNftId)) {
@@ -59,11 +55,11 @@ contract BundleManager is
59
55
  // - the policy MUST be past its expiry period and it MUST NOT have any open claims
60
56
  // - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
61
57
  function unlinkPolicy(NftId policyNftId) external restricted() {
62
- IPolicy.PolicyInfo memory policyInfo = _instanceReader.getPolicyInfo(policyNftId);
58
+ IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
63
59
 
64
60
  NftId bundleNftId = policyInfo.bundleNftId;
65
61
  // decision will likely depend on the decision what to check here and what in the service
66
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
62
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
67
63
 
68
64
  // ensure bundle is registered with this instance
69
65
  if (!_contains(poolNftId, bundleNftId)) {
@@ -78,7 +74,7 @@ contract BundleManager is
78
74
  /// @dev add a new bundle to a riskpool registerd with this instance
79
75
  // the corresponding pool is fetched via instance reader
80
76
  function add(NftId bundleNftId) external restricted() {
81
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
77
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
82
78
 
83
79
  // ensure pool is registered with instance
84
80
  if(poolNftId.eqz()) {
@@ -91,14 +87,14 @@ contract BundleManager is
91
87
 
92
88
  /// @dev unlocked (active) bundles are available to underwrite new policies
93
89
  function unlock(NftId bundleNftId) external restricted() {
94
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
90
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
95
91
  _activate(poolNftId, bundleNftId);
96
92
  emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
97
93
  }
98
94
 
99
95
  /// @dev locked (deactivated) bundles may not underwrite any new policies
100
96
  function lock(NftId bundleNftId) external restricted() {
101
- NftId poolNftId = _instanceReader.getBundleInfo(bundleNftId).poolNftId;
97
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
102
98
  _deactivate(poolNftId, bundleNftId);
103
99
  emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
104
100
  }
@@ -2,12 +2,14 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
+ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
6
 
6
7
  import {BundleManager} from "./BundleManager.sol";
7
8
  import {InstanceReader} from "./InstanceReader.sol";
8
9
 
10
+ import {IInstanceBase} from "./IInstanceBase.sol";
11
+
9
12
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
10
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
11
13
  import {IDistributionService} from "./service/IDistributionService.sol";
12
14
  import {IPoolService} from "./service/IPoolService.sol";
13
15
  import {IProductService} from "./service/IProductService.sol";
@@ -23,9 +25,8 @@ import {IPolicy} from "./module/IPolicy.sol";
23
25
  import {IKeyValueStore} from "./base/IKeyValueStore.sol";
24
26
 
25
27
 
26
- interface IInstance is IERC165, IKeyValueStore {
28
+ interface IInstance is IInstanceBase, IAccessManaged {
27
29
 
28
- function getComponentOwnerService() external view returns (IComponentOwnerService);
29
30
  function getDistributionService() external view returns (IDistributionService);
30
31
  function getProductService() external view returns (IProductService);
31
32
  function getPoolService() external view returns (IPoolService);
@@ -56,7 +57,6 @@ interface IInstance is IERC165, IKeyValueStore {
56
57
  function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
57
58
  function updatePolicyState(NftId policyNftId, StateId newState) external;
58
59
 
59
- function getInstanceAccessManager() external view returns (InstanceAccessManager);
60
60
  function getInstanceReader() external view returns (InstanceReader);
61
61
  function getBundleManager() external view returns (BundleManager);
62
62
  }
@@ -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";
@@ -19,8 +18,10 @@ import {IRisk} from "./module/IRisk.sol";
19
18
  import {IPolicy} from "./module/IPolicy.sol";
20
19
  import {IKeyValueStore} from "./base/IKeyValueStore.sol";
21
20
 
21
+ import {IRegisterable} from "../shared/IRegisterable.sol";
22
22
 
23
- interface IInstanceBase is IERC165, IKeyValueStore {
23
+
24
+ interface IInstanceBase is IRegisterable, IKeyValueStore {
24
25
 
25
26
 
26
27
  }
@@ -8,7 +8,7 @@ import {IService} from "../shared/IService.sol";
8
8
  import {IRegistry} from "../registry/IRegistry.sol";
9
9
 
10
10
  import {IRegisterable} from "../shared/IRegisterable.sol";
11
- import {IBaseComponent} from "../components/IBaseComponent.sol";
11
+ import {IComponent} from "../components/IComponent.sol";
12
12
 
13
13
  import {InstanceAccessManager} from "./InstanceAccessManager.sol";
14
14
  import {Instance} from "./Instance.sol";
@@ -19,7 +19,8 @@ interface IInstanceService is IService {
19
19
 
20
20
  error ErrorInstanceServiceRequestUnauhorized(address caller);
21
21
  error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
22
-
22
+ error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
23
+
23
24
  event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
24
25
 
25
26
  function createInstanceClone()
@@ -33,6 +34,7 @@ interface IInstanceService is IService {
33
34
  );
34
35
 
35
36
  function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
37
+ function setTargetLocked(string memory targetName, bool locked) external;
36
38
 
37
39
  }
38
40