@etherisc/gif-next 0.0.2-e37834a-021 → 0.0.2-e46206a-486

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 (257) hide show
  1. package/README.md +104 -1
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  3. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +90 -2
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +118 -6
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +80 -3
  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/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  12. package/artifacts/contracts/components/Pool.sol/Pool.json +120 -6
  13. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  14. package/artifacts/contracts/components/Product.sol/Product.json +118 -6
  15. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
  16. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
  18. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
  19. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
  20. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
  21. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
  33. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
  37. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  38. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
  39. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  40. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  41. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +54 -286
  43. package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
  44. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/Instance.sol/Instance.json +171 -396
  46. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +90 -2
  48. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  49. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  50. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  51. package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +1 -1
  52. package/artifacts/contracts/instance/base/IService.sol/IService.json +80 -3
  53. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  54. package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +90 -2
  55. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  56. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +22 -14
  57. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  58. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  59. package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
  60. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +90 -2
  62. package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +2 -2
  70. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
  74. package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -13
  75. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
  76. package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -13
  77. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
  78. package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
  79. package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
  80. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
  83. package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +2 -2
  84. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
  85. package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
  86. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  87. package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
  88. package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +194 -41
  91. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +136 -16
  93. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +81 -4
  95. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +80 -3
  97. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +80 -3
  99. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  100. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -3
  101. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  102. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +138 -18
  103. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  104. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +154 -42
  105. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  106. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +47 -2
  107. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  108. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +42 -156
  109. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  110. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +214 -10
  111. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  112. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  113. package/artifacts/contracts/registry/Registry.sol/Registry.json +62 -184
  114. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  115. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +410 -34
  116. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  117. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +86 -42
  118. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  119. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  120. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
  121. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
  122. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +127 -0
  123. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  124. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +80 -3
  125. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  127. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +32 -6
  128. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  129. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +21 -16
  130. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +120 -6
  132. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  133. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  134. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  135. package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +118 -6
  137. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  138. package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
  139. package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
  140. package/artifacts/contracts/test/TestPool.sol/TestPool.json +120 -6
  141. package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +120 -8
  143. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +120 -6
  145. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
  147. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestService.sol/TestService.json +142 -14
  149. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
  151. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  152. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  153. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +18 -2
  154. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  155. package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
  156. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  157. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
  160. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
  161. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/Fee.sol/FeeLib.json +4 -4
  163. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  164. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
  165. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  167. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  168. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  169. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +4 -0
  170. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
  171. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  173. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +4 -0
  174. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -0
  175. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  177. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +134 -8
  179. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  181. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +15 -2
  183. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
  184. package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
  185. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
  186. package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
  187. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  188. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  189. package/contracts/components/BaseComponent.sol +1 -1
  190. package/contracts/components/Distribution.sol +1 -1
  191. package/contracts/components/IBaseComponent.sol +1 -1
  192. package/contracts/components/IDistributionComponent.sol +1 -1
  193. package/contracts/components/IProductComponent.sol +1 -1
  194. package/contracts/components/Product.sol +2 -2
  195. package/contracts/experiment/cloning/Cloner.sol +47 -0
  196. package/contracts/instance/IInstance.sol +4 -6
  197. package/contracts/instance/Instance.sol +4 -6
  198. package/contracts/instance/base/KeyValueStore.sol +3 -2
  199. package/contracts/instance/base/ModuleBase.sol +1 -1
  200. package/contracts/instance/base/ServiceBase.sol +1 -0
  201. package/contracts/instance/module/bundle/BundleModule.sol +2 -2
  202. package/contracts/instance/module/component/ComponentModule.sol +1 -1
  203. package/contracts/instance/module/component/IComponent.sol +1 -1
  204. package/contracts/instance/module/policy/IPolicy.sol +2 -2
  205. package/contracts/instance/module/policy/PolicyModule.sol +2 -2
  206. package/contracts/instance/module/treasury/ITreasury.sol +1 -1
  207. package/contracts/instance/module/treasury/TokenHandler.sol +1 -1
  208. package/contracts/instance/module/treasury/TreasuryModule.sol +4 -4
  209. package/contracts/instance/service/ComponentOwnerService.sol +73 -30
  210. package/contracts/instance/service/IProductService.sol +1 -1
  211. package/contracts/instance/service/ProductService.sol +3 -3
  212. package/contracts/registry/ChainNft.sol +40 -25
  213. package/contracts/registry/IRegistry.sol +9 -25
  214. package/contracts/registry/IRegistryService.sol +9 -3
  215. package/contracts/registry/Registry.sol +90 -157
  216. package/contracts/registry/RegistryService.sol +167 -101
  217. package/contracts/registry/RegistryServiceManager.sol +22 -10
  218. package/contracts/shared/ERC165.sol +1 -1
  219. package/contracts/shared/INftOwnable.sol +22 -0
  220. package/contracts/shared/IRegisterable.sol +3 -8
  221. package/contracts/shared/NftOwnable.sol +83 -34
  222. package/contracts/shared/ProxyManager.sol +3 -12
  223. package/contracts/shared/Registerable.sol +14 -42
  224. package/contracts/shared/UpgradableProxyWithAdmin.sol +2 -2
  225. package/contracts/shared/Versionable.sol +3 -3
  226. package/contracts/test/TestFee.sol +2 -2
  227. package/contracts/test/TestProduct.sol +2 -2
  228. package/contracts/test/TestRoleId.sol +1 -1
  229. package/contracts/types/DistributorType.sol +55 -0
  230. package/contracts/types/Fee.sol +3 -3
  231. package/contracts/types/Key32.sol +8 -3
  232. package/contracts/types/NumberId.sol +52 -0
  233. package/contracts/types/ObjectType.sol +35 -14
  234. package/contracts/types/Referral.sol +85 -0
  235. package/contracts/types/RoleId.sol +53 -9
  236. package/contracts/types/StateId.sol +1 -1
  237. package/contracts/types/Timestamp.sol +7 -3
  238. package/contracts/types/UFixed.sol +128 -12
  239. package/package.json +4 -3
  240. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
  241. package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
  242. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
  243. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
  244. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
  245. package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
  246. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
  247. package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -457
  248. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
  249. package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
  250. package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
  251. package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
  252. package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
  253. package/contracts/instance/module/access/Access.sol +0 -149
  254. package/contracts/instance/module/access/IAccess.sol +0 -53
  255. package/contracts/registry/IChainNft.sol +0 -22
  256. package/contracts/shared/IOwnable.sol +0 -6
  257. package/contracts/types/ReferralId.sol +0 -48
