@etherisc/gif-next 0.0.2-9d3eab3-323 → 0.0.2-9dd1984-016

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 (222) 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} +51 -6
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +51 -104
  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} +51 -6
  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 +51 -132
  13. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  14. package/artifacts/contracts/components/Product.sol/Product.json +56 -120
  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 +2 -2
  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 +90 -13
  41. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +75 -1
  44. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -616
  46. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +221 -114
  48. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +2 -2
  50. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
  52. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +126 -229
  54. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -126
  56. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  58. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  59. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +98 -24
  60. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  62. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  64. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
  68. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +219 -48
  76. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +20 -24
  78. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +131 -38
  80. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +17 -21
  82. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +51 -0
  84. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +107 -0
  87. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +308 -60
  91. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +48 -20
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +131 -38
  95. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -21
  97. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +131 -38
  99. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  100. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +13 -9
  101. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  102. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +72 -1
  104. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  105. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +3 -3
  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 +85 -59
  109. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  110. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +33 -23
  111. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  112. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +17 -17
  113. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  114. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +13 -13
  115. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  116. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +84 -101
  117. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  118. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  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/IService.sol/IService.dbg.json +1 -1
  124. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  125. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  127. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  129. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  131. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  132. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  133. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  134. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  135. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  137. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  138. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  139. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  140. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  141. package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
  142. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  145. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  146. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  147. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  148. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  149. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  150. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  151. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  152. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  153. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  154. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  155. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  160. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  161. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  166. package/contracts/components/Component.sol +177 -0
  167. package/contracts/components/Distribution.sol +5 -14
  168. package/contracts/components/{IBaseComponent.sol → IComponent.sol} +12 -6
  169. package/contracts/components/IProductComponent.sol +2 -2
  170. package/contracts/components/Pool.sol +7 -20
  171. package/contracts/components/Product.sol +21 -18
  172. package/contracts/instance/IInstance.sol +3 -3
  173. package/contracts/instance/IInstanceBase.sol +0 -1
  174. package/contracts/instance/IInstanceService.sol +10 -4
  175. package/contracts/instance/Instance.sol +6 -208
  176. package/contracts/instance/InstanceAccessManager.sol +92 -77
  177. package/contracts/instance/InstanceBase.sol +0 -2
  178. package/contracts/instance/InstanceService.sol +117 -71
  179. package/contracts/instance/InstanceServiceManager.sol +5 -9
  180. package/contracts/instance/base/ComponentService.sol +133 -0
  181. package/contracts/instance/base/IInstanceBase.sol +0 -2
  182. package/contracts/instance/module/IAccess.sol +27 -17
  183. package/contracts/instance/service/BundleService.sol +38 -5
  184. package/contracts/instance/service/BundleServiceManager.sol +5 -9
  185. package/contracts/instance/service/DistributionService.sol +33 -32
  186. package/contracts/instance/service/DistributionServiceManager.sol +6 -10
  187. package/contracts/instance/service/IBundleService.sol +5 -6
  188. package/contracts/instance/service/IPolicyService.sol +7 -0
  189. package/contracts/instance/service/PolicyService.sol +62 -27
  190. package/contracts/instance/service/PoolService.sol +46 -26
  191. package/contracts/instance/service/PoolServiceManager.sol +5 -9
  192. package/contracts/instance/service/ProductService.sol +104 -31
  193. package/contracts/registry/IRegistry.sol +17 -3
  194. package/contracts/registry/IRegistryService.sol +5 -5
  195. package/contracts/registry/Registry.sol +30 -19
  196. package/contracts/registry/RegistryAccessManager.sol +27 -27
  197. package/contracts/registry/RegistryService.sol +22 -32
  198. package/contracts/registry/RegistryServiceManager.sol +4 -2
  199. package/contracts/registry/ReleaseManager.sol +87 -123
  200. package/contracts/registry/TokenRegistry.sol +4 -4
  201. package/contracts/shared/IRegisterable.sol +0 -2
  202. package/contracts/shared/NftOwnable.sol +2 -0
  203. package/contracts/shared/Service.sol +4 -2
  204. package/contracts/types/RoleId.sol +6 -7
  205. package/package.json +1 -1
  206. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  207. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  208. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  209. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  210. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  211. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  212. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
  213. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  214. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  215. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  216. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
  217. package/contracts/components/BaseComponent.sol +0 -132
  218. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  219. package/contracts/instance/base/ComponentServiceBase.sol +0 -72
  220. package/contracts/instance/service/ComponentOwnerService.sol +0 -315
  221. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  222. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -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,
