@etherisc/gif-next 0.0.2-a6f9f86-582 → 0.0.2-a6faeb6-912

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 (272) 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} +241 -245
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +744 -0
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +127 -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 +939 -0
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +4 -0
  17. package/artifacts/contracts/components/Product.sol/Product.json +855 -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/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
  51. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +4 -0
  52. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1698 -0
  53. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  54. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
  55. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
  56. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +496 -0
  57. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  58. package/artifacts/contracts/instance/Instance.sol/Instance.json +553 -530
  59. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  60. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +57 -34
  61. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
  62. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
  63. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
  64. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1422 -0
  65. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  66. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +937 -31
  67. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
  68. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +532 -0
  69. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
  70. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
  71. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
  72. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +540 -0
  73. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
  74. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
  75. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  76. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +0 -77
  77. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  78. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  79. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +10 -244
  80. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  81. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  82. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  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/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +4 -0
  90. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +827 -0
  91. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
  92. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +716 -0
  93. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
  94. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +444 -0
  95. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +4 -0
  96. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +466 -0
  97. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
  98. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +446 -0
  99. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +4 -0
  100. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +728 -0
  101. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
  102. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +760 -0
  103. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
  104. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +1049 -0
  105. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
  106. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +464 -0
  107. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
  108. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1147 -0
  109. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
  110. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +488 -0
  111. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  112. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
  113. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  114. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +197 -116
  115. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  116. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +217 -15
  117. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  118. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  119. package/artifacts/contracts/registry/Registry.sol/Registry.json +167 -172
  120. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  121. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +324 -44
  122. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  123. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +77 -36
  124. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
  125. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +410 -0
  126. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  127. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  129. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
  132. package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +1 -1
  133. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  134. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  135. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  136. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  137. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  138. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  139. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -6
  140. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +4 -0
  141. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +442 -0
  142. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
  143. package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → shared/Service.sol/Service.json} +2 -2
  144. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  145. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  146. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  147. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  148. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  149. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
  151. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  152. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +6 -6
  153. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  154. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +111 -5
  155. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestService.sol/TestService.json +17 -17
  157. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
  159. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  160. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  161. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  162. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  163. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  164. package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
  165. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  166. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
  171. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  172. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  174. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
  175. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  177. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  179. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  181. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  183. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
  185. package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
  186. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
  187. package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
  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 +132 -0
  193. package/contracts/components/Distribution.sol +163 -0
  194. package/contracts/components/IBaseComponent.sol +14 -2
  195. package/contracts/components/IDistributionComponent.sol +44 -0
  196. package/contracts/components/IPoolComponent.sol +66 -0
  197. package/contracts/components/IProductComponent.sol +35 -0
  198. package/contracts/components/Pool.sol +267 -0
  199. package/contracts/components/Product.sol +289 -0
  200. package/contracts/experiment/cloning/Cloner.sol +47 -0
  201. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
  202. package/contracts/instance/BundleManager.sol +129 -0
  203. package/contracts/instance/Cloneable.sol +46 -0
  204. package/contracts/instance/IAccessManagerSimple.sol +1 -1
  205. package/contracts/instance/IInstance.sol +56 -0
  206. package/contracts/instance/IInstanceBase.sol +26 -0
  207. package/contracts/instance/IInstanceService.sol +34 -0
  208. package/contracts/instance/Instance.sol +84 -20
  209. package/contracts/instance/InstanceAccessManager.sol +8 -8
  210. package/contracts/instance/InstanceBase.sol +41 -0
  211. package/contracts/instance/InstanceReader.sol +315 -0
  212. package/contracts/instance/InstanceService.sol +230 -22
  213. package/contracts/instance/InstanceServiceManager.sol +57 -0
  214. package/contracts/instance/ObjectManager.sol +101 -0
  215. package/contracts/instance/base/ComponentServiceBase.sol +134 -0
  216. package/contracts/instance/base/IInstanceBase.sol +23 -0
  217. package/contracts/instance/base/IKeyValueStore.sol +5 -4
  218. package/contracts/instance/base/KeyValueStore.sol +4 -20
  219. package/contracts/instance/module/IAccess.sol +2 -2
  220. package/contracts/instance/module/IBundle.sol +1 -0
  221. package/contracts/instance/module/ISetup.sol +6 -1
  222. package/contracts/instance/module/ITreasury.sol +1 -1
  223. package/contracts/instance/service/ComponentOwnerService.sol +317 -0
  224. package/contracts/instance/service/DistributionService.sol +88 -0
  225. package/contracts/instance/service/DistributionServiceManager.sol +54 -0
  226. package/contracts/instance/service/IComponentOwnerService.sol +20 -0
  227. package/contracts/instance/service/IDistributionService.sol +12 -0
  228. package/contracts/instance/service/IPoolService.sol +51 -0
  229. package/contracts/instance/service/IProductService.sol +110 -0
  230. package/contracts/instance/service/PoolService.sol +287 -0
  231. package/contracts/instance/service/PoolServiceManager.sol +54 -0
  232. package/contracts/instance/service/ProductService.sol +570 -0
  233. package/contracts/instance/service/ProductServiceManager.sol +54 -0
  234. package/contracts/registry/ChainNft.sol +40 -25
  235. package/contracts/registry/IRegistry.sol +30 -22
  236. package/contracts/registry/IRegistryService.sol +36 -15
  237. package/contracts/registry/Registry.sol +133 -176
  238. package/contracts/registry/RegistryService.sol +159 -170
  239. package/contracts/registry/RegistryServiceManager.sol +39 -2
  240. package/contracts/registry/TokenRegistry.sol +111 -0
  241. package/contracts/shared/ERC165.sol +7 -3
  242. package/contracts/shared/IRegisterable.sol +1 -1
  243. package/contracts/{instance/base → shared}/IService.sol +3 -3
  244. package/contracts/shared/NftOwnable.sol +2 -4
  245. package/contracts/shared/ProxyManager.sol +3 -3
  246. package/contracts/shared/Registerable.sol +3 -2
  247. package/contracts/shared/RegisterableUpgradable.sol +16 -0
  248. package/contracts/shared/Service.sol +55 -0
  249. package/contracts/shared/TokenHandler.sol +2 -2
  250. package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
  251. package/contracts/shared/Versionable.sol +1 -1
  252. package/contracts/test/TestFee.sol +2 -2
  253. package/contracts/test/TestRoleId.sol +6 -6
  254. package/contracts/test/TestService.sol +3 -5
  255. package/contracts/types/Fee.sol +3 -3
  256. package/contracts/types/NftIdSet.sol +26 -24
  257. package/contracts/types/RoleId.sol +19 -4
  258. package/contracts/types/StateId.sol +4 -0
  259. package/contracts/types/UFixed.sol +128 -12
  260. package/contracts/types/Version.sol +4 -1
  261. package/package.json +4 -3
  262. package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
  263. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
  264. package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1119
  265. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
  266. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
  267. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
  268. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
  269. package/contracts/instance/AccessManagedSimple.sol +0 -114
  270. package/contracts/instance/AccessManagerSimple.sol +0 -682
  271. package/contracts/instance/base/ServiceBase.sol +0 -44
  272. package/contracts/registry/IChainNft.sol +0 -22
