@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bad4d33-850

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
  2. package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +273 -14
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +184 -10
  5. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
  6. package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +61 -88
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +496 -0
  9. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +512 -74
  11. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +596 -5
  13. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  14. package/artifacts/contracts/components/Pool.sol/Pool.json +165 -93
  15. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  16. package/artifacts/contracts/components/Product.sol/Product.json +189 -15
  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/ISM.sol/ISM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  35. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  36. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  37. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  38. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
  39. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  41. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +179 -13
  42. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -5
  44. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/Instance.sol/Instance.json +111 -74
  46. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +47 -60
  48. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +41 -82
  50. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +168 -92
  52. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -24
  54. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
  56. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
  57. package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +102 -31
  58. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  60. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  68. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +131 -60
  71. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  72. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +31 -18
  73. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +126 -47
  75. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +31 -14
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +0 -5
  79. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +0 -5
  81. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +0 -5
  83. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -5
  85. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +0 -5
  87. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +152 -81
  89. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +44 -31
  91. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -47
  93. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +31 -14
  95. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +126 -47
  97. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +31 -14
  99. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  100. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  101. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +83 -3
  102. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +33 -28
  104. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  105. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  106. package/artifacts/contracts/registry/Registry.sol/Registry.json +96 -24
  107. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  108. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
  109. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  110. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -56
  111. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +28 -15
  113. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  114. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
  115. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  116. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +23 -26
  117. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  118. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  119. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  120. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  121. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -5
  122. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  123. package/artifacts/contracts/shared/IService.sol/IService.json +0 -5
  124. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  125. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +19 -6
  127. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  128. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
  129. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
  131. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  132. package/artifacts/contracts/shared/Service.sol/Service.json +13 -5
  133. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  134. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  135. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  136. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  137. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  138. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +19 -11
  139. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  140. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  141. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestService.sol/TestService.json +29 -21
  143. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  145. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  146. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  147. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  148. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  149. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  150. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  151. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  152. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  153. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  154. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  155. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  159. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  161. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  167. package/contracts/components/Component.sol +216 -0
  168. package/contracts/components/Distribution.sol +40 -51
  169. package/contracts/components/IComponent.sol +43 -0
  170. package/contracts/components/IDistributionComponent.sol +5 -2
  171. package/contracts/components/IPoolComponent.sol +6 -21
  172. package/contracts/components/IProductComponent.sol +7 -3
  173. package/contracts/components/Pool.sol +44 -108
  174. package/contracts/components/Product.sol +51 -86
  175. package/contracts/instance/BundleManager.sol +7 -11
  176. package/contracts/instance/IInstance.sol +20 -10
  177. package/contracts/instance/IInstanceService.sol +2 -1
  178. package/contracts/instance/Instance.sol +28 -31
  179. package/contracts/instance/InstanceAccessManager.sol +6 -11
  180. package/contracts/instance/InstanceReader.sol +3 -25
  181. package/contracts/instance/InstanceService.sol +112 -22
  182. package/contracts/instance/ObjectManager.sol +7 -24
  183. package/contracts/instance/base/ComponentService.sol +134 -0
  184. package/contracts/instance/service/BundleService.sol +2 -3
  185. package/contracts/instance/service/DistributionService.sol +23 -37
  186. package/contracts/instance/service/PolicyService.sol +2 -3
  187. package/contracts/instance/service/PoolService.sol +20 -55
  188. package/contracts/instance/service/ProductService.sol +50 -30
  189. package/contracts/registry/IRegistry.sol +13 -6
  190. package/contracts/registry/IRegistryService.sol +16 -9
  191. package/contracts/registry/Registry.sol +100 -44
  192. package/contracts/registry/RegistryAccessManager.sol +31 -25
  193. package/contracts/registry/RegistryService.sol +27 -85
  194. package/contracts/registry/ReleaseManager.sol +72 -82
  195. package/contracts/registry/TokenRegistry.sol +5 -3
  196. package/contracts/shared/IRegisterable.sol +1 -3
  197. package/contracts/shared/NftOwnable.sol +5 -0
  198. package/contracts/shared/Registerable.sol +10 -14
  199. package/contracts/shared/Service.sol +4 -2
  200. package/contracts/types/RoleId.sol +2 -2
  201. package/package.json +1 -1
  202. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
  203. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
  204. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  205. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
  206. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  207. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
  208. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
  209. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
  210. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
  211. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
  212. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
  213. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  214. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
  215. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  216. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  217. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
  218. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
  219. package/contracts/components/BaseComponent.sol +0 -159
  220. package/contracts/components/IBaseComponent.sol +0 -34
  221. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
  222. package/contracts/instance/IInstanceBase.sol +0 -26
  223. package/contracts/instance/InstanceBase.sol +0 -41
  224. package/contracts/instance/base/ComponentServiceBase.sol +0 -76
  225. package/contracts/instance/base/IInstanceBase.sol +0 -23
  226. package/contracts/instance/service/ComponentOwnerService.sol +0 -315
  227. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
  228. package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -30,21 +30,23 @@ contract Registry is
