@etherisc/gif-next 0.0.2-c8c9cfc-245 → 0.0.2-c9577b6-545

Sign up to get free protection for your applications and to get access to all the features.
Files changed (431) hide show
  1. package/README.md +5 -2
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +105 -65
  4. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  5. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +13 -8
  7. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +60 -32
  10. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +5 -0
  12. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +5 -0
  14. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
  16. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +13 -8
  18. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
  20. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +52 -212
  22. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +28 -19
  24. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +16 -184
  26. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +150 -286
  28. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +100 -120
  30. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +16 -37
  32. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +65 -62
  34. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
  35. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
  36. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
  37. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1507 -0
  38. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  39. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +419 -0
  40. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  41. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1978 -0
  42. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  43. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +423 -0
  44. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  45. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  46. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  47. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1427 -0
  48. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  49. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1187 -0
  50. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  51. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1561 -0
  52. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  53. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1996 -0
  54. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  55. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  56. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  57. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +16 -0
  58. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  59. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +16 -0
  60. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  61. package/artifacts/contracts/instance/Instance.sol/Instance.json +26 -99
  62. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  63. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +177 -113
  64. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  65. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +38 -29
  66. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  67. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +424 -74
  68. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +55 -146
  70. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +77 -81
  72. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +291 -112
  74. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  75. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  76. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  77. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  78. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  79. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  80. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +46 -5
  81. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  82. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  83. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  84. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  85. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  86. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  87. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  88. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  89. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  90. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  91. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +42 -202
  92. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  93. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +30 -21
  94. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  95. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  96. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +16 -37
  97. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  98. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +16 -0
  99. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  100. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +16 -184
  101. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +53 -144
  103. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +76 -80
  105. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  106. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +45 -185
  107. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  108. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +28 -19
  109. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  110. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +148 -222
  111. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +115 -107
  113. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  114. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +40 -31
  115. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  116. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +48 -41
  117. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  118. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +208 -138
  119. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  120. package/artifacts/contracts/pool/Pool.sol/Pool.json +45 -185
  121. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  122. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +283 -355
  123. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  124. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +96 -120
  125. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  126. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +52 -162
  127. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  128. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +73 -89
  129. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  130. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +44 -210
  131. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  132. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +28 -19
  133. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  134. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +258 -184
  135. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  136. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +117 -101
  137. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  138. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +21 -0
  139. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  140. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +148 -7
  141. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +241 -145
  143. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +59 -43
  145. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  146. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +44 -63
  147. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  148. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +18 -2
  149. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  150. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +317 -384
  151. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +108 -124
  153. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.json +133 -261
  155. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +97 -117
  157. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  158. package/artifacts/contracts/product/Product.sol/Product.json +44 -210
  159. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  160. package/artifacts/contracts/product/RiskService.sol/RiskService.json +604 -0
  161. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  162. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +698 -0
  163. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  164. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  165. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  166. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +286 -34
  167. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  168. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +16 -0
  169. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  170. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  171. package/artifacts/contracts/registry/Registry.sol/Registry.json +492 -95
  172. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  173. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +283 -143
  174. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  175. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +39 -313
  176. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  177. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +68 -72
  178. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  179. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
  180. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +129 -221
  182. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  183. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
  184. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  185. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  186. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  187. package/artifacts/contracts/shared/Component.sol/Component.json +16 -173
  188. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +105 -228
  190. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +112 -122
  192. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +21 -112
  194. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  195. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
  196. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  197. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +16 -26
  198. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +16 -0
  200. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +16 -37
  202. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  203. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
  204. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  205. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
  206. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  207. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
  208. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  209. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
  210. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  211. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +16 -0
  212. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  213. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  214. package/artifacts/contracts/shared/IService.sol/IService.json +16 -0
  215. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  216. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
  217. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  218. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +16 -184
  219. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  220. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
  221. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  222. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -1
  223. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  224. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  225. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  226. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
  227. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  228. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
  229. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  230. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +24 -97
  231. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  232. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  233. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  234. package/artifacts/contracts/shared/Service.sol/Service.json +21 -112
  235. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  236. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +288 -16
  237. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
  238. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
  239. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  240. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +43 -27
  241. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  242. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +16 -21
  243. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  244. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +63 -93
  245. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  246. package/artifacts/contracts/staking/Staking.sol/Staking.json +101 -248
  247. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  248. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
  249. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  250. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +93 -100
  251. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  252. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -11
  253. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  254. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +47 -159
  255. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  256. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +72 -76
  257. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  258. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +169 -128
  259. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  260. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +54 -23
  261. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  262. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  263. package/artifacts/contracts/type/Amount.sol/AmountLib.json +32 -8
  264. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  265. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  266. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  267. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  269. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/Fee.sol/FeeLib.json +2 -2
  271. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  273. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  275. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  276. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  277. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  279. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  281. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  283. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  285. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
  287. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  289. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  290. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -2
  291. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  292. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  294. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
  295. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  297. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +2 -2
  298. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
  300. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +15 -2
  302. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  303. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  304. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  305. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  306. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +55 -70
  307. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  308. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  309. package/contracts/authorization/AccessAdmin.sol +63 -59
  310. package/contracts/authorization/Authorization.sol +7 -3
  311. package/contracts/authorization/IAccess.sol +1 -0
  312. package/contracts/authorization/IAccessAdmin.sol +4 -3
  313. package/contracts/authorization/IServiceAuthorization.sol +3 -1
  314. package/contracts/authorization/ServiceAuthorization.sol +26 -10
  315. package/contracts/distribution/BasicDistribution.sol +2 -0
  316. package/contracts/distribution/Distribution.sol +3 -2
  317. package/contracts/distribution/DistributionService.sol +72 -60
  318. package/contracts/distribution/DistributionServiceManager.sol +6 -6
  319. package/contracts/distribution/IDistributionService.sol +9 -5
  320. package/contracts/examples/fire/DamageLevel.sol +59 -0
  321. package/contracts/examples/fire/FirePool.sol +75 -0
  322. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  323. package/contracts/examples/fire/FireProduct.sol +411 -0
  324. package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
  325. package/contracts/examples/fire/FireUSD.sol +26 -0
  326. package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
  327. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  328. package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
  329. package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
  330. package/contracts/instance/IInstance.sol +7 -30
  331. package/contracts/instance/Instance.sol +10 -35
  332. package/contracts/instance/InstanceAdmin.sol +29 -7
  333. package/contracts/instance/InstanceAuthorizationV3.sol +3 -3
  334. package/contracts/instance/InstanceReader.sol +107 -25
  335. package/contracts/instance/InstanceService.sol +63 -41
  336. package/contracts/instance/InstanceServiceManager.sol +6 -7
  337. package/contracts/instance/InstanceStore.sol +11 -1
  338. package/contracts/instance/base/ObjectLifecycle.sol +8 -1
  339. package/contracts/instance/module/IComponents.sol +4 -2
  340. package/contracts/instance/module/IPolicy.sol +23 -23
  341. package/contracts/oracle/Oracle.sol +2 -1
  342. package/contracts/oracle/OracleService.sol +41 -33
  343. package/contracts/oracle/OracleServiceManager.sol +6 -6
  344. package/contracts/pool/BasicPool.sol +12 -13
  345. package/contracts/pool/BundleService.sol +42 -31
  346. package/contracts/pool/BundleServiceManager.sol +6 -6
  347. package/contracts/pool/IBundleService.sol +11 -3
  348. package/contracts/pool/IPoolComponent.sol +18 -8
  349. package/contracts/pool/IPoolService.sol +50 -28
  350. package/contracts/pool/Pool.sol +61 -32
  351. package/contracts/pool/PoolService.sol +121 -117
  352. package/contracts/pool/PoolServiceManager.sol +4 -4
  353. package/contracts/product/ApplicationService.sol +50 -29
  354. package/contracts/product/ApplicationServiceManager.sol +4 -4
  355. package/contracts/product/BasicProduct.sol +1 -0
  356. package/contracts/product/ClaimService.sol +245 -88
  357. package/contracts/product/ClaimServiceManager.sol +4 -4
  358. package/contracts/product/IApplicationService.sol +1 -0
  359. package/contracts/product/IClaimService.sol +30 -7
  360. package/contracts/product/IPolicyService.sol +29 -34
  361. package/contracts/product/IPricingService.sol +7 -7
  362. package/contracts/product/IProductComponent.sol +17 -4
  363. package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
  364. package/contracts/product/PolicyService.sol +313 -172
  365. package/contracts/product/PolicyServiceManager.sol +4 -4
  366. package/contracts/product/PricingService.sol +47 -50
  367. package/contracts/product/PricingServiceManager.sol +3 -3
  368. package/contracts/product/Product.sol +76 -53
  369. package/contracts/product/{ProductService.sol → RiskService.sol} +7 -10
  370. package/contracts/product/RiskServiceManager.sol +39 -0
  371. package/contracts/registry/ChainNft.sol +65 -32
  372. package/contracts/registry/IRegistry.sol +55 -18
  373. package/contracts/registry/IRegistryService.sol +0 -9
  374. package/contracts/registry/Registry.sol +336 -197
  375. package/contracts/registry/RegistryAdmin.sol +134 -51
  376. package/contracts/registry/RegistryService.sol +55 -50
  377. package/contracts/registry/RegistryServiceManager.sol +2 -2
  378. package/contracts/registry/ReleaseLifecycle.sol +6 -3
  379. package/contracts/registry/ReleaseRegistry.sol +204 -188
  380. package/contracts/registry/ServiceAuthorizationV3.sol +7 -9
  381. package/contracts/shared/Component.sol +12 -32
  382. package/contracts/shared/ComponentService.sol +20 -29
  383. package/contracts/shared/ComponentServiceManager.sol +8 -5
  384. package/contracts/shared/ComponentVerifyingService.sol +2 -3
  385. package/contracts/shared/ContractLib.sol +38 -0
  386. package/contracts/shared/IComponent.sol +0 -1
  387. package/contracts/shared/IInstanceLinkedComponent.sol +8 -15
  388. package/contracts/shared/ILifecycle.sol +3 -1
  389. package/contracts/shared/INftOwnable.sol +2 -0
  390. package/contracts/shared/IPolicyHolder.sol +12 -22
  391. package/contracts/shared/InitializableERC165.sol +2 -2
  392. package/contracts/shared/InstanceLinkedComponent.sol +5 -6
  393. package/contracts/shared/KeyValueStore.sol +1 -1
  394. package/contracts/shared/Lifecycle.sol +15 -4
  395. package/contracts/shared/NftOwnable.sol +21 -5
  396. package/contracts/shared/PolicyHolder.sol +15 -52
  397. package/contracts/shared/Registerable.sol +4 -4
  398. package/contracts/shared/RegistryLinked.sol +3 -2
  399. package/contracts/shared/Service.sol +16 -11
  400. package/contracts/shared/TokenHandler.sol +99 -22
  401. package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
  402. package/contracts/staking/IStaking.sol +2 -1
  403. package/contracts/staking/IStakingService.sol +0 -3
  404. package/contracts/staking/StakeManagerLib.sol +18 -25
  405. package/contracts/staking/Staking.sol +11 -29
  406. package/contracts/staking/StakingManager.sol +8 -6
  407. package/contracts/staking/StakingReader.sol +12 -5
  408. package/contracts/staking/StakingService.sol +3 -17
  409. package/contracts/staking/StakingServiceManager.sol +2 -2
  410. package/contracts/staking/TargetManagerLib.sol +7 -3
  411. package/contracts/type/Amount.sol +15 -0
  412. package/contracts/type/ClaimId.sol +6 -1
  413. package/contracts/type/NftId.sol +1 -0
  414. package/contracts/type/ObjectType.sol +16 -11
  415. package/contracts/type/PayoutId.sol +10 -10
  416. package/contracts/type/RiskId.sol +15 -1
  417. package/contracts/type/Seconds.sol +8 -0
  418. package/contracts/type/StateId.sol +15 -1
  419. package/contracts/type/UFixed.sol +4 -0
  420. package/contracts/upgradeability/ProxyManager.sol +67 -34
  421. package/contracts/upgradeability/Versionable.sol +2 -2
  422. package/package.json +2 -1
  423. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  424. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  425. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
  426. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  427. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
  428. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
  429. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
  430. package/contracts/product/ProductServiceManager.sol +0 -39
  431. package/contracts/shared/InitializableCustom.sol +0 -177