@@ -1,239 +1,212 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IERC20Metadata} from "@openzeppelin5/contracts/token/ERC20/extensions/IERC20Metadata.sol";
4
+ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
6
 
6
- import {IRegistry} from "../registry/IRegistry.sol";
7
- // import {IInstance} from "../instance/IInstance.sol";
7
+ import {IRegistry} from "./IRegistry.sol";
8
+ import {IInstance} from "../instance/IInstance.sol";
8
9
 
9
10
  import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
10
- // import {IComponent, IComponentModule} from "../../contracts/instance/module/component/IComponent.sol";
11
- // import {IPool} from "../../contracts/instance/module/pool/IPoolModule.sol";
12
11
  import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
13
- // import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
14
- // import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
15
- // import {IDistributionComponent} from "../../contracts/components/IDistributionComponent.sol";
12
+ import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
13
+ import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
14
+ import {IDistributionComponent} from "../../contracts/components/IDistributionComponent.sol";
16
15
 
17
16
  import {IVersionable} from "../../contracts/shared/IVersionable.sol";
18
17
  import {Versionable} from "../../contracts/shared/Versionable.sol";
19
18
  import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
20
19
 
21
- import {RoleId} from "../../contracts/types/RoleId.sol";
22
- import {ObjectType, REGISTRY, TOKEN, SERVICE, PRODUCT, ORACLE, POOL, TOKEN, INSTANCE, DISTRIBUTION, POLICY, BUNDLE} from "../../contracts/types/ObjectType.sol";
20
+ import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
21
+ import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, POLICY, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
23
22
  import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
