@etherisc/gif-next 0.0.2-2296e6c-721 → 0.0.2-2298fe6-554

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 (340) hide show
  1. package/README.md +1 -1
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +33 -52
  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/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/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  14. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  15. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +30 -177
  16. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  17. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +2 -2
  18. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  19. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -147
  20. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +85 -192
  22. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +84 -104
  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/fire/FirePool.sol/FirePool.dbg.json +4 -0
  27. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1463 -0
  28. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  29. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +410 -0
  30. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  31. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1712 -0
  32. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  33. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +414 -0
  34. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  35. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  36. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  37. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1411 -0
  38. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  39. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1171 -0
  40. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  41. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1517 -0
  42. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  43. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1978 -0
  44. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  45. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  46. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  47. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  48. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  49. package/artifacts/contracts/instance/Instance.sol/Instance.json +10 -99
  50. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  51. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +95 -98
  52. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  53. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
  54. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  55. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +84 -65
  56. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  57. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +39 -146
  58. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  59. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +61 -81
  60. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  61. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +82 -207
  62. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  63. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  64. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  65. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  66. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  67. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  68. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  69. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  70. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  71. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  72. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  73. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  74. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  75. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  76. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  77. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  78. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  79. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +20 -167
  80. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  81. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
  82. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  83. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  84. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  85. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  86. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -147
  87. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  88. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +37 -144
  89. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  90. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +60 -80
  91. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  92. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +0 -147
  93. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  94. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +2 -2
  95. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  96. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +81 -188
  97. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  98. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +82 -102
  99. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  100. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  101. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  102. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +0 -10
  103. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  104. package/artifacts/contracts/pool/Pool.sol/Pool.json +0 -147
  105. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  106. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +43 -160
  107. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  108. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +63 -83
  109. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  110. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +31 -146
  111. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +57 -81
  113. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  114. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +0 -147
  115. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  116. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +2 -2
  117. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  118. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +190 -175
  119. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  120. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +92 -100
  121. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  122. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  123. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +98 -0
  124. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  125. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +83 -11
  126. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  127. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  128. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  129. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  130. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +198 -185
  131. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  132. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +99 -95
  133. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  134. package/artifacts/contracts/product/PricingService.sol/PricingService.json +55 -162
  135. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  136. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +68 -88
  137. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  138. package/artifacts/contracts/product/Product.sol/Product.json +0 -147
  139. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  140. package/artifacts/contracts/product/RiskService.sol/RiskService.json +25 -132
  141. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  142. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +54 -74
  143. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  144. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  145. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  146. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +221 -21
  147. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  148. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  149. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  150. package/artifacts/contracts/registry/Registry.sol/Registry.json +419 -82
  151. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  152. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +244 -132
  153. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  154. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +23 -130
  155. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  156. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +52 -72
  157. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  158. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  159. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  160. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +24 -14
  161. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  162. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +2 -2
  163. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  164. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  165. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  166. package/artifacts/contracts/shared/Component.sol/Component.json +0 -147
  167. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  168. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +75 -182
  169. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  170. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +89 -99
  171. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  172. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +5 -112
  173. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  174. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
  175. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  176. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  177. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  178. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  179. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  180. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  181. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  182. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +14 -46
  183. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  184. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  185. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  186. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  187. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  188. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
  189. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  190. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -147
  191. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  192. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  193. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  194. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  195. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  196. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +6 -57
  197. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  198. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +18 -140
  199. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  200. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +8 -97
  201. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  202. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  203. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  204. package/artifacts/contracts/shared/Service.sol/Service.json +5 -112
  205. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  206. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  207. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  208. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +16 -0
  209. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  210. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  211. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +83 -30
  212. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  213. package/artifacts/contracts/staking/Staking.sol/Staking.json +66 -189
  214. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  215. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  216. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  217. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +73 -84
  218. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  219. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  220. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  221. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +31 -138
  222. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  223. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +56 -76
  224. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  225. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  226. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  227. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
  228. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  229. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  231. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  232. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  233. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  235. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  236. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  237. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  239. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  240. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  241. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  243. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  244. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  245. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  246. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  247. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  248. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
  249. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  253. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  255. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  257. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  258. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  260. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  261. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  262. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  263. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +39 -70
  264. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  265. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  266. package/contracts/authorization/AccessAdmin.sol +25 -24
  267. package/contracts/authorization/IAccessAdmin.sol +0 -1
  268. package/contracts/distribution/Distribution.sol +1 -1
  269. package/contracts/distribution/DistributionService.sol +8 -8
  270. package/contracts/distribution/DistributionServiceManager.sol +6 -6
  271. package/contracts/examples/fire/FirePool.sol +75 -0
  272. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  273. package/contracts/examples/fire/FireProduct.sol +329 -0
  274. package/contracts/examples/fire/FireProductAuthorization.sol +34 -0
  275. package/contracts/examples/fire/FireUSD.sol +26 -0
  276. package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
  277. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  278. package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
  279. package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
  280. package/contracts/instance/Instance.sol +2 -2
  281. package/contracts/instance/InstanceAuthorizationV3.sol +1 -0
  282. package/contracts/instance/InstanceReader.sol +8 -0
  283. package/contracts/instance/InstanceService.sol +10 -11
  284. package/contracts/instance/InstanceServiceManager.sol +6 -7
  285. package/contracts/instance/InstanceStore.sol +0 -4
  286. package/contracts/instance/base/ObjectLifecycle.sol +2 -1
  287. package/contracts/instance/module/IPolicy.sol +5 -5
  288. package/contracts/oracle/Oracle.sol +1 -1
  289. package/contracts/oracle/OracleService.sol +8 -6
  290. package/contracts/oracle/OracleServiceManager.sol +6 -6
  291. package/contracts/pool/BundleService.sol +8 -8
  292. package/contracts/pool/BundleServiceManager.sol +6 -6
  293. package/contracts/pool/Pool.sol +1 -1
  294. package/contracts/pool/PoolService.sol +5 -6
  295. package/contracts/pool/PoolServiceManager.sol +4 -4
  296. package/contracts/product/ApplicationService.sol +4 -6
  297. package/contracts/product/ApplicationServiceManager.sol +4 -4
  298. package/contracts/product/ClaimService.sol +201 -71
  299. package/contracts/product/ClaimServiceManager.sol +4 -4
  300. package/contracts/product/IClaimService.sol +27 -5
  301. package/contracts/product/IPolicyService.sol +9 -5
  302. package/contracts/product/PolicyService.sol +115 -38
  303. package/contracts/product/PolicyServiceManager.sol +4 -4
  304. package/contracts/product/PricingService.sol +4 -5
  305. package/contracts/product/PricingServiceManager.sol +3 -3
  306. package/contracts/product/Product.sol +23 -5
  307. package/contracts/product/RiskService.sol +4 -5
  308. package/contracts/product/RiskServiceManager.sol +4 -4
  309. package/contracts/registry/ChainNft.sol +65 -32
  310. package/contracts/registry/IRegistry.sol +49 -15
  311. package/contracts/registry/Registry.sol +321 -195
  312. package/contracts/registry/RegistryAdmin.sol +140 -50
  313. package/contracts/registry/RegistryService.sol +2 -2
  314. package/contracts/registry/RegistryServiceManager.sol +2 -2
  315. package/contracts/registry/ReleaseRegistry.sol +12 -6
  316. package/contracts/shared/Component.sol +6 -6
  317. package/contracts/shared/ComponentService.sol +7 -7
  318. package/contracts/shared/ComponentServiceManager.sol +8 -5
  319. package/contracts/shared/ComponentVerifyingService.sol +1 -1
  320. package/contracts/shared/ContractLib.sol +38 -0
  321. package/contracts/shared/IPolicyHolder.sol +12 -22
  322. package/contracts/shared/InitializableERC165.sol +2 -2
  323. package/contracts/shared/InstanceLinkedComponent.sol +4 -4
  324. package/contracts/shared/NftOwnable.sol +5 -5
  325. package/contracts/shared/PolicyHolder.sol +12 -53
  326. package/contracts/shared/Registerable.sol +4 -4
  327. package/contracts/shared/RegistryLinked.sol +3 -2
  328. package/contracts/shared/Service.sol +16 -11
  329. package/contracts/staking/IStaking.sol +1 -0
  330. package/contracts/staking/StakeManagerLib.sol +18 -0
  331. package/contracts/staking/Staking.sol +6 -5
  332. package/contracts/staking/StakingManager.sol +8 -6
  333. package/contracts/staking/StakingService.sol +2 -2
  334. package/contracts/staking/StakingServiceManager.sol +2 -2
  335. package/contracts/type/NftId.sol +1 -0
  336. package/contracts/type/RiskId.sol +15 -1
  337. package/contracts/type/StateId.sol +1 -0
  338. package/contracts/upgradeability/ProxyManager.sol +67 -34
  339. package/contracts/upgradeability/Versionable.sol +2 -2
  340. package/package.json +1 -1