@@ -2,11 +2,12 @@
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
 
9
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
10
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
10
11
  import {IDistributionService} from "./service/IDistributionService.sol";
11
12
  import {IPoolService} from "./service/IPoolService.sol";
12
13
  import {IProductService} from "./service/IProductService.sol";
@@ -22,9 +23,8 @@ import {IPolicy} from "./module/IPolicy.sol";
22
23
  import {IKeyValueStore} from "./base/IKeyValueStore.sol";
23
24
 
24
25
 
25
- interface IInstance is IERC165, IKeyValueStore {
26
+ interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
26
27
 
27
- function getComponentOwnerService() external view returns (IComponentOwnerService);
28
28
  function getDistributionService() external view returns (IDistributionService);
29
29
  function getProductService() external view returns (IProductService);
30
30
  function getPoolService() external view returns (IPoolService);
@@ -6,7 +6,6 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
6
  import {BundleManager} from "./BundleManager.sol";
7
7
  import {InstanceReader} from "./InstanceReader.sol";
8
8
 
9
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
10
9
  import {IDistributionService} from "./service/IDistributionService.sol";
11
10
  import {IPoolService} from "./service/IPoolService.sol";
12
11
  import {IProductService} from "./service/IProductService.sol";
@@ -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,23 @@ 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 ErrorInstanceServiceComponentNotRegistered(address componentAddress);
23
+
22
24
  event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
23
25
 
24
26
  function createInstanceClone()
25
27
  external
26
28
  returns (
27
- AccessManagerUpgradeableInitializeable clonedAccessManager,
29
+ InstanceAccessManager clonedAccessManager,
28
30
  Instance clonedInstance,
29
31
  NftId instanceNftId,
30
32
  InstanceReader clonedInstanceReader,
31
33
  BundleManager clonedBundleManager
32
34
  );
35
+
36
+ function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
37
+ function setTargetLocked(string memory targetName, bool locked) external;
38
+
33
39
  }
34
40
 
@@ -5,7 +5,6 @@ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet
5
5
  import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
6
6
  import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
7
7
  import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
8
- import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
9
8
 
10
9
  import {IAccess} from "./module/IAccess.sol";
11
10
  import {IBundle} from "./module/IBundle.sol";
@@ -16,17 +15,13 @@ import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
16
15
  import {KeyValueStore} from "./base/KeyValueStore.sol";
17
16
  import {IInstance} from "./IInstance.sol";
18
17
  import {InstanceReader} from "./InstanceReader.sol";
18
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
19
19
  import {BundleManager} from "./BundleManager.sol";
20
20
  import {NftId} from "../types/NftId.sol";
21
21
  import {NumberId} from "../types/NumberId.sol";
22
22
  import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT} from "../types/ObjectType.sol";
23
- import {RiskId, RiskIdLib} from "../types/RiskId.sol";
24
- import {RoleId, RoleIdLib} from "../types/RoleId.sol";
25
- import {StateId, ACTIVE} from "../types/StateId.sol";
26
- import {ERC165} from "../shared/ERC165.sol";
27
- import {Registerable} from "../shared/Registerable.sol";
28
- import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
29
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
23
+ import {RiskId} from "../types/RiskId.sol";
24
+ import {StateId} from "../types/StateId.sol";
30
25
  import {IDistributionService} from "./service/IDistributionService.sol";
31
26
  import {IPoolService} from "./service/IPoolService.sol";
32
27
  import {IProductService} from "./service/IProductService.sol";
@@ -50,13 +45,7 @@ contract Instance is
50
45
 
51
46
  bool private _initialized;
52
47
 
53
- mapping(ShortString name => RoleId roleId) internal _role;
54
- mapping(RoleId roleId => EnumerableSet.AddressSet roleMembers) internal _roleMembers;
55
- RoleId [] internal _roles;
56
-
57
- mapping(ShortString name => address target) internal _target;
58
-
59
- AccessManagerUpgradeable internal _accessManager;
48
+ InstanceAccessManager internal _accessManager;
60
49
  InstanceReader internal _instanceReader;
61
50
  BundleManager internal _bundleManager;
62
51
 
@@ -68,136 +57,14 @@ contract Instance is
68
57
 
69
58
  __AccessManaged_init(accessManagerAddress);
70
59
 
