@etherisc/gif-next 0.0.2-a6f9f86-582 → 0.0.2-a7954cc-097

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 (299) hide show
  1. package/README.md +171 -2
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +4 -0
  3. package/artifacts/contracts/{registry/IChainNft.sol/IChainNft.json → components/BaseComponent.sol/BaseComponent.json} +262 -237
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +675 -0
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +156 -0
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +152 -0
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +4 -0
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +275 -0
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +157 -0
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +4 -0
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +842 -0
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +4 -0
  17. package/artifacts/contracts/components/Product.sol/Product.json +775 -0
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
  20. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
  21. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
  22. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
  23. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
  24. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  36. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  39. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
  40. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  41. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  42. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  43. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  44. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  45. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  46. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  47. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
  48. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  49. package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
  50. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +4 -0
  51. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1737 -0
  52. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  53. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
  54. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
  55. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +570 -0
  56. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  57. package/artifacts/contracts/instance/Instance.sol/Instance.json +465 -950
  58. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  59. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +244 -114
  60. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  61. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
  62. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
  63. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1422 -0
  64. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +871 -25
  66. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
  67. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +460 -0
  68. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  69. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
  70. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
  71. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +532 -0
  72. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  73. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
  74. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  75. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +0 -77
  76. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  77. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  78. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +10 -244
  79. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  80. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  81. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
  83. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  84. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  85. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  86. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  87. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  88. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  90. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +945 -0
  91. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  92. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +432 -0
  93. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +4 -0
  94. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +814 -0
  95. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  96. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +693 -0
  97. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  98. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +420 -0
  99. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  100. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
  101. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +4 -0
  102. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +466 -0
  103. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
  104. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +446 -0
  105. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  106. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
  107. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
  108. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +499 -0
  109. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
  110. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +536 -0
  111. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  112. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +993 -0
  113. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  114. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
  115. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  116. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +727 -0
  117. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  118. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +420 -0
  119. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  120. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +777 -0
  121. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  122. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
  123. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  124. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
  125. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  126. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +150 -70
  127. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  128. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +259 -28
  129. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  130. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  131. package/artifacts/contracts/registry/Registry.sol/Registry.json +125 -212
  132. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  133. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  134. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  135. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +271 -89
  136. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  137. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +57 -82
  138. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  139. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +546 -0
  140. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  141. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +397 -0
  142. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  143. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  144. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  145. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  146. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  147. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  148. package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +14 -14
  149. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  150. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  151. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  152. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  153. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  154. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  155. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -6
  156. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
  157. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +442 -0
  158. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  159. package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → shared/Service.sol/Service.json} +15 -15
  160. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  161. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  162. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  163. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  164. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  165. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  166. package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
  167. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  168. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +6 -6
  169. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  170. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +111 -5
  171. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  172. package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
  173. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  174. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
  175. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  176. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  177. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  178. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  179. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  180. package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
  181. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  182. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
  187. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  188. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  190. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  191. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  192. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  194. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  195. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  196. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  197. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  198. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  199. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  200. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
  201. package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
  202. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
  203. package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
  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 +22 -3
  208. package/contracts/components/BaseComponent.sol +159 -0
  209. package/contracts/components/Distribution.sol +163 -0
  210. package/contracts/components/IBaseComponent.sol +17 -2
  211. package/contracts/components/IDistributionComponent.sol +44 -0
  212. package/contracts/components/IPoolComponent.sol +66 -0
  213. package/contracts/components/IProductComponent.sol +35 -0
  214. package/contracts/components/Pool.sol +271 -0
  215. package/contracts/components/Product.sol +292 -0
  216. package/contracts/experiment/cloning/Cloner.sol +47 -0
  217. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
  218. package/contracts/instance/BundleManager.sol +129 -0
  219. package/contracts/instance/Cloneable.sol +46 -0
  220. package/contracts/instance/IInstance.sol +62 -0
  221. package/contracts/instance/IInstanceBase.sol +26 -0
  222. package/contracts/instance/IInstanceService.sol +40 -0
  223. package/contracts/instance/Instance.sol +89 -203
  224. package/contracts/instance/InstanceAccessManager.sol +96 -81
  225. package/contracts/instance/InstanceBase.sol +41 -0
  226. package/contracts/instance/InstanceReader.sol +315 -0
  227. package/contracts/instance/InstanceService.sol +327 -22
  228. package/contracts/instance/InstanceServiceManager.sol +54 -0
  229. package/contracts/instance/ObjectManager.sol +101 -0
  230. package/contracts/instance/base/ComponentServiceBase.sol +82 -0
  231. package/contracts/instance/base/IInstanceBase.sol +23 -0
  232. package/contracts/instance/base/IKeyValueStore.sol +5 -4
  233. package/contracts/instance/base/KeyValueStore.sol +4 -20
  234. package/contracts/instance/module/IAccess.sol +29 -19
  235. package/contracts/instance/module/IBundle.sol +1 -0
  236. package/contracts/instance/module/ISetup.sol +6 -1
  237. package/contracts/instance/module/ITreasury.sol +1 -1
  238. package/contracts/instance/service/BundleService.sol +260 -0
  239. package/contracts/instance/service/BundleServiceManager.sol +51 -0
  240. package/contracts/instance/service/ComponentOwnerService.sol +315 -0
  241. package/contracts/instance/service/DistributionService.sol +113 -0
  242. package/contracts/instance/service/DistributionServiceManager.sol +51 -0
  243. package/contracts/instance/service/IBundleService.sol +45 -0
  244. package/contracts/instance/service/IComponentOwnerService.sol +20 -0
  245. package/contracts/instance/service/IDistributionService.sol +12 -0
  246. package/contracts/instance/service/IPolicyService.sol +87 -0
  247. package/contracts/instance/service/IPoolService.sol +20 -0
  248. package/contracts/instance/service/IProductService.sol +40 -0
  249. package/contracts/instance/service/PolicyService.sol +503 -0
  250. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  251. package/contracts/instance/service/PoolService.sol +124 -0
  252. package/contracts/instance/service/PoolServiceManager.sol +51 -0
  253. package/contracts/instance/service/ProductService.sol +170 -0
  254. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  255. package/contracts/registry/ChainNft.sol +41 -26
  256. package/contracts/registry/IRegistry.sol +43 -25
  257. package/contracts/registry/IRegistryService.sol +53 -24
  258. package/contracts/registry/Registry.sol +212 -307
  259. package/contracts/registry/RegistryAccessManager.sol +210 -0
  260. package/contracts/registry/RegistryService.sol +158 -204
  261. package/contracts/registry/RegistryServiceManager.sol +28 -9
  262. package/contracts/registry/ReleaseManager.sol +348 -0
  263. package/contracts/registry/TokenRegistry.sol +110 -0
  264. package/contracts/shared/ERC165.sol +7 -3
  265. package/contracts/shared/IRegisterable.sol +1 -1
  266. package/contracts/shared/IService.sol +16 -0
  267. package/contracts/shared/NftOwnable.sol +2 -4
  268. package/contracts/shared/ProxyManager.sol +4 -4
  269. package/contracts/shared/Registerable.sol +3 -2
  270. package/contracts/shared/RegisterableUpgradable.sol +16 -0
  271. package/contracts/shared/Service.sol +58 -0
  272. package/contracts/shared/TokenHandler.sol +2 -2
  273. package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
  274. package/contracts/shared/Versionable.sol +1 -1
  275. package/contracts/test/TestFee.sol +2 -2
  276. package/contracts/test/TestRoleId.sol +6 -6
  277. package/contracts/test/TestService.sol +6 -7
  278. package/contracts/types/Fee.sol +3 -3
  279. package/contracts/types/NftIdSet.sol +26 -24
  280. package/contracts/types/RoleId.sol +19 -4
  281. package/contracts/types/StateId.sol +4 -0
  282. package/contracts/types/UFixed.sol +128 -12
  283. package/contracts/types/Version.sol +4 -1
  284. package/package.json +4 -3
  285. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
  286. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
  287. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
  288. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  289. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  290. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
  291. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
  292. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
  293. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
  294. package/contracts/instance/AccessManagedSimple.sol +0 -114
  295. package/contracts/instance/AccessManagerSimple.sol +0 -682
  296. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  297. package/contracts/instance/base/IService.sol +0 -15
  298. package/contracts/instance/base/ServiceBase.sol +0 -44
  299. package/contracts/registry/IChainNft.sol +0 -22
