@etherisc/gif-next 0.0.2-dc95063-418 → 0.0.2-dd40550-413

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) 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 +47 -6
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +70 -13
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +137 -6
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +144 -13
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +161 -20
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +151 -20
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +71 -20
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +62 -21
  18. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  19. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
  20. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  21. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  22. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +310 -2004
  23. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  24. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +101 -52
  25. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  26. package/artifacts/contracts/instance/Instance.sol/Instance.json +425 -2757
  27. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  28. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +95 -58
  29. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
  30. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
  31. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  32. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +348 -58
  33. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  34. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +153 -207
  35. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  36. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +38 -83
  37. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
  38. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2788 -0
  39. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  40. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
  41. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  42. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +113 -34
  43. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  44. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  46. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +8 -8
  47. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  48. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +6 -6
  49. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  50. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +6 -6
  51. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  52. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  53. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  54. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  55. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  56. package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
  57. package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
  58. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  59. package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +186 -236
  60. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  61. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +38 -55
  62. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +377 -182
  64. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +74 -39
  66. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
  67. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +710 -88
  68. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +143 -32
  70. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +266 -442
  72. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  73. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +82 -107
  74. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +111 -174
  76. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +233 -128
  78. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +385 -51
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +109 -282
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +210 -99
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +682 -33
  86. package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
  87. package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +510 -0
  88. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +85 -27
  90. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +420 -160
  92. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +104 -53
  94. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +880 -82
  96. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +90 -39
  98. package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
  99. package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +1004 -0
  100. package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
  101. package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +688 -0
  102. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  103. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +144 -57
  104. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  105. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +28 -37
  106. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  107. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  108. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  109. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +5 -37
  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 +2 -2
  113. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  114. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  115. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  116. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +22 -49
  117. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  118. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +21 -34
  119. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  120. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
  121. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  122. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +10 -23
  123. package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  124. package/artifacts/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +3 -3
  125. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  126. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  127. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  128. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +0 -13
  129. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  130. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +69 -9
  131. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  132. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -13
  133. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  134. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -13
  135. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  136. package/artifacts/contracts/shared/IService.sol/IService.json +85 -27
  137. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  138. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  139. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -19
  140. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  141. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +80 -26
  142. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  143. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +14 -27
  144. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  145. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +6 -19
  146. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  147. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  148. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  149. package/artifacts/contracts/shared/Service.sol/Service.json +91 -28
  150. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  151. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
  152. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  153. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  154. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  155. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  156. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  157. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +6 -19
  158. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  159. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
  160. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  161. package/artifacts/contracts/test/TestService.sol/TestService.json +106 -39
  162. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  163. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  164. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  165. package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
  166. package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  167. package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
  168. package/artifacts/contracts/types/Amount.sol/AmountLib.json +281 -0
  169. package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  171. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  172. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +83 -4
  173. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  175. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  176. package/artifacts/contracts/types/Fee.sol/FeeLib.json +74 -19
  177. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  178. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  179. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  180. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
  181. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  182. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  183. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  185. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  186. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  187. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +116 -7
  188. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  189. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
  190. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  191. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  192. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  193. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  194. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +1 -1
  195. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  196. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  197. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  198. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +17 -4
  199. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  200. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  201. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  202. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  203. package/contracts/components/Component.sol +25 -4
  204. package/contracts/components/Distribution.sol +11 -6
  205. package/contracts/components/IComponent.sol +19 -3
  206. package/contracts/components/IPoolComponent.sol +8 -7
  207. package/contracts/components/IProductComponent.sol +5 -4
  208. package/contracts/components/Pool.sol +17 -14
  209. package/contracts/components/Product.sol +144 -62
  210. package/contracts/instance/BundleManager.sol +3 -4
  211. package/contracts/instance/IInstance.sol +32 -53
  212. package/contracts/instance/IInstanceService.sol +15 -14
  213. package/contracts/instance/Instance.sol +107 -205
  214. package/contracts/instance/InstanceAccessManager.sol +44 -25
  215. package/contracts/instance/InstanceAuthorizationsLib.sol +308 -0
  216. package/contracts/instance/InstanceReader.sol +85 -7
  217. package/contracts/instance/InstanceService.sol +102 -289
  218. package/contracts/instance/InstanceStore.sol +212 -0
  219. package/contracts/instance/ObjectManager.sol +1 -1
  220. package/contracts/instance/base/ComponentService.sol +53 -39
  221. package/contracts/instance/base/KeyValueStore.sol +8 -34
  222. package/contracts/instance/base/Lifecycle.sol +15 -4
  223. package/contracts/instance/module/IAccess.sol +2 -2
  224. package/contracts/instance/module/IBundle.sol +6 -4
  225. package/contracts/instance/module/IComponents.sol +7 -1
  226. package/contracts/instance/module/IDistribution.sol +3 -2
  227. package/contracts/instance/module/IPolicy.sol +13 -8
  228. package/contracts/instance/service/ApplicationService.sol +62 -226
  229. package/contracts/instance/service/BundleService.sol +172 -126
  230. package/contracts/instance/service/ClaimService.sol +318 -32
  231. package/contracts/instance/service/DistributionService.sol +71 -190
  232. package/contracts/instance/service/IApplicationService.sol +8 -28
  233. package/contracts/instance/service/IBundleService.sol +82 -26
  234. package/contracts/instance/service/IClaimService.sol +52 -23
  235. package/contracts/instance/service/IDistributionService.sol +11 -22
  236. package/contracts/instance/service/IPolicyService.sol +24 -16
  237. package/contracts/instance/service/IPoolService.sol +82 -3
  238. package/contracts/instance/service/IPricingService.sol +37 -0
  239. package/contracts/instance/service/PolicyService.sol +152 -179
  240. package/contracts/instance/service/PoolService.sol +239 -56
  241. package/contracts/instance/service/PricingService.sol +275 -0
  242. package/contracts/instance/service/PricingServiceManager.sol +51 -0
  243. package/contracts/instance/service/ProductService.sol +27 -58
  244. package/contracts/registry/IRegistryService.sol +2 -3
  245. package/contracts/registry/RegistryService.sol +24 -21
  246. package/contracts/registry/ReleaseManager.sol +20 -18
  247. package/contracts/shared/IPolicyHolder.sol +23 -9
  248. package/contracts/shared/IRegistryLinked.sol +0 -1
  249. package/contracts/shared/IService.sol +6 -6
  250. package/contracts/shared/NftOwnable.sol +0 -2
  251. package/contracts/shared/PolicyHolder.sol +30 -17
  252. package/contracts/shared/Registerable.sol +10 -9
  253. package/contracts/shared/RegistryLinked.sol +0 -5
  254. package/contracts/shared/Service.sol +21 -7
  255. package/contracts/shared/TokenHandler.sol +4 -2
  256. package/contracts/test/TestService.sol +1 -1
  257. package/contracts/types/Amount.sol +109 -0
  258. package/contracts/types/ClaimId.sol +25 -2
  259. package/contracts/types/Fee.sol +16 -8
  260. package/contracts/types/ObjectType.sol +9 -5
  261. package/contracts/types/PayoutId.sol +33 -5
  262. package/contracts/types/StateId.sol +6 -2
  263. package/contracts/types/Timestamp.sol +5 -0
  264. package/package.json +1 -1
  265. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  266. /package/contracts/{instance → shared}/AccessManagerUpgradeableInitializeable.sol +0 -0