30
30
  uint256 public constant REGISTRY_TOKEN_SEQUENCE_ID = 2;
31
31
  string public constant EMPTY_URI = "";
32
32
 
33
- mapping(NftId nftId => ObjectInfo info) internal _info;
34
- mapping(address object => NftId nftId) internal _nftIdByAddress;
33
+ mapping(NftId nftId => ObjectInfo info) private _info;
34
+ mapping(address object => NftId nftId) private _nftIdByAddress;
35
35
 
36
- mapping(VersionPart version => mapping(ObjectType serviceDomain => address)) _service;
36
+ mapping(VersionPart version => mapping(ObjectType serviceDomain => address)) private _service;
37
+
38
+ mapping(ObjectType objectType => bool) private _coreTypes;
37
39
 
38
40
  mapping(ObjectType objectType => mapping(
39
- ObjectType parentType => bool)) internal _isValidContractCombination;
41
+ ObjectType parentType => bool)) private _coreContractCombinations;
40
42
 
41
43
  mapping(ObjectType objectType => mapping(
42
- ObjectType parentType => bool)) internal _isValidObjectCombination;
44
+ ObjectType parentType => bool)) private _coreObjectCombinations;
43
45
 
44
- NftId internal _registryNftId;
45
- ChainNft internal _chainNft;
46
+ NftId private _registryNftId;
47
+ ChainNft private _chainNft;
46
48
 
47
- ReleaseManager internal _releaseManager;
49
+ ReleaseManager private _releaseManager;
48
50
 
