@etherisc/gif-next 0.0.2-93de5de-423 → 0.0.2-94237b7-984

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/README.md +0 -71
  2. package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
  3. package/artifacts/contracts/components/Component.sol/Component.json +78 -89
  4. package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
  5. package/artifacts/contracts/components/Distribution.sol/Distribution.json +123 -183
  6. package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
  7. package/artifacts/contracts/components/IComponent.sol/IComponent.json +156 -64
  8. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  9. package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +169 -143
  10. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  11. package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +353 -176
  12. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  13. package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -138
  14. package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
  15. package/artifacts/contracts/components/Pool.sol/Pool.json +299 -245
  16. package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
  17. package/artifacts/contracts/components/Product.sol/Product.json +83 -162
  18. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
  19. package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
  20. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  21. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
  22. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
  23. package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
  24. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  25. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +199 -316
  26. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  27. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +185 -50
  28. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  29. package/artifacts/contracts/instance/Instance.sol/Instance.json +288 -387
  30. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
  31. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
  32. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  33. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +137 -234
  34. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  35. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +313 -169
  36. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  37. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +71 -23
  38. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  39. package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
  40. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
  41. package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +86 -20
  42. package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  43. package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  44. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  45. package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +40 -10
  46. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  47. package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
  48. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  49. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
  50. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  51. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
  52. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
  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 +261 -80
  60. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  61. package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +41 -25
  62. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
  63. package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +387 -241
  64. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  65. package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +74 -14
  66. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
  67. package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +105 -31
  68. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  69. package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +11 -7
  70. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +933 -70
  72. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  73. package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +142 -14
  74. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +200 -40
  76. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +220 -183
  78. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +90 -13
  80. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  81. package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +630 -20
  82. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  83. package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +103 -69
  84. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
  85. package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +521 -13
  86. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
  87. package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +90 -13
  88. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
  89. package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +150 -167
  90. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  91. package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +27 -47
  92. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
  93. package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +562 -41
  94. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  95. package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +24 -12
  96. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
  97. package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +115 -41
  98. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  99. package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
  100. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  101. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
  102. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  103. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
  104. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  105. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -13
  106. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  107. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
  108. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  109. package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
  110. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
  111. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
  112. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  113. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -26
  114. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
  116. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  117. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
  118. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  119. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  120. package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
  121. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  122. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  123. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  124. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  125. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  126. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  127. package/artifacts/contracts/shared/IService.sol/IService.json +90 -13
  128. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  129. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  130. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  131. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  132. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  133. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  134. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  135. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  136. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +3 -3
  137. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  138. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  139. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  140. package/artifacts/contracts/shared/Service.sol/Service.json +97 -15
  141. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  142. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  143. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  144. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
  145. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  146. package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
  147. package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
  148. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
  149. package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +3 -3
  150. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
  151. package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
  152. package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
  153. package/artifacts/contracts/test/TestService.sol/TestService.json +112 -26
  154. package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
  155. package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
  156. package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
  157. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
  158. package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
  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/Blocknumber.sol/BlocknumberLib.json +2 -2
  165. package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
  166. package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  167. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  168. package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
  169. package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
  170. package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
  171. package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
  172. package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
  173. package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
  174. package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
  175. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  176. package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
  177. package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
  178. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  179. package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
  180. package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  181. package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
  182. package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
  183. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
  184. package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
  185. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
  186. package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
  187. package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
  188. package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
  189. package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
  190. package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
  191. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
  192. package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
  193. package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
  194. package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
  195. package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
  196. package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
  197. package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
  198. package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
  199. package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
  200. package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
  201. package/contracts/components/Component.sol +99 -87
  202. package/contracts/components/Distribution.sol +16 -44
  203. package/contracts/components/IComponent.sol +40 -18
  204. package/contracts/components/IDistributionComponent.sol +1 -30
  205. package/contracts/components/IPoolComponent.sol +73 -47
  206. package/contracts/components/IProductComponent.sol +3 -2
  207. package/contracts/components/Pool.sol +177 -128
  208. package/contracts/components/Product.sol +26 -18
  209. package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
  210. package/contracts/instance/BundleManager.sol +7 -5
  211. package/contracts/instance/Cloneable.sol +7 -2
  212. package/contracts/instance/IInstance.sol +16 -10
  213. package/contracts/instance/IInstanceService.sol +18 -5
  214. package/contracts/instance/Instance.sol +45 -9
  215. package/contracts/instance/InstanceAccessManager.sol +388 -158
  216. package/contracts/instance/InstanceReader.sol +8 -10
  217. package/contracts/instance/InstanceService.sol +184 -165
  218. package/contracts/instance/ObjectManager.sol +6 -8
  219. package/contracts/instance/base/ComponentService.sol +17 -30
  220. package/contracts/instance/base/KeyValueStore.sol +13 -5
  221. package/contracts/instance/base/Lifecycle.sol +11 -2
  222. package/contracts/instance/module/IAccess.sol +21 -14
  223. package/contracts/instance/module/IBundle.sol +8 -5
  224. package/contracts/instance/module/IComponents.sol +41 -0
  225. package/contracts/instance/module/IDistribution.sol +2 -0
  226. package/contracts/instance/module/IPolicy.sol +26 -1
  227. package/contracts/instance/module/ISetup.sol +7 -21
  228. package/contracts/instance/service/ApplicationService.sol +130 -48
  229. package/contracts/instance/service/BundleService.sol +213 -80
  230. package/contracts/instance/service/ClaimService.sol +3 -3
  231. package/contracts/instance/service/DistributionService.sol +212 -54
  232. package/contracts/instance/service/IApplicationService.sol +7 -7
  233. package/contracts/instance/service/IBundleService.sol +65 -26
  234. package/contracts/instance/service/IDistributionService.sol +37 -3
  235. package/contracts/instance/service/IPolicyService.sol +3 -20
  236. package/contracts/instance/service/IPoolService.sol +82 -3
  237. package/contracts/instance/service/PolicyService.sol +107 -219
  238. package/contracts/instance/service/PoolService.sol +214 -20
  239. package/contracts/instance/service/ProductService.sol +30 -53
  240. package/contracts/registry/ChainNft.sol +8 -0
  241. package/contracts/registry/IRegistry.sol +2 -0
  242. package/contracts/registry/IRegistryService.sol +4 -3
  243. package/contracts/registry/ITransferInterceptor.sol +1 -0
  244. package/contracts/registry/Registry.sol +23 -20
  245. package/contracts/registry/RegistryService.sol +15 -16
  246. package/contracts/registry/ReleaseManager.sol +20 -18
  247. package/contracts/shared/IService.sol +4 -4
  248. package/contracts/shared/Registerable.sol +2 -2
  249. package/contracts/shared/Service.sol +21 -7
  250. package/contracts/shared/TokenHandler.sol +11 -5
  251. package/contracts/test/TestService.sol +1 -1
  252. package/contracts/types/Amount.sol +60 -0
  253. package/contracts/types/Blocknumber.sol +1 -0
  254. package/contracts/types/Fee.sol +13 -5
  255. package/contracts/types/NftId.sol +8 -0
  256. package/contracts/types/ObjectType.sol +1 -0
  257. package/contracts/types/Referral.sol +4 -0
  258. package/contracts/types/RoleId.sol +13 -6
  259. package/contracts/types/Seconds.sol +54 -0
  260. package/contracts/types/StateId.sol +1 -0
  261. package/contracts/types/Timestamp.sol +13 -13
  262. package/contracts/types/UFixed.sol +1 -0
  263. package/contracts/types/Version.sol +1 -0
  264. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {POOL} from "../types/ObjectType.sol";