@@ -1,9 +1,12 @@
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 {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
6
+ import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
7
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
8
 
6
- import {IRegistry} from "../registry/IRegistry.sol";
9
+ import {IRegistry} from "./IRegistry.sol";
7
10
  import {IInstance} from "../instance/IInstance.sol";
8
11
 
9
12
  import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
@@ -28,39 +31,49 @@ import {Version, VersionPart, VersionLib} from "../../contracts/types/Version.so
28
31
  import {ServiceBase} from "../../contracts/instance/base/ServiceBase.sol";
29
32
  import {IService} from "../../contracts/instance/base/IService.sol";
30
33
  import {IRegistryService} from "./IRegistryService.sol";
31
- import {Registry} from "../registry/Registry.sol";
34
+ import {Registry} from "./Registry.sol";
35
+ import {ChainNft} from "./ChainNft.sol";
32
36
 
33
37
  contract RegistryService is
38
+ AccessManagedUpgradeable,
34
39
  ServiceBase,
35
40
  IRegistryService
36
41
  {
37
42
  using NftIdLib for NftId;
38
43
 
44
+ error SelfRegistration();
39
45
  error NotRegistryOwner();
40
- error MissingAllowance();
41
46
 
42
47
  error NotToken();
43
48
  error NotService();
44
- error NotComponent();
45
49
  error NotInstance();
46
-
47
- error InvalidAddress(address registerableAddress);
50
+ error NotProduct();
51
+ error NotPool();
52
+ error NotDistribution();
53
+
54
+ error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
55
+ error NotRegisterableOwner(address expectedOwner);
56
+ error RegisterableOwnerIsZero();
57
+ error RegisterableOwnerIsRegistered();
48
58
  error InvalidInitialOwner(address initialOwner);
49
- error SelfRegistration();
50
- error InvalidType(ObjectType objectType);
59
+ error InvalidAddress(address registerableAddress);
60
+
51
61
 
62
+ // Initial value for constant variable has to be compile-time constant
63
+ // TODO define types as constants?
64
+ //ObjectType public constant SERVICE_TYPE = REGISTRY();
52
65
  string public constant NAME = "RegistryService";
53
66
 
54
67
  // TODO update to real hash when registry is stable
55
68
  bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
56
69
 
57
- address constant public NFT_LOCK_ADDRESS = address(0x1);
70
+ address public constant NFT_LOCK_ADDRESS = address(0x1);
58
71
 
59
72
  /// @dev
60
73
  // msg.sender - ONLY registry owner
61
- // CAN register ANY non IRegisterable address
62
- // CAN register ONLY valid object-parent types combinations for TOKEN
63
74
  // CAN NOT register itself
75
+ // CAN NOT register IRegisterable address
76
+ // CAN register ONLY valid object-parent types combinations for TOKEN
64
77
  // IMPORTANT: MUST NOT call untrusted contract inbetween calls to registry/instance (trusted contracts)
65
78
  // motivation: registry/instance state may change during external call
66
79
  // TODO it may be usefull to have transferable token nft in order to delist token, make it invalid for new beginings
@@ -69,29 +82,25 @@ contract RegistryService is
69
82
  external
70
83
  returns(NftId nftId)
71
84
  {
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
- }
85
+ if(msg.sender == tokenAddress) {
86
+ revert SelfRegistration();
87
+ }
81
88
 
82
- if(isRegisterable) {
89
+ // MUST not revert if no ERC165 support
90
+ if(tokenAddress.code.length == 0 ||
91
+ ERC165Checker.supportsInterface(tokenAddress, type(IRegisterable).interfaceId)) {
83
92
  revert NotToken();
84
- }
93
+ }
85
94
 
86
- IRegistry registry = getRegistry();
95
+ NftId registryNftId = _registry.getNftId(address(_registry));
87
96
 
88
- if(msg.sender != registry.ownerOf(address(registry))) {
97
+ if(msg.sender != _registry.ownerOf(registryNftId)) {
89
98
  revert NotRegistryOwner();
90
99
  }
91
100
 
92
101
  IRegistry.ObjectInfo memory info = IRegistry.ObjectInfo(
93
102
  zeroNftId(), // any value
94
- registry.getNftId(address(registry)),
103
+ registryNftId, // parent nft id
95
104
  TOKEN(),
96
105
  false, // isInterceptor
97
106
  tokenAddress,
@@ -99,14 +108,14 @@ contract RegistryService is
99
108
  "" // any value
100
109
  );
101
110
 
102
- nftId = registry.register(info);
111
+ nftId = _registry.register(info);
103
112
  }
104
113
 
105
114
  /// @dev
106
115
  // msg.sender - ONLY registry owner
116
+ // CAN NOT register itself
107
117
  // CAN register ONLY valid object-parent types combinations for SERVICE
108
118
  // CAN register ONLY IRegisterable address he owns
109
- // CAN NOT register itself
110
119
  // IMPORTANT: MUST NOT check owner before calling external contract
111
120
  function registerService(IService service)
112
121
  external
@@ -115,56 +124,83 @@ contract RegistryService is
115
124
  bytes memory data
116
125
  )
117
126
  {
118
- if(service.supportsInterface(type(IService).interfaceId) == false) {
127
+
128
+ // CAN revert if no ERC165 support -> will revert with empty message
129
+ if(!service.supportsInterface(type(IService).interfaceId)) {
119
130
  revert NotService();
120
- }
131
+ }
121
132
 
122
133
  (
123
134
  info,
124
135
  data
125
136
  ) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
126
137
 
127
- IRegistry registry = getRegistry();
128
-
129
- if(msg.sender != registry.ownerOf(address(registry))) {
138
+ if(msg.sender != _registry.getOwner()) {
130
139
  revert NotRegistryOwner();
131
140
  }
132
141
 
133
- info.initialOwner = NFT_LOCK_ADDRESS;//registry.getLockAddress();
134
- info.nftId = registry.register(info);
135
-
142
+ info.nftId = _registry.register(info);
143
+ service.linkToRegisteredNftId();
136
144
  return (
137
145
  info,
138
146
  data
139
147
  );
140
148
  }
141
149
 
142
- // anybody can register component if instance gives a corresponding role
143
- //function registerComponent(IBaseComponent component, ObjectType componentType)
144
- function registerComponent(IBaseComponent component, ObjectType componentType, address owner)
150
+ // If msg.sender is approved service:
151
+ // 1) add owner arg (service MUST pass it's msg.sender as owner)
152
+ // 2) check service allowance
153
+ // 3) comment self registrstion check
154
+ //function registerInstance(IRegisterable instance, address owner)
155
+ function registerInstance(IRegisterable instance)
145
156
  external
146
157
  returns(
147
158
  IRegistry.ObjectInfo memory info,
148
159
  bytes memory data
149
160
  )
150
161
  {
151
- if(component.supportsInterface(type(IBaseComponent).interfaceId) == false) {
152
- revert NotComponent();
162
+
163
+ if(!instance.supportsInterface(type(IInstance).interfaceId)) {
164
+ revert NotInstance();
153
165
  }
154
166
 
155
167
  (
156
168
  info,
157
169
  data
158
- ) = _getAndVerifyContractInfo(component, componentType, owner);
170
+ ) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);
171
+
172
+ info.nftId = _registry.register(info);
173
+ instance.linkToRegisteredNftId(); // asume safe
174
+
175
+ return (
176
+ info,
177
+ data
178
+ );
179
+ }
180
+
181
+ function registerProduct(IBaseComponent product, address owner)
182
+ external
183
+ restricted
184
+ returns(
185
+ IRegistry.ObjectInfo memory info,
186
+ bytes memory data
187
+ )
188
+ {
189
+ // CAN revert if no ERC165 support -> will revert with empty message
190
+ if(!product.supportsInterface(type(IProductComponent).interfaceId)) {
191
+ revert NotProduct();
192
+ }
159
193
 
160
- IRegistry registry = getRegistry();
161
- NftId serviceNftId = registry.getNftId(msg.sender);
194
+ (
195
+ info,
196
+ data
197
+ ) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
162
198
 
163
- if(registry.allowance(serviceNftId, componentType) == false) {
164
- revert MissingAllowance();
165
- }
199
+ NftId serviceNftId = _registry.getNftId(msg.sender);
166
200
 
167
- info.nftId = registry.register(info);
201
+ info.nftId = _registry.register(info);
202
+ // TODO unsafe, let component or its owner derive nftId latter, when state assumptions and modifications of GIF contracts are finished
203
+ product.linkToRegisteredNftId();
168
204
 
169
205
  return (
170
206
  info,
@@ -172,68 +208,85 @@ contract RegistryService is
172
208
  );
173
209
  }
174
210
 
175
- // TODO: when called by approved service: add owner arg (service must pass it's msg.sender as owner) & check service allowance
176
- //function registerInstance(IRegisterable instance, address owner)
177
- function registerInstance(IRegisterable instance)
178
- external
211
+ function registerPool(IBaseComponent pool, address owner)
212
+ external
213
+ restricted
179
214
  returns(
180
215
  IRegistry.ObjectInfo memory info,
181
216
  bytes memory data
182
217
  )
183
218
  {
184
- if(instance.supportsInterface(type(IInstance).interfaceId) == false) {
185
- revert NotInstance();
219
+ if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
220
+ revert NotPool();
186
221
  }
187
222
 
188
223
  (
189
224
  info,
190
225
  data
191
- ) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);// owner);
226
+ ) = _getAndVerifyContractInfo(pool, POOL(), owner);
192
227
 