@@ -2,7 +2,8 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {Amount, AmountLib} from "../type/Amount.sol";
5
- import {BUNDLE, COMPONENT, POOL} from "../type/ObjectType.sol";
5
+ import {BUNDLE, COMPONENT, POLICY, POOL} from "../type/ObjectType.sol";
6
+ import {ClaimId} from "../type/ClaimId.sol";
6
7
  import {IBundleService} from "./IBundleService.sol";
7
8
  import {IAuthorization} from "../authorization/IAuthorization.sol";
8
9
  import {IPoolComponent} from "./IPoolComponent.sol";
@@ -10,13 +11,12 @@ import {IPoolService} from "./IPoolService.sol";
10
11
  import {IComponents} from "../instance/module/IComponents.sol";
11
12
  import {IComponentService} from "../shared/IComponentService.sol";
12
13
  import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
13
- import {Fee, FeeLib} from "../type/Fee.sol";
14
- import {NftId, NftIdLib} from "../type/NftId.sol";
14
+ import {Fee} from "../type/Fee.sol";
15
+ import {NftId} from "../type/NftId.sol";
15
16
  import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
16
17
  import {Seconds} from "../type/Seconds.sol";
17
18
  import {Timestamp} from "../type/Timestamp.sol";
18
- import {TokenHandler} from "../shared/TokenHandler.sol";
19
- import {UFixed, UFixedLib} from "../type/UFixed.sol";
19
+ import {UFixedLib} from "../type/UFixed.sol";
20
20
 