49
51
  modifier onlyRegistryService() {
50
52
  if(!_releaseManager.isActiveRegistryService(msg.sender)) {
@@ -65,14 +67,14 @@ contract Registry is
65
67
  _releaseManager = ReleaseManager(msg.sender);
66
68
 
67
69
  // deploy NFT
68
- _chainNft = new ChainNft(address(this));// adds 10kb to deployment size
70
+ _chainNft = new ChainNft(address(this));
69
71
 
70
72
  // initial registry setup
71
73
  _registerProtocol();
72
74
  _registerRegistry();
73
75
 
74
- // set object parent relations
75
- _setupValidObjectParentCombinations();
76
+ // set object types and object parent relations
77
+ _setupValidCoreTypesAndCombinations();
76
78
 
77
79
  _registerInterface(type(IRegistry).interfaceId);
78
80
  }
@@ -90,7 +92,10 @@ contract Registry is
90
92
  if(info.objectType != SERVICE()) {
91
93
  revert();
92
94
  }
93
- info.initialOwner = NFT_LOCK_ADDRESS <- if services are access managed
95
+ if(info.parentType != REGISTRY()) {
96
+ revert();
97
+ }
98
+ info.initialOwner == NFT_LOCK_ADDRESS <- if services are access managed
94
99
  */
95
100
 
96
101
  if(_service[version][domain] > address(0)) {
@@ -109,16 +114,59 @@ contract Registry is
109
114
  onlyRegistryService
110
115
  returns(NftId nftId)
111
116
  {
117
+ ObjectType objectType = info.objectType;
118
+ ObjectType parentType = _info[info.parentNftId].objectType;
119
+
120
+ // TODO do not need it here -> SERVICE is no longer part of _coreContractCombinations
112
121
  // no service registrations
113
- if(info.objectType == SERVICE()) {
122
+ if(objectType == SERVICE()) {
114
123
  revert ServiceRegistration();
115
124
  }
116
125
 
126
+ // only valid core types combinations
127
+ if(info.objectAddress == address(0))
128
+ {
129
+ if(_coreObjectCombinations[objectType][parentType] == false) {
130
+ revert InvalidTypesCombination(objectType, parentType);
131
+ }
132
+ }
133
+ else
134
+ {
135
+ if(_coreContractCombinations[objectType][parentType] == false) {
136
+ revert InvalidTypesCombination(objectType, parentType);
137
+ }
138
+ }
139
+
117
140
  nftId = _register(info);
118
141
  }
119
142
 
143
+ function registerWithCustomType(ObjectInfo memory info)
144
+ external
145
+ onlyRegistryService
146
+ returns(NftId nftId)
147
+ {
148
+ ObjectType objectType = info.objectType;
149
+ ObjectType parentType = _info[info.parentNftId].objectType;
150
+
151
+ if(_coreTypes[objectType]) {
152
+ revert CoreTypeRegistration();
153
+ }
154
+
155
+ if(
156
+
157
+ parentType == PROTOCOL() ||
158
+ parentType == REGISTRY() ||
159
+ parentType == SERVICE()
160
+ ) {
161
+ revert InvalidTypesCombination(objectType, parentType);
162
+ }
163
+
164
+ _register(info);
165
+ }
166
+
167
+
120
168
  /// @dev earliest GIF major version
121
- function getMajorVersionMin() external view returns (VersionPart) {
169
+ function getInitialVersion() external view returns (VersionPart) {
122
170
  return _releaseManager.getInitialVersion();
123
171
  }
124
172
 
@@ -129,17 +177,16 @@ contract Registry is
129
177
  // in this case we might want to have a period where the latest version is
130
178
  // in the process of being set up while the latest active version is 1 major release smaller
131
179
  /// @dev latest GIF major version (might not yet be active)
132
- function getMajorVersionMax() external view returns (VersionPart) {
180
+ function getNextVersion() external view returns (VersionPart) {
133
181
  return _releaseManager.getNextVersion();
134
182
  }
135
183
 
136
184
  /// @dev latest active GIF release version
137
- function getMajorVersion() external view returns (VersionPart) {
185
+ function getLatestVersion() external view returns (VersionPart) {
138
186
  return _releaseManager.getLatestVersion();
139
187
  }
140
188
 
141
- function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory)
142
- {
189
+ function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory) {
143
190
  return _releaseManager.getReleaseInfo(version);
144
191
  }
145
192
 
@@ -180,15 +227,23 @@ contract Registry is
180
227
  }
181
228
 
182
229
  function isRegisteredService(address object) external view override returns (bool) {
183
- return _nftIdByAddress[object].gtz() && _info[_nftIdByAddress[object]].objectType == SERVICE();
230
+ return _info[_nftIdByAddress[object]].objectType == SERVICE();
231
+ }
232
+
233
+ function isValidRelease(VersionPart version) external view returns (bool)
234
+ {
235
+ return _releaseManager.isValidRelease(version);
184
236
  }
185
237
 
186
238
  function getServiceAddress(
187
239
  ObjectType serviceDomain,
188
240
  VersionPart releaseVersion
189
- ) external view returns (address)
241
+ ) external view returns (address service)
190
242
  {
191
- return _service[releaseVersion][serviceDomain];
243
+ // TODO how can I get service address while release is not validated/activated ?!! -> user will check validity of release on its own
244
+ //if(_releaseManager.isValidRelease(releaseVersion)) {
245
+ service = _service[releaseVersion][serviceDomain];
246
+ //}
192
247
  }
193
248
 
194
249
  function getChainNft() external view override returns (ChainNft) {
@@ -239,11 +294,6 @@ contract Registry is
239
294
 
240
295
  if(info.objectAddress > address(0))
241
296
  {
242
- // parent is registered + object-parent types are valid
243
- if(_isValidContractCombination[objectType][parentType] == false) {
244
- revert InvalidTypesCombination(objectType, parentType);
245
- }
246
-
247
297
  address contractAddress = info.objectAddress;
248
298
 
249
299
  if(_nftIdByAddress[contractAddress].gtz()) {
@@ -252,12 +302,6 @@ contract Registry is
252
302
 
253
303
  _nftIdByAddress[contractAddress] = nftId;
254
304
  }
255
- else
256
- {
257
- if(_isValidObjectCombination[objectType][parentType] == false) {
258
- revert InvalidTypesCombination(objectType, parentType);
259
- }
260
- }
261
305
 
262
306
  emit LogRegistration(nftId, parentNftId, objectType, info.isInterceptor, info.objectAddress, info.initialOwner);
263
307
  }
@@ -370,27 +414,39 @@ contract Registry is
370
414
  // 2) DO NOT use object type (e.g. POLCY, BUNDLE, STAKE) as parent type
371
415
  // 3) DO NOT use REGISTRY as object type
372
416
  // 2) DO NOT use PROTOCOL and "zeroObjectType"
373
- function _setupValidObjectParentCombinations()
417
+ function _setupValidCoreTypesAndCombinations()
374
418
  private
375
419
  {
420
+ _coreTypes[REGISTRY()] = true;
421
+ _coreTypes[SERVICE()] = true;
422
+ _coreTypes[TOKEN()] = true;
423
+ _coreTypes[INSTANCE()] = true;
424
+ _coreTypes[PRODUCT()] = true;
425
+ _coreTypes[POOL()] = true;
426
+ _coreTypes[DISTRIBUTION()] = true;
427
+ _coreTypes[POLICY()] = true;
428
+ _coreTypes[BUNDLE()] = true;
429
+ _coreTypes[STAKE()] = true;
430
+
376
431
  // registry as parent, ONLY registry owner
377
- _isValidContractCombination[TOKEN()][REGISTRY()] = true;
378
- _isValidContractCombination[SERVICE()][REGISTRY()] = true;
432
+ //_coreContractCombinations[REGISTRY()][REGISTRY()] = true; // only for global regstry
433
+ _coreContractCombinations[TOKEN()][REGISTRY()] = true;
434
+ //_coreContractCombinations[SERVICE()][REGISTRY()] = true;// do not need it here -> registerService() registers exactly this combination
379
435
 
380
436
  // registry as parent, ONLY approved
381
- _isValidContractCombination[INSTANCE()][REGISTRY()] = true;
437
+ _coreContractCombinations[INSTANCE()][REGISTRY()] = true;
382
438
 
383
439
  // instance as parent, ONLY approved
384
- _isValidContractCombination[PRODUCT()][INSTANCE()] = true;
385
- _isValidContractCombination[DISTRIBUTION()][INSTANCE()] = true;
386
- _isValidContractCombination[ORACLE()][INSTANCE()] = true;
387
- _isValidContractCombination[POOL()][INSTANCE()] = true;
440
+ _coreContractCombinations[PRODUCT()][INSTANCE()] = true;
441
+ _coreContractCombinations[DISTRIBUTION()][INSTANCE()] = true;
442
+ _coreContractCombinations[ORACLE()][INSTANCE()] = true;
443
+ _coreContractCombinations[POOL()][INSTANCE()] = true;
388
444
 
389
445
  // product as parent, ONLY approved
390
- _isValidObjectCombination[POLICY()][PRODUCT()] = true;
446
+ _coreObjectCombinations[POLICY()][PRODUCT()] = true;
391
447
 
392
448
  // pool as parent, ONLY approved
393
- _isValidObjectCombination[BUNDLE()][POOL()] = true;
394
- _isValidObjectCombination[STAKE()][POOL()] = true;
449
+ _coreObjectCombinations[BUNDLE()][POOL()] = true;
450
+ _coreObjectCombinations[STAKE()][POOL()] = true;
395
451
  }
396
- }
452
+ }
@@ -5,29 +5,31 @@ import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManage
5
5
  import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManaged.sol";
6
6
 
7
7
  import {RoleId, RoleIdLib,
8
- REGISTRY_SERVICE_MANAGER_ROLE,
9
- REGISTRY_SERVICE_ADMIN_ROLE,
8
+ GIF_MANAGER_ROLE,
9
+ GIF_ADMIN_ROLE,
10
10
  RELEASE_MANAGER_ROLE} from "../types/RoleId.sol";
11
11
 
12
12
  import {TokenRegistry} from "./TokenRegistry.sol";
13
13
  import {ReleaseManager} from "./ReleaseManager.sol";
14
14
 
15
15
  /*
16
- 3 types of roles:
17
- 1) REGISTRAR roles
18
- - each one is unique
19
- - always have 1 member
20
- - one role is set for each function of each version of registry service
21
- 2) REGISTRY_SERVICE_MANAGER_ROLE aka GIF_MANAGER_ROLE
16
+ 4 types of roles:
17
+ 1) RELEASE_MANAGER_ROLE
18
+ - has only ReleaseManager as member
19
+ - responsible for setting and granting of REGISTRAR roles
20
+ 1) REGISTRAR roles
21
+ - set and granted by RELEASE_MANAGER_ROLE
22
+ - each has 1 unique member (regular service ver.X) (subject to change)
23
+ - each set to 1 target (registry service ver.X) and 1 selector (function of registry service ver.X) (subject to change)
24
+ 2) GIF_MANAGER_ROLE
22
25
  - can have arbitrary number of members
23
26
  - responsible for services registrations
24
27
  - responsible for token registration and activation
25
- 3) REGISTRY_SERVICE_ADMIN_ROLE aka GIF_ADMIN_ROLE
26
- - admin of REGISTRY_SERVICE_MANAGER_ROLE
28
+ 3) GIF_ADMIN_ROLE
29
+ - admin of GIF_MANAGER_ROLE
27
30
  - MUST have 1 member at any time
28
31
  - granted/revoked ONLY in transferAdminRole() -> consider lock out situations!!!
29
- - responsible for release manager initialization
30
- - responsible for creation and activation of each release
32
+ - responsible for creation and activation of releases
31
33
 
32
34
  */
33
35
 
@@ -71,8 +73,8 @@ contract RegistryAccessManager is AccessManaged
71
73
  _configureAdminRoleInitial();
72
74
 
73
75
  address admin = msg.sender;
74
- _grantRole(REGISTRY_SERVICE_ADMIN_ROLE(), admin, 0);
75
- _grantRole(REGISTRY_SERVICE_MANAGER_ROLE(), manager, 0);
76
+ _grantRole(GIF_ADMIN_ROLE(), admin, 0);
77
+ _grantRole(GIF_MANAGER_ROLE(), manager, 0);
76
78
  }
77
79
 
78
80
  function initialize(address releaseManager, address tokenRegistry)
@@ -124,10 +126,10 @@ contract RegistryAccessManager is AccessManaged
124
126
 
125
127
  /*function transferAdmin(address to)
126
128
  external
127
- restricted // only with REGISTRY_SERVICE_ADMIN_ROLE or nft owner
129
+ restricted // only with GIF_ADMIN_ROLE or nft owner
128
130
  {
129
- _accessManager.revoke(REGISTRY_SERVICE_ADMIN_ROLE, );
130
- _accesssManager.grant(REGISTRY_SERVICE_ADMIN_ROLE, to, 0);
131
+ _accessManager.revoke(GIF_ADMIN_ROLE, );
132
+ _accesssManager.grant(GIF_ADMIN_ROLE, to, 0);
131
133
  }*/
132
134
 
133
135
  //--- view functions ----------------------------------------------------//
@@ -147,7 +149,7 @@ contract RegistryAccessManager is AccessManaged
147
149
  bytes4[] memory functionSelector = new bytes4[](1);
148
150
 
149
151
  functionSelector[0] = RegistryAccessManager.initialize.selector;
150
- _setTargetFunctionRole(address(this), functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
152
+ _setTargetFunctionRole(address(this), functionSelector, GIF_ADMIN_ROLE());
151
153
  }
152
154
 
153
155
  function _configureAdminRole() private
@@ -157,15 +159,16 @@ contract RegistryAccessManager is AccessManaged
157
159
  // for RegistryServiceProxyManager
158
160
  // TODO upgrading with releaseManager.upgrade()->proxy.upgrade()???
159
161
  //functionSelector[0] = RegistryServiceManager.upgrade.selector;
160
- //_setTargetFunctionRole(address(this), functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
162
+ //_setTargetFunctionRole(address(this), functionSelector, GIF_ADMIN_ROLE());
161
163
 
162
164
  // for TokenRegistry
163
165
 
164
166
  // for ReleaseManager
165
167
  functionSelector[0] = ReleaseManager.createNextRelease.selector;
166
- _setTargetFunctionRole(_releaseManager, functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
167
- //functionSelector[0] = ReleaseManager.activateNextRelease.selector;
168
- //_setTargetFunctionRole(_releaseManager, functionSelector, REGISTRY_SERVICE_ADMIN_ROLE());
168
+ _setTargetFunctionRole(_releaseManager, functionSelector, GIF_ADMIN_ROLE());
169
+
170
+ functionSelector[0] = ReleaseManager.activateNextRelease.selector;
171
+ _setTargetFunctionRole(_releaseManager, functionSelector, GIF_ADMIN_ROLE());
169
172
  }
170
173
 
171
174
  function _configureManagerRole() private
@@ -174,14 +177,17 @@ contract RegistryAccessManager is AccessManaged
174
177
 
175
178
  // for TokenRegistry
176
179
  functionSelector[0] = TokenRegistry.setActive.selector;
177
- _setTargetFunctionRole(address(_tokenRegistry), functionSelector, REGISTRY_SERVICE_MANAGER_ROLE());
180
+ _setTargetFunctionRole(address(_tokenRegistry), functionSelector, GIF_MANAGER_ROLE());
178
181
 
179
182
  // for ReleaseManager
180
183
  functionSelector[0] = ReleaseManager.registerService.selector;
181
- _setTargetFunctionRole(_releaseManager, functionSelector, REGISTRY_SERVICE_MANAGER_ROLE());
184
+ _setTargetFunctionRole(_releaseManager, functionSelector, GIF_MANAGER_ROLE());
185
+
186
+ functionSelector[0] = ReleaseManager.registerRegistryService.selector;
187
+ _setTargetFunctionRole(_releaseManager, functionSelector, GIF_MANAGER_ROLE());
182
188
 
183
189
  // set admin
184
- _setRoleAdmin(REGISTRY_SERVICE_MANAGER_ROLE(), REGISTRY_SERVICE_ADMIN_ROLE());
190
+ _setRoleAdmin(GIF_MANAGER_ROLE(), GIF_ADMIN_ROLE());
185
191
  }