24
23
  import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
25
24
  import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
26
25
  import {Version, VersionPart, VersionLib} from "../../contracts/types/Version.sol";
27
26
 
28
- import {ServiceBase} from "../../contracts/instance/base/ServiceBase.sol";
29
- import {IService} from "../../contracts/instance/base/IService.sol";
27
+ import {Service} from "../shared/Service.sol";
28
+ import {IService} from "../shared/IService.sol";
30
29
  import {IRegistryService} from "./IRegistryService.sol";
31
- import {Registry} from "../registry/Registry.sol";
30
+ import {Registry} from "./Registry.sol";
32
31
 
33
32
  contract RegistryService is
34
- ServiceBase,
33
+ AccessManagedUpgradeable,
34
+ Service,
35
35
  IRegistryService
36
36
  {
37
37
  using NftIdLib for NftId;
38
38
 
39
- error NotRegistryOwner();
40
- error MissingAllowance();
41
-
42
- error NotToken();
43
- error NotService();
44
- error NotComponent();
45
- error NotInstance();
46
-
47
- error InvalidAddress(address registerableAddress);
48
- error InvalidInitialOwner(address initialOwner);
49
- error SelfRegistration();
50
- error InvalidType(ObjectType objectType);
51
39
 
40
+ // Initial value for constant variable has to be compile-time constant
41
+ // TODO define types as constants?
42
+ //ObjectType public constant SERVICE_TYPE = REGISTRY();
52
43
  string public constant NAME = "RegistryService";
53
44
 
54
45
  // TODO update to real hash when registry is stable
55
46
  bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
56
47
 
57
- address constant public NFT_LOCK_ADDRESS = address(0x1);
48
+ address public constant NFT_LOCK_ADDRESS = address(0x1);
58
49
 
59
50
  /// @dev
60
51
  // msg.sender - ONLY registry owner
61
- // CAN register ANY non IRegisterable address
62
- // CAN register ONLY valid object-parent types combinations for TOKEN
63
52
  // CAN NOT register itself
64
- // IMPORTANT: MUST NOT call untrusted contract inbetween calls to registry/instance (trusted contracts)
65
- // motivation: registry/instance state may change during external call
66
- // TODO it may be usefull to have transferable token nft in order to delist token, make it invalid for new beginings
67
- // TODO: MUST prohibit registration of precompiles addresses
68
- function registerToken(address tokenAddress)
69
- external
70
- returns(NftId nftId)
71
- {
72
- IRegisterable registerable = IRegisterable(tokenAddress);
73
- bool isRegisterable;
74
-
75
- // registryOwner can not register IRegisterable as TOKEN
76
- try registerable.supportsInterface(type(IRegisterable).interfaceId) returns(bool result) {
77
- isRegisterable = result;
78
- } catch {
79
- isRegisterable = false;
80
- }
81
-
82
- if(isRegisterable) {
83
- revert NotToken();
84
- }
85
-
86
- NftId registryNftId = _registry.getNftId(address(_registry));
87
- if(msg.sender != _registry.ownerOf(registryNftId)) {
88
- revert NotRegistryOwner();
89
- }
90
-
91
- IRegistry.ObjectInfo memory info = IRegistry.ObjectInfo(
92
- zeroNftId(), // any value
93
- registryNftId, // parent nft id
94
- TOKEN(),
95
- false, // isInterceptor
96
- tokenAddress,
97
- NFT_LOCK_ADDRESS,
98
- "" // any value
99
- );
100
-
101
- nftId = _registry.register(info);
102
- }
103
-
104
- /// @dev
105
- // msg.sender - ONLY registry owner
106
53
  // CAN register ONLY valid object-parent types combinations for SERVICE
107
54
  // CAN register ONLY IRegisterable address he owns
108
- // CAN NOT register itself
109
55
  // IMPORTANT: MUST NOT check owner before calling external contract
110
56
  function registerService(IService service)
111
57
  external
58
+ restricted
112
59
  returns(
113
60
  IRegistry.ObjectInfo memory info,
114
61
  bytes memory data
115
62
  )
116
63
  {
117
- if(service.supportsInterface(type(IService).interfaceId) == false) {
64
+
65
+ // CAN revert if no ERC165 support -> will revert with empty message
66
+ if(!service.supportsInterface(type(IService).interfaceId)) {
118
67
  revert NotService();
119
- }
68
+ }
120
69
 
121
70
  (
122
71
  info,
123
72
  data
124
73
  ) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
125
74
 
126
- NftId registryNftId = _registry.getNftId(address(_registry));
127
- if(msg.sender != _registry.ownerOf(registryNftId)) {
128
- revert NotRegistryOwner();
129
- }
130
-
131
- info.initialOwner = NFT_LOCK_ADDRESS;//registry.getLockAddress();
132
75
  info.nftId = _registry.register(info);
133
76
  service.linkToRegisteredNftId();
77
+ return (info, data);
78
+ }
134
79
 
135
- return (
136
- info,
80
+ function registerInstance(IRegisterable instance)
81
+ external
82
+ returns(
83
+ IRegistry.ObjectInfo memory info,
84
+ bytes memory data
85
+ )
86
+ {
87
+ if(!instance.supportsInterface(type(IInstance).interfaceId)) {
88
+ revert NotInstance();
89
+ }
90
+
91
+ (
92
+ info,
137
93
  data
138
- );
94
+ ) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);
95
+
96
+ info.nftId = _registry.register(info);
97
+ instance.linkToRegisteredNftId(); // asume safe
98
+
99
+ return (info, data);
139
100
  }