21
21
  abstract contract Pool is
22
22
  InstanceLinkedComponent,
@@ -40,6 +40,16 @@ abstract contract Pool is
40
40
  }
41
41
 
42
42
 
43
+ function register()
44
+ external
45
+ virtual
46
+ onlyOwner()
47
+ {
48
+ _getPoolStorage()._componentService.registerPool();
49
+ _approveTokenHandler(type(uint256).max);
50
+ }
51
+
52
+
43
53
  /// @dev see {IPoolComponent.verifyApplication}
44
54
  function verifyApplication(
45
55
  NftId applicationNftId,
@@ -51,6 +61,7 @@ abstract contract Pool is
51
61
  public
52
62
  virtual
53
63
  restricted()
64
+ onlyNftOfType(applicationNftId, POLICY())
54
65
  {
55
66
  if(!applicationMatchesBundle(
56
67
  applicationNftId,
@@ -67,6 +78,21 @@ abstract contract Pool is
67
78
  }
68
79
 
69
80
 
81
+ /// @dev see {IPoolComponent.processConfirmedClaim}
82
+ function processConfirmedClaim(
83
+ NftId policyNftId,
84
+ ClaimId claimId,
85
+ Amount amount
86
+ )
87
+ public
88
+ virtual
89
+ restricted()
90
+ onlyNftOfType(policyNftId, POLICY())
91
+ {
92
+ // default implementation is empty
93
+ }
94
+
95
+
70
96
  /// @dev see {IPoolComponent.applicationMatchesBundle}
71
97
  /// Override this function to implement any custom application verification
72
98
  /// Default implementation always returns true
@@ -80,27 +106,20 @@ abstract contract Pool is
80
106
  public
81
107
  virtual
82
108
  view
109
+ onlyNftOfType(applicationNftId, POLICY())
110
+ onlyNftOfType(bundleNftId, BUNDLE())
83
111
  returns (bool isMatching)
84
112
  {
85
113
  return true;
86
114
  }
87
115
 
88
-
89
- function register()
90
- external
91
- virtual
92
- onlyOwner()
93
- {
94
- _getPoolStorage()._componentService.registerPool();
95
- _approveTokenHandler(type(uint256).max);
96
- }
97
-
98
116
  /// @inheritdoc IPoolComponent
99
117
  function withdrawBundleFees(NftId bundleNftId, Amount amount)
100
118
  external
101
119
  virtual
102
120
  restricted()
103
121
  onlyBundleOwner(bundleNftId)
122
+ onlyNftOfType(bundleNftId, BUNDLE())
104
123
  returns (Amount withdrawnAmount)
105
124
  {
106
125
  return _withdrawBundleFees(bundleNftId, amount);
@@ -113,15 +132,16 @@ abstract contract Pool is
113
132
  view
114
133
  returns (IComponents.PoolInfo memory poolInfo)
115
134
  {
116
- return IComponents.PoolInfo(
117
- PUBLIC_ROLE(), // bundleOwnerRole
118
- AmountLib.max(), // maxCapitalAmount,
119
- isNftInterceptor(), // isInterceptingBundleTransfers
120
- false, // isExternallyManaged,
121
- false, // isVerifyingApplications,
122
- UFixedLib.toUFixed(1), // collateralizationLevel,
123
- UFixedLib.toUFixed(1) // retentionLevel,
124
- );
135
+ return IComponents.PoolInfo({
136
+ maxBalanceAmount: AmountLib.max(),
137
+ bundleOwnerRole: PUBLIC_ROLE(),
138
+ isInterceptingBundleTransfers: isNftInterceptor(),
139
+ isProcessingConfirmedClaims: false,
140
+ isExternallyManaged: false,
141
+ isVerifyingApplications: false,
142
+ collateralizationLevel: UFixedLib.toUFixed(1),
143
+ retentionLevel: UFixedLib.toUFixed(1)
144
+ });
125
145
  }
126
146
 
127
147
  // Internals
@@ -158,7 +178,7 @@ abstract contract Pool is
158
178
  $._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
159
179
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
160
180
 
161
- registerInterface(type(IPoolComponent).interfaceId);
181
+ _registerInterface(type(IPoolComponent).interfaceId);
162
182
  }
163
183
 
164
184
  /// @dev increases the staked tokens by the specified amount
@@ -169,9 +189,9 @@ abstract contract Pool is
169
189
  )
170
190
  internal
171
191
  virtual
172
- returns(Amount netAmount)
192
+ returns(Amount)
173
193
  {
174
- _getPoolStorage()._poolService.stake(bundleNftId, amount);
194
+ return _getPoolStorage()._poolService.stake(bundleNftId, amount);
175
195
  }
176
196
 
177
197
 
@@ -287,21 +307,19 @@ abstract contract Pool is
287
307
  _getPoolStorage()._componentService.setPoolFees(poolFee, stakingFee, performanceFee);
288
308
  }
289
309
 
290
- /// @dev Creates a new bundle using the provided parameter values.
310
+ /// @dev Creates a new empty bundle using the provided parameter values.
291
311
  function _createBundle(
292
312
  address bundleOwner,
293
313
  Fee memory fee,
294
- Amount amount,
295
314
  Seconds lifetime,
296
315
  bytes memory filter
297
316
  )
298
317
  internal
299
- returns(NftId bundleNftId, Amount netStakedAmount)
318
+ returns(NftId bundleNftId)
300
319
  {
301
- (bundleNftId, netStakedAmount) = _getPoolStorage()._poolService.createBundle(
320
+ bundleNftId = _getPoolStorage()._poolService.createBundle(
302
321
  bundleOwner,
303
322
  fee,
304
- amount,
305
323
  lifetime,
306
324
  filter);
307
325
 
@@ -320,6 +338,17 @@ abstract contract Pool is
320
338
  return _getPoolStorage()._bundleService.withdrawBundleFees(bundleNftId, amount);
321
339
  }
322
340
 
341
+ function _processFundedClaim(
342
+ NftId policyNftId,
343
+ ClaimId claimId,
344
+ Amount availableAmount
345
+ )
346
+ internal
347
+ {
348
+ _getPoolStorage()._poolService.processFundedClaim(
349
+ policyNftId, claimId, availableAmount);
350
+ }
351
+
323
352
  function _getPoolStorage() private pure returns (PoolStorage storage $) {
324
353
  assembly {
325
354
  $.slot := POOL_STORAGE_LOCATION_V1
@@ -1,8 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
-
6
4
  import {IBundle} from "../instance/module/IBundle.sol";
7
5
  import {IBundleService} from "./IBundleService.sol";
8
6
  import {IComponents} from "../instance/module/IComponents.sol";
@@ -10,12 +8,14 @@ import {IComponentService} from "../shared/IComponentService.sol";
10
8
  import {IInstance} from "../instance/IInstance.sol";
11
9
  import {IInstanceService} from "../instance/IInstanceService.sol";
12
10
  import {IPolicy} from "../instance/module/IPolicy.sol";
11
+ import {IProductComponent} from "../product/IProductComponent.sol";
13
12
  import {IPoolService} from "./IPoolService.sol";
14
13
  import {IRegistry} from "../registry/IRegistry.sol";
15
14
  import {IRegistryService} from "../registry/IRegistryService.sol";
16
15
  import {IStaking} from "../staking/IStaking.sol";
17
16
 
18
17
  import {Amount, AmountLib} from "../type/Amount.sol";
18
+ import {ClaimId} from "../type/ClaimId.sol";
19
19
  import {Fee, FeeLib} from "../type/Fee.sol";
20
20
  import {NftId} from "../type/NftId.sol";
21
21
  import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
@@ -23,8 +23,7 @@ import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
23
23
  import {Fee, FeeLib} from "../type/Fee.sol";
24
24
  import {KEEP_STATE} from "../type/StateId.sol";
25
25
  import {Seconds} from "../type/Seconds.sol";
26
- import {TokenHandler} from "../shared/TokenHandler.sol";
27
- import {UFixed} from "../type/UFixed.sol";
26
+ import {UFixed, UFixedLib} from "../type/UFixed.sol";
28
27
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
29
28
  import {InstanceReader} from "../instance/InstanceReader.sol";
30
29
  import {InstanceStore} from "../instance/InstanceStore.sol";
@@ -47,16 +46,15 @@ contract PoolService is
47
46
  bytes memory data
48
47
  )
49
48
  internal
50
- initializer
51
49
  virtual override
50
+ initializer()
52
51
  {
53
52
  (
54
- address registryAddress,,
55
- //address managerAddress
53
+ address registryAddress,
56
54
  address authority
57
- ) = abi.decode(data, (address, address, address));
55
+ ) = abi.decode(data, (address, address));
58
56
 
59
- initializeService(registryAddress, authority, owner);
57
+ _initializeService(registryAddress, authority, owner);
60
58
 
61
59
  _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
62
60
  _bundleService = IBundleService(_getServiceAddress(BUNDLE()));
@@ -65,9 +63,10 @@ contract PoolService is
65
63
 
66
64
  _staking = IStaking(getRegistry().getStakingAddress());
67
65
 
68
- registerInterface(type(IPoolService).interfaceId);
66
+ _registerInterface(type(IPoolService).interfaceId);
69
67
  }
70
68
 
69
+
71
70
  /// @inheritdoc IPoolService
72
71
  function setMaxBalanceAmount(Amount maxBalanceAmount)
73
72
  external
@@ -84,6 +83,7 @@ contract PoolService is
84
83
  emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
85
84
  }
86
85
 
86
+
87
87
  function setBundleOwnerRole(RoleId bundleOwnerRole)
88
88
  external
89
89
  virtual
@@ -105,62 +105,34 @@ contract PoolService is
105
105
  emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
106
106
  }
