@etherisc/gif-next 0.0.2-ab82da8-607 → 0.0.2-abde86b-349

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 (301) hide show
  1. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +26 -45
  3. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  4. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  5. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
  6. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
  9. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
  14. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  15. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  16. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +2 -2
  17. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
  19. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  20. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +13 -8
  22. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +92 -61
  24. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  26. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  27. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +16 -16
  28. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  29. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +11 -11
  30. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  31. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +60 -32
  32. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  33. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +71 -69
  34. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  35. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  36. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  37. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  38. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  39. package/artifacts/contracts/instance/Instance.sol/Instance.json +2 -2
  40. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  41. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +88 -91
  42. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  43. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +2 -2
  44. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  45. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +291 -66
  46. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  47. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +17 -12
  48. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  49. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +69 -38
  50. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +71 -51
  52. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  53. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  54. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  55. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  56. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  57. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  58. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  59. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  60. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  63. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  64. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  65. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  66. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  67. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  68. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +2 -2
  69. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  70. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +18 -18
  71. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  72. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  73. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  74. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  75. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  76. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +31 -26
  77. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  78. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +68 -37
  79. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  80. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +28 -0
  81. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  82. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
  83. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  84. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +15 -10
  85. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  86. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +90 -59
  87. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  88. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  89. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +28 -0
  90. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  91. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +73 -4
  92. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  93. package/artifacts/contracts/pool/Pool.sol/Pool.json +28 -0
  94. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  95. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +170 -43
  96. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  97. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +95 -40
  98. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  99. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +31 -26
  100. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  101. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +65 -34
  102. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  103. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +28 -26
  104. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
  106. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  107. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +103 -82
  108. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +97 -58
  110. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  111. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  112. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +8 -8
  113. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  114. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +82 -0
  115. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  116. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  117. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +28 -26
  118. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  119. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  120. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +167 -48
  121. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  122. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +92 -45
  123. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  124. package/artifacts/contracts/product/PricingService.sol/PricingService.json +39 -34
  125. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  126. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +76 -45
  127. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  128. package/artifacts/contracts/product/Product.sol/Product.json +28 -26
  129. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  130. package/artifacts/contracts/product/RiskService.sol/RiskService.json +11 -6
  131. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  132. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +62 -31
  133. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  134. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  135. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
  136. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  137. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  138. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  139. package/artifacts/contracts/registry/Registry.sol/Registry.json +55 -36
  140. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  141. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +108 -111
  142. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  143. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +23 -201
  144. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  145. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +60 -29
  146. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  147. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  148. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +2 -2
  149. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  150. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +2 -2
  151. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  152. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  153. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  154. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  155. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +39 -34
  156. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  157. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +97 -56
  158. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  159. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +5 -0
  160. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  161. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
  162. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  163. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  164. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  165. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  166. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  167. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  168. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  169. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +16 -6
  170. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  171. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  172. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  173. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  174. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  175. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  176. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  177. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  178. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  179. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  180. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  181. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  182. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -8
  183. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  184. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  185. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  186. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  187. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  188. package/artifacts/contracts/shared/Service.sol/Service.json +5 -0
  189. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  190. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  191. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  192. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  193. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  194. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  195. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  196. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
  197. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  198. package/artifacts/contracts/staking/Staking.sol/Staking.json +2 -2
  199. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  200. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  201. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +78 -42
  202. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  203. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  204. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  205. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +11 -6
  206. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  207. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +64 -33
  208. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  209. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  210. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  211. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
  212. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  213. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  214. package/artifacts/contracts/type/Amount.sol/AmountLib.json +2 -2
  215. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  216. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  217. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  218. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  219. package/artifacts/contracts/type/Fee.sol/FeeLib.json +2 -2
  220. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  221. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  222. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  223. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  224. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  225. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  226. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  227. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  228. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  229. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  231. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  232. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  233. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  235. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  236. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  237. package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
  238. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  239. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +15 -2
  240. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  241. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  242. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  243. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  244. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +47 -27
  245. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  246. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  247. package/contracts/authorization/AccessAdmin.sol +24 -21
  248. package/contracts/authorization/Authorization.sol +5 -1
  249. package/contracts/authorization/IAccessAdmin.sol +0 -1
  250. package/contracts/distribution/DistributionService.sol +7 -7
  251. package/contracts/distribution/DistributionServiceManager.sol +6 -6
  252. package/contracts/instance/InstanceAdmin.sol +6 -3
  253. package/contracts/instance/InstanceReader.sol +93 -4
  254. package/contracts/instance/InstanceService.sol +3 -5
  255. package/contracts/instance/InstanceServiceManager.sol +6 -7
  256. package/contracts/instance/module/IComponents.sol +3 -1
  257. package/contracts/instance/module/IPolicy.sol +2 -2
  258. package/contracts/oracle/OracleService.sol +8 -6
  259. package/contracts/oracle/OracleServiceManager.sol +6 -6
  260. package/contracts/pool/BundleService.sol +6 -6
  261. package/contracts/pool/BundleServiceManager.sol +6 -6
  262. package/contracts/pool/IPoolComponent.sol +18 -8
  263. package/contracts/pool/IPoolService.sol +19 -8
  264. package/contracts/pool/Pool.sol +37 -10
  265. package/contracts/pool/PoolService.sol +61 -22
  266. package/contracts/pool/PoolServiceManager.sol +4 -4
  267. package/contracts/product/ApplicationService.sol +10 -7
  268. package/contracts/product/ApplicationServiceManager.sol +4 -4
  269. package/contracts/product/ClaimService.sol +147 -61
  270. package/contracts/product/ClaimServiceManager.sol +4 -4
  271. package/contracts/product/IClaimService.sol +1 -1
  272. package/contracts/product/IPolicyService.sol +7 -3
  273. package/contracts/product/IProductComponent.sol +17 -3
  274. package/contracts/product/PolicyService.sol +93 -20
  275. package/contracts/product/PolicyServiceManager.sol +4 -4
  276. package/contracts/product/PricingService.sol +2 -3
  277. package/contracts/product/PricingServiceManager.sol +3 -3
  278. package/contracts/product/Product.sol +25 -18
  279. package/contracts/product/RiskService.sol +2 -3
  280. package/contracts/product/RiskServiceManager.sol +4 -4
  281. package/contracts/registry/IRegistry.sol +2 -0
  282. package/contracts/registry/IRegistryService.sol +0 -9
  283. package/contracts/registry/Registry.sol +7 -2
  284. package/contracts/registry/RegistryService.sol +53 -46
  285. package/contracts/registry/RegistryServiceManager.sol +2 -2
  286. package/contracts/shared/ComponentService.sol +5 -5
  287. package/contracts/shared/ComponentServiceManager.sol +8 -5
  288. package/contracts/shared/ComponentVerifyingService.sol +1 -2
  289. package/contracts/shared/ContractLib.sol +38 -0
  290. package/contracts/shared/IPolicyHolder.sol +12 -13
  291. package/contracts/shared/InstanceLinkedComponent.sol +1 -2
  292. package/contracts/shared/PolicyHolder.sol +11 -5
  293. package/contracts/shared/Service.sol +12 -7
  294. package/contracts/staking/Staking.sol +1 -1
  295. package/contracts/staking/StakingManager.sol +8 -6
  296. package/contracts/staking/StakingServiceManager.sol +2 -2
  297. package/contracts/type/PayoutId.sol +10 -10
  298. package/contracts/type/UFixed.sol +4 -0
  299. package/contracts/upgradeability/ProxyManager.sol +67 -34
  300. package/contracts/upgradeability/Versionable.sol +2 -2
  301. package/package.json +1 -1
