@etherisc/gif-next 0.0.2-a1053ad-624 → 0.0.2-a25e4b8-781

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 (267) hide show
  1. package/README.md +67 -1
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  3. package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → components/Component.sol/Component.json} +288 -166
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +260 -89
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  7. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +129 -30
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +28 -2
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +290 -116
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +271 -144
  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/Dummy.sol/LifeCycleModule.json +2 -2
  32. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  38. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  39. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  40. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  41. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
  42. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  43. package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
  44. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1649 -28
  46. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  47. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +162 -13
  48. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  49. package/artifacts/contracts/instance/Instance.sol/Instance.json +176 -678
  50. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +231 -114
  52. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +182 -58
  54. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +315 -62
  56. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  57. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +57 -21
  58. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  59. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
  60. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  61. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +125 -11
  62. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  64. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  66. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  67. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  68. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  70. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
  72. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  74. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  75. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  76. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  77. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  79. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1094 -0
  80. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  81. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +436 -0
  82. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  83. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +764 -0
  84. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +424 -0
  86. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  87. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +720 -0
  88. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
  90. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  91. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +771 -0
  92. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -77
  94. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -240
  96. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  97. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1219 -0
  98. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  99. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +492 -0
  100. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  101. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +798 -0
  102. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  103. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +424 -0
  104. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  105. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +848 -0
  106. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  107. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +424 -0
  108. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  109. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  110. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  111. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +339 -59
  112. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  113. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +195 -86
  114. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  115. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  116. package/artifacts/contracts/registry/Registry.sol/Registry.json +301 -188
  117. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  118. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  119. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  120. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +38 -112
  121. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  122. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -91
  123. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  124. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
  125. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  126. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +381 -0
  127. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  129. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  130. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  132. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  133. package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +14 -14
  134. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  135. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  137. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  138. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  139. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  140. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +4 -4
  141. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  142. package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → shared/Service.sol/Service.json} +15 -15
  143. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  144. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  145. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  146. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  147. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  149. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
  150. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  152. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  153. package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
  154. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  155. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  157. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  159. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  160. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  161. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  166. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  168. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  169. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  175. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  177. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  179. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  182. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
  184. package/contracts/components/Component.sol +179 -0
  185. package/contracts/components/Distribution.sol +20 -32
  186. package/contracts/components/IComponent.sol +37 -0
  187. package/contracts/components/IDistributionComponent.sol +1 -0
  188. package/contracts/components/IPoolComponent.sol +5 -1
  189. package/contracts/components/IProductComponent.sol +2 -2
  190. package/contracts/components/Pool.sol +49 -50
  191. package/contracts/components/Product.sol +60 -60
  192. package/contracts/instance/BundleManager.sol +125 -0
  193. package/contracts/instance/Cloneable.sol +46 -0
  194. package/contracts/instance/IInstance.sol +50 -12
  195. package/contracts/instance/IInstanceService.sol +30 -7
  196. package/contracts/instance/Instance.sol +66 -249
  197. package/contracts/instance/InstanceAccessManager.sol +88 -78
  198. package/contracts/instance/InstanceReader.sol +34 -21
  199. package/contracts/instance/InstanceService.sol +313 -53
  200. package/contracts/instance/InstanceServiceManager.sol +10 -12
  201. package/contracts/instance/ObjectManager.sol +84 -0
  202. package/contracts/instance/base/ComponentService.sol +133 -0
  203. package/contracts/instance/base/IInstanceBase.sol +0 -2
  204. package/contracts/instance/module/IAccess.sol +27 -17
  205. package/contracts/instance/module/IBundle.sol +1 -0
  206. package/contracts/instance/module/ISetup.sol +3 -0
  207. package/contracts/instance/service/BundleService.sol +293 -0
  208. package/contracts/instance/service/BundleServiceManager.sol +51 -0
  209. package/contracts/instance/service/DistributionService.sol +115 -0
  210. package/contracts/instance/service/DistributionServiceManager.sol +51 -0
  211. package/contracts/instance/service/IBundleService.sol +44 -0
  212. package/contracts/instance/service/IDistributionService.sol +1 -1
  213. package/contracts/instance/service/IPolicyService.sol +94 -0
  214. package/contracts/instance/service/IPoolService.sol +7 -24
  215. package/contracts/instance/service/IProductService.sol +7 -74
  216. package/contracts/instance/service/PolicyService.sol +538 -0
  217. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  218. package/contracts/instance/service/PoolService.sol +142 -0
  219. package/contracts/instance/service/PoolServiceManager.sol +51 -0
  220. package/contracts/instance/service/ProductService.sol +241 -0
  221. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  222. package/contracts/registry/ChainNft.sol +1 -1
  223. package/contracts/registry/IRegistry.sol +47 -6
  224. package/contracts/registry/IRegistryService.sol +52 -30
  225. package/contracts/registry/Registry.sol +243 -214
  226. package/contracts/registry/RegistryAccessManager.sol +216 -0
  227. package/contracts/registry/RegistryService.sol +87 -214
  228. package/contracts/registry/RegistryServiceManager.sol +20 -22
  229. package/contracts/registry/ReleaseManager.sol +352 -0
  230. package/contracts/registry/TokenRegistry.sol +112 -0
  231. package/contracts/shared/ERC165.sol +6 -2
  232. package/contracts/shared/IRegisterable.sol +0 -2
  233. package/contracts/shared/IService.sol +16 -0
  234. package/contracts/shared/NftOwnable.sol +4 -4
  235. package/contracts/shared/ProxyManager.sol +1 -1
  236. package/contracts/shared/Registerable.sol +1 -0
  237. package/contracts/shared/Service.sol +60 -0
  238. package/contracts/test/TestService.sol +6 -7
  239. package/contracts/types/NftIdSet.sol +26 -24
  240. package/contracts/types/RoleId.sol +14 -6
  241. package/contracts/types/StateId.sol +4 -0
  242. package/contracts/types/Version.sol +4 -1
  243. package/package.json +1 -1
  244. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  245. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  246. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -267
  247. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
  248. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
  249. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
  250. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  251. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  252. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  253. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
  254. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
  255. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  256. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  257. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  258. package/contracts/components/BaseComponent.sol +0 -86
  259. package/contracts/components/IBaseComponent.sol +0 -24
  260. package/contracts/instance/AccessManagedSimple.sol +0 -114
  261. package/contracts/instance/AccessManagerSimple.sol +0 -682
  262. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  263. package/contracts/instance/base/ComponentServiceBase.sol +0 -49
  264. package/contracts/instance/base/IService.sol +0 -15
  265. package/contracts/instance/base/ServiceBase.sol +0 -44
  266. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  267. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