107
107
 
108
+
108
109
  /// @inheritdoc IPoolService
109
110
  function createBundle(
110
111
  address bundleOwner, // initial bundle owner
111
112
  Fee memory fee, // fees deducted from premium that go to bundle owner
112
- Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
113
113
  Seconds lifetime, // initial duration for which new policies are covered
114
114
  bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
115
115
  )
116
116
  external
117
117
  virtual
118
- returns(NftId bundleNftId, Amount netStakedAmount)
118
+ returns(NftId bundleNftId)
119
119
  {
120
120
  (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
121
121
 
122
- {
123
- InstanceReader instanceReader = instance.getInstanceReader();
124
- IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
125
- Amount currentPoolBalance = instanceReader.getBalanceAmount(poolNftId);
126
- if (currentPoolBalance + stakingAmount > poolInfo.maxBalanceAmount) {
127
- revert ErrorPoolServiceMaxBalanceAmountExceeded(poolNftId, poolInfo.maxBalanceAmount, currentPoolBalance, stakingAmount);
128
- }
129
- }
130
-
131
-
132
- Amount stakingFeeAmount;
133
- (stakingFeeAmount, netStakedAmount) = FeeLib.calculateFee(
134
- _getStakingFee(instance.getInstanceReader(), poolNftId),
135
- stakingAmount);
136
-
137
-
122
+ // create the empty bundle
138
123
  bundleNftId = _bundleService.create(
139
124
  instance,
140
125
  poolNftId,
141
126
  bundleOwner,
142
127
  fee,
143
- netStakedAmount,
128
+ AmountLib.zero(),
144
129
  lifetime,
145
130
  filter);
146
131
 
147
- // pool book keeping
148
- _componentService.increasePoolBalance(
149
- instance.getInstanceStore(),
150
- poolNftId,
151
- netStakedAmount,
152
- stakingFeeAmount);
153
-
154
- // pool bookkeeping and collect tokens from bundle owner
155
- _collectStakingAmount(
156
- instance.getInstanceReader(),
157
- poolNftId,
158
- bundleOwner,
159
- stakingAmount);
160
-
161
132
  emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
162
133
  }
163
134
 
135
+
164
136
  function _getStakingFee(InstanceReader instanceReader, NftId poolNftId)
165
137
  internal
166
138
  virtual
@@ -171,6 +143,7 @@ contract PoolService is
171
143
  return instanceReader.getProductInfo(productNftId).stakingFee;
172
144
  }