@@ -23,14 +23,16 @@ interface IClaimService is
23
23
  event LogClaimServiceClaimSubmitted(NftId policyNftId, ClaimId claimId, Amount claimAmount);
24
24
  event LogClaimServiceClaimConfirmed(NftId policyNftId, ClaimId claimId, Amount confirmedAmount);
25
25
  event LogClaimServiceClaimDeclined(NftId policyNftId, ClaimId claimId);
26
+ event LogClaimServiceClaimRevoked(NftId policyNftId, ClaimId claimId);
26
27
  event LogClaimServiceClaimClosed(NftId policyNftId, ClaimId claimId);
27
28
 
28
29
  event LogClaimServicePayoutCreated(NftId policyNftId, PayoutId payoutId, Amount amount);
29
- event LogClaimServicePayoutProcessed(NftId policyNftId, PayoutId payoutId, Amount amount, address beneficiary, Amount netAmount);
30
+ event LogClaimServicePayoutProcessed(NftId policyNftId, PayoutId payoutId, Amount amount, address beneficiary, Amount netAmount, Amount processingFeeAmount);
30
31
 
31
32
  error ErrorClaimServicePolicyProductMismatch(NftId policyNftId, NftId expectedProduct, NftId actualProduct);
32
33
  error ErrorClaimServicePolicyNotOpen(NftId policyNftId);