140
101
 
141
- // anybody can register component if instance gives a corresponding role
142
- //function registerComponent(IBaseComponent component, ObjectType componentType)
143
- function registerComponent(IBaseComponent component, ObjectType componentType, address owner)
102
+ function registerProduct(IBaseComponent product, address owner)
144
103
  external
104
+ restricted
145
105
  returns(
146
106
  IRegistry.ObjectInfo memory info,
147
107
  bytes memory data
148
108
  )
149
109
  {
150
- if(!component.supportsInterface(type(IBaseComponent).interfaceId)) {
151
- revert NotComponent();
110
+ // CAN revert if no ERC165 support -> will revert with empty message
111
+ if(!product.supportsInterface(type(IProductComponent).interfaceId)) {
112
+ revert NotProduct();
152
113
  }
153
114
 
154
115
  (
155
116
  info,
156
117
  data
157
- ) = _getAndVerifyContractInfo(component, componentType, owner);
118
+ ) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
158
119
 
159
- NftId serviceNftId = _registry.getNftId(msg.sender);
120
+ info.nftId = _registry.register(info);
121
+ // TODO unsafe, let component or its owner derive nftId latter, when state assumptions and modifications of GIF contracts are finished
122
+ product.linkToRegisteredNftId();
160
123
 
161
- if(!_registry.allowance(serviceNftId, componentType)) {
162
- revert MissingAllowance();
163
- }
124
+ return (info, data);
125
+ }
164
126
 
165
- info.nftId = _registry.register(info);
166
- component.linkToRegisteredNftId();
127
+ function registerPool(IBaseComponent pool, address owner)
128
+ external
129
+ restricted
130
+ returns(
131
+ IRegistry.ObjectInfo memory info,
132
+ bytes memory data
133
+ )
134
+ {
135
+ if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
136
+ revert NotPool();
137
+ }
167
138
 