5
- import {IPoolService} from "../instance/service/IPoolService.sol";
6
- import {IBundleService} from "../instance/service/IBundleService.sol";
7
- import {NftId, NftIdLib} from "../types/NftId.sol";
4
+ import {Amount, AmountLib} from "../types/Amount.sol";
5
+ import {Component} from "./Component.sol";
8
6
  import {Fee, FeeLib} from "../types/Fee.sol";
9
- import {UFixed} from "../types/UFixed.sol";
7
+ import {IBundleService} from "../instance/service/IBundleService.sol";
8
+ import {InstanceReader} from "../instance/InstanceReader.sol";
10
9
  import {IPoolComponent} from "./IPoolComponent.sol";
11
- import {Component} from "./Component.sol";
10
+ import {IPoolService} from "../instance/service/IPoolService.sol";
11
+ import {IComponents} from "../instance/module/IComponents.sol";
12
+ import {NftId, NftIdLib} from "../types/NftId.sol";
13
+ import {POOL} from "../types/ObjectType.sol";
14
+ import {RoleId, PUBLIC_ROLE} from "../types/RoleId.sol";
15
+ import {Seconds} from "../types/Seconds.sol";
12
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
13
- import {ISetup} from "../instance/module/ISetup.sol";
14
-
15
- import {ISetup} from "../instance/module/ISetup.sol";
16
- import {InstanceReader} from "../instance/InstanceReader.sol";
17
-
17
+ import {UFixed, UFixedLib} from "../types/UFixed.sol";
18
18
 