173
145
 
146
+
174
147
  function closeBundle(NftId bundleNftId)
175
148
  external
176
149
  virtual
@@ -192,27 +165,46 @@ contract PoolService is
192
165
 
193
166
  if ((unstakedAmount + feeAmount).gtz()){
194
167
  IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolNftId);
195
- TokenHandler tokenHandler = poolComponentInfo.tokenHandler;
196
- IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
197
-
198
- // TODO: centralize token handling (issue #471)
199
-
200
- // check allowance
201
- uint256 tokenAllowance = token.allowance(poolComponentInfo.wallet, address(tokenHandler));
202
- if (tokenAllowance < (unstakedAmount.toInt() + feeAmount.toInt())) {
203
- revert ErrorPoolServiceWalletAllowanceTooSmall(
204
- poolComponentInfo.wallet,
205
- address(tokenHandler),
206
- tokenAllowance,
207
- unstakedAmount.toInt() + feeAmount.toInt());
208
- }
168
+ poolComponentInfo.tokenHandler.distributeTokens(
169
+ poolComponentInfo.wallet,
170
+ getRegistry().ownerOf(bundleNftId),
171
+ unstakedAmount + feeAmount);
172
+ }
173
+ }
174
+
175
+
176
+ /// @inheritdoc IPoolService
177
+ function processFundedClaim(
178
+ NftId policyNftId,
179
+ ClaimId claimId,
180
+ Amount availableAmount
181
+ )
182
+ external
183
+ virtual
184
+ {
185
+ (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
186
+ InstanceReader instanceReader = instance.getInstanceReader();
187
+ NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
209
188
 
210
- // transfer amount to bundle owner
211
- address bundleOwner = getRegistry().ownerOf(bundleNftId);
212
- tokenHandler.transfer(poolComponentInfo.wallet, bundleOwner, unstakedAmount + feeAmount);
189
+ // check policy matches with calling pool
190
+ IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
191
+ if(policyInfo.productNftId != productNftId) {
192
+ revert ErrorPoolServicePolicyPoolMismatch(
193
+ policyNftId,
194
+ policyInfo.productNftId,
195
+ productNftId);
196
+ }
197
+
198
+ emit LogPoolServiceProcessFundedClaim(policyNftId, claimId, availableAmount);
199
+
200
+ // callback to product component if applicable
201
+ if (instanceReader.getProductInfo(productNftId).isProcessingFundedClaims) {
202
+ address productAddress = getRegistry().getObjectAddress(productNftId);
203
+ IProductComponent(productAddress).processFundedClaim(policyNftId, claimId, availableAmount);
213
204
  }
214
205
  }
215
206
 
207
+
216
208
  /// @inheritdoc IPoolService
217
209
  function stake(NftId bundleNftId, Amount amount)
218
210
  external
@@ -236,6 +228,7 @@ contract PoolService is
236
228
  }