@@ -8,12 +8,14 @@ import {IComponentService} from "../shared/IComponentService.sol";
8
8
  import {IInstance} from "../instance/IInstance.sol";
9
9
  import {IInstanceService} from "../instance/IInstanceService.sol";
10
10
  import {IPolicy} from "../instance/module/IPolicy.sol";
11
+ import {IProductComponent} from "../product/IProductComponent.sol";
11
12
  import {IPoolService} from "./IPoolService.sol";
12
13
  import {IRegistry} from "../registry/IRegistry.sol";
13
14
  import {IRegistryService} from "../registry/IRegistryService.sol";
14
15
  import {IStaking} from "../staking/IStaking.sol";
15
16
 
16
17
  import {Amount, AmountLib} from "../type/Amount.sol";
18
+ import {ClaimId} from "../type/ClaimId.sol";
17
19
  import {Fee, FeeLib} from "../type/Fee.sol";
18
20
  import {NftId} from "../type/NftId.sol";
19
21
  import {ObjectType, POOL, BUNDLE, COMPONENT, INSTANCE, REGISTRY} from "../type/ObjectType.sol";
@@ -21,7 +23,7 @@ import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
21
23
  import {Fee, FeeLib} from "../type/Fee.sol";
22
24
  import {KEEP_STATE} from "../type/StateId.sol";
