@etherisc/gif-next 0.0.2-f034782-101 → 0.0.2-f080b71-868

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. package/README.md +6 -83
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  3. package/artifacts/contracts/components/Component.sol/Component.json +10 -0
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +10 -0
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +100 -0
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +100 -0
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +110 -0
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +100 -0
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +20 -0
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +10 -0
  18. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
  19. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  20. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  21. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  22. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  23. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +214 -1988
  24. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  25. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +101 -14
  26. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  27. package/artifacts/contracts/instance/Instance.sol/Instance.json +379 -2729
  28. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  29. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +95 -58
  30. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
  31. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
  32. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  33. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +45 -25
  34. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  35. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +157 -126
  36. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +30 -58
  38. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
  39. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2677 -0
  40. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  41. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  42. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +108 -21
  44. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  46. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
  48. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  49. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
  50. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  51. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +6 -6
  52. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  53. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  58. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  59. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  60. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +119 -227
  61. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  62. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +11 -35
  63. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  64. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +330 -147
  65. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  66. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +70 -14
  67. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
  68. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +127 -32
  69. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  70. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +11 -7
  71. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  72. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +193 -386
  73. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  74. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +38 -74
  75. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  76. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +68 -149
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +163 -113
  79. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
  80. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +80 -14
  81. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  82. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +89 -231
  83. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  84. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +132 -24
  85. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  86. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +430 -14
  87. package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
  88. package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +518 -0
  89. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  90. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
  91. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  92. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +210 -65
  93. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  94. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +27 -19
  95. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  96. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +493 -48
  97. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  98. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +18 -14
  99. package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
  100. package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +988 -0
  101. package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
  102. package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +689 -0
  103. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  104. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +139 -44
  105. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  106. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
  107. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  108. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  109. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  110. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -24
  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 +2 -2
  114. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  115. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  116. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  117. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +17 -36
  118. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
  120. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  121. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
  122. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  123. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  124. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  125. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  126. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  127. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  128. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  129. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  130. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  131. package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
  132. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  133. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  134. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  135. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  136. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  137. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  138. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  139. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  140. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  141. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  142. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  143. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  144. package/artifacts/contracts/shared/Service.sol/Service.json +86 -15
  145. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  146. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  147. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  148. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  149. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  150. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
  152. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  153. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  154. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  155. package/artifacts/contracts/test/TestService.sol/TestService.json +101 -26
  156. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  157. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  159. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  160. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  161. package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
  162. package/artifacts/contracts/types/Amount.sol/AmountLib.json +161 -0
  163. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  164. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  165. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  168. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  169. package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
  170. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  171. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  172. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  173. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  174. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  175. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  176. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  177. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  179. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
  182. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  183. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  184. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  186. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  188. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  190. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  192. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  193. package/contracts/components/Component.sol +4 -2
  194. package/contracts/components/IComponent.sol +3 -1
  195. package/contracts/components/Pool.sol +8 -4
  196. package/contracts/components/Product.sol +8 -5
  197. package/contracts/instance/IInstance.sol +16 -54
  198. package/contracts/instance/IInstanceService.sol +14 -2
  199. package/contracts/instance/Instance.sol +88 -188
  200. package/contracts/instance/InstanceAccessManager.sol +41 -23
  201. package/contracts/instance/InstanceAuthorizationsLib.sol +299 -0
  202. package/contracts/instance/InstanceReader.sol +15 -6
  203. package/contracts/instance/InstanceService.sol +59 -234
  204. package/contracts/instance/InstanceStore.sol +219 -0
  205. package/contracts/instance/base/ComponentService.sol +51 -38
  206. package/contracts/instance/base/KeyValueStore.sol +8 -3
  207. package/contracts/instance/module/IAccess.sol +2 -2
  208. package/contracts/instance/module/IBundle.sol +6 -4
  209. package/contracts/instance/module/IComponents.sol +6 -0
  210. package/contracts/instance/service/ApplicationService.sol +35 -202
  211. package/contracts/instance/service/BundleService.sol +165 -70
  212. package/contracts/instance/service/ClaimService.sol +2 -8
  213. package/contracts/instance/service/DistributionService.sol +30 -151
  214. package/contracts/instance/service/IApplicationService.sol +0 -18
  215. package/contracts/instance/service/IBundleService.sol +54 -22
  216. package/contracts/instance/service/IDistributionService.sol +1 -14
  217. package/contracts/instance/service/IPolicyService.sol +2 -0
  218. package/contracts/instance/service/IPoolService.sol +65 -1
  219. package/contracts/instance/service/IPricingService.sol +36 -0
  220. package/contracts/instance/service/PolicyService.sol +88 -115
  221. package/contracts/instance/service/PoolService.sol +136 -53
  222. package/contracts/instance/service/PricingService.sol +275 -0
  223. package/contracts/instance/service/PricingServiceManager.sol +51 -0
  224. package/contracts/instance/service/ProductService.sol +25 -56
  225. package/contracts/registry/IRegistryService.sol +4 -3
  226. package/contracts/registry/RegistryService.sol +25 -22
  227. package/contracts/registry/ReleaseManager.sol +20 -18
  228. package/contracts/shared/IService.sol +4 -6
  229. package/contracts/shared/Service.sol +21 -7
  230. package/contracts/test/TestService.sol +1 -1
  231. package/contracts/types/Amount.sol +60 -0
  232. package/contracts/types/Fee.sol +12 -5
  233. package/contracts/types/ObjectType.sol +4 -0
  234. package/package.json +1 -1