186
192
 
187
193
  function _configureReleaseManagerRole() private
@@ -8,7 +8,7 @@ import {IRegistry} from "./IRegistry.sol";
8
8
  import {IInstance} from "../instance/IInstance.sol";
9
9
 
10
10
  import {ContractDeployerLib} from "../shared/ContractDeployerLib.sol";
11
- import {IBaseComponent} from "../../contracts/components/IBaseComponent.sol";
11
+ import {IComponent} from "../../contracts/components/IComponent.sol";
12
12
  import {IPoolComponent} from "../../contracts/components/IPoolComponent.sol";
13
13
  import {IProductComponent} from "../../contracts/components/IProductComponent.sol";
14
14
  import {IDistributionComponent} from "../../contracts/components/IDistributionComponent.sol";
@@ -40,34 +40,28 @@ contract RegistryService is
40
40
  // TODO update to real hash when registry is stable
41
41
  bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
42
42
 
43
- address public constant NFT_LOCK_ADDRESS = address(0x1);
44
-
45
-
46
- function registerInstance(IRegisterable instance)
43
+ function registerInstance(IRegisterable instance, address owner)
47
44
  external
45
+ restricted
48
46
  returns(
49
- IRegistry.ObjectInfo memory info,
50
- bytes memory data
47
+ IRegistry.ObjectInfo memory info
51
48
  )
