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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  2. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → Component.sol/Component.json} +36 -7
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +38 -119
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  6. package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → IComponent.sol/IComponent.json} +36 -7
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
  11. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  12. package/artifacts/contracts/components/Pool.sol/Pool.json +38 -147
  13. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  14. package/artifacts/contracts/components/Product.sol/Product.json +43 -135
  15. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  35. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
  36. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
  38. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  39. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +261 -26
  41. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +171 -0
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  44. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +42 -13
  45. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  46. package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -82
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  48. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +101 -111
  49. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  50. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +11 -11
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  52. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  54. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +116 -183
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  56. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -90
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  58. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
  59. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  60. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +111 -37
  61. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  62. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  63. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  64. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  66. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +11 -0
  69. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  74. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +232 -61
  77. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +20 -24
  79. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  80. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +140 -60
  81. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  82. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +17 -21
  83. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  84. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +64 -13
  85. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
  87. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +120 -13
  89. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +13 -13
  91. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +13 -13
  93. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +321 -86
  95. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -23
  97. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +140 -60
  99. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  100. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -21
  101. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  102. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +146 -66
  103. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  104. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +17 -13
  105. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  106. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  107. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  108. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +132 -133
  109. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  110. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +102 -68
  111. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  112. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  113. package/artifacts/contracts/registry/Registry.sol/Registry.json +145 -227
  114. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  115. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  116. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  117. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +37 -143
  118. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -104
  120. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  121. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +530 -0
  122. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  123. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -27
  124. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  125. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  126. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  127. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  129. package/artifacts/contracts/shared/IService.sol/IService.json +13 -13
  130. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  132. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  133. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  134. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  135. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  137. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  138. package/artifacts/contracts/shared/Service.sol/Service.json +13 -13
  139. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  140. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  141. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  145. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  147. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
  149. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  152. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  153. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  154. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  155. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  159. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  161. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  167. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  173. package/contracts/components/{BaseComponent.sol → Component.sol} +69 -40
  174. package/contracts/components/Distribution.sol +5 -14
  175. package/contracts/components/{IBaseComponent.sol → IComponent.sol} +12 -7
  176. package/contracts/components/IProductComponent.sol +2 -2
  177. package/contracts/components/Pool.sol +7 -20
  178. package/contracts/components/Product.sol +21 -18
  179. package/contracts/instance/BundleManager.sol +7 -11
  180. package/contracts/instance/IInstance.sol +4 -4
  181. package/contracts/instance/IInstanceBase.sol +3 -2
  182. package/contracts/instance/IInstanceService.sol +4 -2
  183. package/contracts/instance/Instance.sol +11 -28
  184. package/contracts/instance/InstanceAccessManager.sol +15 -16
  185. package/contracts/instance/InstanceBase.sol +0 -3
  186. package/contracts/instance/InstanceReader.sol +3 -25
  187. package/contracts/instance/InstanceService.sol +115 -47
  188. package/contracts/instance/InstanceServiceManager.sol +5 -8
  189. package/contracts/instance/ObjectManager.sol +7 -24
  190. package/contracts/instance/base/ComponentService.sol +133 -0
  191. package/contracts/instance/base/IInstanceBase.sol +0 -2
  192. package/contracts/instance/module/IAccess.sol +1 -1
  193. package/contracts/instance/service/BundleService.sol +41 -8
  194. package/contracts/instance/service/BundleServiceManager.sol +5 -8
  195. package/contracts/instance/service/DistributionService.sol +36 -39
  196. package/contracts/instance/service/DistributionServiceManager.sol +6 -9
  197. package/contracts/instance/service/IBundleService.sol +5 -6
  198. package/contracts/instance/service/IPolicyService.sol +7 -0
  199. package/contracts/instance/service/PolicyService.sol +67 -37
  200. package/contracts/instance/service/PoolService.sol +49 -31
  201. package/contracts/instance/service/PoolServiceManager.sol +5 -8
  202. package/contracts/instance/service/ProductService.sol +106 -38
  203. package/contracts/registry/ChainNft.sol +1 -1
  204. package/contracts/registry/IRegistry.sol +26 -16
  205. package/contracts/registry/IRegistryService.sol +17 -10
  206. package/contracts/registry/Registry.sol +149 -201
  207. package/contracts/registry/RegistryAccessManager.sol +210 -0
  208. package/contracts/registry/RegistryService.sol +55 -96
  209. package/contracts/registry/RegistryServiceManager.sol +18 -36
  210. package/contracts/registry/ReleaseManager.sol +342 -0
  211. package/contracts/registry/TokenRegistry.sol +5 -6
  212. package/contracts/shared/IRegisterable.sol +0 -2
  213. package/contracts/shared/IService.sol +2 -1
  214. package/contracts/shared/NftOwnable.sol +2 -0
  215. package/contracts/shared/ProxyManager.sol +1 -1
  216. package/contracts/shared/Service.sol +13 -8
  217. package/contracts/test/TestService.sol +3 -2
  218. package/contracts/types/RoleId.sol +4 -5
  219. package/package.json +1 -1
  220. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  221. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  222. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  223. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  224. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  225. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  226. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  227. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  228. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
  229. package/contracts/instance/base/ComponentServiceBase.sol +0 -72
  230. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  231. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  232. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -4,7 +4,6 @@ pragma solidity ^0.8.19;