@@ -1,6 +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
5
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
6
 
6
7
  import {IComponents} from "../instance/module/IComponents.sol";
@@ -11,12 +12,14 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
11
12
  import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
12
13
  import {NftId} from "../types/NftId.sol";
13
14
  import {ObjectType} from "../types/ObjectType.sol";
15
+ import {TokenHandler} from "../shared/TokenHandler.sol";
14
16
 
15
17
  /// @dev component base class
16
18
  /// component examples are product, distribution, pool and oracle
17
19
  interface IComponent is
18
20
  IRegisterable,
19
- ITransferInterceptor
21
+ ITransferInterceptor,
22
+ IAccessManaged
20
23
  {
21
24
  error ErrorComponentNotChainNft(address caller);
22
25
  error ErrorComponentNotProductService(address caller);
@@ -27,9 +30,13 @@ interface IComponent is
27
30
  error ErrorComponentWalletAddressIsSameAsCurrent();
28
31
  error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
29
32
 
33
+ error ErrorComponentWalletNotComponent();
34
+
30
35
  event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
31
36
  event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
32
37
 
38
+ event LogComponentTokenHandlerApproved(uint256 limit);
39
+
33
40
  /// @dev locks component to disable functions that may change state related to this component, the only exception is function "unlock"
34
41
  /// only component owner (nft holder) is authorizes to call this function
35
42
  function lock() external;
@@ -38,6 +45,11 @@ interface IComponent is
38
45
  /// only component owner (nft holder) is authorizes to call this function
39
46
  function unlock() external;
40
47
 
48
+ /// @dev approves token hanlder to spend up to the specified amount of tokens
49
+ /// reverts if component wallet is not component itself
50
+ /// only component owner (nft holder) is authorizes to call this function
51
+ function approveTokenHandler(uint256 spendingLimitAmount) external;
52
+
41
53
  /// @dev sets the wallet address for the component
42
54
  /// if the current wallet has tokens, these will be transferred
43
55
  /// if the new wallet address is externally owned, an approval from the
@@ -47,6 +59,9 @@ interface IComponent is
47
59
  /// @dev only product service may set product nft id during registration of product setup
48
60
  function setProductNftId(NftId productNftId) external;
49
61
 
62
+ /// @dev defines the instance to which this component is linked to
63
+ function getInstance() external view returns (IInstance instance);
64
+
50
65
  /// @dev returns the name of this component
51
66
  /// to successfully register the component with an instance the name MUST be unique in the linked instance
52
67
  function getName() external view returns (string memory name);
@@ -54,8 +69,9 @@ interface IComponent is
54
69
  /// @dev defines which ERC20 token is used by this component
55
70
  function getToken() external view returns (IERC20Metadata token);
56
71
 
57
- /// @dev defines the instance to which this component is linked to
58
- function getInstance() external view returns (IInstance instance);
72
+ /// @dev returns token handler for this component
73
+ /// only registered components return a non zero token handler
74
+ function getTokenHandler() external view returns (TokenHandler tokenHandler);
59
75
 
60
76
  /// @dev defines the wallet address used to hold the ERC20 tokens related to this component
61
77
  /// the default address is the component token address
@@ -1,6 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {Amount} from "../types/Amount.sol";
4
5
  import {Fee} from "../types/Fee.sol";
5
6
  import {IComponent} from "./IComponent.sol";
6
7
  import {IComponents} from "../instance/module/IComponents.sol";
@@ -18,17 +19,17 @@ interface IPoolComponent is IComponent {
18
19
 
19
20
  error ErrorPoolApplicationBundleMismatch(NftId applicationNftId);
20
21
 
21
- event LogPoolVerifiedByPool(address pool, NftId applicationNftId, uint256 collateralizationAmount);
22
+ event LogPoolVerifiedByPool(address pool, NftId applicationNftId, Amount collateralizationAmount);
22
23
 
23
24
  /// @dev increases the staked tokens by the specified amount
24
25
  /// only the bundle owner may stake tokens
25
26
  /// bundle MUST be in active or locked state
26
- function stake(NftId bundleNftId, uint256 amount) external;
27
+ function stake(NftId bundleNftId, Amount amount) external;
27
28
 
28
29
  /// @dev decreases the staked tokens by the specified amount
29
30
  /// only the bundle owner may unstake tokens from the bundle
30
31
  /// bundle MUST be in active, locked or closed state
31
- function unstake(NftId bundleNftId, uint256 amount) external;
32
+ function unstake(NftId bundleNftId, Amount amount) external;
32
33
 
33
34
  /// @dev extends the bundle lifetime of the bundle by the specified time
34
35
  /// only the bundle owner may extend the bundle's lifetime
@@ -37,7 +38,7 @@ interface IPoolComponent is IComponent {
37
38
 
38
39
  /// @dev locks the specified bundle
39
40
  /// a bundle to be locked MUST be in active state
40
- /// locked bundles may not be used to underwrite any new policy
41
+ /// locked bundles may not be used to collateralize any new policy
41
42
  function lockBundle(NftId bundleNftId) external;
42
43
 
43
44
  /// @dev unlocks the specified bundle
@@ -61,7 +62,7 @@ interface IPoolComponent is IComponent {
61
62
 
62
63
  /// @dev sets the maximum overall capital amound held by this pool
63
64
  /// function may only be called by pool owner
64
- function setMaxCapitalAmount(uint256 maxCapitalAmount) external;
65
+ function setMaxCapitalAmount(Amount maxCapitalAmount) external;
65
66
 
66
67
  /// @dev sets the required role to create/own bundles
67
68
  /// may only be called once after setting up a pool
@@ -88,7 +89,7 @@ interface IPoolComponent is IComponent {
88
89
  bytes memory applicationData,
89
90
  NftId bundleNftId,
90
91
  bytes memory bundleFilter,
91
- uint256 collateralizationAmount
92
+ Amount collateralizationAmount
92
93
  ) external;
93
94
 
94
95
  /// @dev returns true iff the application matches with the bundle
@@ -99,7 +100,7 @@ interface IPoolComponent is IComponent {
99
100
  bytes memory applicationData,
100
101
  NftId bundleNftId,
101
102
  bytes memory bundleFilter,
102
- uint256 collateralizationAmount
103
+ Amount collateralizationAmount
103
104
  )
104
105
  external
105
106
  view
@@ -1,6 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {Amount} from "../types/Amount.sol";
4
5
  import {Fee} from "../types/Fee.sol";
5
6
  import {IComponent} from "./IComponent.sol";
6
7
  import {ISetup} from "../instance/module/ISetup.sol";
@@ -19,20 +20,20 @@ interface IProductComponent is IComponent {
19
20
  ) external;
20
21
 
21
22
  function calculatePremium(
22
- uint256 sumInsuredAmount,
23
+ Amount sumInsuredAmount,
23
24
  RiskId riskId,
24
25
  Seconds lifetime,
25
26
  bytes memory applicationData,
26
27
  NftId bundleNftId,
27
28
  ReferralId referralId
28
- ) external view returns (uint256 premiumAmount);
29
+ ) external view returns (Amount premiumAmount);
29
30
 
30
31
  function calculateNetPremium(
31
- uint256 sumInsuredAmount,
32
+ Amount sumInsuredAmount,
32
33
  RiskId riskId,
33
34
  Seconds lifetime,
34
35
  bytes memory applicationData
35
- ) external view returns (uint256 netPremiumAmount);
36
+ ) external view returns (Amount netPremiumAmount);
36
37
 
37
38
 
38
39
  function getPoolNftId() external view returns (NftId poolNftId);
@@ -1,21 +1,20 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {Amount, AmountLib} from "../types/Amount.sol";
4
5
  import {Component} from "./Component.sol";
5
6
  import {Fee, FeeLib} from "../types/Fee.sol";
6
7
  import {IBundleService} from "../instance/service/IBundleService.sol";
7
- import {InstanceReader} from "../instance/InstanceReader.sol";
8
8
  import {IPoolComponent} from "./IPoolComponent.sol";
9
9
  import {IPoolService} from "../instance/service/IPoolService.sol";
10
10
  import {IComponents} from "../instance/module/IComponents.sol";
11
11
  import {NftId, NftIdLib} from "../types/NftId.sol";
12
- import {POOL} from "../types/ObjectType.sol";
12
+ import {BUNDLE, POOL} from "../types/ObjectType.sol";
13
13
  import {RoleId, PUBLIC_ROLE} from "../types/RoleId.sol";
14
14
  import {Seconds} from "../types/Seconds.sol";
15
15
  import {TokenHandler} from "../shared/TokenHandler.sol";
16
16
  import {UFixed, UFixedLib} from "../types/UFixed.sol";
17
17
 
18
-
19
18
  abstract contract Pool is
20
19
  Component,
21
20
  IPoolComponent
@@ -61,8 +60,8 @@ abstract contract Pool is
61
60
  initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, registryData);
62
61
 
63
62
  PoolStorage storage $ = _getPoolStorage();
64
- $._poolService = getInstance().getPoolService();
65
- $._bundleService = getInstance().getBundleService();
63
+ $._poolService = IPoolService(_getServiceAddress(POOL()));
64
+ $._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
66
65
 
67
66
  registerInterface(type(IPoolComponent).interfaceId);
68
67
  }