@@ -4,17 +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";
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
18
  import {IRegistry} from "../registry/IRegistry.sol";
20
19
  import {IRegisterable} from "../shared/IRegisterable.sol";
@@ -24,22 +23,22 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
24
23
  import {InstanceReader} from "../instance/InstanceReader.sol";
25
24
  import {ISetup} from "../instance/module/ISetup.sol";
26
25
  import {Pool} from "../components/Pool.sol";
26
+ import {Distribution} from "../components/Distribution.sol";
27
27
 
28
- import {zeroNftId} from "../types/NftId.sol";
29
-
30
- contract Product is BaseComponent, IProductComponent {
28
+ abstract contract Product is Component, IProductComponent {
31
29
  using NftIdLib for NftId;
32
30
 
33
- IProductService internal _productService;
31
+ IPolicyService internal _policyService;
34
32
  Pool internal _pool;
35
- address internal _distribution;
33
+ Distribution internal _distribution;
36
34
  Fee internal _initialProductFee;
37
35
  Fee internal _initialProcessingFee;
36
+ TokenHandler internal _tokenHandler;
38
37
 
39
38
  NftId internal _poolNftId;
40
39
  NftId internal _distributionNftId;
41
40
 
42
- constructor(
41
+ function __initialize(
43
42
  address registry,
44
43
  NftId instanceNftid,
45
44
  address token,
@@ -49,17 +48,20 @@ contract Product is BaseComponent, IProductComponent {
49
48
  Fee memory productFee,
50
49
  Fee memory processingFee,
51
50
  address initialOwner
52
- ) BaseComponent(registry, instanceNftid, zeroNftId(), token, PRODUCT(), isInterceptor, initialOwner) {
51
+ ) internal {
52
+ __initialize_component(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner);
53
+
53
54
  // TODO add validation
54
- // TODO: reactivate when services are available again
55
- // _productService = _instance.getProductService();
55
+ _policyService = _instance.getPolicyService();
56
56
  _pool = Pool(pool);
57
- _distribution = distribution;
57
+ _distribution = Distribution(distribution);
58
58
  _initialProductFee = productFee;
59
59
  _initialProcessingFee = processingFee;
60
60
 
61
+ _tokenHandler = new TokenHandler(token);
62
+
61
63
  _poolNftId = getRegistry().getNftId(address(_pool));
62
- _distributionNftId = getRegistry().getNftId(_distribution);
64
+ _distributionNftId = getRegistry().getNftId(address(_distribution));
63
65
 
64
66
  _registerInterface(type(IProductComponent).interfaceId);
65
67
  }
@@ -70,15 +72,15 @@ contract Product is BaseComponent, IProductComponent {
70
72
  RiskId riskId,
71
73
  uint256 lifetime,
72
74
  bytes memory applicationData,
73
- ReferralId referralId,
74
- NftId bundleNftId
75
+ NftId bundleNftId,
76
+ ReferralId referralId
75
77
  )
76
78
  external
77
79
  view
78
80
  override
79
81
  returns (uint256 premiumAmount)
80
82
  {
81
- (premiumAmount,,,,) = _productService.calculatePremium(
83
+ (premiumAmount,,,,) = _policyService.calculatePremium(
82
84
  riskId,
83
85
  sumInsuredAmount,
84
86
  lifetime,
@@ -118,13 +120,13 @@ contract Product is BaseComponent, IProductComponent {
118
120
  );
119
121
  }
120
122
 
121
- function _setRiskInfo(
123
+ function _updateRisk(
122
124
  RiskId id,
123
- IRisk.RiskInfo memory info
125
+ bytes memory data
124
126
  ) internal {
125
- _productService.setRiskInfo(
127
+ _productService.updateRisk(
126
128
  id,
127
- info
129
+ data
128
130
  );
129
131
  }
130
132
 
@@ -151,7 +153,7 @@ contract Product is BaseComponent, IProductComponent {
151
153
  NftId bundleNftId,
152
154
  ReferralId referralId
153
155
  ) internal returns (NftId nftId) {
154
- nftId = _productService.createApplication(
156
+ nftId = _policyService.createApplication(
155
157
  applicationOwner,
156
158
  riskId,
157
159
  sumInsuredAmount,
@@ -169,7 +171,7 @@ contract Product is BaseComponent, IProductComponent {
169
171
  )
170
172
  internal
171
173
  {
172
- _productService.underwrite(
174
+ _policyService.underwrite(
173
175
  policyNftId,
174
176
  requirePremiumPayment,
175
177
  activateAt);
@@ -181,7 +183,7 @@ contract Product is BaseComponent, IProductComponent {
181
183
  )
182
184
  internal
183
185
  {
184
- _productService.collectPremium(
186
+ _policyService.collectPremium(
185
187
  policyNftId,
186
188
  activateAt);
187
189
  }
@@ -192,17 +194,25 @@ contract Product is BaseComponent, IProductComponent {
192
194
  )
193
195
  internal
194
196
  {
195
- _productService.activate(
197
+ _policyService.activate(
196
198
  policyNftId,
197
199
  activateAt);
198
200
  }
199
201
 
202
+ function _close(
203
+ NftId policyNftId
204
+ )
205
+ internal
206
+ {
207
+ _policyService.close(policyNftId);
208
+ }
209
+
200
210
  function getPoolNftId() external view override returns (NftId poolNftId) {
201
211
  return getRegistry().getNftId(address(_pool));
202
212
  }
203
213
 
204
214
  function getDistributionNftId() external view override returns (NftId distributionNftId) {
205
- return getRegistry().getNftId(_distribution);
215
+ return getRegistry().getNftId(address(_distribution));
206
216
  }
207
217
 
208
218
  // from product component
@@ -218,28 +228,12 @@ contract Product is BaseComponent, IProductComponent {
218
228
  }
219
229
 
220
230
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
221
- if (getNftId().eq(zeroNftId())) {
222
- return ISetup.ProductSetupInfo(
223
- _token,
224
- TokenHandler(address(0)),
225
- _distributionNftId,
226
- _poolNftId,
227
- FeeLib.zeroFee(), //_instance.getDistributionFee(_distributionNftId)
228
- _initialProductFee,
229
- _initialProcessingFee,
230
- FeeLib.zeroFee(), //_instance.getPoolFee(_poolNftId)
231
- FeeLib.zeroFee(), //_instance.getStakingFee(_poolNftId)
232
- FeeLib.zeroFee() //_instance.getPerformanceFee(_poolNftId)
233
- );
234
- }
235
-
236
231
  InstanceReader reader = _instance.getInstanceReader();
237
232
  return reader.getProductSetupInfo(getNftId());
238
233
  }
239
234
 
240
235
  // from IRegisterable
241
236
 
242
- // TODO used only once, occupies space
243
237
  function getInitialInfo()
244
238
  public
245
239
  view
@@ -251,7 +245,7 @@ contract Product is BaseComponent, IProductComponent {
251
245
  IRegistry.ObjectInfo memory productInfo,
252
246
  bytes memory data
253
247
  ) = super.getInitialInfo();
254
-
248
+
255
249
  // TODO read pool & distribution fees
256
250
  // 1) from pool -> the only option -> pool must be registered first?
257
251
  // 2) from instance -> all fees are set into instance at product registration which is ongoing here
@@ -261,35 +255,41 @@ contract Product is BaseComponent, IProductComponent {
261
255
 
262
256
  // from PoolComponent
263
257
  (
264
- IRegistry.ObjectInfo memory poolInfo,
258
+ ,
265
259
  bytes memory poolData
266
260
  ) = _pool.getInitialInfo();
261
+
262
+ (
263
+ , ISetup.PoolSetupInfo memory poolSetupInfo
264
+ ) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
267
265
 
266
+ // from DistributionComponent
268
267
  (
269
- /*IPool.PoolInfo memory info*/,
270
- /*address wallet*/,
271
- /*IERC20Metadata token*/,
272
- Fee memory initialPoolFee,
273
- Fee memory initialStakingFee,
274
- Fee memory initialPerformanceFee
275
- ) = abi.decode(poolData, (ISetup.PoolSetupInfo, address, IERC20Metadata, Fee, Fee, Fee));
268
+ ,
269
+ bytes memory distributionData
270
+ ) = _distribution.getInitialInfo();
276
271
 
277
- // TODO from DistributionComponent
272
+ (
273
+ , ISetup.DistributionSetupInfo memory distributionSetupInfo
274
+ ) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
278
275
 
279
276
  return (
280
277
  productInfo,
281
278
  abi.encode(
279
+ getName(),
282
280
  ISetup.ProductSetupInfo(
283
281
  _token,
284
- TokenHandler(address(0)),
282
+ _tokenHandler,
285
283
  _distributionNftId,
286
284
  _poolNftId,
287
- FeeLib.zeroFee(), //_instance.getDistributionFee(_distributionNftId)
285
+ distributionSetupInfo.distributionFee,
288
286
  _initialProductFee,
289
287
  _initialProcessingFee,
290
- initialPoolFee,
291
- initialStakingFee,
292
- initialPerformanceFee
288
+ poolSetupInfo.poolFee,
289
+ poolSetupInfo.stakingFee,
290
+ poolSetupInfo.performanceFee,
291
+ false,
292
+ _wallet
293
293
  )
294
294
  )
295
295
  );
@@ -0,0 +1,125 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IInstance} from "./IInstance.sol";
5
+ import {INSTANCE} from "../types/ObjectType.sol";
6
+ import {InstanceReader} from "./InstanceReader.sol";
7
+ import {IPolicy} from "../instance/module/IPolicy.sol";
8
+ import {IRegistry} from "../registry/IRegistry.sol";
9
+ import {LibNftIdSet} from "../types/NftIdSet.sol";
10
+ import {NftId} from "../types/NftId.sol";
11
+ import {TimestampLib} from "../types/Timestamp.sol";
12
+
13
+ import {ObjectManager} from "./ObjectManager.sol";
14
+
15
+ contract BundleManager is
16
+ ObjectManager
17
+ {
18
+
19
+ event LogBundleManagerPolicyLinked(NftId bundleNftId, NftId policyNftId);
20
+ event LogBundleManagerPolicyUnlinked(NftId bundleNftId, NftId policyNftId);
21
+
22
+ event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
23
+ event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
24
+ event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
25
+
26
+ error ErrorBundleManagerErrorPolicyAlreadyActivated(NftId policyNftId);
27
+ error ErrorBundleManagerErrorBundleLocked(NftId bundleNftId, NftId policyNftId);
28
+ error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
29
+ error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
30
+ error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
31
+ error ErrorBundleManagerBundleNotRegistered(NftId bundleNftId);
32
+
33
+ mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
34
+
35
+ /// @dev links a policy with its bundle
36
+ // to link a policy it MUST NOT yet have been activated
37
+ // the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
38
+ function linkPolicy(NftId policyNftId) external restricted() {
39
+ NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
40
+ // decision will likely depend on the decision what to check here and what in the service
41
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
42
+
43
+ // ensure bundle is unlocked (in active set) and registered with this instance
44
+ if (!_isActive(poolNftId, bundleNftId)) {
45
+ revert ErrorBundleManagerErrorBundleLocked(bundleNftId, policyNftId);
46
+ }
47
+
48
+ LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
49
+ emit LogBundleManagerPolicyLinked(bundleNftId, policyNftId);
50
+ }
51
+
52
+
53
+ /// @dev unlinks a policy from its bundle
54
+ // to unlink a policy it must closable, ie. meet one of the following criterias
55
+ // - the policy MUST be past its expiry period and it MUST NOT have any open claims
56
+ // - the policy's payoutAmount MUST be equal to its sumInsuredAmount and MUST NOT have any open claims
57
+ function unlinkPolicy(NftId policyNftId) external restricted() {
58
+ IPolicy.PolicyInfo memory policyInfo = _instance.getInstanceReader().getPolicyInfo(policyNftId);
59
+
60
+ NftId bundleNftId = policyInfo.bundleNftId;
61
+ // decision will likely depend on the decision what to check here and what in the service
62
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
63
+
64
+ // ensure bundle is registered with this instance
65
+ if (!_contains(poolNftId, bundleNftId)) {
66
+ revert ErrorBundleManagerBundleUnknown(bundleNftId);
67
+ }
68
+
69
+ LibNftIdSet.remove(_activePolicies[bundleNftId], policyNftId);
70
+ emit LogBundleManagerPolicyUnlinked(policyInfo.bundleNftId, policyNftId);
71
+ }
72
+
73
+
74
+ /// @dev add a new bundle to a riskpool registerd with this instance
75
+ // the corresponding pool is fetched via instance reader
76
+ function add(NftId bundleNftId) external restricted() {
77
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
78
+
79
+ // ensure pool is registered with instance
80
+ if(poolNftId.eqz()) {
81
+ revert ErrorBundleManagerBundleNotRegistered(bundleNftId);
82
+ }
83
+
84
+ _add(poolNftId, bundleNftId);
85
+ emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
86
+ }
87
+
88
+ /// @dev unlocked (active) bundles are available to underwrite new policies
89
+ function unlock(NftId bundleNftId) external restricted() {
90
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
91
+ _activate(poolNftId, bundleNftId);
92
+ emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
93
+ }
94
+
95
+ /// @dev locked (deactivated) bundles may not underwrite any new policies
96
+ function lock(NftId bundleNftId) external restricted() {
97
+ NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
98
+ _deactivate(poolNftId, bundleNftId);
99
+ emit LogBundleManagerBundleLocked(poolNftId, bundleNftId);
100
+ }
101
+
102
+ function bundles(NftId poolNftId) external view returns(uint256) {
103
+ return _objects(poolNftId);
104
+ }
105
+
106
+ function getBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
107
+ return _getObject(poolNftId, idx);
108
+ }
109
+
110
+ function activeBundles(NftId poolNftId) external view returns(uint256) {
111
+ return _activeObjs(poolNftId);
112
+ }
113
+
114
+ function getActiveBundleNftId(NftId poolNftId, uint256 idx) external view returns(NftId bundleNftId) {
115
+ return _getActiveObject(poolNftId, idx);
116
+ }
117
+
118
+ function activePolicies(NftId bundleNftId) external view returns(uint256) {
119
+ return LibNftIdSet.size(_activePolicies[bundleNftId]);
120
+ }
121
+
122
+ function getActivePolicy(NftId bundleNftId, uint256 idx) external view returns(NftId policyNftId) {
123
+ return LibNftIdSet.getElementAt(_activePolicies[bundleNftId], idx);
124
+ }
125
+ }
@@ -0,0 +1,46 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
+
7
+ import {IRegistry} from "../registry/IRegistry.sol";
8
+
9
+ abstract contract Cloneable is
10
+ AccessManagedUpgradeable
11
+ {
12
+ event CloneableInitialized(address authority, address registry);
13
+
14
+ error CloneableRegistryInvalid(address registry);
15
+
16
+ IRegistry internal _registry;
17
+
18
+ constructor() {
19
+ _registry = IRegistry(address(0));
20
+ }
21
+
22
+ /// @dev call to initialize MUST be made in the same transaction as cloning of the contract
23
+ function initialize(
24
+ address authority,
25
+ address registry
26
+ )
27
+ public
28
+ initializer
29
+ {
30
+ // check/handle access managed
31
+ __AccessManaged_init(authority);
32
+
33
+ // check/handle registry
34
+ if (registry.code.length == 0) {
35
+ revert CloneableRegistryInvalid(registry);
36
+ }
37
+
38
+ _registry = IRegistry(registry);
39
+
40
+ emit CloneableInitialized(authority, registry);
41
+ }
42
+
43
+ function getRegistry() external view returns (IRegistry) {
44
+ return _registry;
45
+ }
46
+ }
@@ -1,28 +1,66 @@
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";
13
+ import {BundleManager} from "./BundleManager.sol";
6
14
  import {InstanceReader} from "./InstanceReader.sol";
7
15
 
8
- import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
16
+ import {IKeyValueStore} from "./base/IKeyValueStore.sol";
17
+
18
+ import {IBundle} from "./module/IBundle.sol";
19
+ import {ISetup} from "./module/ISetup.sol";
20
+ import {IRisk} from "./module/IRisk.sol";
21
+ import {IPolicy} from "./module/IPolicy.sol";
22
+
9
23
  import {IDistributionService} from "./service/IDistributionService.sol";
10
24
  import {IPoolService} from "./service/IPoolService.sol";
11
25
  import {IProductService} from "./service/IProductService.sol";
12
- import {ISetup} from "./module/ISetup.sol";
13
- import {NftId} from "../types/NftId.sol";
26
+ import {IPolicyService} from "./service/IPolicyService.sol";
27
+ import {IBundleService} from "./service/IBundleService.sol";
14
28
 
15
- interface IInstance is IERC165 {
16
29
 
17
- function getComponentOwnerService() external view returns (IComponentOwnerService);
18
- // TODO: renable these when we have the services
19
- // function getDistributionService() external view returns (IDistributionService);
20
- // function getProductService() external view returns (IProductService);
21
- // function getPoolService() external view returns (IPoolService);
22
30
 
23
- function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
31
+
32
+ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
33
+
34
+ function getDistributionService() external view returns (IDistributionService);
35
+ function getProductService() external view returns (IProductService);
36
+ function getPoolService() external view returns (IPoolService);
37
+ function getPolicyService() external view returns (IPolicyService);
38
+ function getBundleService() external view returns (IBundleService);
39
+
24
40
  function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external;
25
- function createPoolSetup(NftId distributionNftId, ISetup.PoolSetupInfo memory setup) external;
41
+ function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
42
+ function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
43
+
44
+ function createPoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup) external;
45
+ function updatePoolSetup(NftId poolNftId, ISetup.PoolSetupInfo memory setup, StateId newState) external;
46
+ function updatePoolSetupState(NftId poolNftId, StateId newState) external;
47
+
48
+ function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
49
+ function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external;
50
+ function updateBundleState(NftId bundleNftId, StateId newState) external;
51
+
52
+ function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external;
53
+ function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external;
54
+ function updateProductSetupState(NftId productNftId, StateId newState) external;
55
+
56
+ function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external;
57
+ function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
58
+ function updateRiskState(RiskId riskId, StateId newState) external;
59
+
60
+ function createPolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy) external;
61
+ function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
62
+ function updatePolicyState(NftId policyNftId, StateId newState) external;
26
63
 
27
64
  function getInstanceReader() external view returns (InstanceReader);
65
+ function getBundleManager() external view returns (BundleManager);
28
66
  }
@@ -1,17 +1,40 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {NftId} from "../../contracts/types/NftId.sol";
5
- import {ObjectType} from "../../contracts/types/ObjectType.sol";
6
- import {RoleId} from "../../contracts/types/RoleId.sol";
7
- import {IService} from "../../contracts/instance/base/IService.sol";
8
- import {IRegistry} from "../../contracts/registry/IRegistry.sol";
4
+ import {NftId} from "../types/NftId.sol";
5
+ import {ObjectType} from "../types/ObjectType.sol";
6
+ import {RoleId} from "../types/RoleId.sol";
7
+ import {IService} from "../shared/IService.sol";
8
+ import {IRegistry} from "../registry/IRegistry.sol";
9
9
 
10
- import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
11
- import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
10
+ import {IRegisterable} from "../shared/IRegisterable.sol";
11
+ import {IComponent} from "../components/IComponent.sol";
12
+
13
+ import {InstanceAccessManager} from "./InstanceAccessManager.sol";
14
+ import {Instance} from "./Instance.sol";
15
+ import {InstanceReader} from "./InstanceReader.sol";
16
+ import {BundleManager} from "./BundleManager.sol";
12
17
 
13
18
  interface IInstanceService is IService {
14
19
 
20
+ error ErrorInstanceServiceRequestUnauhorized(address caller);
21
+ error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
22
+ error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
15
23
 
24
+ event LogInstanceCloned(address clonedAccessManagerAddress, address clonedInstanceAddress, address clonedInstanceReaderAddress, NftId clonedInstanceNftId);
25
+
26
+ function createInstanceClone()
27
+ external
28
+ returns (
29
+ InstanceAccessManager clonedAccessManager,
30
+ Instance clonedInstance,
31
+ NftId instanceNftId,
32
+ InstanceReader clonedInstanceReader,
33
+ BundleManager clonedBundleManager
34
+ );
35
+
36
+ function hasRole(address account, RoleId role, address instanceAddress) external returns (bool);
37
+ function setTargetLocked(string memory targetName, bool locked) external;
38
+
16
39
  }
17
40