33
34
  error ErrorClaimServiceClaimExceedsSumInsured(NftId policyNftId, Amount sumInsured, Amount payoutsIncludingClaimAmount);
35
+ error ErrorClaimServiceBeneficiaryIsZero(NftId policyNftId, ClaimId claimId);
34
36
  error ErrorClaimsServicePayoutAmountIsZero(NftId policyNftId, PayoutId payoutId);
35
37
 
36
38
  error ErrorClaimServiceClaimWithOpenPayouts(NftId policyNftId, ClaimId claimId, uint8 openPayouts);
@@ -47,9 +49,6 @@ interface IClaimService is
47
49
  ) external returns (ClaimId claimId);
48
50
 
49
51
 
50
- // TODO add claim revoke functionality
51
-
52
-
53
52
  /// @dev declines the specified claim
54
53
  /// function can only be called by product, policy needs to match with calling product
55
54
  function decline(
@@ -59,6 +58,14 @@ interface IClaimService is
59
58
  ) external;
60
59
 
61
60
 
61
+ /// @dev revokes the specified claim
62
+ /// function can only be called by product, policy needs to match with calling product
63
+ function revoke(
64
+ NftId policyNftId,
65
+ ClaimId claimId
66
+ ) external;
67
+
68
+
62
69
  /// @dev confirms the specified claim and specifies the payout amount
63
70
  /// function can only be called by product, policy needs to match with calling product
64
71
  function confirm(
@@ -77,7 +84,8 @@ interface IClaimService is
77
84
  ) external;
78
85
 
79
86
 
80
- /// @dev creates a new payout for the specified claim
87
+ /// @dev Creates a new payout for the specified claim.
88
+ /// The beneficiary is the holder of the policy NFT
81
89
  /// returns the id of the newly created payout, this id is unique for the specified policy