@@ -0,0 +1,124 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {Pool} from "../../components/Pool.sol";
5
+ import {IRegistry} from "../../registry/IRegistry.sol";
6
+ import {IInstance} from "../../instance/IInstance.sol";
7
+ import {IBundle} from "../../instance/module/IBundle.sol";
8
+ import {TokenHandler} from "../../instance/module/ITreasury.sol";
9
+ import {ISetup} from "../module/ISetup.sol";
10
+ import {IPolicy} from "../module/IPolicy.sol";
11
+
12
+ import {IVersionable} from "../../shared/IVersionable.sol";
13
+ import {Versionable} from "../../shared/Versionable.sol";
14
+ import {INftOwnable} from "../../shared/INftOwnable.sol";
15
+
16
+ import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
17
+ import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
18
+ import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
19
+ import {Fee, FeeLib} from "../../types/Fee.sol";
20
+ import {Version, VersionLib} from "../../types/Version.sol";
21
+ import {KEEP_STATE, StateId} from "../../types/StateId.sol";
22
+ import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
23
+
24
+ import {IService} from "../../shared/IService.sol";
25
+ import {Service} from "../../shared/Service.sol";
26
+ import {BundleManager} from "../BundleManager.sol";
27
+ import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
28
+ import {IPoolService} from "./IPoolService.sol";
29
+ import {IRegistryService} from "../../registry/IRegistryService.sol";
30
+ import {InstanceService} from "../InstanceService.sol";
31
+ import {InstanceReader} from "../InstanceReader.sol";
32
+ import {IBaseComponent} from "../../components/IBaseComponent.sol";
33
+
34
+ string constant POOL_SERVICE_NAME = "PoolService";
35
+
36
+ contract PoolService is
37
+ ComponentServiceBase,
38
+ IPoolService
39
+ {
40
+ using NftIdLib for NftId;
41
+
42
+ address internal _registryAddress;
43
+
44
+ function _initialize(
45
+ address owner,
46
+ bytes memory data
47
+ )
48
+ internal
49
+ initializer
50
+ virtual override
51
+ {
52
+ address registryAddress;
53
+ address initialOwner;
54
+ (registryAddress, initialOwner) = abi.decode(data, (address, address));
55
+ // TODO while PoolService is not deployed in PoolServiceManager constructor
56
+ // owner is PoolServiceManager deployer
57
+ _initializeService(registryAddress, owner);
58
+
59
+ _registerInterface(type(IPoolService).interfaceId);
60
+ }
61
+
62
+ function getDomain() public pure override(Service, IService) returns(ObjectType) {
63
+ return POOL();
64
+ }
65
+
66
+ function register(address poolAddress)
67
+ external
68
+ returns(NftId poolNftId)
69
+ {
70
+ address poolOwner = msg.sender;
71
+ IBaseComponent pool = IBaseComponent(poolAddress);
72
+
73
+ IRegistry.ObjectInfo memory info;
74
+ bytes memory data;
75
+ (info, data) = getRegistryService().registerPool(pool, poolOwner);
76
+
77
+ IInstance instance = _getInstance(info.parentNftId);
78
+
79
+ bool hasRole = getInstanceService().hasRole(
80
+ poolOwner,
81
+ POOL_OWNER_ROLE(),
82
+ address(instance));
83
+
84
+ if(!hasRole) {
85
+ revert ExpectedRoleMissing(POOL_OWNER_ROLE(), poolOwner);
86
+ }
87
+
88
+ poolNftId = info.nftId;
89
+ ISetup.PoolSetupInfo memory initialSetup = _decodeAndVerifyPoolSetup(data);
90
+ instance.createPoolSetup(poolNftId, initialSetup);
91
+
92
+ getInstanceService().createTarget(_getInstanceNftId(info), poolAddress, pool.getName());
93
+ }
94
+
95
+ function _decodeAndVerifyPoolSetup(bytes memory data) internal returns(ISetup.PoolSetupInfo memory setup)
96
+ {
97
+ setup = abi.decode(
98
+ data,
99
+ (ISetup.PoolSetupInfo)
100
+ );
101
+
102
+ // TODO add checks if applicable
103
+ }
104
+
105
+ function setFees(
106
+ Fee memory poolFee,
107
+ Fee memory stakingFee,
108
+ Fee memory performanceFee
109
+ )
110
+ external
111
+ override
112
+ {
113
+ (IRegistry.ObjectInfo memory poolInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
114
+ InstanceReader instanceReader = instance.getInstanceReader();
115
+ NftId poolNftId = poolInfo.nftId;
116
+
117
+ ISetup.PoolSetupInfo memory poolSetupInfo = instanceReader.getPoolSetupInfo(poolNftId);
118
+ poolSetupInfo.poolFee = poolFee;
119
+ poolSetupInfo.stakingFee = stakingFee;
120
+ poolSetupInfo.performanceFee = performanceFee;
121
+
122
+ instance.updatePoolSetup(poolNftId, poolSetupInfo, KEEP_STATE());
123
+ }
124
+ }
@@ -0,0 +1,51 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IVersionable} from "../../shared/IVersionable.sol";
5
+ import {ProxyManager} from "../../shared/ProxyManager.sol";
6
+ import {PoolService} from "./PoolService.sol";
7
+ import {Registry} from "../../registry/Registry.sol";
8
+ import {RegistryService} from "../../registry/RegistryService.sol";
9
+ import {REGISTRY} from "../../types/ObjectType.sol";
10
+
11
+ contract PoolServiceManager is ProxyManager {
12
+
13
+ PoolService private _poolService;
14
+
15
+ /// @dev initializes proxy manager with pool service implementation
16
+ constructor(
17
+ address registryAddress
18
+ )
19
+ ProxyManager()
20
+ {
21
+ PoolService poolSrv = new PoolService();
22
+ bytes memory data = abi.encode(registryAddress, address(this));
23
+ IVersionable versionable = deploy(
24
+ address(poolSrv),
25
+ data);
26
+
27
+ _poolService = PoolService(address(versionable));
28
+
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
+ //registryService.registerService(_poolService);
34
+
35
+ // TODO no nft to link yet
36
+ // link ownership of instance service manager ot nft owner of instance service
37
+ //_linkToNftOwnable(
38
+ // address(registryAddress),
39
+ // address(_poolService));
40
+ }
41
+
42
+ //--- view functions ----------------------------------------------------//
43
+ function getPoolService()
44
+ external
45
+ view
46
+ returns (PoolService poolService)
47
+ {
48
+ return _poolService;
49
+ }
50
+
51
+ }
@@ -0,0 +1,170 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {IRegistry} from "../../registry/IRegistry.sol";
5
+ import {IProductComponent} from "../../components/IProductComponent.sol";
6
+ import {Product} from "../../components/Product.sol";
7
+ import {IBaseComponent} from "../../components/IBaseComponent.sol";
8
+ import {IPoolComponent} from "../../components/IPoolComponent.sol";
9
+ import {IDistributionComponent} from "../../components/IDistributionComponent.sol";
10
+ import {IInstance} from "../IInstance.sol";
11
+ import {IPolicy} from "../module/IPolicy.sol";
12
+ import {IRisk} from "../module/IRisk.sol";
13
+ import {IBundle} from "../module/IBundle.sol";
14
+ import {IProductService} from "./IProductService.sol";
15
+ import {ITreasury} from "../module/ITreasury.sol";
16
+ import {ISetup} from "../module/ISetup.sol";
17
+
18
+ import {TokenHandler} from "../../shared/TokenHandler.sol";
19
+
20
+ import {IVersionable} from "../../shared/IVersionable.sol";
21
+ import {Versionable} from "../../shared/Versionable.sol";
22
+
23
+ import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
24
+ import {UFixed, UFixedLib} from "../../types/UFixed.sol";
25
+ import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
26
+ import {ObjectType, PRODUCT, POOL, POLICY} from "../../types/ObjectType.sol";
27
+ import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
28
+ import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
29
+ import {Fee, FeeLib} from "../../types/Fee.sol";
30
+ import {ReferralId} from "../../types/Referral.sol";
31
+ import {RiskId} from "../../types/RiskId.sol";
32
+ import {StateId} from "../../types/StateId.sol";
33
+ import {Version, VersionLib} from "../../types/Version.sol";
34
+ import {RoleId, PRODUCT_OWNER_ROLE} from "../../types/RoleId.sol";
35
+
36
+ import {IService} from "../../shared/IService.sol";
37
+ import {Service} from "../../shared/Service.sol";
38
+ import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
39
+ import {IProductService} from "./IProductService.sol";
40
+ import {InstanceReader} from "../InstanceReader.sol";
41
+ import {IPoolService} from "./PoolService.sol";
42
+
43
+ // TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
44
+ contract ProductService is ComponentServiceBase, IProductService {
45
+ using NftIdLib for NftId;
46
+
47
+ IPoolService internal _poolService;
48
+
49
+ event LogProductServiceSender(address sender);
50
+
51
+ function _initialize(
52
+ address owner,
53
+ bytes memory data
54
+ )
55
+ internal
56
+ initializer
57
+ virtual override
58
+ {
59
+ address registryAddress;
60
+ address initialOwner;
61
+ (registryAddress, initialOwner) = abi.decode(data, (address, address));
62
+
63
+ _initializeService(registryAddress, owner);
64
+
65
+ _poolService = IPoolService(_registry.getServiceAddress(POOL(), getMajorVersion()));
66
+
67
+ _registerInterface(type(IProductService).interfaceId);
68
+ }
69
+
70
+
71
+ function getDomain() public pure override(IService, Service) returns(ObjectType) {
72
+ return PRODUCT();
73
+ }
74
+
75
+ function register(address productAddress)
76
+ external
77
+ returns(NftId productNftId)
78
+ {
79
+ address productOwner = msg.sender;
80
+ IBaseComponent product = IBaseComponent(productAddress);
81
+
82
+ IRegistry.ObjectInfo memory info;
83
+ bytes memory data;
84
+ (info, data) = getRegistryService().registerProduct(product, productOwner);
85
+
86
+ IInstance instance = _getInstance(info.parentNftId);
87
+ bool hasRole = getInstanceService().hasRole(
88
+ productOwner,
89
+ PRODUCT_OWNER_ROLE(),
90
+ address(instance));
91
+
92
+ if(!hasRole) {
93
+ revert ExpectedRoleMissing(PRODUCT_OWNER_ROLE(), productOwner);
94
+ }
95
+
96
+ productNftId = info.nftId;
97
+ ISetup.ProductSetupInfo memory initialSetup = _decodeAndVerifyProductSetup(data);
98
+ instance.createProductSetup(productNftId, initialSetup);
99
+
100
+ getInstanceService().createTarget(_getInstanceNftId(info), productAddress, product.getName());
101
+ }
102
+
103
+ function _decodeAndVerifyProductSetup(bytes memory data) internal returns(ISetup.ProductSetupInfo memory setup)
104
+ {
105
+ setup = abi.decode(
106
+ data,
107
+ (ISetup.ProductSetupInfo)
108
+ );
109
+
110
+ // TODO add checks if applicable
111
+ }
112
+
113
+ function setFees(
114
+ Fee memory productFee,
115
+ Fee memory processingFee
116
+ )
117
+ external
118
+ {
119
+ // TODO check args
120
+
121
+ (
122
+ IRegistry.ObjectInfo memory productInfo,
123
+ IInstance instance
124
+ ) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
125
+
126
+ InstanceReader instanceReader = instance.getInstanceReader();
127
+ NftId productNftId = productInfo.nftId;
128
+ ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(productNftId);
129
+
130
+ productSetupInfo.productFee = productFee;
131
+ productSetupInfo.processingFee = processingFee;
132
+
133
+ instance.updateProductSetup(productNftId, productSetupInfo, KEEP_STATE());
134
+ }
135
+
136
+ function createRisk(
137
+ RiskId riskId,
138
+ bytes memory data
139
+ ) external override {
140
+ (
141
+ IRegistry.ObjectInfo memory productInfo,
142
+ IInstance instance
143
+ ) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
144
+ NftId productNftId = productInfo.nftId;
145
+ IRisk.RiskInfo memory riskInfo = IRisk.RiskInfo(productNftId, data);
146
+ instance.createRisk(
147
+ riskId,
148
+ riskInfo
149
+ );
150
+ }
151
+
152
+ function updateRisk(
153
+ RiskId riskId,
154
+ bytes memory data
155
+ ) external {
156
+ (, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
157
+ InstanceReader instanceReader = instance.getInstanceReader();
158
+ IRisk.RiskInfo memory riskInfo = instanceReader.getRiskInfo(riskId);
159
+ riskInfo.data = data;
160
+ instance.updateRisk(riskId, riskInfo, KEEP_STATE());
161
+ }
162
+
163
+ function updateRiskState(
164
+ RiskId riskId,
165
+ StateId state
166
+ ) external {
167
+ (, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
168
+ instance.updateRiskState(riskId, state);
169
+ }
170
+ }
@@ -0,0 +1,54 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IVersionable} from "../../shared/IVersionable.sol";
5
+ import {ProxyManager} from "../../shared/ProxyManager.sol";
6
+ import {ProductService} from "./ProductService.sol";
7
+ import {Registry} from "../../registry/Registry.sol";
8
+ import {RegistryService} from "../../registry/RegistryService.sol";
9
+ import {VersionLib} from "../../types/Version.sol";
10
+
11
+ contract ProductServiceManager is ProxyManager {
12
+
13
+ ProductService private _productService;
14
+
15
+ /// @dev initializes proxy manager with product service implementation
16
+ constructor(
17
+ address registryAddress
18
+ )
19
+ ProxyManager()
20
+ {
21
+ ProductService svc = new ProductService();
22
+ bytes memory data = abi.encode(registryAddress, address(this));
23
+ IVersionable versionable = deploy(
24
+ address(svc),
25
+ data);
26
+
27
+ _productService = ProductService(address(versionable));
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
33
+ //registryService.registerService(_productService);
34
+
35
+ // TODO no nft to link yet
36
+ // link ownership of instance service manager ot nft owner of instance service
37
+ //_linkToNftOwnable(
38
+ // address(registryAddress),
39
+ // address(_productService));
40
+
41
+ // implies that after this constructor call only upgrade functionality is available
42
+ _isDeployed = true;
43
+ }
44
+
45
+ //--- view functions ----------------------------------------------------//
46
+ function getProductService()
47
+ external
48
+ view
49
+ returns (ProductService productService)
50
+ {
51
+ return _productService;
52
+ }
53
+
54
+ }
@@ -1,19 +1,28 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {ERC721, ERC721Enumerable} from "@openzeppelin5/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
5
- import {IERC721} from "@openzeppelin5/contracts/token/ERC721/IERC721.sol";
4
+ import {ERC721, ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
5
+ import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
6
6
 
7
- import {IChainNft} from "./IChainNft.sol";
8
7
  import {ITransferInterceptor} from "./ITransferInterceptor.sol";
9
8
 
10
- contract ChainNft is ERC721Enumerable, IChainNft {
11
- string public constant NAME = "Dezentralized Insurance Protocol Registry";
12
- string public constant SYMBOL = "DIPR";
9
+ contract ChainNft is ERC721Enumerable {
10
+
11
+ // constants
12
+ string public constant NAME = "Dezentralized Insurance Protocol NFT";
13
+ string public constant SYMBOL = "DIPNFT";
13
14
 
14
15
  uint256 public constant PROTOCOL_NFT_ID = 1101;
15
16
  uint256 public constant GLOBAL_REGISTRY_ID = 2101;
16
17
 
18
+ // custom errors
19
+ error CallerNotRegistry(address caller);
20
+ error RegistryAddressZero();
21
+ error NftUriEmpty();
22
+ error NftUriAlreadySet();
23
+
24
+ // contract state
25
+
17
26
  // remember interceptors
18
27
  mapping(uint256 tokenId => address interceptor) private _interceptor;
19
28
 
@@ -31,19 +40,26 @@ contract ChainNft is ERC721Enumerable, IChainNft {
31
40
  uint256 internal _totalMinted;
32
41
 
33
42
  modifier onlyRegistry() {
34
- require(msg.sender == _registry, "ERROR:NFT-001:CALLER_NOT_REGISTRY");
43
+ if (msg.sender != _registry) { revert CallerNotRegistry(msg.sender); }
35
44
  _;
36
45
  }
37
46
 
38
47
  constructor(address registry) ERC721(NAME, SYMBOL) {
39
- require(registry != address(0), "ERROR:NFT-010:REGISTRY_ZERO");
48
+ if (registry == address(0)) { revert RegistryAddressZero(); }
40
49
 
41
50
  _registry = registry;
42
-
43
51
  _chainIdInt = block.chainid;
44
- _chainIdDigits = _countDigits(_chainIdInt);
52
+ _chainIdDigits = 0;
53
+
54
+ // count digis
55
+ uint256 num = _chainIdInt;
56
+ while (num != 0) {
57
+ _chainIdDigits++;
58
+ num /= 10;
59
+ }
60
+
45
61
  _chainIdMultiplier = 10 ** _chainIdDigits;
46
- _idNext = 4;
62
+ _idNext = 3;
47
63
  }
48
64
 
49
65
  /**
@@ -77,8 +93,8 @@ contract ChainNft is ERC721Enumerable, IChainNft {
77
93
  _uri[tokenId] = uri;
78
94
  }
79
95
 
80
- _safeMint(to, tokenId);
81
96
  _totalMinted++;
97
+ _safeMint(to, tokenId);
82
98
  }
83
99
 
84
100
 
@@ -95,7 +111,7 @@ contract ChainNft is ERC721Enumerable, IChainNft {
95
111
  }
96
112
 
97
113
 
98
- function burn(uint256 tokenId) external override onlyRegistry {
114
+ function burn(uint256 tokenId) external onlyRegistry {
99
115
  _requireOwned(tokenId);
100
116
  _burn(tokenId);
101
117
  delete _uri[tokenId];
@@ -104,29 +120,36 @@ contract ChainNft is ERC721Enumerable, IChainNft {
104
120
  function setURI(
105
121
  uint256 tokenId,
106
122
  string memory uri
107
- ) external override onlyRegistry {
108
- require(bytes(uri).length > 0, "ERROR:CRG-011:URI_EMPTY");
123
+ ) external onlyRegistry {
124
+ if (bytes(uri).length == 0) { revert NftUriEmpty(); }
125
+ if (bytes(_uri[tokenId]).length > 0) { revert NftUriAlreadySet(); }
109
126
 
110
127
  _requireOwned(tokenId);
111
128
  _uri[tokenId] = uri;
112
129
  }
113
130
 
114
- function exists(uint256 tokenId) external view override returns (bool) {
131
+ function exists(uint256 tokenId) external view returns (bool) {
115
132
  return _ownerOf(tokenId) != address(0);
116
133
  }
117
134
 
118
135
  function tokenURI(
119
136
  uint256 tokenId
120
137
  ) public view override returns (string memory) {
138
+ // gif generally does not revert for view functions
139
+ // this is an exception to keep the openzeppelin nft semantics
121
140
  _requireOwned(tokenId);
122
141
  return _uri[tokenId];
123
142
  }
124
143
 
125
- function getRegistryAddress() external view override returns (address) {
144
+ function getInterceptor(uint256 tokenId) external view returns (address) {
145
+ return _interceptor[tokenId];
146
+ }
147
+
148
+ function getRegistryAddress() external view returns (address) {
126
149
  return _registry;
127
150
  }
128
151
 
129
- function totalMinted() external view override returns (uint256) {
152
+ function totalMinted() external view returns (uint256) {
130
153
  return _totalMinted;
131
154
  }
132
155
 
@@ -176,12 +199,4 @@ contract ChainNft is ERC721Enumerable, IChainNft {
176
199
  id = calculateTokenId(_idNext);
177
200
  _idNext++;
178
201
  }
179
-
180
- function _countDigits(uint256 num) private pure returns (uint256 count) {
181
- count = 0;
182
- while (num != 0) {
183
- count++;
184
- num /= 10;
185
- }
186
- }
187
202
  }
@@ -1,20 +1,31 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IERC165} from "@openzeppelin5/contracts/utils/introspection/IERC165.sol";
4
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
 
6
+ import {ChainNft} from "./ChainNft.sol";
6
7
  import {NftId} from "../types/NftId.sol";
7
8
  import {ObjectType} from "../types/ObjectType.sol";
8
9
  import {VersionPart} from "../types/Version.sol";
9
- import {IChainNft} from "./IChainNft.sol";
10
+ import {Timestamp} from "../types/Timestamp.sol";
10
11
 
11
12
  interface IRegistry is IERC165 {
12
13
 
13
- event LogRegistration(NftId indexed nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner);
14
+ event LogRegistration(NftId nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner);
15
+ event LogServiceRegistration(VersionPart majorVersion, ObjectType domain);
14
16
 
15
- event LogServiceNameRegistration(string serviceName, VersionPart majorVersion);
17
+ // register()
18
+ error CallerNotRegistryService();
19
+ error ServiceRegistration();
16
20
 
17
- event LogApproval(NftId indexed nftId, ObjectType objectType);
21
+ // registerService()
22
+ error CallerNotReleaseManager();
23
+ error ServiceAlreadyRegistered(address service);
24
+
25
+ // _register()
26
+ error ZeroParentAddress();
27
+ error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
28
+ error ContractAlreadyRegistered(address objectAddress);
18
29
 
19
30
  struct ObjectInfo {
20
31
  NftId nftId;
@@ -25,27 +36,34 @@ interface IRegistry is IERC165 {
25
36
  address initialOwner;
26
37
  bytes data;
27
38
  }// TODO delete nftId and initialOwner(if not used) from struct
39
+ // TODO strong disagree, keep nftId there (lets keep get object info return object consistent)
40
+
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);
28
52
 
29
53
  function register(ObjectInfo memory info) external returns (NftId nftId);
30
-
31
- function registerFrom(
32
- address from,
33
- ObjectInfo memory info
34
- ) external returns (NftId nftId);
35
-
36
- function approve(
37
- NftId registrar,
38
- ObjectType object,
39
- ObjectType parent
40
- ) external;
41
-
42
- function allowance(
43
- NftId registrar,
44
- ObjectType object
45
- ) external view returns (bool);
54
+
55
+ function getMajorVersionMin() external view returns (VersionPart);
56
+
57
+ function getMajorVersionMax() external view returns (VersionPart);
58
+
59
+ function getMajorVersion() external view returns (VersionPart);
60
+
61
+ function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory);
46
62
 
47
63
  function getObjectCount() external view returns (uint256);
48
64
 
65
+ function getNftId() external view returns (NftId nftId);
66
+
49
67
  function getNftId(address objectAddress) external view returns (NftId nftId);
50
68
 
51
69
  function ownerOf(NftId nftId) external view returns (address);
@@ -60,14 +78,14 @@ interface IRegistry is IERC165 {
60
78
 
61
79
  function isRegistered(address contractAddress) external view returns (bool);
62
80
 
63
- function getServiceName(NftId nftId) external view returns (string memory name);
81
+ function isRegisteredService(address contractAddress) external view returns (bool);
64
82
 
65
83
  function getServiceAddress(
66
- string memory serviceName,
67
- VersionPart majorVersion
84
+ ObjectType serviceDomain,
85
+ VersionPart releaseVersion
68
86
  ) external view returns (address serviceAddress);
69
87
 
70
- function getChainNft() external view returns (IChainNft);
88
+ function getChainNft() external view returns (ChainNft);
71
89
 
72
90
  function getOwner() external view returns (address);
73
91
  }