@@ -70,7 +69,7 @@ abstract contract Pool is
70
69
 
71
70
  function stake(
72
71
  NftId bundleNftId,
73
- uint256 amount
72
+ Amount amount
74
73
  )
75
74
  public
76
75
  virtual
@@ -83,7 +82,7 @@ abstract contract Pool is
83
82
 
84
83
  function unstake(
85
84
  NftId bundleNftId,
86
- uint256 amount
85
+ Amount amount
87
86
  )
88
87
  public
89
88
  virtual
@@ -133,7 +132,7 @@ abstract contract Pool is
133
132
  //restricted()
134
133
  onlyBundleOwner(bundleNftId)
135
134
  {
136
- _getPoolStorage()._bundleService.close(bundleNftId);
135
+ _getPoolStorage()._poolService.closeBundle(bundleNftId);
137
136
  }
138
137
 
139
138
 
@@ -150,7 +149,7 @@ abstract contract Pool is
150
149
  }
151
150
 
152
151
 
153
- function setMaxCapitalAmount(uint256 maxCapitalAmount)
152
+ function setMaxCapitalAmount(Amount maxCapitalAmount)
154
153
  public
155
154
  virtual
156
155
  restricted()
@@ -190,7 +189,7 @@ abstract contract Pool is
190
189
  bytes memory applicationData,
