@etherisc/gif-next 0.0.2-e2d8c7d-942 → 0.0.2-e38b7e6-931

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
  2. package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +40 -0
  3. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.json +42 -100
  5. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
  6. package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +40 -0
  7. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  8. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  10. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
  11. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  12. package/artifacts/contracts/components/Pool.sol/Pool.json +42 -128
  13. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  14. package/artifacts/contracts/components/Product.sol/Product.json +47 -116
  15. package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
  16. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
  17. package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
  18. package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
  19. package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
  20. package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
  21. package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
  22. package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
  23. package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
  24. package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
  25. package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
  26. package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
  27. package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
  28. package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
  29. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
  30. package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
  31. package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
  32. package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
  33. package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
  34. package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
  35. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
  36. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  38. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  39. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  40. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +90 -13
  41. package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  42. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  43. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +88 -14
  44. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  45. package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -616
  46. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +221 -114
  48. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +2 -2
  50. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
  52. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +126 -242
  54. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -126
  56. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  57. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  58. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +114 -13
  60. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
  61. package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
  62. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  64. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  66. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  67. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +59 -16
  68. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  69. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  70. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  71. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +235 -37
  76. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +20 -24
  78. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +145 -38
  80. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +17 -21
  82. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +64 -13
  84. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
  86. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +120 -13
  88. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +13 -13
  90. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +13 -13
  92. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +326 -64
  94. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +51 -23
  96. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +145 -38
  98. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -21
  100. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  101. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +151 -44
  102. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  103. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +17 -13
  104. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  105. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  106. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  107. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +132 -133
  108. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  109. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +94 -65
  110. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  111. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  112. package/artifacts/contracts/registry/Registry.sol/Registry.json +145 -227
  113. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
  114. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
  115. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  116. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +30 -128
  117. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  118. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -104
  119. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
  120. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +530 -0
  121. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  122. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -27
  123. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  124. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  125. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  126. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  127. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IService.sol/IService.json +13 -13
  129. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  131. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  132. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  133. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  134. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  135. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  136. package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
  137. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  138. package/artifacts/contracts/shared/Service.sol/Service.json +13 -13
  139. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  140. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  141. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  142. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  143. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  144. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  145. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  147. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
  149. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  150. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  152. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  153. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  154. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  155. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  156. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  157. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  158. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  159. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  160. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  161. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  162. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  163. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  167. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  173. package/contracts/components/BaseComponent.sol +48 -12
  174. package/contracts/components/Distribution.sol +2 -11
  175. package/contracts/components/IBaseComponent.sol +5 -1
  176. package/contracts/components/IProductComponent.sol +2 -2
  177. package/contracts/components/Pool.sol +5 -18
  178. package/contracts/components/Product.sol +19 -16
  179. package/contracts/instance/IInstance.sol +3 -3
  180. package/contracts/instance/IInstanceBase.sol +0 -1
  181. package/contracts/instance/IInstanceService.sol +9 -3
  182. package/contracts/instance/Instance.sol +12 -214
  183. package/contracts/instance/InstanceAccessManager.sol +92 -77
  184. package/contracts/instance/InstanceBase.sol +0 -2
  185. package/contracts/instance/InstanceService.sol +118 -72
  186. package/contracts/instance/InstanceServiceManager.sol +5 -8
  187. package/contracts/instance/base/ComponentServiceBase.sol +78 -12
  188. package/contracts/instance/base/IInstanceBase.sol +0 -2
  189. package/contracts/instance/module/IAccess.sol +27 -17
  190. package/contracts/instance/service/BundleService.sol +39 -5
  191. package/contracts/instance/service/BundleServiceManager.sol +5 -8
  192. package/contracts/instance/service/DistributionService.sol +33 -36
  193. package/contracts/instance/service/DistributionServiceManager.sol +6 -9
  194. package/contracts/instance/service/IBundleService.sol +5 -6
  195. package/contracts/instance/service/IPolicyService.sol +7 -0
  196. package/contracts/instance/service/PolicyService.sol +65 -34
  197. package/contracts/instance/service/PoolService.sol +46 -28
  198. package/contracts/instance/service/PoolServiceManager.sol +5 -8
  199. package/contracts/instance/service/ProductService.sol +66 -30
  200. package/contracts/registry/ChainNft.sol +1 -1
  201. package/contracts/registry/IRegistry.sol +26 -16
  202. package/contracts/registry/IRegistryService.sol +13 -5
  203. package/contracts/registry/Registry.sol +149 -201
  204. package/contracts/registry/RegistryAccessManager.sol +210 -0
  205. package/contracts/registry/RegistryService.sol +50 -88
  206. package/contracts/registry/RegistryServiceManager.sol +18 -36
  207. package/contracts/registry/ReleaseManager.sol +342 -0
  208. package/contracts/registry/TokenRegistry.sol +5 -6
  209. package/contracts/shared/IRegisterable.sol +0 -2
  210. package/contracts/shared/IService.sol +2 -1
  211. package/contracts/shared/ProxyManager.sol +1 -1
  212. package/contracts/shared/Service.sol +10 -7
  213. package/contracts/test/TestService.sol +3 -2
  214. package/contracts/types/RoleId.sol +10 -12
  215. package/package.json +1 -1
  216. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
  217. package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
  218. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
  219. package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
  220. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
  221. package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
  222. package/contracts/instance/IAccessManagerSimple.sol +0 -391
  223. package/contracts/instance/service/ComponentOwnerService.sol +0 -317
  224. package/contracts/instance/service/IComponentOwnerService.sol +0 -20
