@etherisc/gif-next 0.0.2-bf75dbb-287 → 0.0.2-c2a8d66-341

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  2. package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +300 -12
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +199 -94
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  6. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +86 -84
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +496 -0
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +512 -74
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +596 -5
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +180 -205
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +204 -110
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  37. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  38. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
  39. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  41. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +284 -2
  42. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +115 -19
  44. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/Instance.sol/Instance.json +117 -601
  46. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +416 -186
  48. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
  50. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +253 -226
  52. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +38 -97
  54. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
  56. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  57. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +124 -61
  58. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  60. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +65 -44
  64. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  71. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1102 -0
  72. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  73. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +449 -0
  74. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +149 -93
  76. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +29 -36
  78. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  79. package/artifacts/contracts/instance/service/{IComponentOwnerService.sol/IComponentOwnerService.json → IBundleService.sol/IBundleService.json} +295 -46
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -18
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  83. package/artifacts/contracts/{shared/RegisterableUpgradable.sol/RegisterableUpgradable.json → instance/service/IPolicyService.sol/IPolicyService.json} +372 -48
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +12 -246
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +17 -246
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  89. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1227 -0
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  91. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +505 -0
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -369
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +29 -56
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +137 -428
  98. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +29 -80
  100. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  101. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  102. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +231 -133
  104. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  105. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +127 -93
  106. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  107. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  108. package/artifacts/contracts/registry/Registry.sol/Registry.json +243 -234
  109. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  110. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  111. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  112. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +68 -161
  113. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  114. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +51 -104
  115. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  116. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
  117. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  118. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +13 -29
  119. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  120. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  121. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  122. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  123. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -5
  124. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  125. package/artifacts/contracts/shared/IService.sol/IService.json +13 -18
  126. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  127. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +19 -6
  129. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  130. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
  131. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  132. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
  133. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  134. package/artifacts/contracts/shared/Service.sol/Service.json +26 -18
  135. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  136. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  137. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  138. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  139. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  140. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +19 -11
  141. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
  143. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestService.sol/TestService.json +44 -36
  145. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  147. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  148. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  149. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  150. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  151. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  152. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  153. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  154. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  155. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  157. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  161. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  163. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  169. package/contracts/components/Component.sol +216 -0
  170. package/contracts/components/Distribution.sol +41 -51
  171. package/contracts/components/IComponent.sol +43 -0
  172. package/contracts/components/IDistributionComponent.sol +5 -2
  173. package/contracts/components/IPoolComponent.sol +6 -21
  174. package/contracts/components/IProductComponent.sol +7 -3
  175. package/contracts/components/Pool.sol +50 -109
  176. package/contracts/components/Product.sol +66 -89
  177. package/contracts/instance/BundleManager.sol +7 -11
  178. package/contracts/instance/IInstance.sol +25 -9
  179. package/contracts/instance/IInstanceService.sol +12 -4
  180. package/contracts/instance/Instance.sol +45 -230
  181. package/contracts/instance/InstanceAccessManager.sol +333 -166
  182. package/contracts/instance/InstanceReader.sol +3 -25
  183. package/contracts/instance/InstanceService.sol +352 -143
  184. package/contracts/instance/InstanceServiceManager.sol +5 -8
  185. package/contracts/instance/ObjectManager.sol +7 -24
  186. package/contracts/instance/base/ComponentService.sol +134 -0
  187. package/contracts/instance/module/IAccess.sol +36 -20
  188. package/contracts/instance/service/BundleService.sol +293 -0
  189. package/contracts/instance/service/BundleServiceManager.sol +51 -0
  190. package/contracts/instance/service/DistributionService.sol +43 -25
  191. package/contracts/instance/service/DistributionServiceManager.sol +6 -9
  192. package/contracts/instance/service/IBundleService.sol +44 -0
  193. package/contracts/instance/service/IPolicyService.sol +94 -0
  194. package/contracts/instance/service/IPoolService.sol +2 -33
  195. package/contracts/instance/service/IProductService.sol +2 -72
  196. package/contracts/instance/service/PolicyService.sol +538 -0
  197. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  198. package/contracts/instance/service/PoolService.sol +33 -210
  199. package/contracts/instance/service/PoolServiceManager.sol +5 -8
  200. package/contracts/instance/service/ProductService.sol +122 -459
  201. package/contracts/registry/ChainNft.sol +1 -1
  202. package/contracts/registry/IRegistry.sol +36 -17
  203. package/contracts/registry/IRegistryService.sol +28 -13
  204. package/contracts/registry/Registry.sol +227 -218
  205. package/contracts/registry/RegistryAccessManager.sol +216 -0
  206. package/contracts/registry/RegistryService.sol +61 -157
  207. package/contracts/registry/RegistryServiceManager.sol +18 -36
  208. package/contracts/registry/ReleaseManager.sol +332 -0
  209. package/contracts/registry/TokenRegistry.sol +8 -7
  210. package/contracts/shared/IRegisterable.sol +1 -3
  211. package/contracts/shared/IService.sol +2 -1
  212. package/contracts/shared/NftOwnable.sol +5 -0
  213. package/contracts/shared/ProxyManager.sol +1 -1
  214. package/contracts/shared/Registerable.sol +10 -14
  215. package/contracts/shared/Service.sol +13 -8
  216. package/contracts/test/TestService.sol +3 -2
  217. package/contracts/types/RoleId.sol +18 -15
  218. package/package.json +3 -3
  219. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  220. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  221. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  222. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
  223. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  224. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  225. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  226. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
  227. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
  228. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
  229. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  230. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  231. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
  232. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  233. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  234. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  235. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  236. package/contracts/components/BaseComponent.sol +0 -132
  237. package/contracts/components/IBaseComponent.sol +0 -31
  238. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
  239. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  240. package/contracts/instance/IInstanceBase.sol +0 -26
  241. package/contracts/instance/InstanceBase.sol +0 -41
  242. package/contracts/instance/base/ComponentServiceBase.sol +0 -134
  243. package/contracts/instance/base/IInstanceBase.sol +0 -23
  244. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  245. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  246. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,28 +1,22 @@
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
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
6
+ import {IBundleService} from "../instance/service/IBundleService.sol";
7
+ import {NftId, NftIdLib} from "../types/NftId.sol";
8
8
  import {Fee} from "../types/Fee.sol";