4
4
  import {IRegistry} from "../../registry/IRegistry.sol";
5
5
  import {IProductComponent} from "../../components/IProductComponent.sol";
6
6
  import {Product} from "../../components/Product.sol";
7
- import {IBaseComponent} from "../../components/IBaseComponent.sol";
8
7
  import {IPoolComponent} from "../../components/IPoolComponent.sol";
9
8
  import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
10
9
  import {IInstance} from "../IInstance.sol";
@@ -20,11 +19,11 @@ import {TokenHandler} from "../../shared/TokenHandler.sol";
20
19
  import {IVersionable} from "../../shared/IVersionable.sol";
21
20
  import {Versionable} from "../../shared/Versionable.sol";
22
21
 
23
- import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
22
+ import {Timestamp, TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
24
23
  import {UFixed, UFixedLib} from "../../types/UFixed.sol";
25
24
  import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
26
- import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol";
27
- import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
25
+ import {ObjectType, INSTANCE, PRODUCT, POOL, POLICY, BUNDLE} from "../../types/ObjectType.sol";
26
+ import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE, CLOSED} from "../../types/StateId.sol";
28
27
  import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
29
28
  import {Fee, FeeLib} from "../../types/Fee.sol";
30
29
  import {ReferralId} from "../../types/Referral.sol";
@@ -35,20 +34,16 @@ import {Version, VersionLib} from "../../types/Version.sol";
35
34
 
36
35
  import {IService} from "../../shared/IService.sol";
37
36
  import {Service} from "../../shared/Service.sol";
38
- import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
37
+ import {ComponentService} from "../base/ComponentService.sol";
39
38
  import {IPolicyService} from "./IPolicyService.sol";
40
39
  import {InstanceReader} from "../InstanceReader.sol";
41
40
  import {IPoolService} from "./IPoolService.sol";
42
41
  import {IBundleService} from "./IBundleService.sol";
43
- import {POOL_SERVICE_NAME} from "./PoolService.sol";
44
- import {BUNDLE_SERVICE_NAME} from "./BundleService.sol";
45
42
 
46
- string constant POLICY_SERVICE_NAME = "PolicyService";
47
43
 