@@ -23,7 +23,7 @@ import {Versionable} from "../../shared/Versionable.sol";
23
23
  import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
24
24
  import {UFixed, UFixedLib} from "../../types/UFixed.sol";
25
25
  import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
26
- import {ObjectType, INSTANCE, PRODUCT, POLICY} from "../../types/ObjectType.sol";
26
+ import {ObjectType, PRODUCT, POOL, POLICY} from "../../types/ObjectType.sol";
27
27
  import {APPLIED, UNDERWRITTEN, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
28
28
  import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
29
29
  import {Fee, FeeLib} from "../../types/Fee.sol";
@@ -39,16 +39,11 @@ import {ComponentServiceBase} from "../base/ComponentServiceBase.sol";
39
39
  import {IProductService} from "./IProductService.sol";
40
40
  import {InstanceReader} from "../InstanceReader.sol";
41
41
  import {IPoolService} from "./PoolService.sol";
42
- import {POOL_SERVICE_NAME} from "./PoolService.sol";
43
-
44
- string constant PRODUCT_SERVICE_NAME = "ProductService";
45
42
 
46
43
  // TODO or name this ProtectionService to have Product be something more generic (loan, savings account, ...)
47
44
  contract ProductService is ComponentServiceBase, IProductService {
48
45
  using NftIdLib for NftId;
49
46
 
50
- string public constant NAME = "ProductService";
51
-
52
47
  IPoolService internal _poolService;
53
48
 
54
49
  event LogProductServiceSender(address sender);
@@ -67,50 +62,91 @@ contract ProductService is ComponentServiceBase, IProductService {
67
62
 
68
63
  _initializeService(registryAddress, owner);
69
64
 
70
- _poolService = IPoolService(_registry.getServiceAddress(POOL_SERVICE_NAME, getMajorVersion()));
65
+ _poolService = IPoolService(_registry.getServiceAddress(POOL(), getMajorVersion()));
71
66
 
72
67
  _registerInterface(type(IProductService).interfaceId);
73
68
  }
74
69
 
75
70
 
76
- function getName() public pure override(IService, Service) returns(string memory name) {
77
- return NAME;
71
+ function getDomain() public pure override(IService, Service) returns(ObjectType) {
72
+ return PRODUCT();
78
73
  }
79
74
 
80
75
  function register(address productAddress)
81
76
  external
82
77
  returns(NftId productNftId)
83
78
  {
84
- address productOwner = msg.sender;
85
- IBaseComponent product = IBaseComponent(productAddress);
86
-
87
- IRegistry.ObjectInfo memory info;
88
- bytes memory data;
89
- (info, data) = getRegistryService().registerProduct(product, productOwner);
90
-
91
- IInstance instance = _getInstance(info);
92
- bool hasRole = getInstanceService().hasRole(
93
- productOwner,
94
- PRODUCT_OWNER_ROLE(),
95
- address(instance));
79
+ (
80
+ IBaseComponent product,
81
+ address productOwner,
82
+ IInstance instance,
83
+ NftId instanceNftId
84
+ ) = _checkComponentForRegistration(
85
+ productAddress,
86
+ PRODUCT(),
87
+ PRODUCT_OWNER_ROLE());
96
88
 
97
- if(!hasRole) {
98
- revert ExpectedRoleMissing(PRODUCT_OWNER_ROLE(), productOwner);
99
- }
89
+ (
90
+ IRegistry.ObjectInfo memory productInfo,
91
+ bytes memory data
92
+ ) = getRegistryService().registerProduct(product, productOwner);
93
+ product.linkToRegisteredNftId();
94
+ productNftId = productInfo.nftId;
100
95
 
101
- productNftId = info.nftId;
102
- ISetup.ProductSetupInfo memory initialSetup = _decodeAndVerifyProductSetup(data);
96
+ (
97
+ string memory name,
98
+ ISetup.ProductSetupInfo memory initialSetup
99
+ ) = _decodeAndVerifyProductData(data);
103
100
  instance.createProductSetup(productNftId, initialSetup);
101
+
102
+ getInstanceService().createTarget(instanceNftId, productAddress, name);
104
103
  }
105
104
 
106
- function _decodeAndVerifyProductSetup(bytes memory data) internal returns(ISetup.ProductSetupInfo memory setup)
105
+ function _decodeAndVerifyProductData(bytes memory data)
106
+ internal
107
+ returns(string memory name, ISetup.ProductSetupInfo memory setup)
107
108
  {
108
- setup = abi.decode(
109
+ (name, setup) = abi.decode(
109
110
  data,
110
- (ISetup.ProductSetupInfo)
111
+ (string, ISetup.ProductSetupInfo)
111
112
  );
112
113
 
113
- // TODO add checks if applicable
114
+ // TODO add checks
115
+ // if(wallet == address(0)) {
116
+ // revert WalletIsZero();
117
+ // }
118
+
119
+ // IRegistry.ObjectInfo memory tokenInfo = _registry.getObjectInfo(address(info.token));
120
+
121
+ // if(tokenInfo.objectType != TOKEN()) {
122
+ // revert InvalidToken();
123
+ // }
124
+
125
+ // IRegistry.ObjectInfo memory poolInfo = _registry.getObjectInfo(info.poolNftId);
126
+
127
+ // if(poolInfo.objectType != POOL()) {
128
+ // revert InvalidPool();
129
+ // }
130
+
131
+ // if(poolInfo.parentNftId != instanceNftId) {
132
+ // revert InvalidPoolsInstance();
133
+ // }
134
+ // // TODO pool have the same token
135
+ // //ITreasury.PoolSetup memory poolSetup = instance.getPoolSetup(info.poolNftId);
136
+ // //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
137
+ // // TODO pool is not linked
138
+
139
+ // IRegistry.ObjectInfo memory distributionInfo = _registry.getObjectInfo(info.distributionNftId);
140
+
141
+ // if(distributionInfo.objectType != DISTRIBUTION()) {
142
+ // revert InvalidDistribution();
143
+ // }
144
+
145
+ // if(distributionInfo.parentNftId != instanceNftId) {
146
+ // revert InvalidDistributionsInstance();
147
+ // }
148
+ // // TODO distribution have the same token
149
+ // // TODO distribution is not linked
114
150
  }
115
151
 
116
152
  function setFees(
@@ -59,7 +59,7 @@ contract ChainNft is ERC721Enumerable {
59
59
  }
60
60
 
61
61
  _chainIdMultiplier = 10 ** _chainIdDigits;
62
- _idNext = 4;
62
+ _idNext = 3;
63
63
  }
64
64
 
65
65
  /**
@@ -7,25 +7,25 @@ import {ChainNft} from "./ChainNft.sol";
7
7
  import {NftId} from "../types/NftId.sol";
8
8
  import {ObjectType} from "../types/ObjectType.sol";
9
9
  import {VersionPart} from "../types/Version.sol";
10
+ import {Timestamp} from "../types/Timestamp.sol";
10
11
 
11
12
  interface IRegistry is IERC165 {
12
13
 
13
- event LogInitialMajorVersionSet(VersionPart majorVersion);
14
- event LogMajorVersionSet(VersionPart majorVersionMax);
15
- event LogRegistration(ObjectInfo info);
16
- event LogServiceNameRegistration(string serviceName, VersionPart majorVersion);
17
-
18
- // setMajorVersion()
19
- error NotOwner(address account);
20
- error MajorVersionMaxIncreaseInvalid(VersionPart newMajorVersionMax, VersionPart existingMaxMajorVersion);
14
+ event LogRegistration(NftId nftId, NftId parentNftId, ObjectType objectType, bool isInterceptor, address objectAddress, address initialOwner);
15
+ event LogServiceRegistration(VersionPart majorVersion, ObjectType domain);
21
16
 
22
17
  // register()
23
- error NotRegistryService();
18
+ error CallerNotRegistryService();
19
+ error ServiceRegistration();
20
+
21
+ // registerService()
22
+ error CallerNotReleaseManager();
23
+ error ServiceAlreadyRegistered(address service);
24
+
25
+ // _register()
24
26
  error ZeroParentAddress();
25
27
  error InvalidTypesCombination(ObjectType objectType, ObjectType parentType);
26
28
  error ContractAlreadyRegistered(address objectAddress);
27
- error InvalidServiceVersion(VersionPart majorVersion);
28
- error ServiceNameAlreadyRegistered(string name, VersionPart majorVersion);
29
29
 
30
30
  struct ObjectInfo {
31
31
  NftId nftId;
@@ -38,7 +38,17 @@ interface IRegistry is IERC165 {
38
38
  }// TODO delete nftId and initialOwner(if not used) from struct
39
39
  // TODO strong disagree, keep nftId there (lets keep get object info return object consistent)
40
40
 
41
- function setMajorVersion(VersionPart newMajorVersionMax) external;
41
+ struct ReleaseInfo {
42
+ ObjectType[] domains;
43
+ Timestamp createdAt;
44
+ //Timestamp updatedAt;
45
+ }
46
+
47
+ function registerService(
48
+ ObjectInfo memory serviceInfo,
49
+ VersionPart serviceVersion,
50
+ ObjectType serviceDomain
51
+ ) external returns(NftId nftId);
42
52
 
43
53
  function register(ObjectInfo memory info) external returns (NftId nftId);
44
54
 
@@ -48,6 +58,8 @@ interface IRegistry is IERC165 {
48
58
 
49
59
  function getMajorVersion() external view returns (VersionPart);
50
60
 
61
+ function getReleaseInfo(VersionPart version) external view returns (ReleaseInfo memory);
62
+
51
63
  function getObjectCount() external view returns (uint256);
52
64
 
53
65
  function getNftId() external view returns (NftId nftId);
@@ -68,11 +80,9 @@ interface IRegistry is IERC165 {
68
80
 
69
81
  function isRegisteredService(address contractAddress) external view returns (bool);
70
82
 
71
- function getServiceName(NftId nftId) external view returns (string memory name);
72
-
73
83
  function getServiceAddress(
74
- string memory serviceName,
75
- VersionPart majorVersion
84
+ ObjectType serviceDomain,
85
+ VersionPart releaseVersion
76
86
  ) external view returns (address serviceAddress);
77
87
 
78
88
  function getChainNft() external view returns (ChainNft);
@@ -1,6 +1,8 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
+
4
6
  import {NftId} from "../types/NftId.sol";
5
7
  import {ObjectType} from "../types/ObjectType.sol";
6
8
  import {RoleId} from "../types/RoleId.sol";
@@ -10,8 +12,10 @@ import {IRegistry} from "./IRegistry.sol";
10
12
  import {IRegisterable} from "../shared/IRegisterable.sol";
11
13
  import {IBaseComponent} from "../components/IBaseComponent.sol";
12
14
 
13
- interface IRegistryService is IService {
14
-
15
+ interface IRegistryService is
16
+ IService,
17
+ IAccessManaged
18
+ {
15
19
  error SelfRegistration();
16
20
  error NotRegistryOwner();
17
21
 
@@ -28,9 +32,13 @@ interface IRegistryService is IService {
28
32
  error InvalidInitialOwner(address initialOwner);
29
33
  error InvalidAddress(address registerableAddress);
30
34
 
35
+ struct FunctionConfig
36
+ {
37
+ ObjectType serviceDomain;
38
+ bytes4 selector;
39
+ }
31
40
 
32
- function registerService(IService service) external returns(IRegistry.ObjectInfo memory info, bytes memory data);
33
-
41
+ // TODO used by service -> add owner arg
34
42
  function registerInstance(IRegisterable instance)
35
43
  external returns(IRegistry.ObjectInfo memory info, bytes memory data);
36
44
 
@@ -43,7 +51,7 @@ interface IRegistryService is IService {
43
51
  function registerDistribution(IBaseComponent distribution, address owner)
44
52
  external returns(IRegistry.ObjectInfo memory info, bytes memory data);
45
53
 
46
- function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId); // -> easy to upgrade
54
+ function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
47
55
 
48
56
  function registerBundle(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
49
57
  }