71
- _accessManager = AccessManagerUpgradeable(accessManagerAddress);
72
- _createRole(RoleIdLib.toRoleId(ADMIN_ROLE), "AdminRole", false, false);
73
- _createRole(RoleIdLib.toRoleId(PUBLIC_ROLE), "PublicRole", false, false);
74
-
60
+ _accessManager = InstanceAccessManager(accessManagerAddress);
61
+
75
62
  _initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
76
63
 
77
64
  _registerInterface(type(IInstance).interfaceId);
78
65
  _initialized = true;
79
66
  }
80
67
 
81
- //--- Role ------------------------------------------------------//
82
- function createStandardRole(RoleId roleId, string memory name) external restricted() {
83
- _createRole(roleId, name, false, true);
84
- }
85
-
86
- function createCustomRole(RoleId roleId, string memory name) external restricted() {
87
- _createRole(roleId, name, true, true);
88
- }
89
-
90
- function updateRole(RoleId roleId, string memory name, StateId newState) external restricted() {
91
- (bool isCustom,) = _validateRoleParameters(roleId, name, false);
92
- IAccess.RoleInfo memory role = _toRole(roleId, name, isCustom);
93
- update(toRoleKey32(roleId), abi.encode(role), newState);
94
- }
95
-
96
- function updateRoleState(RoleId roleId, StateId newState) external restricted() {
97
- updateState(toRoleKey32(roleId), newState);
98
- }
99
-
100
- function grantRole(RoleId roleId, address member) external restricted() returns (bool granted) {
101
- Key32 roleKey = toRoleKey32(roleId);
102
-
103
- if (!exists(roleKey)) {
104
- revert IAccess.ErrorGrantNonexstentRole(roleId);
105
- }
106
-
107
- if (getState(roleKey) != ACTIVE()) {
108
- revert IAccess.ErrorRoleIdNotActive(roleId);
109
- }
110
-
111
- if (!EnumerableSet.contains(_roleMembers[roleId], member)) {
112
- _accessManager.grantRole(roleId.toInt(), member, EXECUTION_DELAY);
113
- EnumerableSet.add(_roleMembers[roleId], member);
114
- return true;
115
- }
116
-
117
- return false;
118
- }
119
-
120
- function revokeRole(RoleId roleId, address member) external restricted() returns (bool revoked) {
121
- Key32 roleKey = toRoleKey32(roleId);
122
-
123
- if (!exists(roleKey)) {
124
- revert IAccess.ErrorRevokeNonexstentRole(roleId);
125
- }
126
-
127
- if (EnumerableSet.contains(_roleMembers[roleId], member)) {
128
- _accessManager.revokeRole(roleId.toInt(), member);
129
- EnumerableSet.remove(_roleMembers[roleId], member);
130
- return true;
131
- }
132
-
133
- return false;
134
- }
135
-
136
- /// @dev not restricted function by intention
137
- /// the restriction to role members is already enforced by the call to the access manger
138
- function renounceRole(RoleId roleId) external returns (bool revoked) {
139
- address member = msg.sender;
140
- Key32 roleKey = toRoleKey32(roleId);
141
-
142
- if (!exists(roleKey)) {
143
- revert IAccess.ErrorRenounceNonexstentRole(roleId);
144
- }
145
-
146
- if (EnumerableSet.contains(_roleMembers[roleId], member)) {
147
- _accessManager.renounceRole(roleId.toInt(), member);
148
- EnumerableSet.remove(_roleMembers[roleId], member);
149
- return true;
150
- }
151
-
152
- return false;
153
- }
154
-
155
- function roles() external view returns (uint256 numberOfRoles) {
156
- return _roles.length;
157
- }
158
-
159
- function getRoleId(uint256 idx) external view returns (RoleId roleId) {
160
- return _roles[idx];
161
- }
162
-
163
- function getRole(RoleId roleId) external view returns (IAccess.RoleInfo memory role) {
164
- return abi.decode(getData(roleId.toKey32()), (IAccess.RoleInfo));
165
- }
166
-
167
- function roleMembers(RoleId roleId) external view returns (uint256 numberOfMembers) {
168
- return EnumerableSet.length(_roleMembers[roleId]);
169
- }
170
-
171
- function getRoleMember(RoleId roleId, uint256 idx) external view returns (address roleMember) {
172
- return EnumerableSet.at(_roleMembers[roleId], idx);
173
- }
174
-
175
- function _createRole(RoleId roleId, string memory name, bool isCustom, bool validateParameters) internal {
176
- if (validateParameters) {
177
- _validateRoleParameters(roleId, name, isCustom);
178
- }
179
-
180
- IAccess.RoleInfo memory role = _toRole(roleId, name, isCustom);
181
- _role[role.name] = roleId;
182
- _roles.push(roleId);
183
-
184
- create(toRoleKey32(roleId), abi.encode(role));
185
- }
186
-
187
- //--- Target ------------------------------------------------------//
188
- function createTarget(address target, IAccess.TargetInfo memory targetInfo) external restricted() {
189
- _validateTargetParameters(target, targetInfo);
190
- create(toTargetKey32(target), abi.encode(targetInfo));
191
- }
192
-
193
- function setTargetClosed(address target, bool closed) external restricted() {
194
- if (!exists(toTargetKey32(target))) {
195
- revert IAccess.ErrorTargetDoesNotExist(target);
196
- }
197
-
198
- _accessManager.setTargetClosed(target, closed);
199
- }
200
-
201
68
  //--- ProductSetup ------------------------------------------------------//
