@etherisc/gif-next 0.0.2-f4f92b3-338 → 0.0.2-f509abc-684

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) hide show
  1. package/README.md +73 -1
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  3. package/artifacts/contracts/components/Component.sol/Component.json +270 -94
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +627 -157
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +122 -72
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +323 -102
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +325 -186
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +126 -144
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +552 -212
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +374 -166
  18. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  19. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  20. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  21. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
  22. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  23. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
  24. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  25. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +801 -434
  26. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  27. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +194 -192
  28. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  29. package/artifacts/contracts/instance/Instance.sol/Instance.json +992 -782
  30. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  31. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +441 -164
  32. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  33. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +119 -221
  34. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  35. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +371 -302
  36. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +330 -102
  38. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  39. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
  40. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  41. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +118 -169
  42. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  44. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
  46. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
  48. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  49. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +61 -78
  50. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  51. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
  52. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
  53. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  58. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
  59. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +968 -0
  60. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
  61. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +665 -0
  62. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +306 -315
  64. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +305 -93
  66. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
  67. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
  68. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
  69. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
  70. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1212 -252
  72. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  73. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +453 -85
  74. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
  75. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +556 -0
  76. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +155 -240
  78. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
  79. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +409 -0
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +711 -139
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +60 -286
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +81 -147
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +22 -169
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +185 -391
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +311 -127
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +222 -204
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +310 -90
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +142 -221
  98. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +302 -90
  100. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  101. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
  102. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +34 -2
  104. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  105. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +83 -174
  106. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  107. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
  108. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  109. package/artifacts/contracts/registry/Registry.sol/Registry.json +47 -15
  110. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  111. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  112. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  113. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +193 -216
  114. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +300 -94
  116. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  117. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
  118. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  119. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
  120. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  121. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  122. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
  123. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  124. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
  125. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
  126. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
  127. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -29
  129. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
  130. package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
  131. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  132. package/artifacts/contracts/shared/IService.sol/IService.json +22 -169
  133. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  134. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
  135. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +113 -33
  137. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
  138. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
  139. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  140. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +294 -74
  141. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  142. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +125 -55
  143. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
  144. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
  145. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  146. package/artifacts/contracts/shared/Service.sol/Service.json +113 -164
  147. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  148. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  149. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  150. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  151. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  152. package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -152
  153. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  154. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  155. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +125 -55
  157. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
  159. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  160. package/artifacts/contracts/test/TestService.sol/TestService.json +134 -221
  161. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  162. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  163. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  164. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  165. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -190
  166. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  167. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  168. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
  170. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
  172. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
  173. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  175. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/Fee.sol/FeeLib.json +2 -2
  177. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  178. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  179. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
  181. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  182. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  183. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  186. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
  187. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
  188. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
  190. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  192. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  194. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
  195. package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
  196. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  197. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  198. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  199. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
  200. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  201. package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
  202. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  203. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
  204. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  205. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  206. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  207. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
  208. package/contracts/components/Component.sol +112 -83
  209. package/contracts/components/Distribution.sol +189 -53
  210. package/contracts/components/IComponent.sol +48 -17
  211. package/contracts/components/IDistributionComponent.sol +39 -15
  212. package/contracts/components/IPoolComponent.sol +84 -41
  213. package/contracts/components/IProductComponent.sol +3 -2
  214. package/contracts/components/Pool.sol +211 -153
  215. package/contracts/components/Product.sol +96 -61
  216. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
  217. package/contracts/instance/BundleManager.sol +7 -5
  218. package/contracts/instance/Cloneable.sol +7 -2
  219. package/contracts/instance/IInstance.sol +36 -10
  220. package/contracts/instance/IInstanceService.sol +36 -4
  221. package/contracts/instance/Instance.sol +101 -43
  222. package/contracts/instance/InstanceAccessManager.sol +383 -159
  223. package/contracts/instance/InstanceReader.sol +7 -10
  224. package/contracts/instance/InstanceService.sol +262 -129
  225. package/contracts/instance/InstanceServiceManager.sol +1 -1
  226. package/contracts/instance/ObjectManager.sol +6 -8
  227. package/contracts/instance/base/ComponentService.sol +6 -6
  228. package/contracts/instance/base/KeyValueStore.sol +5 -2
  229. package/contracts/instance/base/Lifecycle.sol +11 -2
  230. package/contracts/instance/module/IAccess.sol +22 -16
  231. package/contracts/instance/module/IBundle.sol +2 -1
  232. package/contracts/instance/module/IComponents.sol +35 -0
  233. package/contracts/instance/module/IDistribution.sol +2 -0
  234. package/contracts/instance/module/IPolicy.sol +30 -3
  235. package/contracts/instance/module/ISetup.sol +7 -20
  236. package/contracts/instance/service/ApplicationService.sol +350 -0
  237. package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
  238. package/contracts/instance/service/BundleService.sol +82 -39
  239. package/contracts/instance/service/BundleServiceManager.sol +1 -1
  240. package/contracts/instance/service/ClaimService.sol +151 -0
  241. package/contracts/instance/service/ClaimServiceManager.sol +35 -0
  242. package/contracts/instance/service/DistributionService.sol +376 -15
  243. package/contracts/instance/service/DistributionServiceManager.sol +1 -1
  244. package/contracts/instance/service/IApplicationService.sol +82 -0
  245. package/contracts/instance/service/IBundleService.sol +30 -12
  246. package/contracts/instance/service/IClaimService.sol +61 -0
  247. package/contracts/instance/service/IDistributionService.sol +86 -0
  248. package/contracts/instance/service/IPolicyService.sol +27 -49
  249. package/contracts/instance/service/IPoolService.sol +17 -2
  250. package/contracts/instance/service/PolicyService.sol +148 -283
  251. package/contracts/instance/service/PolicyServiceManager.sol +2 -2
  252. package/contracts/instance/service/PoolService.sol +130 -19
  253. package/contracts/instance/service/PoolServiceManager.sol +1 -1
  254. package/contracts/instance/service/ProductService.sol +20 -11
  255. package/contracts/instance/service/ProductServiceManager.sol +2 -2
  256. package/contracts/registry/ChainNft.sol +8 -0
  257. package/contracts/registry/IRegistry.sol +5 -2
  258. package/contracts/registry/IRegistryService.sol +10 -8
  259. package/contracts/registry/ITransferInterceptor.sol +1 -0
  260. package/contracts/registry/Registry.sol +43 -28
  261. package/contracts/registry/RegistryService.sol +69 -48
  262. package/contracts/registry/RegistryServiceManager.sol +13 -13
  263. package/contracts/registry/ReleaseManager.sol +18 -28
  264. package/contracts/registry/TokenRegistry.sol +16 -12
  265. package/contracts/shared/ERC165.sol +14 -12
  266. package/contracts/shared/INftOwnable.sol +11 -10
  267. package/contracts/shared/IPolicyHolder.sol +26 -0
  268. package/contracts/shared/IRegisterable.sol +3 -3
  269. package/contracts/shared/IRegistryLinked.sol +12 -0
  270. package/contracts/shared/IService.sol +2 -0
  271. package/contracts/shared/IVersionable.sol +4 -47
  272. package/contracts/shared/NftOwnable.sol +66 -85
  273. package/contracts/shared/PolicyHolder.sol +81 -0
  274. package/contracts/shared/ProxyManager.sol +100 -25
  275. package/contracts/shared/Registerable.sol +7 -19
  276. package/contracts/shared/RegistryLinked.sol +48 -0
  277. package/contracts/shared/Service.sol +15 -17
  278. package/contracts/shared/TokenHandler.sol +11 -5
  279. package/contracts/shared/Versionable.sol +4 -92
  280. package/contracts/test/TestRegisterable.sol +1 -1
  281. package/contracts/test/TestService.sol +1 -1
  282. package/contracts/types/Blocknumber.sol +1 -0
  283. package/contracts/types/ClaimId.sol +52 -0
  284. package/contracts/types/DistributorType.sol +2 -2
  285. package/contracts/types/Fee.sol +1 -0
  286. package/contracts/types/NftId.sol +8 -0
  287. package/contracts/types/ObjectType.sol +10 -5
  288. package/contracts/types/PayoutId.sol +54 -0
  289. package/contracts/types/Referral.sol +4 -0
  290. package/contracts/types/RoleId.sol +16 -9
  291. package/contracts/types/Seconds.sol +54 -0
  292. package/contracts/types/StateId.sol +1 -0
  293. package/contracts/types/Timestamp.sol +13 -13
  294. package/contracts/types/UFixed.sol +1 -0
  295. package/contracts/types/Version.sol +1 -0
  296. package/package.json +3 -3
  297. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
  298. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
  299. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
  300. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
  301. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
  302. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
  303. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
  304. package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
  305. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
  306. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
  307. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
  308. package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
  309. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
  310. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
  311. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
  312. package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
  313. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
  314. package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
  315. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
  316. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
  317. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
  318. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
  319. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
  320. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
  321. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
  322. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
  323. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
  324. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
  325. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
  326. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
  327. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
  328. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
  329. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
  330. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
  331. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
  332. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
  333. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
  334. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
  335. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
  336. package/contracts/experiment/cloning/Cloner.sol +0 -47
  337. package/contracts/experiment/errors/Require.sol +0 -38
  338. package/contracts/experiment/errors/Revert.sol +0 -44
  339. package/contracts/experiment/inheritance/A.sol +0 -53
  340. package/contracts/experiment/inheritance/B.sol +0 -28
  341. package/contracts/experiment/inheritance/C.sol +0 -34
  342. package/contracts/experiment/inheritance/IA.sol +0 -13
  343. package/contracts/experiment/inheritance/IB.sol +0 -10
  344. package/contracts/experiment/inheritance/IC.sol +0 -12
  345. package/contracts/experiment/statemachine/Dummy.sol +0 -27
  346. package/contracts/experiment/statemachine/ISM.sol +0 -25
  347. package/contracts/experiment/statemachine/SM.sol +0 -57
  348. package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
  349. package/contracts/experiment/types/TypeA.sol +0 -47
  350. package/contracts/experiment/types/TypeB.sol +0 -29