23
25
  import {Seconds} from "../type/Seconds.sol";
24
- import {UFixed} from "../type/UFixed.sol";
26
+ import {UFixed, UFixedLib} from "../type/UFixed.sol";
25
27
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
26
28
  import {InstanceReader} from "../instance/InstanceReader.sol";
27
29
  import {InstanceStore} from "../instance/InstanceStore.sol";
@@ -48,10 +50,9 @@ contract PoolService is
48
50
  initializer()
49
51
  {
50
52
  (
51
- address registryAddress,,
52
- //address managerAddress
53
+ address registryAddress,
53
54
  address authority
54
- ) = abi.decode(data, (address, address, address));
55
+ ) = abi.decode(data, (address, address));
55
56
 
56
57
  _initializeService(registryAddress, authority, owner);
57
58
 
@@ -65,6 +66,7 @@ contract PoolService is
65
66
  _registerInterface(type(IPoolService).interfaceId);
66
67
  }
67
68
 
69
+
68
70
  /// @inheritdoc IPoolService
69
71
  function setMaxBalanceAmount(Amount maxBalanceAmount)
70
72
  external
@@ -81,6 +83,7 @@ contract PoolService is
81
83
  emit LogPoolServiceMaxBalanceAmountUpdated(poolNftId, previousMaxBalanceAmount, maxBalanceAmount);
82
84
  }
83
85
 
86
+
84
87
  function setBundleOwnerRole(RoleId bundleOwnerRole)
85
88
  external
86
89
  virtual
@@ -102,6 +105,7 @@ contract PoolService is
102
105
  emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
103
106
  }
104
107
 
108
+
105
109
  /// @inheritdoc IPoolService
106
110
  function createBundle(
107
111
  address bundleOwner, // initial bundle owner
@@ -128,6 +132,7 @@ contract PoolService is
128
132
  emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
129
133
  }
130
134
 
135
+
131
136
  function _getStakingFee(InstanceReader instanceReader, NftId poolNftId)
132
137
  internal
133
138
  virtual
@@ -138,6 +143,7 @@ contract PoolService is
138
143
  return instanceReader.getProductInfo(productNftId).stakingFee;
139
144
  }
140
145
 
146
+
141
147
  function closeBundle(NftId bundleNftId)
142
148
  external
143
149
  virtual
@@ -166,6 +172,39 @@ contract PoolService is
166
172
  }
167
173
  }
168
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;
188
+
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);
204
+ }
205
+ }
206
+
207
+
169
208
  /// @inheritdoc IPoolService
170
209
  function stake(NftId bundleNftId, Amount amount)
171
210
  external
@@ -189,6 +228,7 @@ contract PoolService is
189
228
  }
190
229
  }
191
230
 
231
+
192
232
  // calculate fees
193
233
  Amount feeAmount;