52
49
  {
53
50
  if(!instance.supportsInterface(type(IInstance).interfaceId)) {
54
51
  revert NotInstance();
55
52
  }
56
53
 
57
- (info, data) = _getAndVerifyContractInfo(instance, INSTANCE(), msg.sender);
58
-
54
+ info = _getAndVerifyContractInfo(instance, INSTANCE(), owner);
59
55
  info.nftId = _registry.register(info);
56
+
60
57
  instance.linkToRegisteredNftId(); // asume safe
61
-
62
- return (info, data);
63
58
  }
64
59
 
65
- function registerProduct(IBaseComponent product, address owner)
60
+ function registerProduct(IComponent product, address owner)
66
61
  external
67
62
  restricted
68
63
  returns(
69
- IRegistry.ObjectInfo memory info,
70
- bytes memory data
64
+ IRegistry.ObjectInfo memory info
71
65
  )
72
66
  {
73
67
  // CAN revert if no ERC165 support -> will revert with empty message
@@ -75,49 +69,38 @@ contract RegistryService is
75
69
  revert NotProduct();
76
70
  }
77
71
 
78
- (info, data) = _getAndVerifyContractInfo(product, PRODUCT(), owner);
79
-
72
+ info = _getAndVerifyContractInfo(product, PRODUCT(), owner);
80
73
  info.nftId = _registry.register(info);