237
229
  }
238
230
 
231
+
239
232
  // calculate fees
240
233
  Amount feeAmount;
241
234
  (
@@ -257,6 +250,8 @@ contract PoolService is
257
250
  // collect tokens from bundle owner
258
251
  address bundleOwner = getRegistry().ownerOf(bundleNftId);
259
252
  emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
253
+
254
+ // TODO only collect staking token when pool is not externally managed
260
255
  _collectStakingAmount(
261
256
  instanceReader,
262
257
  poolNftId,
@@ -280,10 +275,6 @@ contract PoolService is
280
275
  revert ErrorPoolServiceBundlePoolMismatch(bundleNftId, poolNftId);
281
276
  }
282
277
 
283
- if (amount.eqz()) {
284
- revert ErrorPoolServiceAmountIsZero();
285
- }
286
-
287
278
  // call bundle service for bookkeeping and additional checks
288
279
  Amount unstakedAmount = _bundleService.unstake(instance, bundleNftId, amount);
289
280
 
@@ -301,27 +292,39 @@ contract PoolService is
301
292
 
302
293
  IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
303
294
  address poolWallet = poolComponentInfo.wallet;
304
-
305
- // check allowance
306
- {
307
- IERC20Metadata token = IERC20Metadata(poolComponentInfo.token);
308
- uint256 tokenAllowance = token.allowance(poolWallet, address(poolComponentInfo.tokenHandler));
309
- if (tokenAllowance < unstakedAmount.toInt()) {
310
- revert ErrorPoolServiceWalletAllowanceTooSmall(poolWallet, address(poolComponentInfo.tokenHandler), tokenAllowance, amount.toInt());
311
- }
312
- }
313
-
314
295
  // transfer amount to bundle owner
315
296
  address owner = getRegistry().ownerOf(bundleNftId);
316
297
  emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
317
- // TODO: centralize token handling (issue #471)
318
- poolComponentInfo.tokenHandler.transfer(poolWallet, owner, unstakedAmount);
298
+ poolComponentInfo.tokenHandler.distributeTokens(
299
+ poolWallet,
300
+ owner,
301
+ unstakedAmount);
319
302
  return unstakedAmount;
320
303
  }