193
- IRegistry registry = getRegistry();
228
+ NftId serviceNftId = _registry.getNftId(msg.sender);
194
229
 
195
- //if(registry.allowance(registry.getNftId(msg.sender), INSTANCE()) == false) {
196
- // revert MissingAllowance();
197
- //}
230
+ info.nftId = _registry.register(info);
231
+ pool.linkToRegisteredNftId();
198
232
 
199
- info.nftId = registry.register(info);
200
-
201
233
  return (
202
234
  info,
203
- data
204
- );
235
+ data
236
+ );
237
+ }
238
+
239
+ function registerDistribution(IBaseComponent distribution, address owner)
240
+ external
241
+ restricted
242
+ returns(
243
+ IRegistry.ObjectInfo memory info,
244
+ bytes memory data
245
+ )
246
+ {
247
+ if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
248
+ revert NotDistribution();
249
+ }
250
+
251
+ (
252
+ info,
253
+ data
254
+ ) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
255
+
256
+ NftId serviceNftId = _registry.getNftId(msg.sender);
257
+
258
+ info.nftId = _registry.register(info);
259
+ distribution.linkToRegisteredNftId();
260
+
261
+ return (
262
+ info,
263
+ data
264
+ );
205
265
  }
206
266
 
207
267
  function registerPolicy(IRegistry.ObjectInfo memory info)