19
19
  abstract contract Pool is
20
20
  Component,
@@ -24,24 +24,19 @@ abstract contract Pool is
24
24
  bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
25
25
 
26
26
  struct PoolStorage {
27
- UFixed _collateralizationLevel;
28
- UFixed _retentionLevel;
29
-
30
- bool _isExternallyManaged;
31
- bool _isInterceptingBundleTransfers;
32
- bool _isVerifyingApplications;
33
-
34
- Fee _initialPoolFee;
35
- Fee _initialStakingFee;
36
- Fee _initialPerformanceFee;
37
-
38
- TokenHandler _tokenHandler;
39
-
40
- // may be used to interact with instance by derived contracts
41
27
  IPoolService _poolService;
42
28
  IBundleService _bundleService;
43
29
  }
44
30
 
31
+
32
+ modifier onlyBundleOwner(NftId bundleNftId) {
33
+ if(msg.sender != getRegistry().ownerOf(bundleNftId)) {
34
+ revert ErrorPoolNotBundleOwner(bundleNftId, msg.sender);
35
+ }
36
+ _;
37
+ }
38
+
39
+
45
40
  modifier onlyPoolService() {
46
41
  if(msg.sender != address(_getPoolStorage()._poolService)) {
47
42
  revert ErrorPoolNotPoolService(msg.sender);
@@ -54,98 +49,124 @@ abstract contract Pool is
54
49
  address registry,
55
50
  NftId instanceNftId,
56
51
  string memory name,
57
- // TODO refactor into tokenNftId
58
52
  address token,
59
53
  bool isInterceptingNftTransfers,
60
- bool isExternallyManaging,
61
- bool isVerifying,
62
- UFixed collateralizationLevel,
63
- UFixed retentionLevel,
64
54
  address initialOwner,
65
- bytes memory data
55
+ bytes memory registryData // writeonly data that will saved in the object info record of the registry
66
56
  )
67
57
  public
68
58
  virtual
69
59
  onlyInitializing()
70
60
  {
71
- initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, data);
61
+ initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, registryData);
72
62
 
73
63
  PoolStorage storage $ = _getPoolStorage();
74
- // TODO add validation
75
- $._tokenHandler = new TokenHandler(token);
76
- $._isExternallyManaged = isExternallyManaging;
77
- $._isVerifyingApplications = isVerifying;
78
- $._collateralizationLevel = collateralizationLevel;
79
- $._retentionLevel = retentionLevel;
80
- $._initialPoolFee = FeeLib.zeroFee();
81
- $._initialStakingFee = FeeLib.zeroFee();
82
- $._initialPerformanceFee = FeeLib.zeroFee();
83
64
  $._poolService = getInstance().getPoolService();
84
65
  $._bundleService = getInstance().getBundleService();
85
66
 
86
67
  registerInterface(type(IPoolComponent).interfaceId);
87
68
  }
88
69
 