@@ -0,0 +1,275 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.19;
3
+
4
+ import {Seconds} from "../../types/Seconds.sol";
5
+ import {UFixed, UFixedLib} from "../../types/UFixed.sol";
6
+ import {ObjectType} from "../../types/ObjectType.sol";
7
+ import {NftId} from "../../types/NftId.sol";
8
+ import {Fee} from "../../types/Fee.sol";
9
+ import {ReferralId} from "../../types/Referral.sol";
10
+ import {RiskId} from "../../types/RiskId.sol";
11
+ import {PRODUCT, DISTRIBUTION, PRICE} from "../../types/ObjectType.sol";
12
+
13
+ import {IRegistry} from "../../registry/IRegistry.sol";
14
+
15
+ import {IProductComponent} from "../../components/IProductComponent.sol";
16
+
17
+ import {IInstance} from "../IInstance.sol";
18
+ import {InstanceReader} from "../InstanceReader.sol";
19
+ import {IComponents} from "../module/IComponents.sol";
20
+ import {IPolicy} from "../module/IPolicy.sol";
21
+ import {IBundle} from "../module/IBundle.sol";
22
+ import {ISetup} from "../module/ISetup.sol";
23
+ import {IDistribution} from "../module/IDistribution.sol";
24
+
25
+ import {ComponentService} from "../base/ComponentService.sol";
26
+
27
+ import {IPricingService} from "./IPricingService.sol";
28
+ import {IDistributionService} from "./IDistributionService.sol";
29
+
30
+
31
+ contract PricingService is
32
+ ComponentService,
33
+ IPricingService
34
+ {
35
+ using UFixedLib for UFixed;
36
+
37
+ IDistributionService internal _distributionService;
38
+
39
+
40
+ function _initialize(
41
+ address owner,
42
+ bytes memory data
43
+ )
44
+ internal
45
+ virtual override
46
+ initializer()
47
+ {
48
+ // TODO check this, might no longer be the way, refactor if necessary
49
+ address registryAddress;
50
+ address initialOwner;
51
+ (registryAddress, initialOwner) = abi.decode(data, (address, address));
52
+
53
+ initializeService(registryAddress, address(0), owner);
54
+ registerInterface(type(IPricingService).interfaceId);
55
+
56
+ _distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
57
+ }
58
+
59
+
60
+ function getDomain() public pure override returns(ObjectType) {
61
+ return PRICE();
62
+ }
63
+
64
+ /// @dev calculates the premium amount for the specified attributes
65
+ /// also returns the various fee components involved with creating a policy
66
+ function calculatePremium(
67
+ NftId productNftId,
68
+ NftId bundleNftId,
69
+ RiskId riskId,
70
+ ReferralId referralId,
71
+ uint256 sumInsuredAmount,
72
+ Seconds lifetime,
73
+ bytes memory applicationData
74
+ )
75
+ external
76
+ view
77
+ virtual override
78
+ returns (
79
+ IPolicy.Premium memory premium
80
+ )
81
+ {
82
+ InstanceReader reader;
83
+ uint256 netPremiumAmount;
84
+
85
+ {
86
+ // verify product
87
+ (
88
+ IRegistry.ObjectInfo memory productInfo,
89
+ IInstance instance
90
+ ) = _getAndVerifyComponentInfoAndInstance(productNftId, PRODUCT());
91
+
92
+ reader = instance.getInstanceReader();
93
+
94
+ // calculate net premium
95
+ netPremiumAmount = IProductComponent(productInfo.objectAddress).calculateNetPremium(
96
+ sumInsuredAmount,
97
+ riskId,
98
+ lifetime,
99
+ applicationData
100
+ );
101
+ }
102
+
103
+ {
104
+ // get configurations for all involed objects
105
+ ISetup.ProductSetupInfo memory productSetup = reader.getProductSetupInfo(productNftId);
106
+
107
+ bytes memory componentData = reader.getComponentInfo(productSetup.poolNftId).data;
108
+ IComponents.PoolInfo memory poolInfo = abi.decode(componentData, (IComponents.PoolInfo));
109
+
110
+ IBundle.BundleInfo memory bundleInfo = reader.getBundleInfo(bundleNftId);
111
+ if(bundleInfo.poolNftId != productSetup.poolNftId) {
112
+ revert ErrorIPricingServiceBundlePoolMismatch(bundleNftId, bundleInfo.poolNftId, productSetup.poolNftId);
113
+ }
114
+
115
+ NftId distributionNftId = productSetup.distributionNftId;
116
+ ISetup.DistributionSetupInfo memory distSetup = reader.getDistributionSetupInfo(distributionNftId);
117
+
118
+ // calculate premium, order is important
119
+ premium = _getFixedFeeAmounts(
120
+ netPremiumAmount,
121
+ productSetup,
122
+ poolInfo,
123
+ distSetup,
124
+ bundleInfo
125
+ );
126
+
127
+ premium = _calculateVariableFeeAmounts(
128
+ premium,
129
+ productSetup,
130
+ poolInfo,
131
+ distSetup,
132
+ bundleInfo
133
+ );
134
+
135
+ premium = _calculateFeeAmount(
136
+ premium,
137
+ distSetup,
138
+ referralId,
139
+ distributionNftId,
140
+ reader
141
+ );
142
+
143
+ // sanity check to validate the fee calculation
144
+ if (premium.distributionOwnerFeeFixAmount < distSetup.minDistributionOwnerFee.fixedFee) {
145
+ revert ErrorIPricingServiceFeeCalculationMismatch(
146
+ premium.distributionFeeFixAmount,
147
+ premium.distributionFeeVarAmount,
148
+ premium.distributionOwnerFeeFixAmount,
149
+ premium.distributionOwnerFeeVarAmount,
150
+ premium.commissionAmount,
151
+ premium.discountAmount
152
+ );
153
+ }
154
+
155
+ if ((premium.distributionFeeVarAmount) != (premium.discountAmount + premium.distributionOwnerFeeVarAmount + premium.commissionAmount)) {
156
+ revert ErrorIPricingServiceFeeCalculationMismatch(
157
+ premium.distributionFeeFixAmount,
158
+ premium.distributionFeeVarAmount,
159
+ premium.distributionOwnerFeeFixAmount,
160
+ premium.distributionOwnerFeeVarAmount,
161
+ premium.commissionAmount,
162
+ premium.discountAmount
163
+ );
164
+ }
165
+ }
166
+ }
167
+
168
+ // internal functions
169
+ function _getFixedFeeAmounts(
170
+ uint256 netPremiumAmount,
171
+ ISetup.ProductSetupInfo memory productInfo,
172
+ IComponents.PoolInfo memory poolInfo,
173
+ ISetup.DistributionSetupInfo memory distInfo,
174
+ IBundle.BundleInfo memory bundleInfo
175
+ )
176
+ internal
177
+ view
178
+ returns (
179
+ IPolicy.Premium memory premium
180
+ )
181
+ {
182
+ // initial premium amount is the net premium
183
+ premium.netPremiumAmount = netPremiumAmount;
184
+ premium.fullPremiumAmount = netPremiumAmount;
185
+
186
+ uint256 t = productInfo.productFee.fixedFee;
187
+ premium.productFeeFixAmount = t;
188
+ premium.fullPremiumAmount += t;
189
+
190
+ t = poolInfo.poolFee.fixedFee;
191
+ premium.poolFeeFixAmount = t;
192
+ premium.fullPremiumAmount += t;
193
+
194
+ t = bundleInfo.fee.fixedFee;
195
+ premium.bundleFeeFixAmount = t;
196
+ premium.fullPremiumAmount += t;
197
+
198
+ t = distInfo.distributionFee.fixedFee;
199
+ premium.distributionFeeFixAmount = t;
200
+ premium.fullPremiumAmount += t;
201
+ }
202
+
203
+ function _calculateVariableFeeAmounts(
204
+ IPolicy.Premium memory premium,
205
+ ISetup.ProductSetupInfo memory productInfo,
206
+ IComponents.PoolInfo memory poolInfo,
207
+ ISetup.DistributionSetupInfo memory distInfo,
208
+ IBundle.BundleInfo memory bundleInfo
209
+ )
210
+ internal
211
+ view
212
+ returns (
213
+ IPolicy.Premium memory intermadiatePremium
214
+ )
215
+ {
216
+ UFixed netPremiumAmount = UFixedLib.toUFixed(premium.netPremiumAmount);
217
+
218
+ uint256 t = (netPremiumAmount * productInfo.productFee.fractionalFee).toInt();
219
+ premium.productFeeVarAmount = t;
220
+ premium.fullPremiumAmount += t;
221
+
222
+ t = (netPremiumAmount * poolInfo.poolFee.fractionalFee).toInt();
223
+ premium.poolFeeVarAmount = t;
224
+ premium.fullPremiumAmount += t;
225
+
226
+ t = (netPremiumAmount * bundleInfo.fee.fractionalFee).toInt();
227
+ premium.bundleFeeVarAmount = t;
228
+ premium.fullPremiumAmount += t;
229
+
230
+ t = (netPremiumAmount * distInfo.distributionFee.fractionalFee).toInt();
231
+ premium.distributionFeeVarAmount = t;
232
+ premium.fullPremiumAmount += t;
233
+
234
+ return premium;
235
+ }
236
+
237
+ function _calculateFeeAmount(
238
+ IPolicy.Premium memory premium,
239
+ ISetup.DistributionSetupInfo memory distInfo,
240
+ ReferralId referralId,
241
+ NftId distributionNftId,
242
+ InstanceReader reader
243
+ )
244
+ internal
245
+ view
246
+ returns (IPolicy.Premium memory finalPremium)
247
+ {
248
+ // if the referral is not valid, then the distribution owner gets everything
249
+ if (! _distributionService.referralIsValid(distributionNftId, referralId)) {
250
+ premium.distributionOwnerFeeFixAmount = premium.distributionFeeFixAmount;
251
+ premium.distributionOwnerFeeVarAmount = premium.distributionFeeVarAmount;
252
+ premium.premiumAmount = premium.fullPremiumAmount;
253
+ return premium;
254
+ }
255
+
256
+ Fee memory minDistributionOwnerFee = distInfo.minDistributionOwnerFee;
257
+
258
+ // if the referral is valid, the the commission and discount are calculated based in the full premium
259
+ // the remaing amount goes to the distribution owner
260
+ {
261
+ IDistribution.ReferralInfo memory referralInfo = reader.getReferralInfo(referralId);
262
+ IDistribution.DistributorInfo memory distributorInfo = reader.getDistributorInfo(referralInfo.distributorNftId);
263
+ IDistribution.DistributorTypeInfo memory distributorTypeInfo = reader.getDistributorTypeInfo(distributorInfo.distributorType);
264
+
265
+ uint256 commissionAmount = UFixedLib.toUFixed(premium.netPremiumAmount).mul(distributorTypeInfo.commissionPercentage).toInt();
266
+ premium.commissionAmount = commissionAmount;
267
+ premium.discountAmount = UFixedLib.toUFixed(premium.fullPremiumAmount).mul(referralInfo.discountPercentage).toInt();
268
+ premium.distributionOwnerFeeFixAmount = distInfo.minDistributionOwnerFee.fixedFee;
269
+ premium.distributionOwnerFeeVarAmount = premium.distributionFeeVarAmount - commissionAmount - premium.discountAmount;
270
+ premium.premiumAmount = premium.fullPremiumAmount - premium.discountAmount;
271
+ }
272
+
273
+ return premium;
274
+ }
275
+ }
@@ -0,0 +1,51 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IVersionable} from "../../shared/IVersionable.sol";
5
+ import {ProxyManager} from "../../shared/ProxyManager.sol";
6
+ import {PricingService} from "./PricingService.sol";
7
+ import {Registry} from "../../registry/Registry.sol";
8
+ import {RegistryService} from "../../registry/RegistryService.sol";
9
+ import {REGISTRY} from "../../types/ObjectType.sol";
10
+
11
+ contract PricingServiceManager is ProxyManager {
12
+
13
+ PricingService private _pricingService;
14
+
15
+ /// @dev initializes proxy manager with distribution service implementation and deploys instance
16
+ constructor(
17
+ address registryAddress
18
+ )
19
+ ProxyManager(registryAddress)
20
+ {
21
+ PricingService pricingSrv = new PricingService();
22
+ bytes memory data = abi.encode(registryAddress, address(this));
23
+ IVersionable versionable = deploy(
24
+ address(pricingSrv),
25
+ data);
26
+
27
+ _pricingService = PricingService(address(versionable));
28
+
29
+ // TODO `thi` must have a role or own nft to register service
30
+ //Registry registry = Registry(registryAddress);
31
+ //address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _distributionService.getMajorVersion());
32
+ //RegistryService registryService = RegistryService(registryServiceAddress);
33
+ //registryService.registerService(_distributionService);
34
+
35
+ // TODO no nft to link yet
36
+ // link ownership of instance service manager ot nft owner of instance service
37
+ //_linkToNftOwnable(
38
+ // address(registryAddress),
39
+ // address(_distributionService));
40
+ }
41
+
42
+ //--- view functions ----------------------------------------------------//
43
+ function getPricingService()
44
+ external
45
+ view
46
+ returns (PricingService getPricingService)
47
+ {
48
+ return _pricingService;
49
+ }
50
+
51
+ }
@@ -60,9 +60,9 @@ contract ProductService is ComponentService, IProductService {
60
60
  address initialOwner;
61
61
  (registryAddress, initialOwner) = abi.decode(data, (address, address));
62
62
 
63
- initializeService(registryAddress, owner);
63
+ initializeService(registryAddress, address(0), owner);
64
64
 
65
- _poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getMajorVersion()));
65
+ _poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
66
66
 