208
- external
268
+ external
269
+ restricted
209
270
  returns(NftId nftId)
210
271
  {
211
- IRegistry registry = getRegistry();
212
- NftId senderNftId = registry.getNftId(msg.sender);
213
-
214
- if(registry.allowance(senderNftId, POLICY()) == false) {
215
- revert MissingAllowance();
216
- }
272
+ NftId senderNftId = _registry.getNftId(msg.sender);
217
273
 
218
274
  _verifyObjectInfo(info, POLICY());
219
275
 
220
- nftId = registry.register(info);
276
+ nftId = _registry.register(info);
221
277
  }
222
278
 
223
279
  function registerBundle(IRegistry.ObjectInfo memory info)
224
- external
280
+ external
281
+ restricted
225
282
  returns(NftId nftId)
226
283
  {
227
- IRegistry registry = getRegistry();
228
- NftId senderNftId = registry.getNftId(msg.sender);
229
284
 
230
- if(registry.allowance(senderNftId, BUNDLE()) == false) {
231
- revert MissingAllowance();
232
- }
285
+ NftId senderNftId = _registry.getNftId(msg.sender);
233
286
 
234
287
  _verifyObjectInfo(info, BUNDLE());
235
288
 
236
- nftId = registry.register(info);
289
+ nftId = _registry.register(info);
237
290
  }