168
- return (
169
- info,
139
+ (
140
+ info,
170
141
  data
171
- );
142
+ ) = _getAndVerifyContractInfo(pool, POOL(), owner);
143
+
144
+ info.nftId = _registry.register(info);
145
+ pool.linkToRegisteredNftId();
146
+
147
+ return (info, data);
172
148
  }
173
149
 
174
- // TODO: when called by approved service: add owner arg (service must pass it's msg.sender as owner) & check service allowance
175
- //function registerInstance(IRegisterable instance, address owner)
176
- function registerInstance(IRegisterable instance)
177
- external
150
+ function registerDistribution(IBaseComponent distribution, address owner)
151
+ external
152
+ restricted
178
153
  returns(
179
154
  IRegistry.ObjectInfo memory info,
180
155
  bytes memory data
181
156
  )
182
157
  {
183
- // TODO reactivate later
184
- // if(instance.supportsInterface(type(IInstance).interfaceId) == false) {
185
- // revert NotInstance();
186
- // }
187
-
188
- // (
189
- // info,
190
- // data
191
- // ) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);// owner);
192
-
193
- // info.nftId = _registry.register(info);
194
- // instance.linkToRegisteredNftId();
195
-
196
- // return (
197
- // info,
198
- // data
199
- // );
158
+ if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
159
+ revert NotDistribution();
160
+ }
161
+
162
+ (
163
+ info,
164
+ data
165
+ ) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
166
+
167
+ info.nftId = _registry.register(info);
168
+ distribution.linkToRegisteredNftId();
169
+
170
+ return (info, data);
200
171
  }
201
172
 
202
173
  function registerPolicy(IRegistry.ObjectInfo memory info)
203
- external
174
+ external
175
+ restricted
204
176
  returns(NftId nftId)
205
177
  {
206
- NftId senderNftId = _registry.getNftId(msg.sender);
207
-
208
- if(_registry.allowance(senderNftId, POLICY()) == false) {
209
- revert MissingAllowance();
210
- }
211
-
212
178
  _verifyObjectInfo(info, POLICY());
213
179
 
214
180
  nftId = _registry.register(info);
215
181
  }
216
182
 
217
183
  function registerBundle(IRegistry.ObjectInfo memory info)
218
- external
184
+ external
185
+ restricted
219
186
  returns(NftId nftId)
220
187
  {
221
- NftId senderNftId = _registry.getNftId(msg.sender);
222
-
223
- if(_registry.allowance(senderNftId, BUNDLE()) == false) {
224
- revert MissingAllowance();
225
- }
226
-
227
188
  _verifyObjectInfo(info, BUNDLE());
228
189
 
229
190
  nftId = _registry.register(info);
230
191
  }
231
192
 
193
+ function registerStake(IRegistry.ObjectInfo memory info)
194
+ external
195
+ restricted
196
+ returns(NftId nftId)
197
+ {
198
+ _verifyObjectInfo(info, STAKE());
199
+
200
+ nftId = _registry.register(info);
201
+ }
232
202
 
233
203
  // From IService