@@ -6,20 +6,22 @@ import {IRegistry} from "../../registry/IRegistry.sol";
6
6
  import {IInstance} from "../../instance/IInstance.sol";
7
7
  import {IBundle} from "../../instance/module/IBundle.sol";
8
8
  import {TokenHandler} from "../../instance/module/ITreasury.sol";
9
- import {ISetup} from "../module/ISetup.sol";
9
+ import {IComponents} from "../module/IComponents.sol";
10
10
  import {IPolicy} from "../module/IPolicy.sol";
11
11
 
12
12
  import {IVersionable} from "../../shared/IVersionable.sol";
13
13
  import {Versionable} from "../../shared/Versionable.sol";
14
14
  import {INftOwnable} from "../../shared/INftOwnable.sol";
15
15
 
16
+ import {Fee, FeeLib} from "../../types/Fee.sol";
16
17
  import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
17
18
  import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
18
- import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
19
+ import {PUBLIC_ROLE, POOL_OWNER_ROLE, POLICY_SERVICE_ROLE, RoleId} from "../../types/RoleId.sol";
19
20
  import {Fee, FeeLib} from "../../types/Fee.sol";
20
21
  import {Version, VersionLib} from "../../types/Version.sol";
21
22
  import {KEEP_STATE, StateId} from "../../types/StateId.sol";