202
69
  function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external restricted() {
203
70
  create(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup));
@@ -342,71 +209,6 @@ contract Instance is
342
209
  }
343
210
 
344
211
  //--- internal view/pure functions --------------------------------------//
345
- function _toRole(RoleId roleId, string memory name, bool isCustom)
346
- internal
347
- pure
348
- returns (IAccess.RoleInfo memory role)
349
- {
350
- return IAccess.RoleInfo(
351
- ShortStrings.toShortString(name),
352
- isCustom);
353
- }
354
-
355
- function _validateRoleParameters(
356
- RoleId roleId,
357
- string memory name,
358
- bool isCustom
359
- )
360
- internal
361
- view
362
- returns (
363
- bool roleExists,
364
- bool roleIsCustom
365
- )
366
- {
367
- Key32 roleKey = toRoleKey32(roleId);
368
- roleExists = exists(roleKey);
369
- if (roleExists) {
370
- roleIsCustom = abi.decode(getData(roleKey), (IAccess.RoleInfo)).isCustom;
371
- } else {
372
- roleIsCustom = isCustom;
373
- }
374
-
375
- // check role id
376
- uint64 roleIdInt = RoleId.unwrap(roleId);
377
- if(roleIdInt == ADMIN_ROLE || roleIdInt == PUBLIC_ROLE) {
378
- revert IAccess.ErrorRoleIdInvalid(roleId);
379
- }
380
-
381
- if (roleIsCustom && roleIdInt < CUSTOM_ROLE_ID_MIN) {
382
- revert IAccess.ErrorRoleIdTooSmall(roleId);
383
- } else if (roleIsCustom && roleIdInt >= CUSTOM_ROLE_ID_MIN) {
384
- revert IAccess.ErrorRoleIdTooBig(roleId);
385
- }
386
-
387
- // role name checks
388
- ShortString nameShort = ShortStrings.toShortString(name);
389
- if (ShortStrings.byteLength(nameShort) == 0) {
390
- revert IAccess.ErrorRoleNameEmpty(roleId);
391
- }
392
-
393
- if (_role[nameShort] != RoleIdLib.zero() && _role[nameShort] != roleId) {
394
- revert IAccess.ErrorRoleNameNotUnique(_role[nameShort], nameShort);
395
- }
396
- }
397
-
398
- function _validateTargetParameters(address target, IAccess.TargetInfo memory targetInfo) internal view {
399
-
400
- }
401
-
402
- function toRoleKey32(RoleId roleId) public pure returns (Key32) {
403
- return roleId.toKey32();
404
- }
405
-
406
- function toTargetKey32(address target) public pure returns (Key32) {
407
- return Key32Lib.toKey32(TARGET(), KeyId.wrap(bytes20(target)));
408
- }
409
-
410
212
  function _toNftKey32(NftId nftId, ObjectType objectType) internal pure returns (Key32) {
411
213
  return nftId.toKey32(objectType);
412
214
  }
@@ -419,10 +221,6 @@ contract Instance is
419
221
  return policyNftId.toKey32(POLICY());
420
222
  }
421
223
 
422
- function getComponentOwnerService() external view returns (IComponentOwnerService) {
423
- return ComponentOwnerService(_registry.getServiceAddress(COMPONENT(), VersionPart.wrap(3)));
424
- }
425
-
426
224
  function getDistributionService() external view returns (IDistributionService) {
427
225
  return IDistributionService(_registry.getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
428
226
  }