238
291
 
239
292
 
@@ -241,6 +294,9 @@ contract RegistryService is
241
294
  function getName() public pure override(IService, ServiceBase) returns(string memory) {
242
295
  return NAME;
243
296
  }
297
+ //function getType() public pure override(IService, ServiceBase) returns(ObjectType serviceType) {
298
+ // return SERVICE_TYPE;
299
+ //}
244
300
 
245
301
 
246
302
  // from Versionable
@@ -252,12 +308,19 @@ contract RegistryService is
252
308
  // registry is getting instantiated and locked to registry service address forever
253
309
  function _initialize(
254
310
  address owner,
255
- bytes memory registryByteCodeWithInitCode
311
+ bytes memory data
256
312
  )
257
313
  internal
258
314
  initializer
259
315
  virtual override
260
316
  {
317
+ (
318
+ address initialAuthority,
319
+ bytes memory registryByteCodeWithInitCode
320
+ ) = abi.decode(data, (address, bytes));
321
+
322
+ __AccessManaged_init(initialAuthority);
323
+
261
324
  bytes memory encodedConstructorArguments = abi.encode(
262
325
  owner,
263
326
  getMajorVersion());
@@ -266,25 +329,28 @@ contract RegistryService is
266
329
  registryByteCodeWithInitCode,
267
330
  encodedConstructorArguments);