194
234
  (
@@ -327,13 +367,13 @@ contract PoolService is
327
367
  virtual
328
368
  restricted()
329
369
  returns (
330
- Amount localCollateralAmount,
331
- Amount totalCollateralAmount
370
+ Amount totalCollateralAmount,
371
+ Amount localCollateralAmount
332
372
  )
333
373
  {
334
374
  (
335
- localCollateralAmount,
336
- totalCollateralAmount
375
+ totalCollateralAmount,
376
+ localCollateralAmount
337
377
  ) = calculateRequiredCollateral(
338
378
  instance.getInstanceReader(),
339
379
  productNftId,
@@ -425,16 +465,16 @@ contract PoolService is
425
465
  public
426
466
  view
427
467
  returns(
428
- Amount localCollateralAmount,
429
- Amount totalCollateralAmount
468
+ Amount totalCollateralAmount,
469
+ Amount localCollateralAmount
430
470
  )
431
471
  {
432
472
  NftId poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
433
473
  IComponents.PoolInfo memory poolInfo = instanceReader.getPoolInfo(poolNftId);
434
474
 
435
475
  (
436
- localCollateralAmount,
437
- totalCollateralAmount
476
+ totalCollateralAmount,
477
+ localCollateralAmount
438
478
  ) = calculateRequiredCollateral(
439
479
  poolInfo.collateralizationLevel,
440
480
  poolInfo.retentionLevel,
@@ -450,18 +490,17 @@ contract PoolService is
450
490
  public
451
491
  pure
452
492
  returns(
453
- Amount localCollateralAmount,
454
- Amount totalCollateralAmount
493
+ Amount totalCollateralAmount,
494
+ Amount localCollateralAmount
455
495
  )
456
496
  {
457
- // TODO define if only applies to local collateral
458
- // TODO add minimalistic implementation
459
-
460
- // assumptions
461
- // - collateralizationLevel == 1.0
462
- // - retentionLevel == 1.0
463
- localCollateralAmount = sumInsuredAmount;
464
- totalCollateralAmount = localCollateralAmount;
497
+ // collateralization is applied to sum insured
498
+ UFixed totalUFixed = collateralizationLevel * sumInsuredAmount.toUFixed();
499
+ totalCollateralAmount = AmountLib.toAmount(totalUFixed.toInt());
500
+
501
+ // retention level defines how much capital is required locally
502
+ localCollateralAmount = AmountLib.toAmount(
503
+ (retentionLevel * totalUFixed).toInt());
465
504
  }
466
505
 
467
506
 
@@ -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);
@@ -41,12 +41,11 @@ contract ApplicationService is
41
41
  initializer()
42
42
  {
43
43
  (
44
- address registryAddress,,
45
- //address managerAddress
44
+ address registryAddress,
46
45
  address authority
47
- ) = abi.decode(data, (address, address, address));
46
+ ) = abi.decode(data, (address, address));
48
47
 
49
- _initializeService(registryAddress, address(0), owner);
48
+ _initializeService(registryAddress, authority, owner);
50
49
 
51
50
  _distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
52
51
  _pricingService = IPricingService(_getServiceAddress(PRICE()));
@@ -135,6 +134,7 @@ contract ApplicationService is
135
134
  )
136
135
  external
137
136
  virtual
137
+ nonReentrant()
138
138
  returns (NftId applicationNftId)
139
139
  {
140
140
  (NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
@@ -209,7 +209,8 @@ contract ApplicationService is
209
209
  NftId bundleNftId // will likely need a newer bundle for underwriting
210
210
  )
211
211
  external
212
- virtual override
212
+ virtual
213
+ nonReentrant()
213
214
  returns (NftId applicationNftId)
214
215
  {
215
216
  // TODO implement
@@ -226,14 +227,16 @@ contract ApplicationService is
226
227
  bytes memory applicationData
227
228
  )
228
229
  external
229
- virtual override
230
+ virtual
231
+ nonReentrant()
230
232
  {
231
233
  // TODO implement
232
234
  }
233
235
 
234
236
  function revoke(NftId applicationNftId)
235
237
  external
236
- virtual override
238
+ virtual
239
+ nonReentrant()
237
240
  {
238
241
  (,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
239
242
  instance.getInstanceStore().updateApplicationState(applicationNftId, REVOKED());
@@ -12,14 +12,14 @@ contract ApplicationServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with 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
  ApplicationService svc = new ApplicationService{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(svc),
24
24
  data,
25
25
  salt);
@@ -1,9 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IComponents} from "../instance/module/IComponents.sol";
5
- import {IInstance} from "../instance/IInstance.sol";
6
- import {IPolicy} from "../instance/module/IPolicy.sol";
7
4
  import {Amount, AmountLib} from "../type/Amount.sol";
8
5
  import {TimestampLib} from "../type/Timestamp.sol";
9
6
  import {ObjectType, CLAIM, PRODUCT, POOL} from "../type/ObjectType.sol";
@@ -14,8 +11,14 @@ import {StateId} from "../type/StateId.sol";
14
11
  import {ClaimId, ClaimIdLib} from "../type/ClaimId.sol";
15
12
  import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
16
13
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
14
+ import {ContractLib} from "../shared/ContractLib.sol";
17
15
  import {InstanceReader} from "../instance/InstanceReader.sol";
18
16
  import {IClaimService} from "./IClaimService.sol";
17
+ import {IComponents} from "../instance/module/IComponents.sol";
18
+ import {IInstance} from "../instance/IInstance.sol";
19
+ import {IPolicy} from "../instance/module/IPolicy.sol";
20
+ import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
21
+ import {IPoolComponent} from "../pool/IPoolComponent.sol";
19
22
  import {IPoolService} from "../pool/IPoolService.sol";
20
23
 
21
24
 
@@ -35,10 +38,9 @@ contract ClaimService is
35
38
  initializer()
36
39
  {
37
40
  (
38
- address registryAddress,,
39
- //address managerAddress
41
+ address registryAddress,
40
42
  address authority
41
- ) = abi.decode(data, (address, address, address));
43
+ ) = abi.decode(data, (address, address));
42
44
 
43
45
  _initializeService(registryAddress, authority, owner);
44
46
 
@@ -54,9 +56,11 @@ contract ClaimService is
54
56
  )
55
57
  external
56
58
  virtual
59
+ // nonReentrant() // prevents creating a reinsurance claim in a single tx
57
60
  returns (ClaimId claimId)
58
61
  {
59
62
  (
63
+ ,
60
64
  IInstance instance,
61
65
  InstanceReader instanceReader,
62
66
  IPolicy.PolicyInfo memory policyInfo
@@ -108,8 +112,10 @@ contract ClaimService is
108
112
  )
109
113
  external
110
114
  virtual
115
+ // nonReentrant() // prevents creating a reinsurance claim in a single tx
111
116
  {
112
117
  (
118
+ NftId productNftId,
113
119
  IInstance instance,
114
120
  InstanceReader instanceReader,
115
121
  IPolicy.PolicyInfo memory policyInfo
@@ -131,8 +137,15 @@ contract ClaimService is
131
137
  instance.getInstanceStore().updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
132
138
 
133
139
  emit LogClaimServiceClaimConfirmed(policyNftId, claimId, confirmedAmount);
140
+
141
+ // callback to pool if applicable
142
+ _processConfirmedClaimByPool(instanceReader, productNftId, policyNftId, claimId, confirmedAmount);
143
+
144
+ // callback to policy holder if applicable
145
+ _policyHolderClaimConfirmed(policyNftId, claimId, confirmedAmount);
134
146
  }
135
147
 
148
+
136
149
  function decline(
137
150
  NftId policyNftId,
138
151
  ClaimId claimId,
@@ -140,8 +153,10 @@ contract ClaimService is
140
153
  )
141
154
  external
142
155
  virtual
156
+ // nonReentrant() // prevents creating a reinsurance claim in a single tx
143
157
  {
144
158
  (
159
+ ,
145
160
  IInstance instance,
146
161
  InstanceReader instanceReader,
147
162
  IPolicy.PolicyInfo memory policyInfo
@@ -168,8 +183,10 @@ contract ClaimService is
168
183
  )
169
184
  external
170
185
  virtual
186
+ // nonReentrant() // prevents creating a reinsurance claim in a single tx
171
187
  {
172
188
  (
189
+ ,
173
190
  IInstance instance,
174
191
  InstanceReader instanceReader,
175
192
  IPolicy.PolicyInfo memory policyInfo
@@ -194,8 +211,10 @@ contract ClaimService is
194
211
  )
195
212
  external
196
213
  virtual
214
+ // nonReentrant() // prevents creating a reinsurance claim in a single tx
197
215
  {
198
216
  (
217
+ ,
199
218
  IInstance instance,
200
219
  InstanceReader instanceReader,
201
220
  IPolicy.PolicyInfo memory policyInfo
@@ -225,7 +244,7 @@ contract ClaimService is
225
244
  instance.getInstanceStore().updateClaim(policyNftId, claimId, claimInfo, CLOSED());
226
245
  }
227
246
 
228
- // TODO add test
247
+
229
248
  function createPayoutForBeneficiary(
230
249
  NftId policyNftId,
231
250
  ClaimId claimId,
@@ -235,6 +254,7 @@ contract ClaimService is
235
254
  )
236
255
  external
237
256
  virtual
257
+ // nonReentrant() // prevents creating a reinsurance claim in a single tx
238
258
  returns (PayoutId payoutId)
239
259
  {
240
260
  if (beneficiary == address(0)) {
@@ -258,6 +278,7 @@ contract ClaimService is
258
278
  )
259
279
  external
260
280
  virtual
281
+ // nonReentrant() // prevents creating a reinsurance payout in a single tx
261
282
  returns (PayoutId payoutId)
262
283
  {
263
284
  return _createPayout(
@@ -268,56 +289,6 @@ contract ClaimService is
268
289
  data);
269
290
  }
270
291
 
271
- function _createPayout(
272
- NftId policyNftId,
273
- ClaimId claimId,
274
- Amount amount,
275
- address beneficiary,
276
- bytes memory data
277
- )
278
- internal
279
- virtual
280
- returns (PayoutId payoutId)
281
- {
282
- (
283
- IInstance instance,
284
- InstanceReader instanceReader,
285
- IPolicy.PolicyInfo memory policyInfo
286
- ) = _verifyCallerWithPolicy(policyNftId);
287
-
288
- IPolicy.ClaimInfo memory claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
289
- StateId claimState = instanceReader.getClaimState(policyNftId, claimId);
290
-
291
- // TODO add checks
292
- // claim needs to be open
293
- // claim.paidAmount + amount <= claim.claimAmount
294
-
295
- // check/update claim info
296
- // create payout info with instance
297
- uint8 claimNo = claimInfo.payoutsCount + 1;
298
- payoutId = PayoutIdLib.toPayoutId(claimId, claimNo);
299
- instance.getInstanceStore().createPayout(
300
- policyNftId,
301
- payoutId,
302
- IPolicy.PayoutInfo({
303
- claimId: payoutId.toClaimId(),
304
- amount: amount,
305
- beneficiary: beneficiary,
306
- data: data,
307
- paidAt: TimestampLib.zero()}));
308
-
309
- // update and save claim info with instance
310
- claimInfo.payoutsCount += 1;
311
- claimInfo.openPayoutsCount += 1;
312
- instance.getInstanceStore().updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
313
-
314
- // update and save policy info with instance
315
- policyInfo.payoutAmount.add(amount);
316
- instance.getInstanceStore().updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
317
-
318
- emit LogClaimServicePayoutCreated(policyNftId, payoutId, amount);
319
- }
320
-
321
292
 
322
293
  function processPayout(
323
294
  NftId policyNftId,
@@ -325,8 +296,10 @@ contract ClaimService is
325
296
  )
326
297
  external
327
298
  virtual
299
+ // nonReentrant() // prevents creating a reinsurance payout in a single tx
328
300
  {
329
301
  (
302
+ ,
330
303
  IInstance instance,
331
304
  InstanceReader instanceReader,
332
305
  IPolicy.PolicyInfo memory policyInfo
@@ -339,7 +312,6 @@ contract ClaimService is
339
312
  payoutInfo.paidAt = TimestampLib.blockTimestamp();
340
313
  instance.getInstanceStore().updatePayout(policyNftId, payoutId, payoutInfo, PAID());
341
314
 
342
- // TODO update and save claim info with instance
343
315
  ClaimId claimId = payoutId.toClaimId();
344
316
  Amount payoutAmount = payoutInfo.amount;
345
317
  IPolicy.ClaimInfo memory claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
@@ -390,9 +362,65 @@ contract ClaimService is
390
362
  // TODO add 2nd token tx if processingFeeAmount > 0
391
363
  }
392
364
 
393
- // TODO callback IPolicyHolder
365
+ // callback to policy holder if applicable
366
+ _policyHolderPayoutExecuted(policyNftId, payoutId, beneficiary, payoutAmount);
394
367
  }
395
368
 
369
+ // internal functions
370
+
371
+
372
+ function _createPayout(
373
+ NftId policyNftId,
374
+ ClaimId claimId,
375
+ Amount amount,
376
+ address beneficiary,
377
+ bytes memory data
378
+ )
379
+ internal
380
+ virtual
381
+ returns (PayoutId payoutId)
382
+ {
383
+ (
384
+ ,
385
+ IInstance instance,
386
+ InstanceReader instanceReader,
387
+ IPolicy.PolicyInfo memory policyInfo
388
+ ) = _verifyCallerWithPolicy(policyNftId);
389
+
390
+ IPolicy.ClaimInfo memory claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
391
+ StateId claimState = instanceReader.getClaimState(policyNftId, claimId);
392
+
393
+ // TODO add checks
394
+ // claim needs to be open
395
+ // claim.paidAmount + amount <= claim.claimAmount
396
+
397
+ // check/update claim info
398
+ // create payout info with instance
399
+ uint24 payoutNo = claimInfo.payoutsCount + 1;
400
+ payoutId = PayoutIdLib.toPayoutId(claimId, payoutNo);
401
+ instance.getInstanceStore().createPayout(
402
+ policyNftId,
403
+ payoutId,
404
+ IPolicy.PayoutInfo({
405
+ claimId: payoutId.toClaimId(),
406
+ amount: amount,
407
+ beneficiary: beneficiary,
408
+ data: data,
409
+ paidAt: TimestampLib.zero()}));
410
+
411
+ // update and save claim info with instance
412
+ claimInfo.payoutsCount += 1;
413
+ claimInfo.openPayoutsCount += 1;
414
+ instance.getInstanceStore().updateClaim(policyNftId, claimId, claimInfo, KEEP_STATE());
415
+
416
+ // update and save policy info with instance
417
+ policyInfo.payoutAmount.add(amount);
418
+ instance.getInstanceStore().updatePolicyClaims(policyNftId, policyInfo, KEEP_STATE());
419
+
420
+ emit LogClaimServicePayoutCreated(policyNftId, payoutId, amount);
421
+ }
422
+
423
+
396
424
  function _calculatePayoutAmount(
397
425
  InstanceReader instanceReader,
398
426
  NftId policyNftId,
@@ -430,7 +458,6 @@ contract ClaimService is
430
458
  }
431
459
  }
432
460
 
433
- // internal functions
434
461
 
435
462
  function _verifyCallerWithPolicy(
436
463
  NftId policyNftId
@@ -439,12 +466,12 @@ contract ClaimService is
439
466
  view
440
467
  virtual
441
468
  returns (
469
+ NftId productNftId,
442
470
  IInstance instance,
443
471
  InstanceReader instanceReader,
444
472
  IPolicy.PolicyInfo memory policyInfo
445
473
  )
446
474
  {
447
- NftId productNftId;
448
475
  (productNftId,, instance) = _getAndVerifyActiveComponent(PRODUCT());
449
476
  instanceReader = instance.getInstanceReader();
450
477
 
@@ -480,6 +507,65 @@ contract ClaimService is
480
507
  claimInfo = instanceReader.getClaimInfo(policyNftId, claimId);
481
508
  }
482
509
 
510
+ function _processConfirmedClaimByPool(
511
+ InstanceReader instanceReader,
512
+ NftId productNftId,
513
+ NftId policyNftId,
514
+ ClaimId claimId,
515
+ Amount amount
516
+ )
517
+ internal
518
+ {
519
+ NftId poolNftId = instanceReader.getProductInfo(productNftId).poolNftId;
520
+ if (instanceReader.getPoolInfo(poolNftId).isProcessingConfirmedClaims) {
521
+ address poolAddress = getRegistry().getObjectAddress(poolNftId);
522
+ IPoolComponent(poolAddress).processConfirmedClaim(policyNftId, claimId, amount);
523
+ }
524
+ }
525
+
526
+
527
+ function _policyHolderClaimConfirmed(
528
+ NftId policyNftId,
529
+ ClaimId claimId,
530
+ Amount confirmedAmount
531
+ )
532
+ internal
533
+ {
534
+ IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
535
+ if(address(policyHolder) != address(0)) {
536
+ policyHolder.claimConfirmed(policyNftId, claimId, confirmedAmount);
537
+ }
538
+ }
539
+
540
+
541
+ function _policyHolderPayoutExecuted(
542
+ NftId policyNftId,
543
+ PayoutId payoutId,
544
+ address beneficiary,
545
+ Amount payoutAmount
546
+ )
547
+ internal
548
+ {
549
+ IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
550
+ if(address(policyHolder) != address(0)) {
551
+ policyHolder.payoutExecuted(policyNftId, payoutId, payoutAmount, beneficiary);
552
+ }
553
+ }
554
+
555
+
556
+ function _getPolicyHolder(NftId policyNftId)
557
+ internal
558
+ view
559
+ returns (IPolicyHolder policyHolder)
560
+ {
561
+ address policyHolderAddress = getRegistry().ownerOf(policyNftId);
562
+ policyHolder = IPolicyHolder(policyHolderAddress);
563
+
564
+ if (!ContractLib.isPolicyHolder(policyHolderAddress)) {
565
+ policyHolder = IPolicyHolder(address(0));
566
+ }
567
+ }
568
+
483
569
 
484
570
  function _getDomain() internal pure override returns(ObjectType) {
485
571
  return CLAIM();
@@ -12,14 +12,14 @@ contract ClaimServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with 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
  ClaimService svc = new ClaimService{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(svc),
24
24
  data,
25
25
  salt);
@@ -35,7 +35,7 @@ interface IClaimService is
35
35
  error ErrorClaimServiceBeneficiaryIsZero(NftId policyNftId, ClaimId claimId);
36
36
  error ErrorClaimsServicePayoutAmountIsZero(NftId policyNftId, PayoutId payoutId);
37
37
 
38
- error ErrorClaimServiceClaimWithOpenPayouts(NftId policyNftId, ClaimId claimId, uint8 openPayouts);
38
+ error ErrorClaimServiceClaimWithOpenPayouts(NftId policyNftId, ClaimId claimId, uint24 openPayouts);
39
39
  error ErrorClaimServiceClaimWithMissingPayouts(NftId policyNftId, ClaimId claimId, Amount claimAmount, Amount paidAmount);
40
40
  error ErrorClaimServiceClaimNotInExpectedState(NftId policyNftId, ClaimId claimId, StateId expectedState, StateId actualState);
41
41
 
@@ -10,6 +10,13 @@ import {Timestamp} from "../type/Timestamp.sol";
10
10
 
11
11
  interface IPolicyService is IService {
12
12
 
13
+ event LogPolicyServicePolicyCreated(NftId policyNftId, Amount premiumAmount, Timestamp activatedAt);
14
+ event LogPolicyServicePolicyDeclined(NftId policyNftId);
15
+ event LogPolicyServicePolicyPremiumCollected(NftId policyNftId, Amount premiumAmount);
16
+ event LogPolicyServicePolicyActivated(NftId policyNftId, Timestamp activatedAt);
17
+ event LogPolicyServicePolicyExpirationUpdated(NftId policyNftId, Timestamp originalExpiredAt, Timestamp expiredAt);
18
+ event LogPolicyServicePolicyClosed(NftId policyNftId);
19
+
13
20
  error ErrorPolicyServicePolicyProductMismatch(NftId applicationNftId, NftId expectedProductNftId, NftId actualProductNftId);
14
21
  error ErrorPolicyServicePolicyStateNotApplied(NftId applicationNftId);
15
22
  error ErrorPolicyServicePolicyStateNotCollateralized(NftId applicationNftId);
@@ -32,9 +39,6 @@ interface IPolicyService is IService {
32
39
  error ErrorPolicyServicePremiumMismatch(NftId policyNftId, Amount expectedPremiumAmount, Amount recalculatedPremiumAmount);
33
40
  error ErrorPolicyServiceTransferredPremiumMismatch(NftId policyNftId, Amount expectedPremiumAmount, Amount transferredPremiumAmount);
34
41
 
35
- event LogPolicyServicePolicyDeclined(NftId policyNftId);
36
- event LogPolicyServicePolicyExpirationUpdated(NftId policyNftId, Timestamp expiredAt);
37
-
38
42
  /// @dev creates the policy from {applicationNftId}.
39
43
  /// After successful completion of the function the policy can be referenced using the application NftId.
40
44
  /// Locks the sum insured amount in the pool, but does not transfer tokens. Call collectPremium to transfer tokens.