234
- function getName() public pure override(IService, ServiceBase) returns(string memory) {
204
+ function getName() public pure override(IService, Service) returns(string memory) {
235
205
  return NAME;
236
206
  }
207
+ //function getType() public pure override(IService, ServiceBase) returns(ObjectType serviceType) {
208
+ // return SERVICE_TYPE;
209
+ //}
237
210
 
238
211
 
239
212
  // from Versionable
@@ -245,12 +218,19 @@ contract RegistryService is
245
218
  // registry is getting instantiated and locked to registry service address forever
246
219
  function _initialize(
247
220
  address owner,
248
- bytes memory registryByteCodeWithInitCode
221
+ bytes memory data
249
222
  )
250
223
  internal
251
224
  initializer
252
225
  virtual override
253
226
  {
227
+ (
228
+ address initialAuthority,
229
+ bytes memory registryByteCodeWithInitCode
230
+ ) = abi.decode(data, (address, bytes));
231
+
232
+ __AccessManaged_init(initialAuthority);
233
+
254
234
  bytes memory encodedConstructorArguments = abi.encode(
255
235
  owner,
256
236
  getMajorVersion());
@@ -259,26 +239,27 @@ contract RegistryService is
259
239
  registryByteCodeWithInitCode,
260
240
  encodedConstructorArguments);
261
241
 
262
- address registryAddress = ContractDeployerLib.deploy(
242
+ IRegistry registry = IRegistry(ContractDeployerLib.deploy(
263
243
  registryCreationCode,
264
- REGISTRY_CREATION_CODE_HASH);
244
+ REGISTRY_CREATION_CODE_HASH));
265
245
 
266
- IRegistry registry = IRegistry(registryAddress);
267
- NftId registryNftId = registry.getNftId(registryAddress);
246
+ NftId registryNftId = registry.getNftId(address(registry));
268
247
 
269
- _initializeServiceBase(registryAddress, registryNftId, owner);
270
- linkToRegisteredNftId();
248
+ _initializeService(address(registry), owner);
271
249
 
250
+ // TODO why do registry service proxy need to keep its nftId??? -> no registryServiceNftId checks in implementation
251
+ // if they are -> use registry address to obtain owner of registry service nft (works the same with any registerable and(or) implementation)
252
+ linkToRegisteredNftId();
272
253
  _registerInterface(type(IRegistryService).interfaceId);
273
254
  }
274
255
 
275
- // parent check done in registry because of approve()
276
256
  function _getAndVerifyContractInfo(
277
257
  IRegisterable registerable,
278
- ObjectType objectType,
279
- address owner
258
+ ObjectType expectedType, // assume can be valid only
259
+ address expectedOwner // assume can be 0
280
260
  )
281
261
  internal
262
+ view
282
263
  returns(
283
264
  IRegistry.ObjectInfo memory info,
284
265
  bytes memory data
@@ -288,23 +269,33 @@ contract RegistryService is
288
269
  info,
289
270
  data
290
271
  ) = registerable.getInitialInfo();
272
+ info.objectAddress = address(registerable);
291
273
 
292
- if(info.objectAddress != address(registerable)) {
293
- revert InvalidAddress(info.objectAddress);
274
+ if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
275
+ revert UnexpectedRegisterableType(expectedType, info.objectType);
294
276
  }
295
277
 
296
- if(
297
- getRegistry().isRegistered(owner) ||
298
- info.initialOwner != owner) { // contract owner protection
299
- revert InvalidInitialOwner(info.initialOwner);
278
+ address owner = info.initialOwner;
279
+
280
+ // solhint-disable-next-line
281
+ if(expectedType == INSTANCE()) {
282
+ // any address may create a new instance via instance service
283
+ } else {
284
+ if(owner != expectedOwner) { // registerable owner protection
285
+ revert NotRegisterableOwner(expectedOwner);
286
+ }
300
287
  }
301
288
 
302
- if(msg.sender == address(registerable)) {
289
+ if(owner == address(registerable)) {
303
290
  revert SelfRegistration();
304
291
  }
292
+
293
+ if(owner == address(0)) {
294
+ revert RegisterableOwnerIsZero();
295
+ }
305
296
 
306
- if(info.objectType != objectType) {
307
- revert InvalidType(info.objectType);
297
+ if(getRegistry().isRegistered(owner)) {
298
+ revert RegisterableOwnerIsRegistered();
308
299
  }
309
300
 
310
301
  /*NftId parentNftId = info.parentNftId;
@@ -320,25 +311,28 @@ contract RegistryService is
320
311
  );
321
312
  }
322
313
 
323
- // parent checks done in registry because of approve()
324
314
  function _verifyObjectInfo(
325
315
  IRegistry.ObjectInfo memory info,
326
- ObjectType objectType
316
+ ObjectType expectedType
327
317
  )
328
318
  internal
329
319
  view
330
320
  {
331
- if(info.objectAddress > address(0)) {
332
- revert InvalidAddress(info.objectAddress);
321
+ // enforce instead of check
322
+ info.objectAddress = address(0);
323
+
324
+ if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
325
+ revert UnexpectedRegisterableType(expectedType, info.objectType);
333
326
  }
334
327
 
335
- if(
336
- getRegistry().isRegistered(info.initialOwner) ||
337
- info.initialOwner == address(0)) {
338
- // TODO non registered address can register object(e.g. POLICY()) and then transfer associated nft to registered contract
339
- // what are motivations to do so?
340
- // at least registered contract can not register objects by itself, SERVICE,
341
- revert InvalidInitialOwner(info.initialOwner);
328
+ address owner = info.initialOwner;
329
+
330
+ if(owner == address(0)) {
331
+ revert RegisterableOwnerIsZero();
332
+ }
333
+
334
+ if(getRegistry().isRegistered(owner)) {
335
+ revert RegisterableOwnerIsRegistered();
342
336
  }
343
337
 
344
338
  // can catch all 3 if check that initialOwner is not registered
@@ -354,11 +348,6 @@ contract RegistryService is
354
348
  revert InitialOwnerIsRegistry();
355
349
  }*/
356
350
 
357
-
358
- if(info.objectType != objectType) {
359
- revert InvalidType(info.objectType);
360
- }
361
-
362
351
  /*NftId parentNftId = info.parentNftId;
363
352
  IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
364
353
 
@@ -366,4 +355,4 @@ contract RegistryService is
366
355
  revert InvalidParent(parentNftId);
367
356
  }*/
368
357
  }
369
- }
358
+ }
@@ -1,25 +1,39 @@
1
1
  // SPDX-License-Identifier: UNLICENSED
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
5
+
6
+ import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
7
+
4
8
  import {Registry} from "./Registry.sol";