48
- contract PolicyService is ComponentServiceBase, IPolicyService {
44
+ contract PolicyService is ComponentService, IPolicyService {
49
45
  using NftIdLib for NftId;
50
-
51
- string public constant NAME = "PolicyService";
46
+ using TimestampLib for Timestamp;
52
47
 
53
48
  IPoolService internal _poolService;
54
49
  IBundleService internal _bundleService;
@@ -69,15 +64,15 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
69
64
 
70
65
  _initializeService(registryAddress, owner);
71
66
 
72
- _poolService = IPoolService(_registry.getServiceAddress(POOL_SERVICE_NAME, getMajorVersion()));
73
- _bundleService = IBundleService(_registry.getServiceAddress(BUNDLE_SERVICE_NAME, getMajorVersion()));
67
+ _poolService = IPoolService(_registry.getServiceAddress(POOL(), getMajorVersion()));
68
+ _bundleService = IBundleService(_registry.getServiceAddress(BUNDLE(), getMajorVersion()));
74
69
 
75
70
  _registerInterface(type(IPolicyService).interfaceId);
76
71
  }
77
72
 
78
73
 
79
- function getName() public pure override(IService, Service) returns(string memory name) {
80
- return NAME;
74
+ function getDomain() public pure override(IService, Service) returns(ObjectType) {
75
+ return POLICY();
81
76
  }
82
77
 
83
78
 
@@ -86,7 +81,7 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
86
81
  (productInfo,) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
87
82
  product = Product(productInfo.objectAddress);
88
83
  }
89
- // TODO no access restrictions
84
+ // TODO: no access restrictions
90
85
  function calculatePremium(
91
86
  RiskId riskId,
92
87
  uint256 sumInsuredAmount,
@@ -184,7 +179,7 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
184
179
  ReferralId referralId
185
180
  ) external override returns (NftId policyNftId) {
186
181
  (IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
187
- // TODO add validations (see create bundle in pool service)
182
+ // TODO: add validations (see create bundle in pool service)
188
183
 
189
184
  policyNftId = getRegistryService().registerPolicy(
190
185
  IRegistry.ObjectInfo(
@@ -229,7 +224,7 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
229
224
  instance.createPolicy(policyNftId, policyInfo);
230
225
  instance.updatePolicyState(policyNftId, APPLIED());
231
226
 
232
- // TODO add logging
227
+ // TODO: add logging
233
228
  }
234
229
 
235
230
  function _getAndVerifyUnderwritingSetup(
@@ -389,7 +384,7 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
389
384
  }
390
385
  }
391
386
 
392
- // TODO add logging
387
+ // TODO: add logging
393
388
  }
394
389
 
395
390
  function calculateRequiredCollateral(UFixed collateralizationLevel, uint256 sumInsuredAmount) public pure override returns(uint256 collateralAmount) {
@@ -402,28 +397,30 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
402
397
  // check caller is registered product
403
398
  (IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
404
399
  InstanceReader instanceReader = instance.getInstanceReader();
400
+ IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
405
401
 
406
- // TODO: check if not paid
407
- // TODO: transfer premium
408
- // TODO: optionally activate
402
+ if (policyInfo.premiumPaidAmount == policyInfo.premiumAmount) {
403
+ revert ErrorIPolicyServicePremiumAlreadyPaid(policyNftId, policyInfo.premiumPaidAmount);
404
+ }
409
405
 
410
- // // perform actual token transfers (this code is probably not complete)
411
- // IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
412
-
413
- // uint256 premiumAmount = policyInfo.premiumAmount;
414
- // _processPremiumByTreasury(instance, productInfo.nftId, policyNftId, premiumAmount);
406
+ uint256 unpaidPremiumAmount = policyInfo.premiumAmount - policyInfo.premiumPaidAmount;
415
407
 
416
- // // policy level book keeping for premium paid
417
- // policyInfo.premiumPaidAmount += premiumAmount;
408
+ uint256 netPremiumAmount = _processPremiumByTreasury(
409
+ instance,
410
+ productInfo.nftId,
411
+ policyNftId,
412
+ unpaidPremiumAmount);
418
413
 
419
- // instance.updatePolicy(policyNftId, policyInfo, KEEP_STATE());
414
+ policyInfo.premiumPaidAmount += unpaidPremiumAmount;
420
415
 
421
- // // optional activation of policy
422
- // if(activateAt > zeroTimestamp()) {
423
- // activate(policyNftId, activateAt);
424
- // }
416
+ _bundleService.increaseBalance(instance, policyInfo.bundleNftId, netPremiumAmount);
417
+ instance.updatePolicy(policyNftId, policyInfo, KEEP_STATE());
425
418
 
426
- // TODO add logging
419
+ if(activateAt.gtz() && policyInfo.activatedAt.eqz()) {
420
+ activate(policyNftId, activateAt);
421
+ }
422
+
423
+ // TODO: add logging
427
424
  }
428
425
 
429
426
  function activate(NftId policyNftId, Timestamp activateAt) public override {
@@ -442,14 +439,47 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
442
439
 
443
440
  instance.updatePolicy(policyNftId, policyInfo, ACTIVE());
444
441
 
445
- // TODO add logging
442
+ // TODO: add logging
446
443
  }
447
444
 
448
445
  function close(
449
446
  NftId policyNftId
450
447
  ) external override // solhint-disable-next-line no-empty-blocks
451
448
  {
449
+ (, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
450
+ InstanceReader instanceReader = instance.getInstanceReader();
451
+
452
+ IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
453
+
454
+ if (policyInfo.activatedAt.eqz()) {
455
+ revert ErrorIPolicyServicePolicyNotActivated(policyNftId);
456
+ }
457
+
458
+ StateId state = instanceReader.getPolicyState(policyNftId);
459
+ if (state != ACTIVE()) {
460
+ revert ErrorIPolicyServicePolicyNotActive(policyNftId, state);
461
+ }
462
+
463
+ if (policyInfo.closedAt.gtz()) {
464
+ revert ErrorIPolicyServicePolicyAlreadyClosed(policyNftId);
465
+ }
466
+
467
+ if (policyInfo.premiumAmount != policyInfo.premiumPaidAmount) {
468
+ revert ErrorIPolicyServicePremiumNotFullyPaid(policyNftId, policyInfo.premiumAmount, policyInfo.premiumPaidAmount);
469
+ }
470
+
471
+ if (policyInfo.openClaimsCount > 0) {
472
+ revert ErrorIPolicyServiceOpenClaims(policyNftId, policyInfo.openClaimsCount);
473
+ }
474
+
475
+ if (TimestampLib.blockTimestamp().lte(policyInfo.expiredAt) && (policyInfo.payoutAmount < policyInfo.sumInsuredAmount)) {
476
+ revert ErrorIPolicyServicePolicyHasNotExpired(policyNftId, policyInfo.expiredAt);
477
+ }
478
+
479
+ policyInfo.closedAt = TimestampLib.blockTimestamp();
452
480
 
481
+ _bundleService.closePolicy(instance, policyNftId, policyInfo.bundleNftId, policyInfo.sumInsuredAmount);
482
+ instance.updatePolicy(policyNftId, policyInfo, CLOSED());
453
483
  }
454
484
 
455
485
  function _getPoolNftId(
@@ -503,6 +533,6 @@ contract PolicyService is ComponentServiceBase, IPolicyService {
503
533
  }
504
534
  }
505
535
 
506
- // TODO add logging
536
+ // TODO: add logging
507
537
  }
508
538
  }
@@ -14,7 +14,7 @@ import {Versionable} from "../../shared/Versionable.sol";
14
14
  import {INftOwnable} from "../../shared/INftOwnable.sol";
15
15
 
16
16
  import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
17
- import {POOL, BUNDLE} from "../../types/ObjectType.sol";
17
+ import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
18
18
  import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
19
19
  import {Fee, FeeLib} from "../../types/Fee.sol";
20
20
  import {Version, VersionLib} from "../../types/Version.sol";
@@ -24,23 +24,21 @@ import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
24
24
  import {IService} from "../../shared/IService.sol";
25
25
  import {Service} from "../../shared/Service.sol";
26
26
  import {BundleManager} from "../BundleManager.sol";
27
- import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
27
+ import {ComponentService} from "../base/ComponentService.sol";
28
28
  import {IPoolService} from "./IPoolService.sol";
29
29
  import {IRegistryService} from "../../registry/IRegistryService.sol";
30
30
  import {InstanceService} from "../InstanceService.sol";
31
31
  import {InstanceReader} from "../InstanceReader.sol";
32
- import {IBaseComponent} from "../../components/IBaseComponent.sol";
32
+ import {IComponent} from "../../components/IComponent.sol";
33
33
 
34
34
  string constant POOL_SERVICE_NAME = "PoolService";
35
35
 
36
36
  contract PoolService is
37
- ComponentServiceBase,
37
+ ComponentService,
38
38
  IPoolService
39
39
  {
40
40
  using NftIdLib for NftId;
41
41
 
42
- string public constant NAME = "PoolService";
43
-
44
42
  address internal _registryAddress;
45
43
 
46
44
  function _initialize(
@@ -61,45 +59,65 @@ contract PoolService is
61
59
  _registerInterface(type(IPoolService).interfaceId);
62
60
  }
63
61
 
64
- function getName() public pure override(Service, IService) returns(string memory name) {
65
- return NAME;
62
+ function getDomain() public pure override(Service, IService) returns(ObjectType) {
63
+ return POOL();
66
64
  }
67
65
 
68
66
  function register(address poolAddress)
69
67
  external
70
68
  returns(NftId poolNftId)
71
69
  {
72
- address poolOwner = msg.sender;
73
- IBaseComponent pool = IBaseComponent(poolAddress);
70
+ (
71
+ IComponent pool,
72
+ address owner,
73
+ IInstance instance,
74
+ NftId instanceNftId
75
+ ) = _checkComponentForRegistration(
76
+ poolAddress,
77
+ POOL(),
78
+ POOL_OWNER_ROLE());
79
+
80
+ (
81
+ IRegistry.ObjectInfo memory poolInfo,
82
+ bytes memory data
83
+ ) = getRegistryService().registerPool(pool, owner);
84
+ pool.linkToRegisteredNftId();
85
+ poolNftId = poolInfo.nftId;
86
+
87
+ (
88
+ string memory name,
89
+ ISetup.PoolSetupInfo memory initialSetup
90
+ ) = _decodeAndVerifyPoolData(data);
91
+ instance.createPoolSetup(poolNftId, initialSetup);
74
92
 
75
- IRegistry.ObjectInfo memory info;
76
- bytes memory data;
77
- (info, data) = getRegistryService().registerPool(pool, poolOwner);
93
+ getInstanceService().createTarget(instanceNftId, poolAddress, name);
94
+ }
78
95
 
79
- IInstance instance = _getInstance(info);
96
+ function _decodeAndVerifyPoolData(bytes memory data)
97
+ internal
98
+ returns(string memory name, ISetup.PoolSetupInfo memory setup)
99
+ {
100
+ (name, setup) = abi.decode(
101
+ data,
102
+ (string, ISetup.PoolSetupInfo)
103
+ );
80
104
 
81
- bool hasRole = getInstanceService().hasRole(
82
- poolOwner,
83
- POOL_OWNER_ROLE(),
84
- address(instance));
105
+ // TODO add checks
106
+ /*IRegistry _registry = getRegistry();
85
107
 
86
- if(!hasRole) {
87
- revert ExpectedRoleMissing(POOL_OWNER_ROLE(), poolOwner);
108
+ if(wallet == address(0)) {
109
+ revert WalletIsZero();
88
110
  }
89
111
 
90
- poolNftId = info.nftId;
91
- ISetup.PoolSetupInfo memory initialSetup = _decodeAndVerifyPoolSetup(data);
92
- instance.createPoolSetup(poolNftId, initialSetup);
93
- }
112
+ ObjectType tokenType = _registry.getObjectInfo(address(token)).objectType;
94
113
 
95
- function _decodeAndVerifyPoolSetup(bytes memory data) internal returns(ISetup.PoolSetupInfo memory setup)
96
- {
97
- setup = abi.decode(
98
- data,
99
- (ISetup.PoolSetupInfo)
100
- );
114
+ if(tokenType != TOKEN()) {
115
+ revert InvalidToken();
116
+ }
101
117
 
102
- // TODO add checks if applicable
118
+ if(UFixedLib.eqz(info.collateralizationLevel)) {
119
+ revert CollateralizationLevelIsZero();
120
+ }*/
103
121
  }
104
122
 
105
123
  function setFees(
@@ -6,7 +6,7 @@ import {ProxyManager} from "../../shared/ProxyManager.sol";
6
6
  import {PoolService} from "./PoolService.sol";
7
7
  import {Registry} from "../../registry/Registry.sol";
8
8
  import {RegistryService} from "../../registry/RegistryService.sol";
9
- import {VersionLib} from "../../types/Version.sol";
9
+ import {REGISTRY} from "../../types/ObjectType.sol";
10
10
 
11
11
  contract PoolServiceManager is ProxyManager {
12
12
 
@@ -26,10 +26,10 @@ contract PoolServiceManager is ProxyManager {
26
26
 
27
27
  _poolService = PoolService(address(versionable));
28
28
 
29
- Registry registry = Registry(registryAddress);
30
- address registryServiceAddress = registry.getServiceAddress("RegistryService", VersionLib.toVersion(3, 0, 0).toMajorPart());
31
- RegistryService registryService = RegistryService(registryServiceAddress);
32
- // TODO this must have a role or own nft to register service
29
+ // TODO `this` must have a role or own nft to register service
30
+ //Registry registry = Registry(registryAddress);
31
+ //address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _poolService.getMajorVersion());
32
+ //RegistryService registryService = RegistryService(registryServiceAddress);
33
33
  //registryService.registerService(_poolService);
34
34
 
35
35
  // TODO no nft to link yet
@@ -37,9 +37,6 @@ contract PoolServiceManager is ProxyManager {
37
37
  //_linkToNftOwnable(
38
38
  // address(registryAddress),
39
39
  // address(_poolService));
40
-
41
- // implies that after this constructor call only upgrade functionality is available
42
- _isDeployed = true;
43
40
  }
44
41
 
45
42
  //--- view functions ----------------------------------------------------//
@@ -4,7 +4,7 @@ pragma solidity ^0.8.19;
4
4
  import {IRegistry} from "../../registry/IRegistry.sol";
5
5
  import {IProductComponent} from "../../components/IProductComponent.sol";
6
6
  import {Product} from "../../components/Product.sol";
7
- import {IBaseComponent} from "../../components/IBaseComponent.sol";
7
+ import {IComponent} from "../../components/IComponent.sol";
8
8
  import {IPoolComponent} from "../../components/IPoolComponent.sol";
9
9
  import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
10
10
  import {IInstance} from "../IInstance.sol";
@@ -23,7 +23,7 @@ import {Versionable} from "../../shared/Versionable.sol";
23
23
  import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
24
24
  import {UFixed, UFixedLib} from "../../types/UFixed.sol";
25
25
  import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
26
- import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol";
26
+ import {ObjectType, PRODUCT, POOL, POLICY} from "../../types/ObjectType.sol";
27
27
  import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
28
28
  import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
29
29
  import {Fee, FeeLib} from "../../types/Fee.sol";
@@ -35,20 +35,15 @@ import {RoleId, PRODUCT_OWNER_ROLE} from "../../types/RoleId.sol";
35
35
 
36
36
  import {IService} from "../../shared/IService.sol";
37
37
  import {Service} from "../../shared/Service.sol";
38
- import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
38
+ import {ComponentService} from "../base/ComponentService.sol";
39
39
  import {IProductService} from "./IProductService.sol";
40
40
  import {InstanceReader} from "../InstanceReader.sol";
41
41
  import {IPoolService} from "./PoolService.sol";
42
- import {POOL_SERVICE_NAME} from "./PoolService.sol";
43
-
44
- string constant PRODUCT_SERVICE_NAME = "ProductService";
45
42
 
46
43
  // TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
47
- contract ProductService is ComponentServiceBase, IProductService {
44
+ contract ProductService is ComponentService, IProductService {
48
45
  using NftIdLib for NftId;
49
46
 
50
- string public constant NAME = "ProductService";
51
-
52
47
  IPoolService internal _poolService;
53
48
 
54
49
  event LogProductServiceSender(address sender);
@@ -67,50 +62,123 @@ contract ProductService is ComponentServiceBase, IProductService {
67
62
 
68
63
  _initializeService(registryAddress, owner);
69
64
 
70
- _poolService = IPoolService(_registry.getServiceAddress(POOL_SERVICE_NAME, getMajorVersion()));
65
+ _poolService = IPoolService(_registry.getServiceAddress(POOL(), getMajorVersion()));
71
66
 
72
67
  _registerInterface(type(IProductService).interfaceId);
73
68
  }
74
69
 
75
70
 
76
- function getName() public pure override(IService, Service) returns(string memory name) {
77
- return NAME;
78
- }
79
-
80
71
  function register(address productAddress)
81
72
  external
82
73
  returns(NftId productNftId)
83
74
  {
84
- address productOwner = msg.sender;
85
- IBaseComponent product = IBaseComponent(productAddress);
86
-
87
- IRegistry.ObjectInfo memory info;
88
- bytes memory data;
89
- (info, data) = getRegistryService().registerProduct(product, productOwner);
90
-
91
- IInstance instance = _getInstance(info);
92
- bool hasRole = getInstanceService().hasRole(
93
- productOwner,
94
- PRODUCT_OWNER_ROLE(),
95
- address(instance));
96
-
97
- if(!hasRole) {
98
- revert ExpectedRoleMissing(PRODUCT_OWNER_ROLE(), productOwner);
99
- }
100
-
101
- productNftId = info.nftId;
102
- ISetup.ProductSetupInfo memory initialSetup = _decodeAndVerifyProductSetup(data);
103
- instance.createProductSetup(productNftId, initialSetup);
75
+ (
76
+ IComponent product,
77
+ address owner,
78
+ IInstance instance,
79
+ NftId instanceNftId
80
+ ) = _checkComponentForRegistration(
81
+ productAddress,
82
+ PRODUCT(),
83
+ PRODUCT_OWNER_ROLE());
84
+
85
+ (
86
+ IRegistry.ObjectInfo memory productInfo,
87
+ bytes memory data
88
+ ) = getRegistryService().registerProduct(product, owner);
89
+
90
+ productNftId = productInfo.nftId;
91
+ _createProductSetup(
92
+ instance,
93
+ product,
94
+ productNftId,
95
+ data);
96
+ }
97
+
98
+
99
+ function _createProductSetup(
100
+ IInstance instance,
101
+ IComponent product,
102
+ NftId productNftId,
103
+ bytes memory data
104
+ )
105
+ internal
106
+ returns (string memory name)
107
+ {
108
+ (
109
+ string memory name,
110
+ ISetup.ProductSetupInfo memory setup
111
+ ) = _decodeAndVerifyProductData(data);
112
+
113
+ // wire distribution and pool components to product component
114
+ IComponent distribution = IComponent(_registry.getObjectInfo(setup.distributionNftId).objectAddress);
115
+ IComponent pool = IComponent(_registry.getObjectInfo(setup.poolNftId).objectAddress);
116
+
117
+ distribution.setProductNftId(productNftId);
118
+ pool.setProductNftId(productNftId);
119
+ product.setProductNftId(productNftId);
120
+ product.linkToRegisteredNftId();
121
+
122
+ // create product setup in instance
123
+ instance.createProductSetup(productNftId, setup);
124
+
125
+ // create target for instane access manager
126
+ getInstanceService().createTarget(
127
+ _registry.getNftId(address(instance)),
128
+ address(product),
129
+ name);
130
+ }
131
+
132
+ function getDomain() public pure override(IService, Service) returns(ObjectType) {
133
+ return PRODUCT();
104
134
  }
105
135
 
106
- function _decodeAndVerifyProductSetup(bytes memory data) internal returns(ISetup.ProductSetupInfo memory setup)
136
+
137
+ function _decodeAndVerifyProductData(bytes memory data)
138
+ internal
139
+ returns(string memory name, ISetup.ProductSetupInfo memory setup)
107
140
  {
108
- setup = abi.decode(
141
+ (name, setup) = abi.decode(
109
142
  data,
110
- (ISetup.ProductSetupInfo)
143
+ (string, ISetup.ProductSetupInfo)
111
144
  );
112
145
 
113
- // TODO add checks if applicable
146
+ // TODO add checks
147
+ // if(wallet == address(0)) {
148
+ // revert WalletIsZero();
149
+ // }
150
+
151
+ // IRegistry.ObjectInfo memory tokenInfo = _registry.getObjectInfo(address(info.token));
152
+
153
+ // if(tokenInfo.objectType != TOKEN()) {
154
+ // revert InvalidToken();
155
+ // }
156
+
157
+ // IRegistry.ObjectInfo memory poolInfo = _registry.getObjectInfo(info.poolNftId);
158
+
159
+ // if(poolInfo.objectType != POOL()) {
160
+ // revert InvalidPool();
161
+ // }
162
+
163
+ // if(poolInfo.parentNftId != instanceNftId) {
164
+ // revert InvalidPoolsInstance();
165
+ // }
166
+ // // TODO pool have the same token
167
+ // //ITreasury.PoolSetup memory poolSetup = instance.getPoolSetup(info.poolNftId);
168
+ // //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
169
+ // // TODO pool is not linked
170
+
171
+ // IRegistry.ObjectInfo memory distributionInfo = _registry.getObjectInfo(info.distributionNftId);
172
+
173
+ // if(distributionInfo.objectType != DISTRIBUTION()) {
174
+ // revert InvalidDistribution();
175
+ // }
176
+
177
+ // if(distributionInfo.parentNftId != instanceNftId) {
178
+ // revert InvalidDistributionsInstance();
179
+ // }
180
+ // // TODO distribution have the same token
181
+ // // TODO distribution is not linked
114
182
  }
115
183
 
116
184
  function setFees(
@@ -59,7 +59,7 @@ contract ChainNft is ERC721Enumerable {
59
59
  }
60
60
 
61
61
  _chainIdMultiplier = 10 ** _chainIdDigits;
62
- _idNext = 4;
62
+ _idNext = 3;
63
63
  }
64
64
 
65
65
  /**
@@ -7,25 +7,25 @@ import {ChainNft} from "./ChainNft.sol";
7
7
  import {NftId} from "../types/NftId.sol";
8
8
  import {ObjectType} from "../types/ObjectType.sol";
9
9
  import {VersionPart} from "../types/Version.sol";
10
+ import {Timestamp} from "../types/Timestamp.sol";
10
11
 
11
12
  interface IRegistry is IERC165 {
12
13
 
13
- event LogInitialMajorVersionSet(VersionPart majorVersion);
14
- event LogMajorVersionSet(VersionPart majorVersionMax);
15
- event LogRegistration(ObjectInfo info);
16
- event LogServiceNameRegistration(string serviceName, VersionPart majorVersion);
17
-
18
- // setMajorVersion()
19
- error NotOwner(address account);
20
- error MajorVersionMaxIncreaseInvalid(VersionPart newMajorVersionMax, VersionPart existingMaxMajorVersion);
14
+ event LogRegistration(NftId nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner);
15
+ event LogServiceRegistration(VersionPart majorVersion, ObjectType domain);
21
16
 
22
17
  // register()
23
- error NotRegistryService();
18
+ error CallerNotRegistryService();
19
+ error ServiceRegistration();
20
+
21
+ // registerService()
22
+ error CallerNotReleaseManager();
23
+ error ServiceAlreadyRegistered(address service);
24
+
25
+ // _register()
24
26
  error ZeroParentAddress();
25
27
  error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
26
28
  error ContractAlreadyRegistered(address objectAddress);
27
- error InvalidServiceVersion(VersionPart majorVersion);
28
- error ServiceNameAlreadyRegistered(string name, VersionPart majorVersion);
29
29
 
30
30
  struct ObjectInfo {
31
31
  NftId nftId;
@@ -38,7 +38,17 @@ interface IRegistry is IERC165 {
38
38
  }// TODO delete nftId and initialOwner(if not used) from struct
39
39
  // TODO strong disagree, keep nftId there (lets keep get object info return object consistent)
40
40
 
41
- function setMajorVersion(VersionPart newMajorVersionMax) external;
41
+ struct ReleaseInfo {
42
+ ObjectType[] domains;
43
+ Timestamp createdAt;
44
+ //Timestamp updatedAt;
45
+ }
46
+
47
+ function registerService(
48
+ ObjectInfo memory serviceInfo,
49
+ VersionPart serviceVersion,
50
+ ObjectType serviceDomain
51
+ ) external returns(NftId nftId);
42
52
 
43
53
  function register(ObjectInfo memory info) external returns (NftId nftId);
44
54
 
@@ -48,6 +58,8 @@ interface IRegistry is IERC165 {
48
58
 
49
59
  function getMajorVersion() external view returns (VersionPart);
50
60
 
61
+ function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory);
62
+
51
63
  function getObjectCount() external view returns (uint256);
52
64
 
53
65
  function getNftId() external view returns (NftId nftId);
@@ -68,11 +80,9 @@ interface IRegistry is IERC165 {
68
80
 
69
81
  function isRegisteredService(address contractAddress) external view returns (bool);
70
82
 
71
- function getServiceName(NftId nftId) external view returns (string memory name);
72
-
73
83
  function getServiceAddress(
74
- string memory serviceName,
75
- VersionPart majorVersion
84
+ ObjectType serviceDomain,
85
+ VersionPart releaseVersion
76
86
  ) external view returns (address serviceAddress);
77
87
 
78
88
  function getChainNft() external view returns (ChainNft);