191
190
  NftId bundleNftId,
192
191
  bytes memory bundleFilter,
193
- uint256 collateralizationAmount
192
+ Amount collateralizationAmount
194
193
  )
195
194
  public
196
195
  virtual
@@ -219,7 +218,7 @@ abstract contract Pool is
219
218
  bytes memory applicationData,
220
219
  NftId bundleNftId,
221
220
  bytes memory bundleFilter,
222
- uint256 collateralizationAmount
221
+ Amount collateralizationAmount
223
222
  )
224
223
  public
225
224
  view
@@ -239,14 +238,14 @@ abstract contract Pool is
239
238
  function _createBundle(
240
239
  address bundleOwner,
241
240
  Fee memory fee,
242
- uint256 amount,
241
+ Amount amount,
243
242
  Seconds lifetime,
244
243
  bytes memory filter
245
244
  )
246
245
  internal
247
246
  returns(NftId bundleNftId)
248
247
  {
249
- bundleNftId = _getPoolStorage()._bundleService.create(
248
+ bundleNftId = _getPoolStorage()._poolService.createBundle(
250
249
  bundleOwner,
251
250
  fee,
252
251
  amount,
@@ -274,11 +273,15 @@ abstract contract Pool is
274
273
  getToken(),
275
274
  TokenHandler(address(0)), // will be created by GIF service during registration
276
275
  address(this), // contract is its own wallet
276
+ AmountLib.zero(), // balance amount
277
+ AmountLib.zero(), // fee amount
277
278
  abi.encode(
278
279
  IComponents.PoolInfo(
279
280
  NftIdLib.zero(), // will be set when GIF registers the related product
280
281
  PUBLIC_ROLE(), // bundleOwnerRole
281
- type(uint256).max, // maxCapitalAmount,
282
+ AmountLib.max(), // maxCapitalAmount,
283
+ AmountLib.zero(), // initial balance amount
284
+ AmountLib.zero(), // initial fee amount
282
285
  isNftInterceptor(), // isInterceptingBundleTransfers
283
286
  false, // isExternallyManaged,
284
287
  false, // isVerifyingApplications,
@@ -3,21 +3,25 @@ pragma solidity ^0.8.19;
3
3
 
4
4
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
5
 
6
+ import {Amount, AmountLib} from "../types/Amount.sol";
7
+ import {ClaimId} from "../types/ClaimId.sol";
8
+ import {Component} from "./Component.sol";
9
+ import {Fee} from "../types/Fee.sol";
6
10
  import {IRisk} from "../instance/module/IRisk.sol";
7
11
  import {IApplicationService} from "../instance/service/IApplicationService.sol";
8
12
  import {IPolicyService} from "../instance/service/IPolicyService.sol";
9
13
  import {IProductService} from "../instance/service/IProductService.sol";
10
14
  import {IClaimService} from "../instance/service/IClaimService.sol";
15
+ import {IPricingService} from "../instance/service/IPricingService.sol";
11
16
  import {IProductComponent} from "./IProductComponent.sol";
12
17
  import {NftId, NftIdLib} from "../types/NftId.sol";
13
- import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
18
+ import {PayoutId} from "../types/PayoutId.sol";
19
+ import {PRODUCT, APPLICATION, POLICY, CLAIM, PRICE } from "../types/ObjectType.sol";
14
20
  import {ReferralId} from "../types/Referral.sol";
15
21
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
16
22
  import {Seconds} from "../types/Seconds.sol";
17
23
  import {StateId} from "../types/StateId.sol";
18
24
  import {Timestamp} from "../types/Timestamp.sol";
19
- import {Fee} from "../types/Fee.sol";
20
- import {Component} from "./Component.sol";
21
25
 
22
26
  import {TokenHandler} from "../shared/TokenHandler.sol";
23
27
 
@@ -40,6 +44,7 @@ abstract contract Product is
40
44
  IApplicationService _applicationService;
41
45
  IPolicyService _policyService;
42
46
  IClaimService _claimService;
47
+ IPricingService _pricingService;
43
48
  Pool _pool;
44
49
  Distribution _distribution;
45
50
  Fee _initialProductFee;
@@ -70,11 +75,12 @@ abstract contract Product is
70
75
 
71
76
  ProductStorage storage $ = _getProductStorage();
72
77
  // TODO add validation
73
- // TODO refactor to go via registry
78
+ // TODO refactor to go via registry ?
74
79
  $._productService = IProductService(_getServiceAddress(PRODUCT()));
75
80
  $._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
76
81
  $._policyService = IPolicyService(_getServiceAddress(POLICY()));
77
82
  $._claimService = IClaimService(_getServiceAddress(CLAIM()));
83
+ $._pricingService = IPricingService(_getServiceAddress(PRICE()));
78
84
  $._pool = Pool(pool);
79
85
  $._distribution = Distribution(distribution);
80
86
  $._initialProductFee = productFee;
@@ -86,50 +92,17 @@ abstract contract Product is
86
92
  registerInterface(type(IProductComponent).interfaceId);
87
93
  }
88
94
 
89
-
90
- function calculatePremium(
91
- uint256 sumInsuredAmount,
92
- RiskId riskId,
93
- Seconds lifetime,
94
- bytes memory applicationData,
95
- NftId bundleNftId,
96
- ReferralId referralId
97
- )
98
- external
99
- view
100
- override
101
- returns (uint256 premiumAmount)
102
- {
103
- IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
104
- getNftId(),
105
- riskId,
106
- sumInsuredAmount,
107
- lifetime,
108
- applicationData,
109
- bundleNftId,
110
- referralId
111
- );
112
- premiumAmount = premium.premiumAmount;
113
- }
114
-
115
-
116
- function calculateNetPremium(
117
- uint256 sumInsuredAmount,
118
- RiskId riskId,
119
- Seconds lifetime,
120
- bytes memory applicationData
95
+ // from product component
96
+ function setFees(
97
+ Fee memory productFee,
98
+ Fee memory processingFee
121
99
  )
122
100
  external
123
- view
124
- virtual override
125
- returns (uint256 netPremiumAmount)
101
+ onlyOwner
102
+ restricted()
103
+ override
126
104
  {
127
- // default 10% of sum insured
128
- return sumInsuredAmount / 10;
129
- }
130
-
131
- function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
132
- return RiskIdLib.toRiskId(riskName);
105
+ _getProductService().setFees(productFee, processingFee);
133
106
  }
134
107
 
135
108
  function _createRisk(
@@ -169,7 +142,7 @@ abstract contract Product is
169
142
  function _createApplication(
170
143
  address applicationOwner,
171
144
  RiskId riskId,
172
- uint256 sumInsuredAmount,
145
+ Amount sumInsuredAmount,
173
146
  Seconds lifetime,
174
147
  NftId bundleNftId,
175
148
  ReferralId referralId,
@@ -189,14 +162,14 @@ abstract contract Product is
189
162
  );
190
163
  }
191
164
 
192
- function _underwrite(
165
+ function _collateralize(
193
166
  NftId policyNftId,
194
167
  bool requirePremiumPayment,
195
168
  Timestamp activateAt
196
169
  )
197
170
  internal
198
171
  {
199
- _getProductStorage()._policyService.underwrite(
172
+ _getProductStorage()._policyService.collateralize(
200
173
  policyNftId,
201
174
  requirePremiumPayment,
202
175
  activateAt);
@@ -229,28 +202,137 @@ abstract contract Product is
229
202
  )
230
203
  internal
231
204
  {
232
- _getProductStorage()._policyService.close(policyNftId);
205
+ _getProductStorage()._policyService.close(
206
+ policyNftId);
233
207
  }
234
208
 
235
- function getPoolNftId() external view override returns (NftId poolNftId) {
236
- return getRegistry().getNftId(address(_getProductStorage()._pool));
209
+ function _submitClaim(
210
+ NftId policyNftId,
211
+ Amount claimAmount,
212
+ bytes memory claimData
213
+ )
214
+ internal
215
+ returns(ClaimId)
216
+ {
217
+ return _getProductStorage()._claimService.submit(
218
+ policyNftId,
219
+ claimAmount,
220
+ claimData);
237
221
  }
238
222
 
239
- function getDistributionNftId() external view override returns (NftId distributionNftId) {
240
- return getRegistry().getNftId(address(_getProductStorage()._distribution));
223
+ function _confirmClaim(
224
+ NftId policyNftId,
225
+ ClaimId claimId,
226
+ Amount confirmedAmount
227
+ )
228
+ internal
229
+ {
230
+ _getProductStorage()._claimService.confirm(
231
+ policyNftId,
232
+ claimId,
233
+ confirmedAmount);
241
234
  }
242
235
 
243
- // from product component
244
- function setFees(
245
- Fee memory productFee,
246
- Fee memory processingFee
236
+ function _declineClaim(
237
+ NftId policyNftId,
238
+ ClaimId claimId
239
+ )
240
+ internal
241
+ {
242
+ _getProductStorage()._claimService.decline(
243
+ policyNftId,
244
+ claimId);
245
+ }
246
+
247
+ function _closeClaim(
248
+ NftId policyNftId,
249
+ ClaimId claimId
250
+ )
251
+ internal
252
+ {
253
+ _getProductStorage()._claimService.close(
254
+ policyNftId,
255
+ claimId);
256
+ }
257
+
258
+ function _createPayout(
259
+ NftId policyNftId,
260
+ ClaimId claimId,
261
+ Amount amount,
262
+ bytes memory data
263
+ )
264
+ internal
265
+ returns (PayoutId)
266
+ {
267
+ return _getProductStorage()._claimService.createPayout(
268
+ policyNftId,
269
+ claimId,
270
+ amount,
271
+ data);
272
+ }
273
+
274
+ function _processPayout(
275
+ NftId policyNftId,
276
+ PayoutId payoutId
277
+ )
278
+ internal
279
+ {
280
+ _getProductStorage()._claimService.processPayout(
281
+ policyNftId,
282
+ payoutId);
283
+ }
284
+
285
+ function calculatePremium(
286
+ Amount sumInsuredAmount,
287
+ RiskId riskId,
288
+ Seconds lifetime,
289
+ bytes memory applicationData,
290
+ NftId bundleNftId,
291
+ ReferralId referralId
292
+ )
293
+ external
294
+ view
295
+ override
296
+ returns (Amount premiumAmount)
297
+ {
298
+ IPolicy.Premium memory premium = _getProductStorage()._pricingService.calculatePremium(
299
+ getNftId(),
300
+ riskId,
301
+ sumInsuredAmount,
302
+ lifetime,
303
+ applicationData,
304
+ bundleNftId,
305
+ referralId
306
+ );
307
+
308
+ return AmountLib.toAmount(premium.premiumAmount);
309
+ }
310
+
311
+ function calculateNetPremium(
312
+ Amount sumInsuredAmount,
313
+ RiskId riskId,
314
+ Seconds lifetime,
315
+ bytes memory applicationData
247
316
  )
248
317
  external
249
- onlyOwner
250
- restricted()
251
- override
318
+ view
319
+ virtual override
320
+ returns (Amount netPremiumAmount)
252
321
  {
253
- _getProductService().setFees(productFee, processingFee);
322
+ // default 10% of sum insured
323
+ return AmountLib.toAmount(sumInsuredAmount.toInt() / 10);
324
+ }
325
+
326
+ function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
327
+ return RiskIdLib.toRiskId(riskName);
328
+ }
329
+
330
+ function getPoolNftId() external view override returns (NftId poolNftId) {
331
+ return getRegistry().getNftId(address(_getProductStorage()._pool));
332
+ }
333
+
334
+ function getDistributionNftId() external view override returns (NftId distributionNftId) {
335
+ return getRegistry().getNftId(address(_getProductStorage()._distribution));
254
336
  }
255
337
 
256
338
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
@@ -290,4 +372,4 @@ abstract contract Product is
290
372
  function _getProductService() internal view returns (IProductService) {
291
373
  return _getProductStorage()._productService;
292
374
  }
293
- }
375
+ }
@@ -34,8 +34,7 @@ contract BundleManager is
34
34
  mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
35
35
 
36
36
  /// @dev links a policy to its bundle
37
- // to link a policy it MUST NOT yet have been activated
38
- // the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
37
+ // to link a policy it MUST NOT yet have been linked
39
38
  function linkPolicy(NftId policyNftId) external restricted() {
40
39
  NftId bundleNftId = _instance.getInstanceReader().getPolicyInfo(policyNftId).bundleNftId;
41
40
  // decision will likely depend on the decision what to check here and what in the service
@@ -87,14 +86,14 @@ contract BundleManager is
87
86
  }
88
87
 
89
88
 
90
- /// @dev unlocked (active) bundles are available to underwrite new policies
89
+ /// @dev unlocked (active) bundles are available to collateralize new policies
91
90
  function unlock(NftId bundleNftId) external restricted() {
92
91
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
93
92
  _activate(poolNftId, bundleNftId);
94
93
  emit LogBundleManagerBundleUnlocked(poolNftId, bundleNftId);
95
94
  }
96
95
 
97
- /// @dev locked (deactivated) bundles may not underwrite any new policies
96
+ /// @dev locked (deactivated) bundles may not collateralize any new policies
98
97
  function lock(NftId bundleNftId) external restricted() {
99
98
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
100
99
  _deactivate(poolNftId, bundleNftId);