@etherisc/gif-next 0.0.2-b9e9dc3-713 → 0.0.2-bb7b80e-316

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. package/README.md +67 -1
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  3. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +179 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +166 -90
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +141 -0
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +28 -2
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +198 -119
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +178 -146
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  32. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
  36. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  37. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  38. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  39. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  40. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  41. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  42. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
  43. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
  44. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
  45. package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
  46. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  47. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1478 -28
  48. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  49. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
  50. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +162 -13
  52. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  53. package/artifacts/contracts/instance/Instance.sol/Instance.json +175 -625
  54. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +244 -114
  56. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  57. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
  58. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  59. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +202 -37
  60. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  61. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +308 -48
  62. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  63. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +57 -21
  64. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  65. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
  66. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  67. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +60 -9
  68. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  69. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  70. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  71. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  72. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  73. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  74. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  75. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  76. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  77. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
  78. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  79. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  80. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  83. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  84. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
  85. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1031 -0
  86. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
  87. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +436 -0
  88. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  89. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +693 -0
  90. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  91. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +420 -0
  92. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
  93. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +720 -0
  94. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
  96. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
  97. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +771 -0
  98. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -77
  100. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -240
  102. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
  103. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1156 -0
  104. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
  105. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +492 -0
  106. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  107. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +727 -0
  108. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  109. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +420 -0
  110. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  111. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +777 -0
  112. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  113. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
  114. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  115. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  116. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  117. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +263 -63
  118. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  119. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +187 -83
  120. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  121. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  122. package/artifacts/contracts/registry/Registry.sol/Registry.json +233 -192
  123. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  124. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  125. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  126. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +31 -97
  127. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  128. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -91
  129. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  130. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +530 -0
  131. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  132. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +397 -0
  133. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  134. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  135. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  136. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  137. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  138. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  139. package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +14 -14
  140. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  141. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  142. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  143. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  144. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  145. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  146. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +4 -4
  147. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
  148. package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/RegisterableUpgradable.sol/RegisterableUpgradable.json} +57 -81
  149. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  150. package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → shared/Service.sol/Service.json} +15 -15
  151. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  152. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  153. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  154. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  155. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  157. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
  158. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  159. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  160. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  161. package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
  162. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  163. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  164. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  165. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  166. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  167. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  168. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  169. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  174. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  175. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  176. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  177. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  179. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  183. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  185. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  188. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  190. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
  192. package/contracts/components/BaseComponent.sol +99 -17
  193. package/contracts/components/Distribution.sol +15 -27
  194. package/contracts/components/IBaseComponent.sol +12 -1
  195. package/contracts/components/IDistributionComponent.sol +1 -0
  196. package/contracts/components/IPoolComponent.sol +5 -1
  197. package/contracts/components/IProductComponent.sol +2 -2
  198. package/contracts/components/Pool.sol +45 -46
  199. package/contracts/components/Product.sol +56 -58
  200. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
  201. package/contracts/instance/BundleManager.sol +129 -0
  202. package/contracts/instance/Cloneable.sol +46 -0
  203. package/contracts/instance/IInstance.sol +41 -9
  204. package/contracts/instance/IInstanceBase.sol +25 -0
  205. package/contracts/instance/IInstanceService.sol +30 -7
  206. package/contracts/instance/Instance.sol +62 -236
  207. package/contracts/instance/InstanceAccessManager.sol +93 -78
  208. package/contracts/instance/InstanceBase.sol +39 -0
  209. package/contracts/instance/InstanceReader.sol +36 -1
  210. package/contracts/instance/InstanceService.sol +295 -52
  211. package/contracts/instance/InstanceServiceManager.sol +10 -12
  212. package/contracts/instance/ObjectManager.sol +101 -0
  213. package/contracts/instance/base/ComponentServiceBase.sol +49 -22
  214. package/contracts/instance/base/IInstanceBase.sol +0 -2
  215. package/contracts/instance/module/IAccess.sol +27 -17
  216. package/contracts/instance/module/IBundle.sol +1 -0
  217. package/contracts/instance/module/ISetup.sol +3 -0
  218. package/contracts/instance/service/BundleService.sol +294 -0
  219. package/contracts/instance/service/BundleServiceManager.sol +51 -0
  220. package/contracts/instance/service/DistributionService.sol +120 -0
  221. package/contracts/instance/service/DistributionServiceManager.sol +51 -0
  222. package/contracts/instance/service/IBundleService.sol +44 -0
  223. package/contracts/instance/service/IDistributionService.sol +1 -1
  224. package/contracts/instance/service/IPolicyService.sol +94 -0
  225. package/contracts/instance/service/IPoolService.sol +7 -24
  226. package/contracts/instance/service/IProductService.sol +7 -74
  227. package/contracts/instance/service/PolicyService.sol +539 -0
  228. package/contracts/instance/service/PolicyServiceManager.sol +54 -0
  229. package/contracts/instance/service/PoolService.sol +145 -0
  230. package/contracts/instance/service/PoolServiceManager.sol +51 -0
  231. package/contracts/instance/service/ProductService.sol +213 -0
  232. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  233. package/contracts/registry/ChainNft.sol +1 -1
  234. package/contracts/registry/IRegistry.sol +40 -6
  235. package/contracts/registry/IRegistryService.sol +53 -30
  236. package/contracts/registry/Registry.sol +172 -199
  237. package/contracts/registry/RegistryAccessManager.sol +210 -0
  238. package/contracts/registry/RegistryService.sol +88 -208
  239. package/contracts/registry/RegistryServiceManager.sol +20 -22
  240. package/contracts/registry/ReleaseManager.sol +342 -0
  241. package/contracts/registry/TokenRegistry.sol +110 -0
  242. package/contracts/shared/ERC165.sol +6 -2
  243. package/contracts/shared/IService.sol +16 -0
  244. package/contracts/shared/NftOwnable.sol +2 -4
  245. package/contracts/shared/ProxyManager.sol +1 -1
  246. package/contracts/shared/Registerable.sol +1 -0
  247. package/contracts/shared/RegisterableUpgradable.sol +16 -0
  248. package/contracts/shared/Service.sol +58 -0
  249. package/contracts/test/TestService.sol +6 -7
  250. package/contracts/types/NftIdSet.sol +26 -24
  251. package/contracts/types/RoleId.sol +14 -6
  252. package/contracts/types/StateId.sol +4 -0
  253. package/contracts/types/Version.sol +4 -1
  254. package/package.json +1 -1
  255. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
  256. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
  257. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
  258. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  259. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  260. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
  261. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
  262. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  263. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  264. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  265. package/contracts/instance/AccessManagedSimple.sol +0 -114
  266. package/contracts/instance/AccessManagerSimple.sol +0 -682
  267. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  268. package/contracts/instance/base/IService.sol +0 -15
  269. package/contracts/instance/base/ServiceBase.sol +0 -44
  270. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  271. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