268
331
 
269
- address registryAddress = ContractDeployerLib.deploy(
332
+ IRegistry registry = IRegistry(ContractDeployerLib.deploy(
270
333
  registryCreationCode,
271
- REGISTRY_CREATION_CODE_HASH);
334
+ REGISTRY_CREATION_CODE_HASH));
272
335
 
273
- IRegistry registry = IRegistry(registryAddress);
274
- NftId registryNftId = registry.getNftId(registryAddress);
336
+ NftId registryNftId = registry.getNftId(address(registry));
275
337
 
276
- _initializeServiceBase(registryAddress, registryNftId, owner);
338
+ _initializeServiceBase(address(registry), registryNftId, owner);
277
339
 
340
+ // TODO why do registry service proxy need to keep its nftId??? -> no registryServiceNftId checks in implementation
341
+ // if they are -> use registry address to obtain owner of registry service nft (works the same with any registerable and(or) implementation)
342
+ linkToRegisteredNftId();
278
343
  _registerInterface(type(IRegistryService).interfaceId);
279
344
  }
280
345
 
281
346
  // parent check done in registry because of approve()
282
347
  function _getAndVerifyContractInfo(
283
348
  IRegisterable registerable,
284
- ObjectType objectType,
285
- address owner
349
+ ObjectType expectedType, // assume can be valid only
350
+ address expectedOwner // assume can be 0
286
351
  )
287
352
  internal
353
+ view
288
354
  returns(
289
355
  IRegistry.ObjectInfo memory info,
290
356
  bytes memory data
@@ -294,23 +360,28 @@ contract RegistryService is
294
360
  info,
295
361
  data
296
362
  ) = registerable.getInitialInfo();
363
+ info.objectAddress = address(registerable);
297
364
 
298
- if(info.objectAddress != address(registerable)) {
299
- revert InvalidAddress(info.objectAddress);
365
+ if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
366
+ revert UnexpectedRegisterableType(expectedType, info.objectType);
300
367
  }
301
368
 
302
- if(
303
- getRegistry().isRegistered(owner) ||
304
- info.initialOwner != owner) { // contract owner protection
305
- revert InvalidInitialOwner(info.initialOwner);
369
+ address owner = info.initialOwner;
370
+
371
+ if(owner != expectedOwner) { // registerable owner protection
372
+ revert NotRegisterableOwner(expectedOwner);
306
373
  }
307
374
 
308
- if(msg.sender == address(registerable)) {
375
+ if(owner == address(registerable)) {
309
376
  revert SelfRegistration();
310
377
  }
378
+
379
+ if(owner == address(0)) {
380
+ revert RegisterableOwnerIsZero();
381
+ }
311
382
 
312
- if(info.objectType != objectType) {
313
- revert InvalidType(info.objectType);
383
+ if(getRegistry().isRegistered(owner)) {
384
+ revert RegisterableOwnerIsRegistered();
314
385
  }
315
386
 
316
387
  /*NftId parentNftId = info.parentNftId;
@@ -360,11 +431,6 @@ contract RegistryService is
360
431
  revert InitialOwnerIsRegistry();
361
432
  }*/
362
433
 
363
-
364
- if(info.objectType != objectType) {
365
- revert InvalidType(info.objectType);
366
- }
367
-
368
434
  /*NftId parentNftId = info.parentNftId;
369
435
  IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
370
436
 
@@ -372,4 +438,4 @@ contract RegistryService is
372
438
  revert InvalidParent(parentNftId);
373
439
  }*/
374
440
  }
375
- }
441
+ }
@@ -1,8 +1,11 @@
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
- import {IRegistry} from "./IRegistry.sol";
6
9
  import {IVersionable} from "../shared/IVersionable.sol";