81
-
82
- return (info, data);
83
74
  }
84
75
 
85
- function registerPool(IBaseComponent pool, address owner)
76
+ function registerPool(IComponent pool, address owner)
86
77
  external
87
78
  restricted
88
79
  returns(
89
- IRegistry.ObjectInfo memory info,
90
- bytes memory data
80
+ IRegistry.ObjectInfo memory info
91
81
  )
92
82
  {
93
83
  if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
94
84
  revert NotPool();
95
85
  }
96
86
 
97
- (info, data) = _getAndVerifyContractInfo(pool, POOL(), owner);
98
-
87
+ info = _getAndVerifyContractInfo(pool, POOL(), owner);
99
88
  info.nftId = _registry.register(info);
100
-
101
- return (info, data);
102
89
  }
103
90
 
104
- function registerDistribution(IBaseComponent distribution, address owner)
91
+ function registerDistribution(IComponent distribution, address owner)
105
92
  external
106
93
  restricted
107
94
  returns(
108
- IRegistry.ObjectInfo memory info,
109
- bytes memory data
95
+ IRegistry.ObjectInfo memory info
110
96
  )
111
97
  {
112
98
  if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
113
99
  revert NotDistribution();
114
100
  }
115
101
 
116
- (info, data) = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
117
-
102
+ info = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
118
103
  info.nftId = _registry.register(info);