321
304
 
305
+
306
+ function fundPoolWallet(NftId poolNftId, Amount amount)
307
+ external
308
+ virtual
309
+ restricted()
310
+ {
311
+ // TODO check that poolNftId is externally managed
312
+ // TODO implement
313
+ }
314
+
315
+
316
+ function defundPoolWallet(NftId poolNftId, Amount amount)
317
+ external
318
+ virtual
319
+ restricted()
320
+ {
321
+ // TODO check that poolNftId is externally managed
322
+ // TODO implement
323
+ }
324
+
322
325
  function processSale(
323
326
  NftId bundleNftId,
324
- IPolicy.Premium memory premium
327
+ IPolicy.PremiumInfo memory premium
325
328
  )
326
329
  external
327
330
  virtual
@@ -333,9 +336,9 @@ contract PoolService is
333
336
  IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
334
337
  IInstance instance = IInstance(instanceObjectInfo.objectAddress);
335
338
 
336
- Amount poolFeeAmount = AmountLib.toAmount(premium.poolFeeFixAmount + premium.poolFeeVarAmount);
337
- Amount bundleFeeAmount = AmountLib.toAmount(premium.bundleFeeFixAmount + premium.bundleFeeVarAmount);
338
- Amount bundleNetAmount = AmountLib.toAmount(premium.netPremiumAmount);
339
+ Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
340
+ Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
341
+ Amount bundleNetAmount = premium.netPremiumAmount;
339
342
 
340
343
  InstanceStore instanceStore = instance.getInstanceStore();