22
23
  import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
24
+ import {Version, VersionLib} from "../../types/Version.sol";
23
25
 
24
26
  import {IService} from "../../shared/IService.sol";
25
27
  import {Service} from "../../shared/Service.sol";
@@ -55,16 +57,15 @@ contract PoolService is
55
57
  (registryAddress, initialOwner) = abi.decode(data, (address, address));
56
58
  // TODO while PoolService is not deployed in PoolServiceManager constructor
57
59
  // owner is PoolServiceManager deployer
58
- _initializeService(registryAddress, owner);
59
-
60
- _registerInterface(type(IPoolService).interfaceId);
60
+ initializeService(registryAddress, owner);
61
+ registerInterface(type(IPoolService).interfaceId);
61
62
  }
62
63
 
63
64
  function getDomain() public pure override(Service, IService) returns(ObjectType) {
64
65
  return POOL();
65
66
  }
66
67
 
67
- function register(address poolAddress)
68
+ /*function register(address poolAddress)
68
69
  external
69
70
  returns(NftId poolNftId)
70
71
  {
@@ -79,31 +80,141 @@ contract PoolService is
79
80
  POOL_OWNER_ROLE());
80
81
 
81
82
  IPoolComponent pool = IPoolComponent(poolAddress);
82
- IRegistry.ObjectInfo memory poolInfo = getRegistryService().registerPool(pool, owner);
83
+ IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
83
84
  pool.linkToRegisteredNftId();
84
- poolNftId = poolInfo.nftId;
85
+ poolNftId = registryInfo.nftId;
85
86
 
86
87
  instance.createPoolSetup(poolNftId, pool.getSetupInfo());
87
- getInstanceService().createTarget(instanceNftId, poolAddress, pool.getName());
88
+
89
+ bytes4[][] memory selectors = new bytes4[][](2);
90
+ selectors[0] = new bytes4[](1);
91
+ selectors[1] = new bytes4[](1);
92
+
93
+ selectors[0][0] = IPoolComponent.setFees.selector;
94
+ selectors[1][0] = IPoolComponent.verifyApplication.selector;
95
+
96
+ RoleId[] memory roles = new RoleId[](2);
97
+ roles[0] = POOL_OWNER_ROLE();
98
+ roles[1] = POLICY_SERVICE_ROLE();
99
+
100
+ getInstanceService().createGifTarget(
101
+ instanceNftId,
102
+ poolAddress,
103
+ pool.getName(),
104
+ selectors,
105
+ roles);
106
+ }*/
107
+
108
+ function register(address poolAddress)
109
+ external
110
+ returns(NftId poolNftId)
111
+ {
112
+ (
113
+ IComponent component,
114
+ address owner,
115
+ IInstance instance,
116
+ NftId instanceNftId
117
+ ) = _checkComponentForRegistration(
118
+ poolAddress,
119
+ POOL(),
120
+ POOL_OWNER_ROLE());
121
+
122
+ IPoolComponent pool = IPoolComponent(poolAddress);
123
+ IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
124
+ pool.linkToRegisteredNftId();
125
+ poolNftId = registryInfo.nftId;
126
+
127
+ // amend component info with pool specific token handler
128
+ IComponents.ComponentInfo memory componentInfo = pool.getComponentInfo();
129
+ componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
130
+
131
+ // save amended component info with instance
132
+ instance.createPoolSetup(poolNftId, componentInfo);
133
+
134
+ bytes4[][] memory selectors = new bytes4[][](2);
135
+ selectors[0] = new bytes4[](1);
136
+ selectors[1] = new bytes4[](1);
137
+
138
+ selectors[0][0] = IPoolComponent.setFees.selector;
139
+ selectors[1][0] = IPoolComponent.verifyApplication.selector;
140
+
141
+ RoleId[] memory roles = new RoleId[](2);
142
+ roles[0] = POOL_OWNER_ROLE();
143
+ roles[1] = POLICY_SERVICE_ROLE();
144
+
145
+ getInstanceService().createGifTarget(
146
+ instanceNftId,
147
+ poolAddress,
148
+ pool.getName(),
149
+ selectors,
150
+ roles);
151
+ }
152
+
153
+
154
+ function setMaxCapitalAmount(uint256 maxCapitalAmount)
155
+ external
156
+ virtual
157
+ {
158
+ (IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
159
+ InstanceReader instanceReader = instance.getInstanceReader();
160
+ NftId poolNftId = registryInfo.nftId;
161
+
162
+ IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
163
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
164
+ uint256 previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
165
+
166
+ poolInfo.maxCapitalAmount = maxCapitalAmount;
167
+ componentInfo.data = abi.encode(poolInfo);
168
+ instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
169
+
170
+ emit LogPoolServiceMaxCapitalAmountUpdated(poolNftId, previousMaxCapitalAmount, maxCapitalAmount);
88
171
  }
89
172
 
173
+ function setBundleOwnerRole(RoleId bundleOwnerRole)
174
+ external
175
+ virtual
176
+ {
177
+ (IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
178
+ InstanceReader instanceReader = instance.getInstanceReader();
179
+ NftId poolNftId = registryInfo.nftId;
180
+
181
+ IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
182
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
183
+
184
+ // bundle owner role may only be set once per pool
185
+ if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
186
+ revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
187
+ }
188
+
189
+ poolInfo.bundleOwnerRole = bundleOwnerRole;
190
+ componentInfo.data = abi.encode(poolInfo);
191
+ instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
192
+
193
+ emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
194
+ }
195
+
196
+
90
197
  function setFees(
91
198
  Fee memory poolFee,
92
199
  Fee memory stakingFee,
93
200
  Fee memory performanceFee
94
201
  )
95
202
  external
96
- override
203
+ virtual
97
204
  {
98
- (IRegistry.ObjectInfo memory poolInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
205
+ (IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
99
206
  InstanceReader instanceReader = instance.getInstanceReader();
100
- NftId poolNftId = poolInfo.nftId;
101
-
102
- ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
103
- poolSetupInfo.poolFee = poolFee;
104
- poolSetupInfo.stakingFee = stakingFee;
105
- poolSetupInfo.performanceFee = performanceFee;
106
-
107
- instance.updatePoolSetup(poolNftId, poolSetupInfo, KEEP_STATE());
207
+ NftId poolNftId = registryInfo.nftId;
208
+
209
+ IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
210
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
211
+
212
+ poolInfo.poolFee = poolFee;
213
+ poolInfo.stakingFee = stakingFee;
214
+ poolInfo.performanceFee = performanceFee;
215
+ componentInfo.data = abi.encode(poolInfo);
216
+ instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
217
+
218
+ // TODO add logging
108
219
  }
109
220
  }
@@ -16,7 +16,7 @@ contract PoolServiceManager is ProxyManager {
16
16
  constructor(
17
17
  address registryAddress
18
18
  )
19
- ProxyManager()
19
+ ProxyManager(registryAddress)
20
20
  {
21
21
  PoolService poolSrv = new PoolService();
22
22
  bytes memory data = abi.encode(registryAddress, address(this));
@@ -60,11 +60,11 @@ contract ProductService is ComponentService, IProductService {
60
60
  address initialOwner;
61
61
  (registryAddress, initialOwner) = abi.decode(data, (address, address));
62
62
 
63
- _initializeService(registryAddress, owner);
63
+ initializeService(registryAddress, owner);
64
64
 
65
- _poolService = IPoolService(_registry.getServiceAddress(POOL(), getMajorVersion()));
65
+ _poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getMajorVersion()));
66
66
 
67
- _registerInterface(type(IProductService).interfaceId);
67
+ registerInterface(type(IProductService).interfaceId);
68
68
  }
69
69
 
70
70
 
@@ -102,8 +102,8 @@ contract ProductService is ComponentService, IProductService {
102
102
  {
103
103
  // wire distribution and pool components to product component
104
104
  ISetup.ProductSetupInfo memory setup = product.getSetupInfo();
105
- IComponent distribution = IComponent(_registry.getObjectInfo(setup.distributionNftId).objectAddress);
106
- IComponent pool = IComponent(_registry.getObjectInfo(setup.poolNftId).objectAddress);
105
+ IComponent distribution = IComponent(getRegistry().getObjectInfo(setup.distributionNftId).objectAddress);
106
+ IComponent pool = IComponent(getRegistry().getObjectInfo(setup.poolNftId).objectAddress);
107
107
 
108
108
  distribution.setProductNftId(productNftId);
109
109
  pool.setProductNftId(productNftId);
@@ -113,11 +113,20 @@ contract ProductService is ComponentService, IProductService {
113
113
  // create product setup in instance
114
114
  instance.createProductSetup(productNftId, product.getSetupInfo());
115
115
 
116
+ bytes4[][] memory selectors = new bytes4[][](1);
117
+ selectors[0] = new bytes4[](1);
118
+ selectors[0][0] = IProductComponent.setFees.selector;
119
+
120
+ RoleId[] memory roles = new RoleId[](1);
121
+ roles[0] = PRODUCT_OWNER_ROLE();
122
+
116
123
  // create target for instane access manager
117
- getInstanceService().createTarget(
118
- _registry.getNftId(address(instance)),
124
+ getInstanceService().createGifTarget(
125
+ getRegistry().getNftId(address(instance)),
119
126
  address(product),
120
- product.getName());
127
+ product.getName(),
128
+ selectors,
129
+ roles);
121
130
  }
122
131
 
123
132
  function getDomain() public pure override(IService, Service) returns(ObjectType) {
@@ -139,13 +148,13 @@ contract ProductService is ComponentService, IProductService {
139
148
  // revert WalletIsZero();
140
149
  // }
141
150
 
142
- // IRegistry.ObjectInfo memory tokenInfo = _registry.getObjectInfo(address(info.token));
151
+ // IRegistry.ObjectInfo memory tokenInfo = getRegistry().getObjectInfo(address(info.token));
143
152
 
144
153
  // if(tokenInfo.objectType != TOKEN()) {
145
154
  // revert InvalidToken();
146
155
  // }
147
156
 
148
- // IRegistry.ObjectInfo memory poolInfo = _registry.getObjectInfo(info.poolNftId);
157
+ // IRegistry.ObjectInfo memory poolInfo = getRegistry().getObjectInfo(info.poolNftId);
149
158
 
150
159
  // if(poolInfo.objectType != POOL()) {
151
160
  // revert InvalidPool();
@@ -159,7 +168,7 @@ contract ProductService is ComponentService, IProductService {
159
168
  // //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
160
169
  // // TODO pool is not linked
161
170
 
162
- // IRegistry.ObjectInfo memory distributionInfo = _registry.getObjectInfo(info.distributionNftId);
171
+ // IRegistry.ObjectInfo memory distributionInfo = getRegistry().getObjectInfo(info.distributionNftId);
163
172
 
164
173
  // if(distributionInfo.objectType != DISTRIBUTION()) {
165
174
  // revert InvalidDistribution();
@@ -16,7 +16,7 @@ contract ProductServiceManager is ProxyManager {
16
16
  constructor(
17
17
  address registryAddress
18
18
  )
19
- ProxyManager()
19
+ ProxyManager(registryAddress)
20
20
  {
21
21
  ProductService svc = new ProductService();
22
22
  bytes memory data = abi.encode(registryAddress, address(this));
@@ -39,7 +39,7 @@ contract ProductServiceManager is ProxyManager {
39
39
  // address(_productService));
40
40
 
41
41
  // implies that after this constructor call only upgrade functionality is available
42
- _isDeployed = true;
42
+ // _isDeployed = true;
43
43
  }
44
44
 
45
45
  //--- view functions ----------------------------------------------------//
@@ -95,6 +95,10 @@ contract ChainNft is ERC721Enumerable {
95
95
 
96
96
  _totalMinted++;
97
97
  _safeMint(to, tokenId);
98
+
99
+ if(interceptor != address(0)) {
100
+ ITransferInterceptor(interceptor).nftMint(to, tokenId);
101
+ }
98
102
  }
99
103
 
100
104
 
@@ -195,6 +199,10 @@ contract ChainNft is ERC721Enumerable {
195
199
  _chainIdDigits;
196
200
  }
197
201
 
202
+ function getNextTokenId() external view returns (uint256) {
203
+ return calculateTokenId(_idNext);
204
+ }
205
+
198
206
  function _getNextTokenId() private returns (uint256 id) {
199
207
  id = calculateTokenId(_idNext);
200
208
  _idNext++;
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
 
6
- import {ChainNft} from "./ChainNft.sol";
7
6
  import {NftId} from "../types/NftId.sol";
8
7
  import {ObjectType} from "../types/ObjectType.sol";
9
8
  import {VersionPart} from "../types/Version.sol";
@@ -85,6 +84,8 @@ interface IRegistry is IERC165 {
85
84
 
86
85
  function isRegisteredService(address contractAddress) external view returns (bool);
87
86
 
87
+ function isRegisteredComponent(address object) external view returns (bool);
88
+
88
89
  function isValidRelease(VersionPart version) external view returns (bool);
89
90
 
90
91
  function getServiceAddress(
@@ -92,7 +93,9 @@ interface IRegistry is IERC165 {
92
93
  VersionPart releaseVersion
93
94
  ) external view returns (address serviceAddress);
94
95
 
95
- function getChainNft() external view returns (ChainNft);
96
+ function getReleaseManagerAddress() external view returns (address);
97
+
98
+ function getChainNftAddress() external view returns (address);
96
99
 
97
100
  function getOwner() external view returns (address);
98
101
  }
@@ -35,18 +35,18 @@ interface IRegistryService is
35
35
  struct FunctionConfig
36
36
  {
37
37
  ObjectType serviceDomain;
38
- bytes4 selector;
38
+ bytes4[] selectors;
39
39
  }
40
40
 
41
- function getFunctionConfigs()
42
- external
43
- pure
44
- returns(
45
- FunctionConfig[] memory config
46
- );
41
+ function getFunctionConfigs()
42
+ external
43
+ pure
44
+ returns(
45
+ FunctionConfig[] memory config
46
+ );
47
47
 
48
48
  // TODO used by service -> add owner arg
49
- function registerInstance(IRegisterable instance, address owner)
49
+ function registerInstance(IRegisterable instance, address owner)
50
50
  external returns(IRegistry.ObjectInfo memory info);
51
51
 
52
52
  function registerProduct(IComponent product, address owner)
@@ -58,6 +58,8 @@ interface IRegistryService is
58
58
  function registerDistribution(IComponent distribution, address owner)
59
59
  external returns(IRegistry.ObjectInfo memory info);
60
60
 
61
+ function registerDistributor(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
62
+
61
63
  function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
62
64
 
63
65
  function registerBundle(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
@@ -2,5 +2,6 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  interface ITransferInterceptor {
5
+ function nftMint(address to, uint256 tokenId) external;
5
6
  function nftTransferFrom(address from, address to, uint256 tokenId) external;
6
7
  }
@@ -1,12 +1,11 @@
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
5
 
5
6
  import {NftId, toNftId, zeroNftId} from "../types/NftId.sol";
6
7
  import {VersionPart} from "../types/Version.sol";
7
- import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
8
-
9
- import {ERC165} from "../shared/ERC165.sol";
8
+ import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, DISTRIBUTION, DISTRIBUTOR, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
10
9
 
11
10
  import {ChainNft} from "./ChainNft.sol";
12
11
  import {IRegistry} from "./IRegistry.sol";
@@ -23,7 +22,6 @@ import {ReleaseManager} from "./ReleaseManager.sol";
23
22
  // 4) state object by regular service (POLICY, BUNDLE, STAKE)
24
23
 
25
24
  contract Registry is
26
- ERC165,
27
25
  IRegistry
28
26
  {
29
27
  address public constant NFT_LOCK_ADDRESS = address(0x1);
@@ -75,8 +73,6 @@ contract Registry is
75
73
 
76
74
  // set object types and object parent relations
77
75
  _setupValidCoreTypesAndCombinations();
78
-
79
- _registerInterface(type(IRegistry).interfaceId);
80
76
  }
81
77
 
82
78
  function registerService(
@@ -153,7 +149,6 @@ contract Registry is
153
149
  }
154
150
 
155
151
  if(
156
-
157
152
  parentType == PROTOCOL() ||
158
153
  parentType == REGISTRY() ||
159
154
  parentType == SERVICE()
@@ -190,19 +185,23 @@ contract Registry is
190
185
  return _releaseManager.getReleaseInfo(version);
191
186
  }
192
187
 
193
- function getObjectCount() external view override returns (uint256) {
188
+ function getObjectCount() external view returns (uint256) {
194
189
  return _chainNft.totalSupply();
195
190
  }
196
191
 
192
+ function getReleaseManagerAddress() external view returns (address) {
193
+ return address(_releaseManager);
194
+ }
195
+
197
196
  function getNftId() external view returns (NftId nftId) {
198
197
  return _registryNftId;
199
198
  }
200
199
 
201
- function getNftId(address object) external view override returns (NftId id) {
200
+ function getNftId(address object) external view returns (NftId id) {
202
201
  return _nftIdByAddress[object];
203
202
  }
204
203
 
205
- function ownerOf(NftId nftId) public view override returns (address) {
204
+ function ownerOf(NftId nftId) public view returns (address) {
206
205
  return _chainNft.ownerOf(nftId.toInt());
207
206
  }
208
207
 
@@ -210,26 +209,31 @@ contract Registry is
210
209
  return _chainNft.ownerOf(_nftIdByAddress[contractAddress].toInt());
211
210
  }
212
211
 
213
- function getObjectInfo(NftId nftId) external view override returns (ObjectInfo memory) {
212
+ function getObjectInfo(NftId nftId) external view returns (ObjectInfo memory) {
214
213
  return _info[nftId];
215
214
  }
216
215
 
217
- function getObjectInfo(address object) external view override returns (ObjectInfo memory) {
216
+ function getObjectInfo(address object) external view returns (ObjectInfo memory) {
218
217
  return _info[_nftIdByAddress[object]];
219
218
  }
220
219
 
221
- function isRegistered(NftId nftId) public view override returns (bool) {
220
+ function isRegistered(NftId nftId) public view returns (bool) {
222
221
  return _info[nftId].objectType.gtz();
223
222
  }
224
223
 
225
- function isRegistered(address object) external view override returns (bool) {
224
+ function isRegistered(address object) external view returns (bool) {
226
225
  return _nftIdByAddress[object].gtz();
227
226
  }
228
227
 
229
- function isRegisteredService(address object) external view override returns (bool) {
228
+ function isRegisteredService(address object) external view returns (bool) {
230
229
  return _info[_nftIdByAddress[object]].objectType == SERVICE();
231
230
  }
232
231
 
232
+ function isRegisteredComponent(address object) external view returns (bool) {
233
+ NftId objectParentNftId = _info[_nftIdByAddress[object]].parentNftId;
234
+ return _info[objectParentNftId].objectType == INSTANCE();
235
+ }
236
+
233
237
  function isValidRelease(VersionPart version) external view returns (bool)
234
238
  {
235
239
  return _releaseManager.isValidRelease(version);
@@ -246,14 +250,24 @@ contract Registry is
246
250
  //}
247
251
  }
248
252
 
249
- function getChainNft() external view override returns (ChainNft) {
250
- return _chainNft;
253
+ function getChainNftAddress() external view override returns (address) {
254
+ return address(_chainNft);
251
255
  }
252
256
 
253
257
  function getOwner() public view returns (address owner) {
254
258
  return ownerOf(address(this));
255
259
  }
256
260
 
261
+ // IERC165
262
+
263
+ function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
264
+ if(interfaceId == type(IERC165).interfaceId || interfaceId == type(IRegistry).interfaceId) {
265
+ return true;
266
+ }
267
+
268
+ return false;
269
+ }
270
+
257
271
  // Internals
258
272
 
259
273
  /// @dev registry protects only against tampering existing records, registering with invalid types pairs and 0 parent address
@@ -277,18 +291,9 @@ contract Registry is
277
291
  }
278
292
 
279
293
  address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
294
+ uint256 tokenId = _chainNft.getNextTokenId();
295
+ nftId = toNftId(tokenId);
280
296
 
281
- // TODO does external call
282
- // compute next nftId, do all checks and stores, mint() at most end...
283
- uint256 mintedTokenId = _chainNft.mint(
284
- info.initialOwner,
285
- interceptor,
286
- EMPTY_URI);
287
- nftId = toNftId(mintedTokenId);
288
-
289
- // TODO move nftId out of info struct
290
- // getters by nftId -> return struct without nftId
291
- // getters by address -> return nftId AND struct
292
297
  info.nftId = nftId;
293
298
  _info[nftId] = info;
294
299
 
@@ -304,6 +309,14 @@ contract Registry is
304
309
  }
305
310
 
306
311
  emit LogRegistration(nftId, parentNftId, objectType, info.isInterceptor, info.objectAddress, info.initialOwner);
312
+
313
+ // calls nft receiver(1) and interceptor(2)
314
+ uint256 mintedTokenId = _chainNft.mint(
315
+ info.initialOwner,
316
+ interceptor,
317
+ EMPTY_URI);
318
+ assert(mintedTokenId == tokenId);
319
+
307
320
  }
308
321
 
309
322
  /// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
@@ -442,6 +455,8 @@ contract Registry is
442
455
  _coreContractCombinations[ORACLE()][INSTANCE()] = true;
443
456
  _coreContractCombinations[POOL()][INSTANCE()] = true;
444
457
 
458
+ _coreObjectCombinations[DISTRIBUTOR()][DISTRIBUTION()] = true;
459
+
445
460
  // product as parent, ONLY approved
446
461
  _coreObjectCombinations[POLICY()][PRODUCT()] = true;
447
462