89
- /**
90
- * @dev see {IPool.verifyApplication}.
91
- * Default implementation that only writes a {LogUnderwrittenByPool} entry.
92
- */
93
- function verifyApplication(
94
- NftId applicationNftId,
95
- bytes memory applicationData,
96
- bytes memory bundleFilter,
97
- uint256 collateralizationAmount
70
+
71
+ function stake(
72
+ NftId bundleNftId,
73
+ uint256 amount
98
74
  )
99
- external
75
+ public
76
+ virtual
100
77
  restricted()
101
- virtual override
78
+ onlyBundleOwner(bundleNftId)
102
79
  {
103
- require(
104
- policyMatchesBundle(applicationData, bundleFilter),
105
- "ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
106
- );
107
-
108
- emit LogUnderwrittenByPool(applicationNftId, collateralizationAmount, address(this));
80
+ // TODO add implementation
109
81
  }
110
82
 
111
83
 
112
- function isInterceptingBundleTransfers() external view override returns (bool) {
113
- return isNftInterceptor();
84
+ function unstake(
85
+ NftId bundleNftId,
86
+ uint256 amount
87
+ )
88
+ public
89
+ virtual
90
+ restricted()
91
+ onlyBundleOwner(bundleNftId)
92
+ {
93
+ // TODO add implementation
114
94
  }
115
95
 
116
96
 
117
- function isExternallyManaged() external view override returns (bool) {
118
- return _getPoolStorage()._isExternallyManaged;
97
+ function extend(
98
+ NftId bundleNftId,
99
+ Seconds lifetimeExtension
100
+ )
101
+ public
102
+ virtual
103
+ restricted()
104
+ onlyBundleOwner(bundleNftId)
105
+ {
106
+ // TODO add implementation
119
107
  }
120
108
 
121
109
 
122
- function getRetentionLevel() external view override returns (UFixed retentionLevel) {
123
- return _getPoolStorage()._retentionLevel;
110
+ function lockBundle(NftId bundleNftId)
111
+ public
112
+ virtual
113
+ //restricted() // TODO consider adding this back
114
+ onlyBundleOwner(bundleNftId)
115
+ {
116
+ _getPoolStorage()._bundleService.lock(bundleNftId);
124
117
  }
125
118
 
126
119
 
127
- function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
128
- return _getPoolStorage()._collateralizationLevel;
120
+ function unlockBundle(NftId bundleNftId)
121
+ public
122
+ virtual
123
+ //restricted()
124
+ onlyBundleOwner(bundleNftId)
125
+ {
126
+ _getPoolStorage()._bundleService.unlock(bundleNftId);
129
127
  }
130
128
 
131
129
 
132
- function isVerifyingApplications() external view override returns (bool isConfirmingApplication) {
133
- return _getPoolStorage()._isVerifyingApplications;
130
+ function close(NftId bundleNftId)
131
+ public
132
+ virtual
133
+ //restricted()
134
+ onlyBundleOwner(bundleNftId)
135
+ {
136
+ _getPoolStorage()._poolService.closeBundle(bundleNftId);
134
137
  }
135
138
 
136
139
 
137
- /// @dev see {IPoolComponent.policyMatchesBundle}.
138
- /// Default implementation always returns true
139
- function policyMatchesBundle(
140
- bytes memory, // policyData
141
- bytes memory // bundleFilter
140
+ function setBundleFee(
141
+ NftId bundleNftId,
142
+ Fee memory fee
142
143
  )
143
144
  public
144
- pure
145
- virtual override
146
- returns (bool isMatching)
145
+ virtual
146
+ restricted()
147
+ onlyBundleOwner(bundleNftId)
147
148
  {
148
- return true;
149
+ _getPoolStorage()._bundleService.setFee(bundleNftId, fee);
150
+ }
151
+
152
+
153
+ function setMaxCapitalAmount(uint256 maxCapitalAmount)
154
+ public
155
+ virtual
156
+ restricted()
157
+ onlyOwner()
158
+ {
159
+ _getPoolStorage()._poolService.setMaxCapitalAmount(maxCapitalAmount);
160
+ }
161
+
162
+
163
+ function setBundleOwnerRole(RoleId bundleOwnerRole)
164
+ public
165
+ virtual
166
+ restricted()
167
+ onlyOwner()
168
+ {
169
+ _getPoolStorage()._poolService.setBundleOwnerRole(bundleOwnerRole);
149
170
  }
150
171
 
151
172
 
@@ -154,70 +175,63 @@ abstract contract Pool is
154
175
  Fee memory stakingFee,
155
176
  Fee memory performanceFee
156
177
  )
157
- external
158
- onlyOwner
178
+ public
179
+ virtual
159
180
  restricted()
160
- override
181
+ onlyOwner()
161
182
  {
162
183
  _getPoolStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
163
184
  }
164
185
 
165
- function setBundleFee(
186
+
187
+ /// @dev see {IPool.verifyApplication}
188
+ function verifyApplication(
189
+ NftId applicationNftId,
190
+ bytes memory applicationData,
166
191
  NftId bundleNftId,
167
- Fee memory fee
192
+ bytes memory bundleFilter,
193
+ uint256 collateralizationAmount
168
194
  )
169
- external
170
- override
171
- // TODO add onlyBundleOwner
195
+ public
196
+ virtual
197
+ restricted()
172
198
  {
173
- _getPoolStorage()._bundleService.setBundleFee(bundleNftId, fee);
174
- }
199
+ if(!applicationMatchesBundle(
200
+ applicationNftId,
201
+ applicationData,
202
+ bundleNftId,
203
+ bundleFilter,
204
+ collateralizationAmount)
205
+ )
206
+ {
207
+ revert ErrorPoolApplicationBundleMismatch(applicationNftId);
208
+ }
175
209
 
176
- function lockBundle(
177
- NftId bundleNftId
178
- )
179
- external
180
- override
181
- // TODO add onlyBundleOwner
182
- {
183
- _getPoolStorage()._bundleService.lockBundle(bundleNftId);
210
+ emit LogPoolVerifiedByPool(address(this), applicationNftId, collateralizationAmount);
184
211
  }
185
212
 
186
- function unlockBundle(
187
- NftId bundleNftId
213
+
214
+ /// @dev see {IPoolComponent.applicationMatchesBundle}
215
+ /// Override this function to implement any custom application verification
216
+ /// Default implementation always returns true
217
+ function applicationMatchesBundle(
218
+ NftId applicationNftId,
219
+ bytes memory applicationData,
220
+ NftId bundleNftId,
221
+ bytes memory bundleFilter,
222
+ uint256 collateralizationAmount
188
223
  )
189
- external
190
- override
191
- // TODO add onlyBundleOwner
224
+ public
225
+ view
226
+ virtual override
227
+ returns (bool isMatching)
192
228
  {
193
- _getPoolStorage()._bundleService.unlockBundle(bundleNftId);
229
+ return true;
194
230
  }
195
231
 
196
- function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
197
- InstanceReader reader = getInstance().getInstanceReader();
198
- setupInfo = reader.getPoolSetupInfo(getNftId());
199
-
200
- // fallback to initial setup info (wallet is always != address(0))
201
- if(setupInfo.wallet == address(0)) {
202
- setupInfo = _getInitialSetupInfo();
203
- }
204
- }
205
232
 
206
- function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
207
- PoolStorage storage $ = _getPoolStorage();
208
- return ISetup.PoolSetupInfo(
209
- getProductNftId(),
210
- $._tokenHandler,
211
- isNftInterceptor(),
212
- $._isExternallyManaged,
213
- $._isVerifyingApplications,
214
- $._collateralizationLevel,
215
- $._retentionLevel,
216
- $._initialPoolFee,
217
- $._initialStakingFee,
218
- $._initialPerformanceFee,
219
- getWallet()
220
- );
233
+ function getPoolInfo() external view returns (IComponents.PoolInfo memory poolInfo) {
234
+ poolInfo = abi.decode(getComponentInfo().data, (IComponents.PoolInfo));
221
235
  }
222
236
 
223
237
  // Internals
@@ -225,14 +239,14 @@ abstract contract Pool is
225
239
  function _createBundle(
226
240
  address bundleOwner,
227
241
  Fee memory fee,
228
- uint256 amount,
229
- uint256 lifetime,
242
+ Amount amount,
243
+ Seconds lifetime,
230
244
  bytes memory filter
231
245
  )
232
246
  internal
233
247
  returns(NftId bundleNftId)
234
248
  {
235
- bundleNftId = _getPoolStorage()._bundleService.createBundle(
249
+ bundleNftId = _getPoolStorage()._poolService.createBundle(
236
250
  bundleOwner,
237
251
  fee,
238
252
  amount,
@@ -242,10 +256,45 @@ abstract contract Pool is
242
256
  // TODO add logging
243
257
  }
244
258
 
259
+ // TODO remove function once this is no longer used to produce contract locations on the fly ...
245
260
  function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
246
261
  return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
247
262
  }
248
263
 
264
+ /// @dev defines initial pool specification
265
+ /// overwrite this function according to your use case
266
+ function _getInitialInfo()
267
+ internal
268
+ view
269
+ virtual override
270
+ returns (IComponents.ComponentInfo memory info)
271
+ {
272
+ return IComponents.ComponentInfo(
273
+ getName(),
274
+ getToken(),
275
+ TokenHandler(address(0)), // will be created by GIF service during registration
276
+ address(this), // contract is its own wallet
277
+ AmountLib.zero(), // balance amount
278
+ AmountLib.zero(), // fee amount
279
+ abi.encode(
280
+ IComponents.PoolInfo(
281
+ NftIdLib.zero(), // will be set when GIF registers the related product
282
+ PUBLIC_ROLE(), // bundleOwnerRole
283
+ type(uint256).max, // maxCapitalAmount,
284
+ 0, // initial balance amount
285
+ 0, // initial fee amount
286
+ isNftInterceptor(), // isInterceptingBundleTransfers
287
+ false, // isExternallyManaged,
288
+ false, // isVerifyingApplications,
289
+ UFixedLib.toUFixed(1), // collateralizationLevel,
290
+ UFixedLib.toUFixed(1), // retentionLevel,
291
+ FeeLib.zeroFee(), // initialPoolFee,
292
+ FeeLib.zeroFee(), // initialStakingFee,
293
+ FeeLib.zeroFee() // initialPerformanceFee,
294
+ )));
295
+ }
296
+
297
+
249
298
  function _getPoolStorage() private pure returns (PoolStorage storage $) {
250
299
  assembly {
251
300
  $.slot := POOL_STORAGE_LOCATION_V1
@@ -6,12 +6,14 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
6
6
  import {IRisk} from "../instance/module/IRisk.sol";
7
7
  import {IApplicationService} from "../instance/service/IApplicationService.sol";
8
8
  import {IPolicyService} from "../instance/service/IPolicyService.sol";
9
+ import {IProductService} from "../instance/service/IProductService.sol";
9
10
  import {IClaimService} from "../instance/service/IClaimService.sol";
10
11
  import {IProductComponent} from "./IProductComponent.sol";
11
12
  import {NftId, NftIdLib} from "../types/NftId.sol";
12
13
  import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
13
14
  import {ReferralId} from "../types/Referral.sol";
14
15
  import {RiskId, RiskIdLib} from "../types/RiskId.sol";
16
+ import {Seconds} from "../types/Seconds.sol";
15
17
  import {StateId} from "../types/StateId.sol";
16
18
  import {Timestamp} from "../types/Timestamp.sol";
17
19
  import {Fee} from "../types/Fee.sol";
@@ -20,7 +22,9 @@ import {Component} from "./Component.sol";
20
22
  import {TokenHandler} from "../shared/TokenHandler.sol";
21
23
 
22
24
  import {InstanceReader} from "../instance/InstanceReader.sol";
25
+ import {IPolicy} from "../instance/module/IPolicy.sol";
23
26
  import {ISetup} from "../instance/module/ISetup.sol";
27
+ import {IComponents} from "../instance/module/IComponents.sol";
24
28
  import {Pool} from "../components/Pool.sol";
25
29
  import {Distribution} from "../components/Distribution.sol";
26
30
 
@@ -32,6 +36,7 @@ abstract contract Product is
32
36
  bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
33
37
 
34
38
  struct ProductStorage {
39
+ IProductService _productService;
35
40
  IApplicationService _applicationService;
36
41
  IPolicyService _policyService;
37
42
  IClaimService _claimService;
@@ -55,20 +60,21 @@ abstract contract Product is
55
60
  Fee memory productFee,
56
61
  Fee memory processingFee,
57
62
  address initialOwner,
58
- bytes memory data
63
+ bytes memory registryData // writeonly data that will saved in the object info record of the registry
59
64
  )
60
65
  public
61
66
  virtual
62
67
  onlyInitializing()
63
68
  {
64
- initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, data);
69
+ initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
65
70
 
66
71
  ProductStorage storage $ = _getProductStorage();
67
72
  // TODO add validation
68
73
  // TODO refactor to go via registry
69
- $._applicationService = IApplicationService(getServiceAddress(APPLICATION()));
70
- $._policyService = IPolicyService(getServiceAddress(POLICY()));
71
- $._claimService = IClaimService(getServiceAddress(CLAIM()));
74
+ $._productService = IProductService(_getServiceAddress(PRODUCT()));
75
+ $._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
76
+ $._policyService = IPolicyService(_getServiceAddress(POLICY()));
77
+ $._claimService = IClaimService(_getServiceAddress(CLAIM()));
72
78
  $._pool = Pool(pool);
73
79
  $._distribution = Distribution(distribution);
74
80
  $._initialProductFee = productFee;
@@ -84,7 +90,7 @@ abstract contract Product is
84
90
  function calculatePremium(
85
91
  uint256 sumInsuredAmount,
86
92
  RiskId riskId,
87
- uint256 lifetime,
93
+ Seconds lifetime,
88
94
  bytes memory applicationData,
89
95
  NftId bundleNftId,
90
96
  ReferralId referralId
@@ -94,7 +100,8 @@ abstract contract Product is
94
100
  override
95
101
  returns (uint256 premiumAmount)
96
102
  {
97
- (premiumAmount,,,,) = _getProductStorage()._policyService.calculatePremium(
103
+ IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
104
+ getNftId(),
98
105
  riskId,
99
106
  sumInsuredAmount,
100
107
  lifetime,
@@ -102,13 +109,14 @@ abstract contract Product is
102
109
  bundleNftId,
103
110
  referralId
104
111
  );
112
+ premiumAmount = premium.premiumAmount;
105
113
  }
106
114
 
107
115
 
108
116
  function calculateNetPremium(
109
117
  uint256 sumInsuredAmount,
110
118
  RiskId riskId,
111
- uint256 lifetime,
119
+ Seconds lifetime,
112
120
  bytes memory applicationData
113
121
  )
114
122
  external
@@ -128,7 +136,7 @@ abstract contract Product is
128
136
  RiskId id,
129
137
  bytes memory data
130
138
  ) internal {
131
- getProductService().createRisk(
139
+ _getProductService().createRisk(
132
140
  id,
133
141
  data
134
142
  );
@@ -138,7 +146,7 @@ abstract contract Product is
138
146
  RiskId id,
139
147
  bytes memory data
140
148
  ) internal {
141
- getProductService().updateRisk(
149
+ _getProductService().updateRisk(
142
150
  id,
143
151
  data
144
152
  );
@@ -148,7 +156,7 @@ abstract contract Product is
148
156
  RiskId id,
149
157
  StateId state
150
158
  ) internal {
151
- getProductService().updateRiskState(
159
+ _getProductService().updateRiskState(
152
160
  id,
153
161
  state
154
162
  );
@@ -162,7 +170,7 @@ abstract contract Product is
162
170
  address applicationOwner,
163
171
  RiskId riskId,
164
172
  uint256 sumInsuredAmount,
165
- uint256 lifetime,
173
+ Seconds lifetime,
166
174
  NftId bundleNftId,
167
175
  ReferralId referralId,
168
176
  bytes memory applicationData
@@ -242,7 +250,7 @@ abstract contract Product is
242
250
  restricted()
243
251
  override
244
252
  {
245
- getProductService().setFees(productFee, processingFee);
253
+ _getProductService().setFees(productFee, processingFee);
246
254
  }
247
255
 
248
256
  function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
@@ -259,19 +267,15 @@ abstract contract Product is
259
267
  ProductStorage storage $ = _getProductStorage();
260
268
 
261
269
  ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
262
- ISetup.PoolSetupInfo memory poolSetupInfo = $._pool.getSetupInfo();
270
+ IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
263
271
 
264
272
  return ISetup.ProductSetupInfo(
265
273
  getToken(),
266
274
  $._tokenHandler,
267
275
  $._distributionNftId,
268
276
  $._poolNftId,
269
- distributionSetupInfo.distributionFee,
270
277
  $._initialProductFee,
271
278
  $._initialProcessingFee,
272
- poolSetupInfo.poolFee,
273
- poolSetupInfo.stakingFee,
274
- poolSetupInfo.performanceFee,
275
279
  false,
276
280
  getWallet()
277
281
  );
@@ -282,4 +286,8 @@ abstract contract Product is
282
286
  $.slot := PRODUCT_STORAGE_LOCATION_V1
283
287
  }
284
288
  }
289
+
290
+ function _getProductService() internal view returns (IProductService) {
291
+ return _getProductStorage()._productService;
292
+ }
285
293
  }
@@ -0,0 +1,13 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
5
+
6
+
7
+ contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
8
+
9
+ function initialize(address initialAdmin) initializer public {
10
+ __AccessManager_init(initialAdmin);
11
+ }
12
+
13
+ }
@@ -22,9 +22,10 @@ contract BundleManager is
22
22
  event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
23
23
  event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
24
24
  event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
25
+ event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
25
26
 
26
- error ErrorBundleManagerErrorPolicyAlreadyActivated(NftId policyNftId);
27
- error ErrorBundleManagerErrorBundleLocked(NftId bundleNftId, NftId policyNftId);
27
+ error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
28
+ error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
28
29
  error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
29
30
  error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
30
31
  error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
@@ -32,7 +33,7 @@ contract BundleManager is
32
33
 
33
34
  mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
34
35
 
35
- /// @dev links a policy with its bundle
36
+ /// @dev links a policy to its bundle
36
37
  // to link a policy it MUST NOT yet have been activated
37
38
  // the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
38
39
  function linkPolicy(NftId policyNftId) external restricted() {
@@ -42,7 +43,7 @@ contract BundleManager is
42
43
 
43
44
  // ensure bundle is unlocked (in active set) and registered with this instance
44
45
  if (!_isActive(poolNftId, bundleNftId)) {
45
- revert ErrorBundleManagerErrorBundleLocked(bundleNftId, policyNftId);
46
+ revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
46
47
  }
47
48
 
48
49
  LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
@@ -71,7 +72,7 @@ contract BundleManager is
71
72
  }
72
73
 
73
74
 
74
- /// @dev add a new bundle to a riskpool registerd with this instance
75
+ /// @dev add a new bundle to a pool registerd with this instance
75
76
  // the corresponding pool is fetched via instance reader
76
77
  function add(NftId bundleNftId) external restricted() {
77
78
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
@@ -85,6 +86,7 @@ contract BundleManager is
85
86
  emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
86
87
  }
87
88
 
89
+
88
90
  /// @dev unlocked (active) bundles are available to underwrite new policies
89
91
  function unlock(NftId bundleNftId) external restricted() {
90
92
  NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
@@ -10,7 +10,8 @@ abstract contract Cloneable is
10
10
  AccessManagedUpgradeable
11
11
  {
12
12
  event CloneableInitialized(address authority, address registry);
13
-
13
+
14
+ error CloneableAuthorityZero();
14
15
  error CloneableRegistryInvalid(address registry);
15
16
 
16
17
  IRegistry internal _registry;
@@ -25,9 +26,13 @@ abstract contract Cloneable is
25
26
  address registry
26
27
  )
27
28
  public
28
- initializer
29
+ onlyInitializing
29
30
  {
30
31
  // check/handle access managed
32
+ if(authority == address(0)) {
33
+ revert CloneableAuthorityZero();
34
+ }
35
+
31
36
  __AccessManaged_init(authority);
32
37
 
33
38
  // check/handle registry