82
90
  /// function can only be called by product, policy needs to match with calling product
83
91
  function createPayout(
@@ -90,6 +98,20 @@ interface IClaimService is
90
98
  returns (PayoutId payoutId);
91
99
 
92
100
 
101
+ /// @dev Creates a new payout for the specified claim and beneficiary.
102
+ /// returns the id of the newly created payout, this id is unique for the specified policy
103
+ /// function can only be called by product, policy needs to match with calling product
104
+ function createPayoutForBeneficiary(
105
+ NftId policyNftId,
106
+ ClaimId claimId,
107
+ Amount amount,
108
+ address beneficiary,
109
+ bytes memory data
110
+ )
111
+ external
112
+ returns (PayoutId payoutId);
113
+
114
+
93
115
  /// @dev processes the specified payout
94
116
  /// this includes moving the payout token to the beneficiary (default: policy holder)
95
117
  /// function can only be called by product, policy needs to match with calling product
@@ -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);
@@ -19,11 +26,11 @@ interface IPolicyService is IService {
19
26
  error ErrorPolicyServiceAllowanceInsufficient(address policyOwner, address tokenHandler, uint256 premiumAmount, uint256 allowance);
20
27
 
21
28
  error ErrorPolicyServiceInsufficientAllowance(address customer, address tokenHandlerAddress, uint256 amount);
22
- error ErrorPolicyServicePremiumAlreadyPaid(NftId policyNftId, Amount premiumPaidAmount);
29
+ error ErrorPolicyServicePremiumAlreadyPaid(NftId policyNftId);
23
30
  error ErrorPolicyServicePolicyNotActivated(NftId policyNftId);
24
31
  error ErrorPolicyServicePolicyAlreadyClosed(NftId policyNftId);
25
32
  error ErrorPolicyServicePolicyNotActive(NftId policyNftId, StateId state);
26
- error ErrorPolicyServicePremiumNotFullyPaid(NftId policyNftId, Amount premiumAmount, Amount premiumPaidAmount);
33
+ error ErrorPolicyServicePremiumNotPaid(NftId policyNftId, Amount premiumAmount);
27
34
  error ErrorPolicyServiceOpenClaims(NftId policyNftId, uint16 openClaimsCount);
28
35
  error ErrorPolicyServicePolicyHasNotExpired(NftId policyNftId, Timestamp expiredAt);
29
36
  error ErrorPolicyServicePolicyExpirationTooLate(NftId policyNftId, Timestamp upperLimit, Timestamp expiredAt);
@@ -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.
@@ -14,13 +14,14 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
14
14
  import {Amount, AmountLib} from "../type/Amount.sol";
15
15
  import {Timestamp, TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
16
16
  import {ObjectType, APPLICATION, COMPONENT, DISTRIBUTION, PRODUCT, POOL, POLICY, BUNDLE, CLAIM, PRICE} from "../type/ObjectType.sol";
17
- import {APPLIED, COLLATERALIZED, KEEP_STATE, CLOSED, DECLINED} from "../type/StateId.sol";
17
+ import {APPLIED, COLLATERALIZED, KEEP_STATE, CLOSED, DECLINED, PAID} from "../type/StateId.sol";
18
18
  import {NftId, NftIdLib} from "../type/NftId.sol";
19
19
  import {ReferralId} from "../type/Referral.sol";
20
20
  import {StateId} from "../type/StateId.sol";
21
21
  import {VersionPart} from "../type/Version.sol";
22
22
 
23
23
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
24
+ import {ContractLib} from "../shared/ContractLib.sol";
24
25
  import {IApplicationService} from "./IApplicationService.sol";
25
26
  import {IBundleService} from "../pool/IBundleService.sol";
26
27
  import {IClaimService} from "./IClaimService.sol";
@@ -28,6 +29,7 @@ import {IComponentService} from "../shared/IComponentService.sol";
28
29
  import {IDistributionService} from "../distribution/IDistributionService.sol";
29
30
  import {InstanceReader} from "../instance/InstanceReader.sol";
30
31
  import {InstanceStore} from "../instance/InstanceStore.sol";
32
+ import {IPolicyHolder} from "../shared/IPolicyHolder.sol";
31
33
  import {IPolicyService} from "./IPolicyService.sol";
32
34
  import {IPoolService} from "../pool/IPoolService.sol";
33
35
  import {IPricingService} from "./IPricingService.sol";
@@ -56,12 +58,11 @@ contract PolicyService is
56
58
  initializer
57
59
  {
58
60
  (
59
- address registryAddress,,
60
- //address managerAddress
61
+ address registryAddress,
61
62
  address authority
62
- ) = abi.decode(data, (address, address, address));
63
+ ) = abi.decode(data, (address, address));
63
64
 
64
- initializeService(registryAddress, authority, owner);
65
+ _initializeService(registryAddress, authority, owner);
65
66
 
66
67
  VersionPart majorVersion = getVersion().toMajorPart();
67
68
  _applicationService = IApplicationService(getRegistry().getServiceAddress(APPLICATION(), majorVersion));
@@ -72,7 +73,7 @@ contract PolicyService is
72
73
  _distributionService = IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), majorVersion));