9
9
  import {UFixed} from "../types/UFixed.sol";
10
10
  import {IPoolComponent} from "./IPoolComponent.sol";
11
- import {BaseComponent} from "./BaseComponent.sol";
11
+ import {Component} from "./Component.sol";
12
12
  import {TokenHandler} from "../shared/TokenHandler.sol";
13
13
  import {ISetup} from "../instance/module/ISetup.sol";
14
14
 
15
- import {IRegistry} from "../registry/IRegistry.sol";
16
-
17
- // import {IPool} from "../instance/module/pool/IPoolModule.sol";
18
- import {ITreasury} from "../instance/module/ITreasury.sol";
19
15
  import {ISetup} from "../instance/module/ISetup.sol";
20
16
  import {InstanceReader} from "../instance/InstanceReader.sol";
21
17
 
22
- import {IRegisterable} from "../shared/IRegisterable.sol";
23
- import {Registerable} from "../shared/Registerable.sol";
24
18
 
25
- contract Pool is BaseComponent, IPoolComponent {
19
+ abstract contract Pool is Component, IPoolComponent {
26
20
  using NftIdLib for NftId;
27
21
 
28
22
  bool internal _isConfirmingApplication;
@@ -36,9 +30,7 @@ contract Pool is BaseComponent, IPoolComponent {
36
30
 
37
31
  // may be used to interact with instance by derived contracts
38
32
  IPoolService internal _poolService;
39
-
40
- // only relevant to protect callback functions for "active" pools
41
- IProductService private _productService;
33
+ IBundleService private _bundleService;
42
34
 
43
35
  modifier onlyPoolService() {
44
36
  require(
@@ -47,16 +39,10 @@ contract Pool is BaseComponent, IPoolComponent {
47
39
  _;
48
40
  }
49
41
 
50
- modifier onlyProductService() {
51
- require(
52
- msg.sender == address(_productService),
53
- "ERROR:POL-002:NOT_PRODUCT_SERVICE");
54
- _;
55
- }
56
-
57
42
  constructor(
58
43
  address registry,
59
44
  NftId instanceNftId,
45
+ string memory name,
60
46
  // TODO refactor into tokenNftId
61
47
  address token,
62
48
  bool isInterceptor,
@@ -65,10 +51,18 @@ contract Pool is BaseComponent, IPoolComponent {
65
51
  Fee memory poolFee,
66
52
  Fee memory stakingFee,
67
53
  Fee memory performanceFee,
68
- address initialOwner
69
- )
70
- BaseComponent(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
71
- {
54
+ address initialOwner,
55
+ bytes memory data
56
+ ) Component(
57
+ registry,
58
+ instanceNftId,
59
+ name,
60
+ token,
61
+ POOL(),
62
+ isInterceptor,
63
+ initialOwner,
64
+ data
65
+ ) {
72
66
  _isConfirmingApplication = isConfirmingApplication;
73
67
  // TODO add validation
74
68
  _collateralizationLevel = collateralizationLevel;
@@ -78,34 +72,12 @@ contract Pool is BaseComponent, IPoolComponent {
78
72
 
79
73
  _tokenHandler = new TokenHandler(token);
80
74
 
81
- _poolService = _instance.getPoolService();
82
- _productService = _instance.getProductService();
75
+ _poolService = getInstance().getPoolService();
76
+ _bundleService = getInstance().getBundleService();
83
77
 
84
78
  _registerInterface(type(IPoolComponent).interfaceId);
85
79
  }
86
80
 
87
- function createBundle(
88
- Fee memory fee,
89
- uint256 initialAmount,
90
- uint256 lifetime,
91
- bytes memory filter
92
- )
93
- external
94
- virtual override
95
- returns(NftId bundleNftId)
96
- {
97
- address owner = msg.sender;
98
- bundleNftId = _poolService.createBundle(
99
- owner,
100
- fee,
101
- initialAmount,
102
- lifetime,
103
- filter
104
- );
105
-
106
- // TODO add logging
107
- }
108
-
109
81
  /**
110
82
  * @dev see {IPool.underwrite}.
111
83
  * Default implementation that only writes a {LogUnderwrittenByPool} entry.
@@ -117,7 +89,7 @@ contract Pool is BaseComponent, IPoolComponent {
117
89
  uint256 collateralizationAmount
118
90
  )
119
91
  external
120
- onlyProductService
92
+ restricted()
121
93
  virtual override
122
94
  {
123
95
  _underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
@@ -155,76 +127,45 @@ contract Pool is BaseComponent, IPoolComponent {
155
127
  )
156
128
  external
157
129
  onlyOwner
130
+ restricted()
158
131
  override
159
132
  {
160
133
  _poolService.setFees(poolFee, stakingFee, performanceFee);
161
134
  }
162
135
 
163
- function setBundleFee(
164
- NftId bundleNftId,
165
- Fee memory fee
166
- )
167
- external
168
- override
169
- // TODO add onlyBundleOwner
170
- {
171
- _poolService.setBundleFee(bundleNftId, fee);
136
+ function _setBundleFee(NftId bundleNftId, Fee memory fee) internal {
137
+ _bundleService.setBundleFee(bundleNftId, fee);
172
138
  }
173
139
 
174
- function lockBundle(
175
- NftId bundleNftId
176
- )
177
- external
178
- override
179
- // TODO add onlyBundleOwner
180
- {
181
- _poolService.lockBundle(bundleNftId);
140
+ function _lockBundle(NftId bundleNftId) internal {
141
+ _bundleService.lockBundle(bundleNftId);
182
142
  }
183
143
 
184
- function unlockBundle(
185
- NftId bundleNftId
186
- )
187
- external
188
- override
189
- // TODO add onlyBundleOwner
190
- {
191
- _poolService.unlockBundle(bundleNftId);
144
+ function _unlockBundle(NftId bundleNftId) internal {
145
+ _bundleService.unlockBundle(bundleNftId);
192
146
  }
193
147
 
194
148
  function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
195
- InstanceReader reader = _instance.getInstanceReader();
196
- return reader.getPoolSetupInfo(getNftId());
197
- }
198
-
199
- // from IRegisterable
200
-
201
- // TODO used only once, occupies space
202
- // TODO do not use super
203
- function getInitialInfo()
204
- public
205
- view
206
- override (IRegisterable, Registerable)
207
- returns (IRegistry.ObjectInfo memory, bytes memory)
208
- {
209
- (
210
- IRegistry.ObjectInfo memory info,
211
- ) = super.getInitialInfo();
212
-
213
- return (
214
- info,
215
- abi.encode(
216
- ISetup.PoolSetupInfo(
217
- _productNftId,
218
- _tokenHandler,
219
- _collateralizationLevel,
220
- _initialPoolFee,
221
- _initialStakingFee,
222
- _initialPerformanceFee,
223
- false,
224
- _isConfirmingApplication,
225
- _wallet
226
- )
227
- )
149
+ InstanceReader reader = getInstance().getInstanceReader();
150
+ setupInfo = reader.getPoolSetupInfo(getNftId());
151
+
152
+ // fallback to initial setup info (wallet is always != address(0))
153
+ if(setupInfo.wallet == address(0)) {
154
+ setupInfo = _getInitialSetupInfo();
155
+ }
156
+ }
157
+
158
+ function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
159
+ return ISetup.PoolSetupInfo(
160
+ getProductNftId(),
161
+ _tokenHandler,
162
+ _collateralizationLevel,
163
+ _initialPoolFee,
164
+ _initialStakingFee,
165
+ _initialPerformanceFee,
166
+ false,
167
+ _isConfirmingApplication,
168
+ getWallet()
228
169
  );
229
170
  }
230
171
 
@@ -256,7 +197,7 @@ contract Pool is BaseComponent, IPoolComponent {
256
197
  internal
257
198
  returns(NftId bundleNftId)
258
199
  {
259
- bundleNftId = _poolService.createBundle(
200
+ bundleNftId = _bundleService.createBundle(
260
201
  bundleOwner,
261
202
  fee,
262
203
  amount,
@@ -4,21 +4,17 @@ 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";
7
+ import {IPolicyService} from "../instance/service/IPolicyService.sol";
9
8
  import {IProductComponent} from "./IProductComponent.sol";
10
- import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
11
- import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
9
+ import {NftId, NftIdLib} from "../types/NftId.sol";
10
+ import {PRODUCT} from "../types/ObjectType.sol";
12
11
  import {ReferralId} from "../types/Referral.sol";
13
12
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
14
13
  import {StateId} from "../types/StateId.sol";
15
14
  import {Timestamp} from "../types/Timestamp.sol";
16
- import {Fee, FeeLib} from "../types/Fee.sol";
17
- import {BaseComponent} from "./BaseComponent.sol";
15
+ import {Fee} from "../types/Fee.sol";
16
+ import {Component} from "./Component.sol";
18
17
 
19
- import {IRegistry} from "../registry/IRegistry.sol";
20
- import {IRegisterable} from "../shared/IRegisterable.sol";
21
- import {Registerable} from "../shared/Registerable.sol";
22
18
  import {TokenHandler} from "../shared/TokenHandler.sol";
23
19
 
24
20
  import {InstanceReader} from "../instance/InstanceReader.sol";
@@ -26,12 +22,10 @@ import {ISetup} from "../instance/module/ISetup.sol";
26
22
  import {Pool} from "../components/Pool.sol";
27
23
  import {Distribution} from "../components/Distribution.sol";
28
24
 
29
- import {zeroNftId} from "../types/NftId.sol";
30
-
31
- contract Product is BaseComponent, IProductComponent {
25
+ abstract contract Product is Component, IProductComponent {
32
26
  using NftIdLib for NftId;
33
27
 
34
- IProductService internal _productService;
28
+ IPolicyService internal _policyService;
35
29
  Pool internal _pool;
36
30
  Distribution internal _distribution;
37
31
  Fee internal _initialProductFee;
@@ -44,16 +38,27 @@ contract Product is BaseComponent, IProductComponent {
44
38
  constructor(
45
39
  address registry,
46
40
  NftId instanceNftid,
41
+ string memory name,
47
42
  address token,
48
43
  bool isInterceptor,
49
44
  address pool,
50
45
  address distribution,
51
46
  Fee memory productFee,
52
47
  Fee memory processingFee,
53
- address initialOwner
54
- ) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
48
+ address initialOwner,
49
+ bytes memory data
50
+ ) Component (
51
+ registry,
52
+ instanceNftid,
53
+ name,
54
+ token,
55
+ PRODUCT(),
56
+ isInterceptor,
57
+ initialOwner,
58
+ data
59
+ ) {
55
60
  // TODO add validation
56
- _productService = _instance.getProductService();
61
+ _policyService = getInstance().getPolicyService();
57
62
  _pool = Pool(pool);
58
63
  _distribution = Distribution(distribution);
59
64
  _initialProductFee = productFee;
@@ -73,15 +78,15 @@ contract Product is BaseComponent, IProductComponent {
73
78
  RiskId riskId,
74
79
  uint256 lifetime,
75
80
  bytes memory applicationData,
76
- ReferralId referralId,
77
- NftId bundleNftId
81
+ NftId bundleNftId,
82
+ ReferralId referralId
78
83
  )
79
84
  external
80
85
  view
81
86
  override
82
87
  returns (uint256 premiumAmount)
83
88
  {
84
- (premiumAmount,,,,) = _productService.calculatePremium(
89
+ (premiumAmount,,,,) = _policyService.calculatePremium(
85
90
  riskId,
86
91
  sumInsuredAmount,
87
92
  lifetime,
@@ -115,7 +120,7 @@ contract Product is BaseComponent, IProductComponent {
115
120
  RiskId id,
116
121
  bytes memory data
117
122
  ) internal {
118
- _productService.createRisk(
123
+ getProductService().createRisk(
119
124
  id,
120
125
  data
121
126
  );
@@ -125,7 +130,7 @@ contract Product is BaseComponent, IProductComponent {
125
130
  RiskId id,
126
131
  bytes memory data
127
132
  ) internal {
128
- _productService.updateRisk(
133
+ getProductService().updateRisk(
129
134
  id,
130
135
  data
131
136
  );
@@ -135,14 +140,14 @@ contract Product is BaseComponent, IProductComponent {
135
140
  RiskId id,
136
141
  StateId state
137
142
  ) internal {
138
- _productService.updateRiskState(
143
+ getProductService().updateRiskState(
139
144
  id,
140
145
  state
141
146
  );
142
147
  }
143
148
 
144
149
  function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
145
- return _instance.getInstanceReader().getRiskInfo(id);
150
+ return getInstance().getInstanceReader().getRiskInfo(id);
146
151
  }
147
152
 
148
153
  function _createApplication(
@@ -154,7 +159,7 @@ contract Product is BaseComponent, IProductComponent {
154
159
  NftId bundleNftId,
155
160
  ReferralId referralId
156
161
  ) internal returns (NftId nftId) {
157
- nftId = _productService.createApplication(
162
+ nftId = _policyService.createApplication(
158
163
  applicationOwner,
159
164
  riskId,
160
165
  sumInsuredAmount,
@@ -172,7 +177,7 @@ contract Product is BaseComponent, IProductComponent {
172
177
  )
173
178
  internal
174
179
  {
175
- _productService.underwrite(
180
+ _policyService.underwrite(
176
181
  policyNftId,
177
182
  requirePremiumPayment,
178
183
  activateAt);
@@ -184,7 +189,7 @@ contract Product is BaseComponent, IProductComponent {
184
189
  )
185
190
  internal
186
191
  {
187
- _productService.collectPremium(
192
+ _policyService.collectPremium(
188
193
  policyNftId,
189
194
  activateAt);
190
195
  }
@@ -195,11 +200,19 @@ contract Product is BaseComponent, IProductComponent {
195
200
  )
196
201
  internal
197
202
  {
198
- _productService.activate(
203
+ _policyService.activate(
199
204
  policyNftId,
200
205
  activateAt);
201
206
  }
202
207
 
208
+ function _close(
209
+ NftId policyNftId
210
+ )
211
+ internal
212
+ {
213
+ _policyService.close(policyNftId);
214
+ }
215
+
203
216
  function getPoolNftId() external view override returns (NftId poolNftId) {
204
217
  return getRegistry().getNftId(address(_pool));
205
218
  }
@@ -215,75 +228,39 @@ contract Product is BaseComponent, IProductComponent {
215
228
  )
216
229
  external
217
230
  onlyOwner
231
+ restricted()
218
232
  override
219
233
  {
220
- _productService.setFees(productFee, processingFee);
234
+ getProductService().setFees(productFee, processingFee);
221
235
  }
222
236
 
223
237
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
224
- InstanceReader reader = _instance.getInstanceReader();
225
- return reader.getProductSetupInfo(getNftId());
226
- }
238
+ InstanceReader reader = getInstance().getInstanceReader();
239
+ setupInfo = reader.getProductSetupInfo(getNftId());
227
240
 
228
- // from IRegisterable
241
+ // fallback to initial setup info (wallet is always != address(0))
242
+ if(setupInfo.wallet == address(0)) {
243
+ setupInfo = _getInitialSetupInfo();
244
+ }
245
+ }
229
246
 
230
- function getInitialInfo()
231
- public
232
- view
233
- override (IRegisterable, Registerable)
234
- returns (IRegistry.ObjectInfo memory, bytes memory)
235
- {
236
- // from Registerable
237
- (
238
- IRegistry.ObjectInfo memory productInfo,
239
- bytes memory data
240
- ) = super.getInitialInfo();
241
-
242
- // TODO read pool & distribution fees
243
- // 1) from pool -> the only option -> pool must be registered first?
244
- // 2) from instance -> all fees are set into instance at product registration which is ongoing here
245
- // checks are done in registryProduct() where THIS function is called
246
- //require(getRegistry().getObjectInfo(_poolNftId).objectType == POOL(), "POOL_NOT_REGISTERED");
247
- //require(getRegistry().getObjectInfo(_distributionNftId).objectType == DISTRIBUTION(), "DISTRIBUTION_NOT_REGISTERED");
248
-
249
- // from PoolComponent
250
- (
251
- ,
252
- bytes memory poolData
253
- ) = _pool.getInitialInfo();
254
-
255
- (
256
- ISetup.PoolSetupInfo memory poolSetupInfo
257
- ) = abi.decode(poolData, (ISetup.PoolSetupInfo));
258
-
259
- // from DistributionComponent
260
- (
261
- ,
262
- bytes memory distributionData
263
- ) = _distribution.getInitialInfo();
264
-
265
- (
266
- ISetup.DistributionSetupInfo memory distributionSetupInfo
267
- ) = abi.decode(distributionData, (ISetup.DistributionSetupInfo));
268
-
269
- return (
270
- productInfo,
271
- abi.encode(
272
- ISetup.ProductSetupInfo(
273
- _token,
274
- _tokenHandler,
275
- _distributionNftId,
276
- _poolNftId,
277
- distributionSetupInfo.distributionFee,
278
- _initialProductFee,
279
- _initialProcessingFee,
280
- poolSetupInfo.poolFee,
281
- poolSetupInfo.stakingFee,
282
- poolSetupInfo.performanceFee,
283
- false,
284
- _wallet
285
- )
286
- )
247
+ function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
248
+ ISetup.DistributionSetupInfo memory distributionSetupInfo = _distribution.getSetupInfo();
249
+ ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
250
+
251
+ return ISetup.ProductSetupInfo(
252
+ getToken(),
253
+ _tokenHandler,
254
+ _distributionNftId,
255
+ _poolNftId,
256
+ distributionSetupInfo.distributionFee,
257
+ _initialProductFee,
258
+ _initialProcessingFee,
259
+ poolSetupInfo.poolFee,
260
+ poolSetupInfo.stakingFee,
261
+ poolSetupInfo.performanceFee,
262
+ false,
263
+ getWallet()
287
264
  );
288
265
  }
289
266
  }
@@ -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
  }
@@ -1,31 +1,46 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
4
+ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
5
 
6
+ import {NftId} from "../types/NftId.sol";
7
+ import {StateId} from "../types/StateId.sol";
8
+ import {RiskId} from "../types/RiskId.sol";
9
+
10
+ import {IRegisterable} from "../shared/IRegisterable.sol";
11
+
12
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
6
13
  import {BundleManager} from "./BundleManager.sol";
7
14
  import {InstanceReader} from "./InstanceReader.sol";
8
15
 
9
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
16
+ import {IBundle} from "./module/IBundle.sol";
17
+ import {IBundleService} from "./service/IBundleService.sol";
10
18
  import {IDistributionService} from "./service/IDistributionService.sol";
19
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
20
+ import {IKeyValueStore} from "./base/IKeyValueStore.sol";
21
+ import {IPolicy} from "./module/IPolicy.sol";
22
+ import {IPolicyService} from "./service/IPolicyService.sol";
11
23
  import {IPoolService} from "./service/IPoolService.sol";
12
24
  import {IProductService} from "./service/IProductService.sol";
13
- import {IBundle} from "./module/IBundle.sol";
25
+ import {IPolicyService} from "./service/IPolicyService.sol";
26
+ import {IBundleService} from "./service/IBundleService.sol";
27
+ import {IRisk} from "./module/IRisk.sol";
14
28
  import {ISetup} from "./module/ISetup.sol";
15
29
  import {NftId} from "../types/NftId.sol";
16
- import {StateId} from "../types/StateId.sol";
17
30
  import {RiskId} from "../types/RiskId.sol";
18
- import {IRisk} from "./module/IRisk.sol";
19
- import {IPolicy} from "./module/IPolicy.sol";
20
- import {IKeyValueStore} from "./base/IKeyValueStore.sol";
31
+ import {StateId} from "../types/StateId.sol";
32
+ import {VersionPart} from "../types/Version.sol";
33
+
34
+
21
35
 
22
36
 
23
- interface IInstance is IERC165, IKeyValueStore {
37
+ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
24
38
 
25
- function getComponentOwnerService() external view returns (IComponentOwnerService);
26
39
  function getDistributionService() external view returns (IDistributionService);
27
40
  function getProductService() external view returns (IProductService);
28
41
  function getPoolService() external view returns (IPoolService);
42
+ function getPolicyService() external view returns (IPolicyService);
43
+ function getBundleService() external view returns (IBundleService);
29
44
 
30
45
  function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
31
46
  function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
@@ -51,6 +66,7 @@ interface IInstance is IERC165, IKeyValueStore {
51
66
  function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
52
67
  function updatePolicyState(NftId policyNftId, StateId newState) external;
53
68
 
69
+ function getMajorVersion() external pure returns (VersionPart majorVersion);
54
70
  function getInstanceReader() external view returns (InstanceReader);
55
71
  function getBundleManager() external view returns (BundleManager);
56
72
  }
@@ -8,9 +8,9 @@ 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
- import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
13
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
14
14
  import {Instance} from "./Instance.sol";
15
15
  import {InstanceReader} from "./InstanceReader.sol";
16
16
  import {BundleManager} from "./BundleManager.sol";
@@ -18,17 +18,25 @@ import {BundleManager} from "./BundleManager.sol";
18
18
  interface IInstanceService is IService {
19
19
 
20
20
  error ErrorInstanceServiceRequestUnauhorized(address caller);
21
-
21
+ error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
22
+ error ErrorInstanceServiceNotInstance(NftId nftId);
23
+ error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
24
+ error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
25
+
22
26
  event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
23
27
 
24
28
  function createInstanceClone()
25
29
  external
26
30
  returns (
27
- AccessManagerUpgradeableInitializeable clonedAccessManager,
31
+ InstanceAccessManager clonedAccessManager,
28
32
  Instance clonedInstance,
29
33
  NftId instanceNftId,
30
34
  InstanceReader clonedInstanceReader,
31
35
  BundleManager clonedBundleManager
32
36
  );
37
+
38
+ function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
39
+ function setComponentLocked(bool locked) external;
40
+
33
41
  }
34
42