@@ -9,6 +9,7 @@ import {Registry} from "./Registry.sol";
9
9
  import {IVersionable} from "../shared/IVersionable.sol";
10
10
  import {ProxyManager} from "../shared/ProxyManager.sol";
11
11
  import {RegistryService} from "./RegistryService.sol";
12
+ import {TokenRegistry} from "./TokenRegistry.sol";
12
13
 
13
14
 
14
15
  contract RegistryServiceManager is
@@ -16,36 +17,41 @@ contract RegistryServiceManager is
16
17
  {
17
18
  bytes32 constant public ACCESS_MANAGER_CREATION_CODE_HASH = 0x0;
18
19
 
19
- RegistryService private _registryService;
20
-
21
- AccessManager private _accessManager;
20
+ RegistryService private immutable _registryService;
22
21
 
23
22
  /// @dev initializes proxy manager with registry service implementation and deploys registry
24
23
  constructor(
25
- address accessManager
26
- )
24
+ address initialAuthority, // used by implementation
25
+ address registry) // used by implementation
27
26
  ProxyManager()
28
27
  {
29
- _accessManager = AccessManager(accessManager);
30
-
31
- bytes memory initializationData = abi.encode(accessManager, type(Registry).creationCode);
28
+ require(initialAuthority > address(0), "RegistryServiceManager: initial authority is 0");
29
+ require(registry > address(0), "RegistryServiceManager: registry is 0");
30
+
31
+ // implementation's initializer func `data` argument
32
+ bytes memory initializationData = abi.encode(
33
+ initialAuthority,
34
+ registry);
32
35
 
33
36
  IVersionable versionable = deploy(
34
37
  address(new RegistryService()),
35
38
  initializationData);
36
39
 
37
40
  _registryService = RegistryService(address(versionable));
41
+ }
38
42
 