341
344
  _componentService.increasePoolBalance(
@@ -364,13 +367,13 @@ contract PoolService is
364
367
  virtual
365
368
  restricted()
366
369
  returns (
367
- Amount localCollateralAmount,
368
- Amount totalCollateralAmount
370
+ Amount totalCollateralAmount,
371
+ Amount localCollateralAmount
369
372
  )
370
373
  {
371
374
  (
372
- localCollateralAmount,
373
- totalCollateralAmount
375
+ totalCollateralAmount,
376
+ localCollateralAmount
374
377
  ) = calculateRequiredCollateral(
375
378
  instance.getInstanceReader(),
376
379
  productNftId,
@@ -396,8 +399,7 @@ contract PoolService is
396
399
  }
397
400
  }
398
401
 
399
-
400
- function reduceCollateral(
402
+ function processPayout(
401
403
  IInstance instance,
402
404
  address token,
403
405
  NftId policyNftId,
@@ -408,6 +410,22 @@ contract PoolService is
408
410
  virtual
409
411
  restricted()
410
412
  {
413
+ NftId bundleNftId = policyInfo.bundleNftId;
414
+ NftId poolNftId = getRegistry().getObjectInfo(bundleNftId).parentNftId;
415
+ InstanceStore instanceStore = instance.getInstanceStore();
416
+
417
+ _componentService.decreasePoolBalance(
418
+ instanceStore,
419
+ poolNftId,
420
+ payoutAmount,
421
+ AmountLib.zero());
422
+
423
+ _componentService.decreaseBundleBalance(
424
+ instanceStore,
425
+ bundleNftId,
426
+ payoutAmount,
427
+ AmountLib.zero());
428
+
411
429
  _bundleService.releaseCollateral(
412
430
  instance,
413
431
  policyNftId,
@@ -462,16 +480,16 @@ contract PoolService is
462
480
  public
463
481
  view
464
482
  returns(
465
- Amount localCollateralAmount,
466
- Amount totalCollateralAmount
483
+ Amount totalCollateralAmount,
484
+ Amount localCollateralAmount
467
485
  )
468
486
  {
469
487
  NftId poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
470
488
  IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
471
489
 
472
490
  (
473
- localCollateralAmount,
474
- totalCollateralAmount
491
+ totalCollateralAmount,
492
+ localCollateralAmount
475
493
  ) = calculateRequiredCollateral(
476
494
  poolInfo.collateralizationLevel,
477
495
  poolInfo.retentionLevel,
@@ -487,18 +505,17 @@ contract PoolService is
487
505
  public
488
506
  pure
489
507
  returns(
490
- Amount localCollateralAmount,
491
- Amount totalCollateralAmount
508
+ Amount totalCollateralAmount,
509
+ Amount localCollateralAmount
492
510
  )
493
511
  {
494
- // TODO define if only applies to local collateral
495
- // TODO add minimalistic implementation
496
-
497
- // assumptions
498
- // - collateralizationLevel == 1.0
499
- // - retentionLevel == 1.0
500
- localCollateralAmount = sumInsuredAmount;
501
- totalCollateralAmount = localCollateralAmount;
512
+ // collateralization is applied to sum insured
513
+ UFixed totalUFixed = collateralizationLevel * sumInsuredAmount.toUFixed();
514
+ totalCollateralAmount = AmountLib.toAmount(totalUFixed.toInt());
515
+
516
+ // retention level defines how much capital is required locally
517
+ localCollateralAmount = AmountLib.toAmount(
518
+ (retentionLevel * totalUFixed).toInt());
502
519
  }
503
520
 
504
521
 
@@ -521,7 +538,6 @@ contract PoolService is
521
538
  }
522
539
 
523
540
 
524
- // TODO create (I)TreasuryService that deals with all gif related token transfers
525
541
  /// @dev transfers the specified amount from the bundle owner to the pool's wallet
526
542
  function _collectStakingAmount(
527
543
  InstanceReader instanceReader,
@@ -534,23 +550,11 @@ contract PoolService is
534
550
 
535
551
  // collecting investor token
536
552
  IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
537
- TokenHandler tokenHandler = componentInfo.tokenHandler;
538
553
  address poolWallet = componentInfo.wallet;
539
-
540
- if(amount.gtz()) {
541
- uint256 allowance = IERC20Metadata(componentInfo.token).allowance(bundleOwner, address(tokenHandler));
542
- if (allowance < amount.toInt()) {
543
- revert ErrorPoolServiceWalletAllowanceTooSmall(bundleOwner, address(tokenHandler), allowance, amount.toInt());
544
- }
545
-
546
- // TODO: centralize token handling (issue #471)
547
- tokenHandler.transfer(
548
- bundleOwner,
549
- poolWallet,
550
- amount);
551
- } else {
552
- revert ErrorPoolServiceAmountIsZero();
553
- }
554
+ componentInfo.tokenHandler.collectTokens(
555
+ bundleOwner,
556
+ poolWallet,
557
+ amount);
554
558
  }
555
559
 
556
560
  function _getDomain() internal pure override returns(ObjectType) {
@@ -12,14 +12,14 @@ contract PoolServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with pool service implementation
13
13
  constructor(
14
14
  address authority,
15
- address registryAddress,
15
+ address registry,
16
16
  bytes32 salt
17
17
  )
18
- ProxyManager(registryAddress)
19
18
  {
20
19
  PoolService poolSrv = new PoolService{salt: salt}();
21
- bytes memory data = abi.encode(registryAddress, address(this), authority);
22
- IVersionable versionable = deployDetermenistic(
20
+ bytes memory data = abi.encode(registry, authority);
21
+ IVersionable versionable = initialize(
22
+ registry,
23
23
  address(poolSrv),
24
24
  data,
25
25
  salt);