5
9
  import {IVersionable} from "../shared/IVersionable.sol";
6
10
  import {ProxyManager} from "../shared/ProxyManager.sol";
7
11
  import {RegistryService} from "./RegistryService.sol";
12
+ import {TokenRegistry} from "./TokenRegistry.sol";
8
13
 
9
14
 
10
15
  contract RegistryServiceManager is
11
16
  ProxyManager
12
17
  {
13
- RegistryService private _registryService;
18
+ bytes32 constant public ACCESS_MANAGER_CREATION_CODE_HASH = 0x0;
19
+
20
+ AccessManager private _accessManager;
21
+ RegistryService private _registryService;
22
+ TokenRegistry private _tokenRegistry;
14
23
 
15
24
  /// @dev initializes proxy manager with registry service implementation and deploys registry
16
25
  constructor(
26
+ address accessManager
17
27
  )
18
28
  ProxyManager()
19
29
  {
30
+ _accessManager = AccessManager(accessManager);
31
+
32
+ bytes memory initializationData = abi.encode(accessManager, type(Registry).creationCode);
33
+
20
34
  IVersionable versionable = deploy(
21
35
  address(new RegistryService()),
22
- type(Registry).creationCode);
36
+ initializationData);
23
37
 
24
38
  _registryService = RegistryService(address(versionable));
25
39
 
@@ -28,11 +42,26 @@ contract RegistryServiceManager is
28
42
  address(_registryService.getRegistry()),
29
43
  address(_registryService));
30
44
 
45
+ // deploy token registry
46
+
47
+ // _tokenRegistry = new TokenRegistry(
48
+ // address(_registryService.getRegistry()),
49
+ // address(_registryService));
50
+
31
51
  // implies that after this constructor call only upgrade functionality is available
32
52
  _isDeployed = true;
33
53
  }
34
54
 
35
55
  //--- view functions ----------------------------------------------------//
56
+
57
+ function getAccessManager()
58
+ external
59
+ view
60
+ returns (AccessManager)
61
+ {
62
+ return _accessManager;
63
+ }
64
+
36
65
  function getRegistryService()
37
66
  external
38
67
  view
@@ -40,4 +69,12 @@ contract RegistryServiceManager is
40
69
  {
41
70
  return _registryService;
42
71
  }
72
+
73
+ function getTokenRegistry()
74
+ external
75
+ view
76
+ returns (TokenRegistry)
77
+ {
78
+ return _tokenRegistry;
79
+ }
43
80
  }