39
- // link ownership of registry service manager ot nft owner of registry service
40
- _linkToNftOwnable(
41
- address(_registryService.getRegistry()),
42
- address(_registryService));
43
+ // from IRegisterable
43
44
 
44
- // implies that after this constructor call only upgrade functionality is available
45
- _isDeployed = true;
45
+ // IMPORTANT: registry here and in constructor MUST be the same
46
+ function linkToNftOwnable(address registry)
47
+ public
48
+ onlyOwner
49
+ {
50
+ _linkToNftOwnable(registry, address(_registryService));
46
51
  }
47
52
 
48
53
  //--- view functions ----------------------------------------------------//
54
+
49
55
  function getRegistryService()
50
56
  external
51
57
  view
@@ -53,12 +59,4 @@ contract RegistryServiceManager is
53
59
  {
54
60
  return _registryService;
55
61
  }
56
-
57
- function getAccessManager()
58
- external
59
- view
60
- returns (AccessManager)
61
- {
62
- return _accessManager;
63
- }
64
62
  }
@@ -0,0 +1,342 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManaged.sol";
5
+
6
+ import {NftId} from "../types/NftId.sol";
7
+ import {RoleId} from "../types/RoleId.sol";
8
+ import {ObjectType, ObjectTypeLib, zeroObjectType, REGISTRY, SERVICE} from "../types/ObjectType.sol";
9
+ import {VersionPart, VersionPartLib} from "../types/Version.sol";
10
+ import {Timestamp, TimestampLib} from "../types/Timestamp.sol";
11
+
12
+ import {IService} from "../shared/IService.sol";
13
+
14
+ import {IRegistry} from "./IRegistry.sol";
15
+ import {Registry} from "./Registry.sol";
16
+ import {IRegistryService} from "./IRegistryService.sol";
17
+ import {RegistryAccessManager} from "./RegistryAccessManager.sol";
18
+
19
+
20
+ contract ReleaseManager is AccessManaged
21
+ {
22
+ using ObjectTypeLib for ObjectType;
23
+
24
+ event LogReleaseCreation(VersionPart version, IService registryService);
25
+ event LogReleaseActivation(VersionPart version);
26
+
27
+ // createNextRelease
28
+ error NotRegistryService();
29
+ error UnexpectedServiceAuthority(address expected, address found);
30
+
31
+ // registerService
32
+ error NotService();
33
+
34
+ // activateNextRelease
35
+ //error ReleaseNotCreated();
36
+ //error ReleaseRegistrationNotFinished();
37
+
38
+ // _getAndVerifyContractInfo
39
+ error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
40
+ error NotRegisterableOwner(address notOwner);
41
+ error SelfRegistration();
42
+ error RegisterableOwnerIsRegistered();
43
+
44
+ // _verifyServiceInfo
45
+ error UnexpectedServiceVersion(VersionPart expected, VersionPart found);
46
+ error UnexpectedServiceDomain(ObjectType expected, ObjectType found);
47
+
48
+ // _verifyAndStoreConfig
49
+ error ConfigMissing();
50
+ error ConfigServiceDomainInvalid(uint configArrayIndex, ObjectType domain);
51
+ error ConfigSelectorZero(uint configArrayIndex);
52
+ error SelectorAlreadyExists(VersionPart releaseVersion, ObjectType serviceDomain);
53
+
54
+
55
+ RegistryAccessManager private immutable _accessManager;
56
+ IRegistry private immutable _registry;
57
+
58
+ VersionPart _latest;// latest active version
59
+ VersionPart immutable _initial;// first active version
60
+
61
+ mapping(VersionPart version => IRegistry.ReleaseInfo info) _release;
62
+
63
+ mapping(VersionPart version => mapping(ObjectType serviceDomain => bytes4)) _selector; // registry service function selector assigned to domain
64
+
65
+ uint _awaitingRegistration; // "services left to register" counter
66
+
67
+ mapping(address registryService => bool isActive) _active;
68
+
69
+ constructor(
70
+ RegistryAccessManager accessManager,
71
+ VersionPart initialVersion)
72
+ AccessManaged(accessManager.authority())
73
+ {
74
+ require(initialVersion.toInt() > 0, "ReleaseManager: initial version is 0");
75
+
76
+ _accessManager = accessManager;
77
+
78
+ _initial = initialVersion;
79
+
80
+ _registry = new Registry();
81
+ }
82
+
83
+ // TODO deploy proxy and initialize with given implementation instead of using given proxy?
84
+ // IMPORTANT: MUST never be possible to create with access/release manager, token registry
85
+ function createNextRelease(IRegistryService service)
86
+ external
87
+ restricted // GIF_ADMIN_ROLE
88
+ returns(NftId nftId)
89
+ {
90
+ if(!service.supportsInterface(type(IRegistryService).interfaceId)) {
91
+ revert NotRegistryService();
92
+ }
93
+ // TODO unreliable! MUST guarantee the same authority -> how?
94
+ address serviceAuthority = service.authority();
95
+ if(serviceAuthority != authority()) {
96
+ revert UnexpectedServiceAuthority(
97
+ authority(),
98
+ serviceAuthority);
99
+ }
100
+
101
+ (
102
+ IRegistry.ObjectInfo memory info,
103
+ bytes memory data
104
+ ) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
105
+
106
+ VersionPart version = getNextVersion();
107
+ ObjectType domain = REGISTRY();
108
+ _verifyServiceInfo(info, version, domain);
109
+
110
+ _createRelease(data);
111
+
112
+ //setTargetClosed(service, true);
113
+
114
+ nftId = _registry.registerService(info, version, domain);
115
+
116
+ // external call
117
+ service.linkToRegisteredNftId();
118
+
119
+ emit LogReleaseCreation(version, service);
120
+ }
121
+
122
+ // TODO adding service to release -> synchronized with proxy upgrades or simple addServiceToRelease(service, version, selector)?
123
+ // TODO removing service from release? -> set _active to false forever, but keep all other records?
124
+ function registerService(IService service)
125
+ external
126
+ restricted // GIF_MANAGER_ROLE
127
+ returns(NftId nftId)
128
+ {
129
+ if(!service.supportsInterface(type(IService).interfaceId)) {
130
+ revert NotService();
131
+ }
132
+
133
+ (
134
+ IRegistry.ObjectInfo memory info,
135
+ //bytes memory data
136
+ ) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
137
+
138
+ VersionPart version = getNextVersion();
139
+ ObjectType domain = _release[version].domains[_awaitingRegistration];// reversed registration order of services specified in RegistryService config
140
+ _verifyServiceInfo(info, version, domain);
141
+
142
+ // setup and grant unique role if service does registrations
143
+ address registryService = _registry.getServiceAddress(REGISTRY(), version);
144
+ bytes4[] memory selector = new bytes4[](1);
145
+ selector[0] = _selector[version][domain];
146
+ if(selector[0] != 0) {
147
+ _accessManager.setAndGrantUniqueRole(
148
+ address(service),
149
+ registryService,
150
+ selector);
151
+ }
152
+
153
+ _awaitingRegistration--;
154
+
155
+ // activate release
156
+ if(_awaitingRegistration == 0) {
157
+ _latest = version;
158
+ _active[registryService] = true;
159
+
160
+ emit LogReleaseActivation(version);
161
+ }
162
+
163
+ nftId = _registry.registerService(info, version, domain);
164
+
165
+ // external call
166
+ service.linkToRegisteredNftId();
167
+ }
168
+
169
+ /*function activateNextRelease()
170
+ external
171
+ restricted // GIF_ADMIN_ROLE
172
+ {
173
+ VersionPart version = getNextVersion();
174
+ address service = _registry.getServiceAddress(REGISTRY(), version);
175
+
176
+ // release was created
177
+ if(service == address(0)) {
178
+ revert ReleaseNotCreated();
179
+ }
180
+
181
+ // release fully deployed
182
+ if(_awaitingRegistration > 0) {
183
+ revert ReleaseRegistrationNotFinished();
184
+ }
185
+
186
+ //setTargetClosed(service, false);
187
+
188
+ _latest = version;
189
+ _active[service] = true;
190
+
191
+ LogReleaseActivation(version);
192
+ }*/
193
+
194
+ //--- view functions ----------------------------------------------------//
195
+
196
+ function isActiveRegistryService(address service) external view returns(bool)
197
+ {
198
+ return _active[service];
199
+ }
200
+
201
+ function getRegistry() external view returns(address)
202
+ {
203
+ return (address(_registry));
204
+ }
205
+
206
+ function getReleaseInfo(VersionPart version) external view returns(IRegistry.ReleaseInfo memory)
207
+ {
208
+ return _release[version];
209
+ }
210
+
211
+ function getNextVersion() public view returns(VersionPart)
212
+ {
213
+ uint256 latest = _latest.toInt();
214
+
215
+ return latest == 0 ?
216
+ _initial : // no active releases yet
217
+ VersionPartLib.toVersionPart(latest + 1);
218
+ }
219
+
220
+ function getLatestVersion() external view returns(VersionPart) {
221
+ return _latest;
222
+ }
223
+
224
+ function getInitialVersion() external view returns(VersionPart) {
225
+ return _initial;
226
+ }
227
+
228
+ //--- private functions ----------------------------------------------------//
229
+
230
+ function _getAndVerifyContractInfo(
231
+ IService service,
232
+ ObjectType expectedType,
233
+ address expectedOwner // assume always valid, can not be 0
234
+ )
235
+ internal
236
+ view
237
+ returns(
238
+ IRegistry.ObjectInfo memory info,
239
+ bytes memory data
240
+ )
241
+ {
242
+ (info, data) = service.getInitialInfo();
243
+ info.objectAddress = address(service);
244
+ info.isInterceptor = false; // service is never interceptor, at least now
245
+
246
+ if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
247
+ revert UnexpectedRegisterableType(expectedType, info.objectType);
248
+ }
249
+
250
+ address owner = info.initialOwner;
251
+
252
+ if(owner != expectedOwner) { // registerable owner protection
253
+ revert NotRegisterableOwner(expectedOwner);
254
+ }
255
+
256
+ if(owner == address(service)) {
257
+ revert SelfRegistration();
258
+ }
259
+
260
+ /*if(owner == address(0)) { // never 0
261
+ revert();// RegisterableOwnerIsZero();
262
+ }*/
263
+
264
+ if(_registry.isRegistered(owner)) {
265
+ revert RegisterableOwnerIsRegistered();
266
+ }
267
+
268
+ /*NftId parentNftId = info.parentNftId;
269
+ IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
270
+
271
+ if(parentInfo.objectType != parentType) { // parent registration + type
272
+ revert InvalidParent(parentNftId);
273
+ }*/
274
+
275
+ return(info, data);
276
+ }
277
+
278
+ function _verifyServiceInfo(
279
+ IRegistry.ObjectInfo memory info,
280
+ VersionPart expectedVersion,
281
+ ObjectType expectedDomain
282
+ )
283
+ internal
284
+ view
285
+ returns(ObjectType)
286
+ {
287
+ (
288
+ ObjectType domain,
289
+ VersionPart version
290
+ ) = abi.decode(info.data, (ObjectType, VersionPart));
291
+
292
+ if(version != expectedVersion) {
293
+ revert UnexpectedServiceVersion(expectedVersion, version);
294
+ }
295
+
296
+ if(expectedDomain.gtz()) {
297
+ if(domain != expectedDomain) {
298
+ revert UnexpectedServiceDomain(expectedDomain, domain);
299
+ }
300
+ }
301
+
302
+ return domain;
303
+ }
304
+
305
+ // TODO check if registry supports types specified in the config array
306
+ function _createRelease(bytes memory configBytes)
307
+ internal
308
+ {
309
+ VersionPart version = getNextVersion();
310
+ IRegistryService.FunctionConfig[] memory config = abi.decode(configBytes, (IRegistryService.FunctionConfig[]));
311
+
312
+ if(config.length == 0) {
313
+ revert ConfigMissing();
314
+ }
315
+ // always in release
316
+ _release[version].domains.push(REGISTRY());
317
+ for(uint idx = 0; idx < config.length; idx++)
318
+ {
319
+ ObjectType domain = config[idx].serviceDomain;
320
+ bytes4 selector = config[idx].selector;
321
+
322
+ // not "registry service" / zero domain
323
+ if(
324
+ domain == REGISTRY() ||
325
+ domain.eqz()
326
+ ) { revert ConfigServiceDomainInvalid(idx, domain); }
327
+
328
+ // no overwrite
329
+ if(_selector[version][domain] > 0) {
330
+ revert SelectorAlreadyExists(version, domain);
331
+ }
332
+
333
+ _selector[version][domain] = selector;
334
+ _release[version].domains.push(domain);
335
+ }
336
+ // TODO set when activated?
337
+ _release[version].createdAt = TimestampLib.blockTimestamp();
338
+ //_release[version].updatedAt = TimestampLib.blockTimestamp();
339
+
340
+ _awaitingRegistration = config.length;
341
+ }
342
+ }
@@ -0,0 +1,110 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
6
+
7
+ import {IRegisterable} from "../shared/IRegisterable.sol";
8
+ import {IRegistry} from "./IRegistry.sol";
9
+ import {VersionPart} from "../types/Version.sol";
10
+ import {REGISTRY} from "../types/ObjectType.sol";
11
+ import {NftOwnable} from "../shared/NftOwnable.sol";
12
+
13
+ /// @title contract to register token per GIF major release.
14
+ contract TokenRegistry is
15
+ NftOwnable
16
+ {
17
+ event LogRegistered(address token, string symbol, uint256 decimals);
18
+ event LogTokenStateSet(address token, VersionPart majorVersion, bool active);
19
+
20
+ error NotContract(address account);
21
+ error NotToken(address account);
22
+ error TokenDecimalsZero();
23
+ error TokenMajorVersionInvalid(VersionPart majorVersion);
24
+
25
+ address [] internal _token;
26
+ mapping(address token => bool registered) internal _registered;
27
+ mapping(address token => mapping(VersionPart majorVersion => bool isActive)) internal _active;
28
+
29
+ constructor()
30
+ NftOwnable()
31
+ { }
32
+
33
+
34
+ /// @dev link ownership of token registry to nft owner of registry service
35
+ function linkToNftOwnable(address registryAddress)
36
+ external
37
+ onlyOwner
38
+ {
39
+ IRegistry registry = IRegistry(registryAddress);
40
+ // TODO use _latest instead of `next version` -> but _latest is 0 before first release activation
41
+ address registryServiceAddress = registry.getServiceAddress(REGISTRY(), registry.getMajorVersionMax());
42
+
43
+ _linkToNftOwnable(registryAddress, registryServiceAddress);
44
+ }
45
+
46
+ /// @dev token state is informative, registry have no clue about used tokens
47
+ // component owner is responsible for token selection and operations
48
+ // service MUST deny registration of component with inactive token
49
+ function setActive(address token, VersionPart majorVersion, bool active)
50
+ external
51
+ onlyOwner
52
+ {
53
+ // verify that token is registered
54
+ if (!_registered[token]) {
55
+ _registerToken(token);
56
+ }
57
+
58
+ // verify valid major version
59
+ // ensure major version increments is one
60
+ uint256 version = majorVersion.toInt();
61
+ if (version < _registry.getMajorVersionMin().toInt() || version > _registry.getMajorVersionMax().toInt()) {
62
+ revert TokenMajorVersionInvalid(majorVersion);
63
+ }
64
+
65
+ _active[token][majorVersion] = active;
66
+
67
+ emit LogTokenStateSet(token, majorVersion, active);
68
+ }
69
+
70
+ function tokens() external view returns (uint256) {
71
+ return _token.length;
72
+ }
73
+
74
+ function getToken(uint256 idx) external view returns (IERC20Metadata token) {
75
+ return IERC20Metadata(_token[idx]);
76
+ }
77
+
78
+ function isRegistered(address token) external view returns (bool) {
79
+ return _registered[token];
80
+ }
81
+
82
+ function isActive(address token, VersionPart majorVersion) external view returns (bool) {
83
+ return _active[token][majorVersion];
84
+ }
85
+
86
+ /// @dev some sanity checks to prevent unintended registration
87
+ function _registerToken(address token) internal {
88
+
89
+ // MUST be contract
90
+ if(token.code.length == 0) {
91
+ revert NotContract(token);
92
+ }
93
+
94
+ // MUST not be GIF registerable
95
+ if(ERC165Checker.supportsInterface(token, type(IRegisterable).interfaceId)) {
96
+ revert NotToken(token);
97
+ }
98
+
99
+ // MUST have decimals > 0
100
+ IERC20Metadata erc20 = IERC20Metadata(token);
101
+ if(erc20.decimals() == 0) {
102
+ revert TokenDecimalsZero();
103
+ }
104
+
105
+ _registered[token] = true;
106
+ _token.push(token);
107
+
108
+ emit LogRegistered(token, erc20.symbol(), erc20.decimals());
109
+ }
110
+ }
@@ -7,14 +7,18 @@ contract ERC165 is IERC165 {
7
7
  mapping(bytes4 => bool) private _isSupported;
8
8
 
9
9
  constructor() {
10
- // register support for ERC165
11
- _registerInterface(type(IERC165).interfaceId);
10
+ _initializeERC165();
12
11
  }
13
12
 
14
13
  function supportsInterface(bytes4 interfaceId) external view override returns (bool) {
15
14
  return _isSupported[interfaceId];
16
15
  }
17
16
 
17
+ // @dev register support for ERC165 itself
18
+ function _initializeERC165() internal {
19
+ _isSupported[type(IERC165).interfaceId] = true;
20
+ }
21
+
18
22
  function _registerInterface(bytes4 interfaceId) internal {
19
23
  _isSupported[interfaceId] = true;
20
24
  }
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {VersionPart} from "../types/Version.sol";
5
+ import {ObjectType} from "../types/ObjectType.sol";
6
+
7
+ import {IRegisterable} from "./IRegisterable.sol";
8
+ import {IVersionable} from "./IVersionable.sol";
9
+
10
+ interface IService is
11
+ IRegisterable,
12
+ IVersionable
13
+ {
14
+ function getDomain() external pure returns(ObjectType serviceDomain);
15
+ function getMajorVersion() external view returns(VersionPart majorVersion);
16
+ }
@@ -13,10 +13,7 @@ contract NftOwnable is INftOwnable {
13
13
 
14
14
  /// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
15
15
  modifier onlyOwner() {
16
- address owner = getOwner();
17
-
18
- // owner == address(0) is eg uninitialized upgradable contract
19
- if (owner != address(0) && msg.sender != owner) {
16
+ if (msg.sender != getOwner()) {
20
17
  revert ErrorNotOwner(msg.sender);
21
18
  }
22
19
  _;
@@ -77,6 +74,7 @@ contract NftOwnable is INftOwnable {
77
74
  internal
78
75
  virtual
79
76
  {
77
+ require(initialOwner > address(0), "NftOwnable: initial owner is 0");
80
78
  _initialOwner = initialOwner;
81
79
  _setRegistry(registryAddress);
82
80
  }
@@ -38,6 +38,7 @@ contract ProxyManager is
38
38
  returns (IVersionable versionable)
39
39
  {
40
40
  if (_isDeployed) { revert ErrorAlreadyDeployed(); }
41
+ _isDeployed = true;
41
42
 
42
43
  address currentProxyOwner = getOwner(); // used by implementation
43
44
  address initialProxyAdminOwner = address(this); // used by proxy
@@ -49,7 +50,6 @@ contract ProxyManager is
49
50
  data
50
51
  );
51
52
 
52
- _isDeployed = true;
53
53
  versionable = IVersionable(address(_proxy));
54
54
 
55
55
  emit LogProxyDeployed(address(_proxy), initialImplementation);
@@ -49,6 +49,7 @@ contract Registerable is
49
49
  //onlyInitializing//TODO uncomment when "fully" upgradeable
50
50
  virtual
51
51
  {
52
+ _initializeERC165();
52
53
  _initializeNftOwnable(
53
54
  initialOwner,
54
55
  registryAddress);
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {Registerable} from "./Registerable.sol";
5
+ import {Versionable} from "./Versionable.sol";
6
+
7
+ /// @dev base contract for upgradable objects like services and upgradable components
8
+ /// deriving contracs need to call _initializeRegisterable
9
+ /// TODO internalizes versionable here, a non-registerable versionalbe might itself have some value but is outside the scope of the gif
10
+ /// after this merge versionable will no longer exist on its own in gif
11
+ /// only registerable and upgradable (which is a registerable too) will remain
12
+ abstract contract RegisterableUpgradable is
13
+ Registerable,
14
+ Versionable
15
+ {
16
+ }
@@ -0,0 +1,58 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {ObjectType, SERVICE} from "../types/ObjectType.sol";
5
+ import {NftId, zeroNftId} from "../types/NftId.sol";
6
+ import {Version, VersionPart, VersionLib} from "../types/Version.sol";
7
+
8
+ import {Versionable} from "./Versionable.sol";
9
+ import {IService} from "./IService.sol";
10
+ import {IVersionable} from "./IVersionable.sol";
11
+ import {RegisterableUpgradable} from "./RegisterableUpgradable.sol";
12
+
13
+ import {IRegistry} from "../registry/IRegistry.sol";
14
+
15
+
16
+ /// @dev service base contract
17
+ abstract contract Service is
18
+ RegisterableUpgradable,
19
+ IService
20
+ {
21
+ function getDomain() public pure virtual override returns(ObjectType);
22
+
23
+ function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
24
+ return getVersion().toMajorPart();
25
+ }
26
+
27
+ // from Versionable
28
+ function getVersion()
29
+ public
30
+ pure
31
+ virtual override (IVersionable, Versionable)
32
+ returns(Version)
33
+ {
34
+ return VersionLib.toVersion(3,0,0);
35
+ }
36
+
37
+ function _initializeService(
38
+ address registry,
39
+ address initialOwner
40
+ )
41
+ internal
42
+ virtual
43
+ //onlyInitializing //TODO uncomment when "fully" upgradeable
44
+ {
45
+ // service must provide its name and version upon registration
46
+ bytes memory data = abi.encode(getDomain(), getMajorVersion());
47
+ NftId registryNftId = _getRegistryNftId(registry);
48
+ bool isInterceptor = false;
49
+
50
+ _initializeRegisterable(registry, registryNftId, SERVICE(), isInterceptor, initialOwner, data);
51
+ _registerInterface(type(IService).interfaceId);
52
+ }
53
+
54
+ // this is just a conveniene function, actual validation will be done upon registration
55
+ function _getRegistryNftId(address registryAddress) internal view returns (NftId) {
56
+ return IRegistry(registryAddress).getNftId(registryAddress);
57
+ }
58
+ }