119
-
120
- return (info, data);
121
104
  }
122
105
 
123
106
  function registerPolicy(IRegistry.ObjectInfo memory info)
@@ -180,15 +163,14 @@ contract RegistryService is
180
163
 
181
164
  // from IRegisterable
182
165
 
183
- function getInitialInfo()
184
- public
185
- view
186
- override(IRegisterable, Registerable)
187
- returns (IRegistry.ObjectInfo memory info, bytes memory data)
166
+ function getFunctionConfigs()
167
+ external
168
+ pure
169
+ returns(
170
+ FunctionConfig[] memory config
171
+ )
188
172
  {
189
- (info , data) = super.getInitialInfo();
190
-
191
- FunctionConfig[] memory config = new FunctionConfig[](6);
173
+ config = new FunctionConfig[](6);
192
174
 
193
175
  // order of service registrations MUST be reverse to this array
194
176
  /*config[-1].serviceDomain = STAKE();
@@ -212,8 +194,6 @@ contract RegistryService is
212
194
  // registerInstance() have no restriction
213
195
  config[5].serviceDomain = INSTANCE();
214
196
  config[5].selector = RegistryService.registerInstance.selector;
215
-
216
- data = abi.encode(config);
217
197
  }
218
198
 
219
199
  // Internal
@@ -224,16 +204,12 @@ contract RegistryService is
224
204
  address expectedOwner // assume can be 0 when given by other service
225
205
  )
226
206
  internal
227
- view
207
+ // view
228
208
  returns(
229
- IRegistry.ObjectInfo memory info,
230
- bytes memory data
209
+ IRegistry.ObjectInfo memory info
231
210
  )
232
211
  {
233
- (
234
- info,
235
- data
236
- ) = registerable.getInitialInfo();
212
+ info = registerable.getInitialInfo();
237
213
  info.objectAddress = address(registerable);
238
214
 
239
215
  if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
@@ -242,13 +218,8 @@ contract RegistryService is
242
218
 
243
219
  address owner = info.initialOwner;
244
220
 
245
- // solhint-disable-next-line
246
- if(expectedType == INSTANCE()) {
247
- // any address may create a new instance via instance service
248
- } else {
249
- if(owner != expectedOwner) { // registerable owner protection
250
- revert NotRegisterableOwner(expectedOwner);
251
- }
221
+ if(owner != expectedOwner) { // registerable owner protection
222
+ revert NotRegisterableOwner(expectedOwner);
252
223
  }
253
224
 
254
225
  if(owner == address(registerable)) {
@@ -262,15 +233,6 @@ contract RegistryService is
262
233
  if(getRegistry().isRegistered(owner)) {
263
234
  revert RegisterableOwnerIsRegistered();
264
235
  }
265
-
266
- /*NftId parentNftId = info.parentNftId;
267
- IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
268
-
269
- if(parentInfo.objectType != parentType) { // parent registration + type
270
- revert InvalidParent(parentNftId);
271
- }*/
272
-
273
- return(info, data);
274
236
  }
275
237
 
276
238
  function _verifyObjectInfo(
@@ -296,25 +258,5 @@ contract RegistryService is
296
258
  if(getRegistry().isRegistered(owner)) {
297
259
  revert RegisterableOwnerIsRegistered();
298
260
  }
299
-
300
- // can catch all 3 if check that initialOwner is not registered
301
- /*if(info.initialOwner == msg.sender) {
302
- revert InitialOwnerIsParent();
303
- }
304
-
305
- if(info.initialOwner == address(this)) {
306
- revert InitialOwnerIsService();
307
- }
308
-
309
- if(info.initialOwner == address(getRegistry())) {
310
- revert InitialOwnerIsRegistry();
311
- }*/
312
-
313
- /*NftId parentNftId = info.parentNftId;
314
- IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
315
-
316
- if(parentInfo.objectType != parentType) { // parent registration + type
317
- revert InvalidParent(parentNftId);
318
- }*/
319
261
  }
320
262
  }