73
74
  _pricingService = IPricingService(getRegistry().getServiceAddress(PRICE(), majorVersion));
74
75
 
75
- registerInterface(type(IPolicyService).interfaceId);
76
+ _registerInterface(type(IPolicyService).interfaceId);
76
77
  }
77
78
 
78
79
 
@@ -80,7 +81,8 @@ contract PolicyService is
80
81
  NftId applicationNftId // = policyNftId
81
82
  )
82
83
  external
83
- virtual override
84
+ virtual
85
+ nonReentrant()
84
86
  {
85
87
  (NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
86
88
  InstanceReader instanceReader = instance.getInstanceReader();
@@ -115,7 +117,8 @@ contract PolicyService is
115
117
  Timestamp activateAt
116
118
  )
117
119
  external
118
- virtual override
120
+ virtual
121
+ nonReentrant()
119
122
  {
120
123
  // check caller is registered product
121
124
  (NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
@@ -175,16 +178,21 @@ contract PolicyService is
175
178
  // update referral counter
176
179
  {
177
180
  IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
178
- _distributionService.processReferral(
179
- productInfo.distributionNftId,
180
- applicationInfo.referralId);
181
+
182
+ if (! productInfo.distributionNftId.eqz()) { // only call distribution service if a distribution component is connected to the product
183
+ _distributionService.processReferral(
184
+ productInfo.distributionNftId,
185
+ applicationInfo.referralId);
186
+ }
181
187
  }
182
-
183
- // TODO add calling pool contract if it needs to validate application
184
188
 
185
- // TODO: add logging
189
+ // log policy creation before interactions with token and policy holder
190
+ emit LogPolicyServicePolicyCreated(applicationNftId, premium.premiumAmount, activateAt);
186
191
 
187
- // TODO: add callback IPolicyHolder.policyActivated() if applicable
192
+ // TODO add calling pool contract if it needs to validate application
193
+
194
+ // callback to policy holder if applicable
195
+ _policyHolderPolicyActivated(applicationNftId, activateAt);
188
196
  }
189
197
 
190
198
 
@@ -195,6 +203,7 @@ contract PolicyService is
195
203
  )
196
204
  external
197
205
  virtual
206
+ nonReentrant()
198
207
  {
199
208
  // check caller is registered product
200
209
  (,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
@@ -206,16 +215,14 @@ contract PolicyService is
206
215
  revert ErrorPolicyServicePolicyStateNotCollateralized(policyNftId);
207
216
  }
208
217
 
209
- IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
210
-
211
218
  // check if premium is already collected
212
- if (policyInfo.premiumPaidAmount.gtz()) {
213
- revert ErrorPolicyServicePremiumAlreadyPaid(policyNftId, policyInfo.premiumPaidAmount);
219
+ if (instanceReader.getPremiumInfoState(policyNftId) == PAID()) {
220
+ revert ErrorPolicyServicePremiumAlreadyPaid(policyNftId);
214
221
  }
215
222
 
223
+ IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
216
224
  IPolicy.PremiumInfo memory premium = instanceReader.getPremiumInfo(policyNftId);
217
- policyInfo.premiumPaidAmount = premium.premiumAmount;
218
-
225
+
219
226
  _processPremium(
220
227
  instance,
221
228
  policyNftId,
@@ -228,16 +235,20 @@ contract PolicyService is
228
235
  }
229
236
 
230
237
  instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
238
+ instance.getInstanceStore().updatePremiumState(policyNftId, PAID());
231
239
 
232
- // TODO: add logging
240
+ // log premium collection before interactions with token
241
+ emit LogPolicyServicePolicyPremiumCollected(policyNftId, premium.premiumAmount);
233
242
 
234
243
  _transferFunds(instanceReader, policyNftId, policyInfo.productNftId, premium);
235
-
236
- // TODO: add callback IPolicyHolder.policyActivated() if applicable
237
244
  }
238
245
 
239
246
  /// @inheritdoc IPolicyService
240
- function activate(NftId policyNftId, Timestamp activateAt) public override {
247
+ function activate(NftId policyNftId, Timestamp activateAt)
248
+ external
249
+ virtual
250
+ nonReentrant()
251
+ {
241
252
  // check caller is registered product
242
253
  (,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
243
254
  InstanceReader instanceReader = instance.getInstanceReader();
@@ -247,9 +258,11 @@ contract PolicyService is
247
258
 
248
259
  instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
249
260
 
250
- // TODO: add logging
261
+ // log policy activation before interactions with policy holder
262
+ emit LogPolicyServicePolicyActivated(policyNftId, activateAt);
251
263
 
252
- // TODO: add callback IPolicyHolder.policyActivated() if applicable
264
+ // callback to policy holder if applicable
265
+ _policyHolderPolicyActivated(policyNftId, activateAt);
253
266
  }
254
267
 
255
268
 
@@ -259,8 +272,8 @@ contract PolicyService is
259
272
  Timestamp expireAt
260
273
  )
261
274
  external
262
- override
263
275
  virtual
276
+ nonReentrant()
264
277
  returns (Timestamp expiredAt)
265
278
  {
266
279
  (NftId productNftId,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
@@ -298,12 +311,14 @@ contract PolicyService is
298
311
  }
299
312
 
300
313
  // update policyInfo with new expiredAt timestamp
314
+ Timestamp originalExpiredAt = policyInfo.expiredAt;
301
315
  policyInfo.expiredAt = expiredAt;
302
316
  instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, KEEP_STATE());
303
317
 
304
- emit LogPolicyServicePolicyExpirationUpdated(policyNftId, expiredAt);
318
+ emit LogPolicyServicePolicyExpirationUpdated(policyNftId, originalExpiredAt, expiredAt);
305
319
 
306
- // TODO: add callback IPolicyHolder.policyExpired() if applicable
320
+ // callback to policy holder if applicable
321
+ _policyHolderPolicyExpired(policyNftId, expiredAt);
307
322
  }
308
323
 
309
324
 
@@ -311,7 +326,8 @@ contract PolicyService is
311
326
  NftId policyNftId
312
327
  )
313
328
  external
314
- override
329
+ virtual
330
+ nonReentrant()
315
331
  {
316
332
  (,, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
317
333
  InstanceReader instanceReader = instance.getInstanceReader();
@@ -335,8 +351,8 @@ contract PolicyService is
335
351
 
336
352
  // TODO consider to allow for underpaid premiums (with the effects of reducing max payouts accordingly)
337
353
  // TODO consider to remove requirement for fully paid premiums altogether
338
- if (!(policyInfo.premiumAmount == policyInfo.premiumPaidAmount)) {
339
- revert ErrorPolicyServicePremiumNotFullyPaid(policyNftId, policyInfo.premiumAmount, policyInfo.premiumPaidAmount);
354
+ if (! instanceReader.getPremiumInfoState(policyNftId).eq(PAID())) {
355
+ revert ErrorPolicyServicePremiumNotPaid(policyNftId, policyInfo.premiumAmount);
340
356
  }
341
357
 
342
358
  // release (remaining) collateral that was blocked by policy
@@ -352,7 +368,7 @@ contract PolicyService is
352
368
  policyInfo.closedAt = TimestampLib.blockTimestamp();
353
369
  instance.getInstanceStore().updatePolicy(policyNftId, policyInfo, CLOSED());
354
370
 
355
- // TODO add logging
371
+ emit LogPolicyServicePolicyClosed(policyNftId);
356
372
  }
357
373
 
358
374
 
@@ -440,10 +456,12 @@ contract PolicyService is
440
456
  premium.productFeeVarAmount + premium.productFeeFixAmount);
441
457
 
442
458
  // update distribution fees and distributor commission and pool fees
443
- _distributionService.processSale(
444
- distributionNftId,
445
- referralId,
446
- premium);
459
+ if (!distributionNftId.eqz()) { // only call distribution service if a distribution component is connected to the product
460
+ _distributionService.processSale(
461
+ distributionNftId,
462
+ referralId,
463
+ premium);
464
+ }
447
465
 
448
466
  // update pool and bundle fees
449
467
  _poolService.processSale(
@@ -526,6 +544,64 @@ contract PolicyService is
526
544
  }
527
545
 
528
546
 
547
+ function _policyHolderPolicyActivated(
548
+ NftId policyNftId,
549
+ Timestamp activateAt
550
+ )
551
+ internal
552
+ virtual
553
+ {
554
+ // immediately return if policy is not activated
555
+ if (activateAt.eqz()) {
556
+ return;
557
+ }
558
+
559
+ // get policy holder address
560
+ IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
561
+
562
+ // execute callback if policy holder implements IPolicyHolder
563
+ if (address(policyHolder) != address(0)) {
564
+ policyHolder.policyActivated(policyNftId, activateAt);
565
+ }
566
+ }
567
+
568
+
569
+ function _policyHolderPolicyExpired(
570
+ NftId policyNftId,
571
+ Timestamp expiredAt
572
+ )
573
+ internal
574
+ virtual
575
+ {
576
+ // immediately return if policy is not activated
577
+ if (expiredAt.eqz()) {
578
+ return;
579
+ }
580
+
581
+ // get policy holder address
582
+ IPolicyHolder policyHolder = _getPolicyHolder(policyNftId);
583
+
584
+ // execute callback if policy holder implements IPolicyHolder
585
+ if (address(policyHolder) != address(0)) {
586
+ policyHolder.policyExpired(policyNftId, expiredAt);
587
+ }
588
+ }
589
+
590
+
591
+ function _getPolicyHolder(NftId policyNftId)
592
+ internal
593
+ view
594
+ returns (IPolicyHolder policyHolder)
595
+ {
596
+ address policyHolderAddress = getRegistry().ownerOf(policyNftId);
597
+ policyHolder = IPolicyHolder(policyHolderAddress);
598
+
599
+ if (!ContractLib.isPolicyHolder(policyHolderAddress)) {
600
+ policyHolder = IPolicyHolder(address(0));
601
+ }
602
+ }
603
+
604
+
529
605
  function _getTokenHandler(
530
606
  InstanceReader instanceReader,
531
607
  NftId productNftId
@@ -540,6 +616,7 @@ contract PolicyService is
540
616
  tokenHandler = instanceReader.getComponentInfo(productNftId).tokenHandler;
541
617
  }
542
618
 
619
+
543
620
  function _getDistributionNftAndWallets(
544
621
  InstanceReader instanceReader,
545
622
  NftId productNftId
@@ -12,14 +12,14 @@ contract PolicyServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with product 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
  PolicyService svc = new PolicyService{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);
@@ -45,13 +45,12 @@ contract PricingService is
45
45
  initializer()
46
46
  {
47
47
  (
48
- address registryAddress,,
49
- //address managerAddress
48
+ address registryAddress,
50
49
  address authority
51
- ) = abi.decode(data, (address, address, address));
50
+ ) = abi.decode(data, (address, address));
52
51
 
53
- initializeService(registryAddress, authority, owner);
54
- registerInterface(type(IPricingService).interfaceId);
52
+ _initializeService(registryAddress, authority, owner);
53
+ _registerInterface(type(IPricingService).interfaceId);
55
54
 
56
55
  _distributionService = IDistributionService(_getServiceAddress(DISTRIBUTION()));
57
56
  }
@@ -15,11 +15,11 @@ contract PricingServiceManager is ProxyManager {
15
15
  address registryAddress,
16
16
  bytes32 salt
17
17
  )
18
- ProxyManager(registryAddress)
19
18
  {
20
19
  PricingService pricingSrv = new PricingService{salt: salt}();
21
- bytes memory data = abi.encode(registryAddress, address(this), authority);
22
- IVersionable versionable = deployDetermenistic(
20
+ bytes memory data = abi.encode(registryAddress, authority);
21
+ IVersionable versionable = initialize(
22
+ registryAddress,
23
23
  address(pricingSrv),
24
24
  data,
25
25
  salt);
@@ -123,11 +123,11 @@ abstract contract Product is
123
123
  }
124
124
 
125
125
  function getPoolNftId() external view override returns (NftId poolNftId) {
126
- return getRegistry().getNftId(address(_getProductStorage()._pool));
126
+ return getRegistry().getNftIdForAddress(address(_getProductStorage()._pool));
127
127
  }
128
128
 
129
129
  function getDistributionNftId() external view override returns (NftId distributionNftId) {
130
- return getRegistry().getNftId(address(_getProductStorage()._distribution));
130
+ return getRegistry().getNftIdForAddress(address(_getProductStorage()._distribution));
131
131
  }
132
132
 
133
133
  function _initializeProduct(
@@ -171,10 +171,10 @@ abstract contract Product is
171
171
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
172
172
  $._pool = Pool(pool);
173
173
  $._distribution = Distribution(distribution);
174
- $._poolNftId = getRegistry().getNftId(pool);
175
- $._distributionNftId = getRegistry().getNftId(distribution);
174
+ $._poolNftId = getRegistry().getNftIdForAddress(pool);
175
+ $._distributionNftId = getRegistry().getNftIdForAddress(distribution);
176
176
 
177
- registerInterface(type(IProductComponent).interfaceId);
177
+ _registerInterface(type(IProductComponent).interfaceId);
178
178
  }
179
179
 
180
180
 
@@ -380,6 +380,24 @@ abstract contract Product is
380
380
  data);
381
381
  }
382
382
 
383
+ function _createPayoutForBeneficiary(
384
+ NftId policyNftId,
385
+ ClaimId claimId,
386
+ Amount amount,
387
+ address beneficiary,
388
+ bytes memory data
389
+ )
390
+ internal
391
+ returns (PayoutId)
392
+ {
393
+ return _getProductStorage()._claimService.createPayoutForBeneficiary(
394
+ policyNftId,
395
+ claimId,
396
+ amount,
397
+ beneficiary,
398
+ data);
399
+ }
400
+
383
401
  function _processPayout(
384
402
  NftId policyNftId,
385
403
  PayoutId payoutId
@@ -33,18 +33,17 @@ contract RiskService is
33
33
  virtual override
34
34
  {
35
35
  (
36
- address registryAddress,,
37
- //address managerAddress
36
+ address registryAddress,
38
37
  address authority
39
- ) = abi.decode(data, (address, address, address));
38
+ ) = abi.decode(data, (address, address));
40
39
 
41
- initializeService(registryAddress, authority, owner);
40
+ _initializeService(registryAddress, authority, owner);
42
41
 
43
42
  _instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
44
43
  _poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
45
44
  _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
46
45
 
47
- registerInterface(type(IRiskService).interfaceId);
46
+ _registerInterface(type(IRiskService).interfaceId);
48
47
  }
49
48
 
50
49
 
@@ -12,14 +12,14 @@ contract RiskServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with product 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
  RiskService svc = new RiskService{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);