67
67
  registerInterface(type(IProductService).interfaceId);
68
68
  }
@@ -111,7 +111,7 @@ contract ProductService is ComponentService, IProductService {
111
111
  product.linkToRegisteredNftId();
112
112
 
113
113
  // create product setup in instance
114
- instance.createProductSetup(productNftId, product.getSetupInfo());
114
+ instance.getInstanceStore().createProductSetup(productNftId, product.getSetupInfo());
115
115
 
116
116
  bytes4[][] memory selectors = new bytes4[][](1);
117
117
  selectors[0] = new bytes4[](1);
@@ -129,7 +129,7 @@ contract ProductService is ComponentService, IProductService {
129
129
  roles);
130
130
  }
131
131
 
132
- function getDomain() public pure override(IService, Service) returns(ObjectType) {
132
+ function getDomain() public pure override returns(ObjectType) {
133
133
  return PRODUCT();
134
134
  }
135
135
 
@@ -147,38 +147,6 @@ contract ProductService is ComponentService, IProductService {
147
147
  // if(wallet == address(0)) {
148
148
  // revert WalletIsZero();
149
149
  // }
150
-
151
- // IRegistry.ObjectInfo memory tokenInfo = getRegistry().getObjectInfo(address(info.token));
152
-
153
- // if(tokenInfo.objectType != TOKEN()) {
154
- // revert InvalidToken();
155
- // }
156
-
157
- // IRegistry.ObjectInfo memory poolInfo = getRegistry().getObjectInfo(info.poolNftId);
158
-
159
- // if(poolInfo.objectType != POOL()) {
160
- // revert InvalidPool();
161
- // }
162
-
163
- // if(poolInfo.parentNftId != instanceNftId) {
164
- // revert InvalidPoolsInstance();
165
- // }
166
- // // TODO pool have the same token
167
- // //ITreasury.PoolSetup memory poolSetup = instance.getPoolSetup(info.poolNftId);
168
- // //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
169
- // // TODO pool is not linked
170
-
171
- // IRegistry.ObjectInfo memory distributionInfo = getRegistry().getObjectInfo(info.distributionNftId);
172
-
173
- // if(distributionInfo.objectType != DISTRIBUTION()) {
174
- // revert InvalidDistribution();
175
- // }
176
-
177
- // if(distributionInfo.parentNftId != instanceNftId) {
178
- // revert InvalidDistributionsInstance();
179
- // }
180
- // // TODO distribution have the same token
181
- // // TODO distribution is not linked
182
150
  }
183
151
 
184
152
  function setFees(
@@ -189,32 +157,28 @@ contract ProductService is ComponentService, IProductService {
189
157
  {
190
158
  // TODO check args
191
159
 
192
- (
193
- IRegistry.ObjectInfo memory productInfo,
194
- IInstance instance
195
- ) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
196
-
160
+ (NftId productNftId,, IInstance instance) = _getAndVerifyCallingComponentAndInstance(PRODUCT());
197
161
  InstanceReader instanceReader = instance.getInstanceReader();
198
- NftId productNftId = productInfo.nftId;
162
+
199
163
  ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(productNftId);
200
164
 
201
165
  productSetupInfo.productFee = productFee;
202
166
  productSetupInfo.processingFee = processingFee;
203
167
 
204
- instance.updateProductSetup(productNftId, productSetupInfo, KEEP_STATE());
168
+ instance.getInstanceStore().updateProductSetup(productNftId, productSetupInfo, KEEP_STATE());
205
169
  }
206
170
 
207
171
  function createRisk(
208
172
  RiskId riskId,
209
173
  bytes memory data
210
- ) external override {
211
- (
212
- IRegistry.ObjectInfo memory productInfo,
213
- IInstance instance
214
- ) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
215
- NftId productNftId = productInfo.nftId;
174
+ )
175
+ external
176
+ override
177
+ {
178
+ (NftId productNftId,, IInstance instance) = _getAndVerifyCallingComponentAndInstance(PRODUCT());
216
179
  IRisk.RiskInfo memory riskInfo = IRisk.RiskInfo(productNftId, data);
217
- instance.createRisk(
180
+
181
+ instance.getInstanceStore().createRisk(
218
182
  riskId,
219
183
  riskInfo
220
184
  );
@@ -223,19 +187,24 @@ contract ProductService is ComponentService, IProductService {
223
187
  function updateRisk(
224
188
  RiskId riskId,
225
189
  bytes memory data
226
- ) external {
227
- (, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
190
+ )
191
+ external
192
+ {
193
+ (,, IInstance instance) = _getAndVerifyCallingComponentAndInstance(PRODUCT());
228
194
  InstanceReader instanceReader = instance.getInstanceReader();
195
+
229
196
  IRisk.RiskInfo memory riskInfo = instanceReader.getRiskInfo(riskId);
230
197
  riskInfo.data = data;
231
- instance.updateRisk(riskId, riskInfo, KEEP_STATE());
198
+ instance.getInstanceStore().updateRisk(riskId, riskInfo, KEEP_STATE());
232
199
  }
233
200
 
234
201
  function updateRiskState(
235
202
  RiskId riskId,
236
203
  StateId state
237
- ) external {
238
- (, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
239
- instance.updateRiskState(riskId, state);
204
+ )
205
+ external
206
+ {
207
+ (,, IInstance instance) = _getAndVerifyCallingComponentAndInstance(PRODUCT());
208
+ instance.getInstanceStore().updateRiskState(riskId, state);
240
209
  }
241
210
  }
@@ -1,7 +1,7 @@
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";
4
+ // import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
5
5
 
6
6
  import {NftId} from "../types/NftId.sol";
7
7
  import {ObjectType} from "../types/ObjectType.sol";
@@ -13,8 +13,9 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
13
13
  import {IComponent} from "../components/IComponent.sol";
14
14
 
15
15
  interface IRegistryService is
16
- IService,
17
- IAccessManaged
16
+ IService
17
+ // TODO cleanup
18
+ // IAccessManaged
18
19
  {
19
20
  error SelfRegistration();
20
21
  error NotRegistryOwner();
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5
- import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
+ // import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
6
6
 
7
7
  import {IRegistry} from "./IRegistry.sol";
8
8
  import {IInstance} from "../instance/IInstance.sol";
@@ -19,7 +19,7 @@ import {IRegisterable} from "../../contracts/shared/IRegisterable.sol";
19
19
  import {Registerable} from "../../contracts/shared/Registerable.sol";
20
20
 
21
21
  import {RoleId, PRODUCT_OWNER_ROLE, POOL_OWNER_ROLE, ORACLE_OWNER_ROLE} from "../../contracts/types/RoleId.sol";
22
- import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, DISTRIBUTOR, APPLICATION, POLICY, CLAIM, BUNDLE, STAKE} from "../../contracts/types/ObjectType.sol";
22
+ import {ObjectType, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, DISTRIBUTION, DISTRIBUTOR, APPLICATION, POLICY, CLAIM, BUNDLE, STAKE, PRICE} from "../../contracts/types/ObjectType.sol";
23
23
  import {StateId, ACTIVE, PAUSED} from "../../contracts/types/StateId.sol";
24
24
  import {NftId, NftIdLib, zeroNftId} from "../../contracts/types/NftId.sol";
25
25
  import {Fee, FeeLib} from "../../contracts/types/Fee.sol";
@@ -31,7 +31,6 @@ import {IRegistryService} from "./IRegistryService.sol";
31
31
  import {Registry} from "./Registry.sol";
32
32
 
33
33
  contract RegistryService is
34
- AccessManagedUpgradeable,
35
34
  Service,
36
35
  IRegistryService
37
36
  {
@@ -41,7 +40,7 @@ contract RegistryService is
41
40
  bytes32 public constant REGISTRY_CREATION_CODE_HASH = bytes32(0);
42
41
 
43
42
  // From IService
44
- function getDomain() public pure override(IService, Service) returns(ObjectType serviceDomain) {
43
+ function getDomain() public pure override returns(ObjectType serviceDomain) {
45
44
  return REGISTRY();
46
45
  }
47
46
 
@@ -61,9 +60,8 @@ contract RegistryService is
61
60
  address initialAuthority
62
61
  ) = abi.decode(data, (address, address));
63
62
 
64
- __AccessManaged_init(initialAuthority);
63
+ initializeService(registryAddress, initialAuthority, owner);
65
64
 
66
- initializeService(registryAddress, owner);
67
65
  registerInterface(type(IRegistryService).interfaceId);
68
66
  }
69
67
 
@@ -170,7 +168,7 @@ contract RegistryService is
170
168
  }
171
169
 
172
170
  // from IRegisterable
173
-
171
+ // TODO store precalculated addresses, deply with CREATE2
174
172
  function getFunctionConfigs()
175
173
  external
176
174
  pure
@@ -178,7 +176,7 @@ contract RegistryService is
178
176
  FunctionConfig[] memory config
179
177
  )
180
178
  {
181
- config = new FunctionConfig[](8);
179
+ config = new FunctionConfig[](9);
182
180
 
183
181
  // order of service registrations MUST be reverse to this array
184
182
  /*config[-1].serviceDomain = STAKE();
@@ -194,27 +192,32 @@ contract RegistryService is
194
192
  config[2].serviceDomain = CLAIM();
195
193
  config[2].selectors = new bytes4[](0);
196
194
 
197
- config[3].serviceDomain = BUNDLE();
195
+ config[3].serviceDomain = PRODUCT();
198
196
  config[3].selectors = new bytes4[](1);
199
- config[3].selectors[0] = RegistryService.registerBundle.selector;
197
+ config[3].selectors[0] = RegistryService.registerProduct.selector;
200
198
 
201
- config[4].serviceDomain = PRODUCT();
199
+ config[4].serviceDomain = POOL();
202
200
  config[4].selectors = new bytes4[](1);
203
- config[4].selectors[0] = RegistryService.registerProduct.selector;
201
+ config[4].selectors[0] = RegistryService.registerPool.selector;
204
202
 
205
- config[5].serviceDomain = POOL();
203
+ // registration of bundle service must preceed registration of pool service
204
+ config[5].serviceDomain = BUNDLE();
206
205
  config[5].selectors = new bytes4[](1);
207
- config[5].selectors[0] = RegistryService.registerPool.selector;
206
+ config[5].selectors[0] = RegistryService.registerBundle.selector;
207
+
208
+ // registration of pricing service must preceed registration of application service
209
+ config[6].serviceDomain = PRICE();
210
+ config[6].selectors = new bytes4[](0);
208
211
 
209
- config[6].serviceDomain = DISTRIBUTION();
210
- config[6].selectors = new bytes4[](2);
211
- config[6].selectors[0] = RegistryService.registerDistribution.selector;
212
- config[6].selectors[1] = RegistryService.registerDistributor.selector;
212
+ // registration of distribution service must preceed registration of pricing service
213
+ config[7].serviceDomain = DISTRIBUTION();
214
+ config[7].selectors = new bytes4[](2);
215
+ config[7].selectors[0] = RegistryService.registerDistribution.selector;
216
+ config[7].selectors[1] = RegistryService.registerDistributor.selector;
213
217
 
214
- // registerInstance() have no restriction
215
- config[7].serviceDomain = INSTANCE();
216
- config[7].selectors = new bytes4[](1);
217
- config[7].selectors[0] = RegistryService.registerInstance.selector;
218
+ config[8].serviceDomain = INSTANCE();
219
+ config[8].selectors = new bytes4[](1);
220
+ config[8].selectors[0] = RegistryService.registerInstance.selector;
218
221
  }
219
222
 
220
223
  // Internal