7
10
  import {ProxyManager} from "../shared/ProxyManager.sol";
8
11
  import {RegistryService} from "./RegistryService.sol";
@@ -11,29 +14,30 @@ import {RegistryService} from "./RegistryService.sol";
11
14
  contract RegistryServiceManager is
12
15
  ProxyManager
13
16
  {
14
- error ErrorRegistryServiceWithZeroAddress();
17
+ bytes32 constant public ACCESS_MANAGER_CREATION_CODE_HASH = 0x0;
18
+
19
+ RegistryService private _registryService;
15
20
 
16
- RegistryService private _registryService;
21
+ AccessManager private _accessManager;
17
22
 
18
23
  /// @dev initializes proxy manager with registry service implementation and deploys registry
19
24
  constructor(
20
- // address registryServiceImplementationAddress,
21
- // bytes memory registryBytecodeWithInitCode // type(Registry).creationCode
25
+ address accessManager
22
26
  )
23
27
  ProxyManager()
24
28
  {
25
- // if (registryServiceImplementationAddress == address(0)) {
26
- // revert ErrorRegistryServiceWithZeroAddress();
27
- // }
29
+ _accessManager = AccessManager(accessManager);
30
+
31
+ bytes memory initializationData = abi.encode(accessManager, type(Registry).creationCode);
28
32
 
29
33
  IVersionable versionable = deploy(
30
34
  address(new RegistryService()),
31
- type(Registry).creationCode);
35
+ initializationData);
32
36
 
33
37
  _registryService = RegistryService(address(versionable));
34
38
 
35
39
  // link ownership of registry service manager ot nft owner of registry service
36
- linkToRegistry(
40
+ _linkToNftOwnable(
37
41
  address(_registryService.getRegistry()),
38
42
  address(_registryService));
39
43
 
@@ -49,4 +53,12 @@ contract RegistryServiceManager is
49
53
  {
50
54
  return _registryService;
51
55
  }
56
+
57
+ function getAccessManager()
58
+ external
59
+ view
60
+ returns (AccessManager)
61
+ {
62
+ return _accessManager;
63
+ }
52
64
  }
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.19;
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
6
  contract ERC165 is IERC165 {
7
7
  mapping(bytes4 => bool) private _isSupported;
@@ -0,0 +1,22 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IRegistry} from "../registry/IRegistry.sol";
5
+ import {NftId} from "../types/NftId.sol";
6
+
7
+ interface INftOwnable {
8
+ error ErrorNotOwner(address account);
9
+
10
+ error ErrorAlreadyLinked(address registry, NftId nftId);
11
+ error ErrorRegistryAlreadyInitialized(address registry);
12
+ error ErrorRegistryNotInitialized();
13
+ error ErrorRegistryAddressZero();
14
+ error ErrorNotRegistry(address registryAddress);
15
+ error ErrorContractNotRegistered(address contractAddress);
16
+
17
+ function linkToRegisteredNftId() external;
18
+
19
+ function getRegistry() external view returns (IRegistry);
20
+ function getNftId() external view returns (NftId);
21
+ function getOwner() external view returns (address);
22
+ }
@@ -1,22 +1,17 @@
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 {INftOwnable} from "./INftOwnable.sol";
6
7
  import {IRegistry} from "../registry/IRegistry.sol";
7
8
  import {NftId} from "../types/NftId.sol";
8
9
  import {ObjectType} from "../types/ObjectType.sol";
9
10
 
10
- import {IOwnable} from "./IOwnable.sol";
11
-
12
- interface IRegisterable is IERC165, IOwnable {
13
- function getRegistry() external view returns (IRegistry registry);
14
-
15
- function getNftId() external view returns (NftId nftId);
11
+ interface IRegisterable is IERC165, INftOwnable {
16
12
 
17
13
  function getInitialInfo()
18
14
  external
19
15
  view
20
16
  returns (IRegistry.ObjectInfo memory, bytes memory data);
21
-
22
17
  }