@etherisc/gif-next 0.0.2-b3a9c97-695 → 0.0.2-b3e9a44-364

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 (419) hide show
  1. package/README.md +5 -2
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +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/Authorization.sol/Authorization.json +2 -2
  7. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
  10. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
  14. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  17. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +52 -212
  19. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
  21. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  22. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +16 -184
  23. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +148 -284
  25. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +100 -120
  27. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +16 -37
  29. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +65 -31
  31. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
  32. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
  33. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
  34. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1507 -0
  35. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  36. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +410 -0
  37. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  38. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1978 -0
  39. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  40. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +414 -0
  41. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  42. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  43. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  44. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1427 -0
  45. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  46. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1187 -0
  47. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  48. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1561 -0
  49. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  50. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1996 -0
  51. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  52. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  53. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  54. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +16 -0
  55. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  56. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +16 -0
  57. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  58. package/artifacts/contracts/instance/Instance.sol/Instance.json +26 -99
  59. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  60. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +97 -100
  61. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  62. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
  63. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  64. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +424 -74
  65. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  66. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +55 -146
  67. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  68. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +77 -81
  69. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  70. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +249 -111
  71. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  72. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  73. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  74. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  75. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  76. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  77. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  78. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  79. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  80. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  81. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  82. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  83. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  84. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  85. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  86. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  87. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  88. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +42 -202
  89. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  90. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +18 -18
  91. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  92. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  93. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +16 -37
  94. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  95. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +16 -0
  96. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  97. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +16 -184
  98. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  99. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +53 -144
  100. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +76 -80
  102. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  103. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +45 -185
  104. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
  106. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  107. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +146 -220
  108. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +115 -107
  110. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  111. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +40 -0
  112. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  113. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +48 -41
  114. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  115. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +219 -118
  116. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  117. package/artifacts/contracts/pool/Pool.sol/Pool.json +45 -185
  118. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +284 -300
  120. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +96 -92
  122. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  123. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +47 -146
  124. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  125. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +73 -81
  126. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  127. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +44 -210
  128. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  129. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
  130. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  131. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +256 -229
  132. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +117 -109
  134. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  135. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +16 -0
  136. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  137. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +148 -7
  138. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  139. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +128 -16
  140. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  141. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +59 -43
  142. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  143. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +44 -63
  144. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  145. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +18 -2
  146. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  147. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +218 -289
  148. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  149. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +108 -128
  150. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  151. package/artifacts/contracts/product/PricingService.sol/PricingService.json +133 -261
  152. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  153. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +97 -117
  154. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  155. package/artifacts/contracts/product/Product.sol/Product.json +44 -210
  156. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  157. package/artifacts/contracts/product/RiskService.sol/RiskService.json +604 -0
  158. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  159. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +698 -0
  160. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  161. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  162. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  163. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +288 -21
  164. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +16 -0
  166. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  167. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  168. package/artifacts/contracts/registry/Registry.sol/Registry.json +494 -82
  169. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +243 -131
  171. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  172. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +39 -313
  173. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  174. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +68 -72
  175. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  176. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  177. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  178. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +24 -14
  179. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  181. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  183. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  184. package/artifacts/contracts/shared/Component.sol/Component.json +16 -173
  185. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  186. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +103 -265
  187. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +112 -126
  189. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  190. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +21 -112
  191. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  192. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
  193. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  194. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +16 -26
  195. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  196. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +16 -0
  197. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +16 -37
  199. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  200. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  201. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  202. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
  203. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  204. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
  205. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  206. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +16 -0
  207. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  208. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  209. package/artifacts/contracts/shared/IService.sol/IService.json +16 -0
  210. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  211. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
  212. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  213. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +16 -184
  214. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  215. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  216. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  217. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  218. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  219. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
  220. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  221. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
  222. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  223. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +24 -97
  224. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  225. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  226. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  227. package/artifacts/contracts/shared/Service.sol/Service.json +21 -112
  228. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  229. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +288 -16
  230. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
  231. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
  232. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  233. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +43 -27
  234. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  235. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +16 -21
  236. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  237. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +63 -93
  238. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  239. package/artifacts/contracts/staking/Staking.sol/Staking.json +101 -248
  240. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  241. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  242. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  243. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +93 -100
  244. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  245. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -11
  246. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  247. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +47 -159
  248. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  249. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +72 -76
  250. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  251. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +84 -84
  252. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  253. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +54 -23
  254. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  255. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/Amount.sol/AmountLib.json +32 -8
  257. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  258. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  260. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  262. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  263. package/artifacts/contracts/type/Fee.sol/FeeLib.json +2 -2
  264. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  265. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  266. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  267. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  268. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  269. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  270. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  271. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  272. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  273. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  274. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  276. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  278. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
  280. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  282. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -2
  284. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  288. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  290. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +2 -2
  291. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  292. package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
  293. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  294. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +15 -2
  295. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  297. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  298. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  299. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +55 -70
  300. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  301. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  302. package/contracts/authorization/AccessAdmin.sol +25 -24
  303. package/contracts/authorization/Authorization.sol +5 -2
  304. package/contracts/authorization/IAccessAdmin.sol +0 -1
  305. package/contracts/distribution/BasicDistribution.sol +2 -0
  306. package/contracts/distribution/Distribution.sol +3 -2
  307. package/contracts/distribution/DistributionService.sol +70 -45
  308. package/contracts/distribution/DistributionServiceManager.sol +6 -6
  309. package/contracts/distribution/IDistributionService.sol +8 -2
  310. package/contracts/examples/fire/DamageLevel.sol +59 -0
  311. package/contracts/examples/fire/FirePool.sol +75 -0
  312. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  313. package/contracts/examples/fire/FireProduct.sol +411 -0
  314. package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
  315. package/contracts/examples/fire/FireUSD.sol +26 -0
  316. package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
  317. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  318. package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
  319. package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
  320. package/contracts/instance/IInstance.sol +7 -30
  321. package/contracts/instance/Instance.sol +10 -35
  322. package/contracts/instance/InstanceAdmin.sol +29 -7
  323. package/contracts/instance/InstanceAuthorizationV3.sol +3 -3
  324. package/contracts/instance/InstanceReader.sol +106 -19
  325. package/contracts/instance/InstanceService.sol +12 -14
  326. package/contracts/instance/InstanceServiceManager.sol +6 -7
  327. package/contracts/instance/InstanceStore.sol +11 -1
  328. package/contracts/instance/base/ObjectLifecycle.sol +7 -1
  329. package/contracts/instance/module/IComponents.sol +4 -2
  330. package/contracts/instance/module/IPolicy.sol +23 -23
  331. package/contracts/oracle/Oracle.sol +2 -1
  332. package/contracts/oracle/OracleService.sol +41 -33
  333. package/contracts/oracle/OracleServiceManager.sol +6 -6
  334. package/contracts/pool/BasicPool.sol +12 -13
  335. package/contracts/pool/BundleService.sol +41 -17
  336. package/contracts/pool/BundleServiceManager.sol +6 -6
  337. package/contracts/pool/IBundleService.sol +10 -0
  338. package/contracts/pool/IPoolComponent.sol +18 -8
  339. package/contracts/pool/IPoolService.sol +49 -25
  340. package/contracts/pool/Pool.sol +61 -32
  341. package/contracts/pool/PoolService.sol +116 -77
  342. package/contracts/pool/PoolServiceManager.sol +4 -4
  343. package/contracts/product/ApplicationService.sol +13 -12
  344. package/contracts/product/ApplicationServiceManager.sol +4 -4
  345. package/contracts/product/BasicProduct.sol +1 -0
  346. package/contracts/product/ClaimService.sol +245 -81
  347. package/contracts/product/ClaimServiceManager.sol +4 -4
  348. package/contracts/product/IClaimService.sol +30 -7
  349. package/contracts/product/IPolicyService.sol +16 -20
  350. package/contracts/product/IPricingService.sol +7 -7
  351. package/contracts/product/IProductComponent.sol +17 -4
  352. package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
  353. package/contracts/product/PolicyService.sol +209 -118
  354. package/contracts/product/PolicyServiceManager.sol +4 -4
  355. package/contracts/product/PricingService.sol +42 -46
  356. package/contracts/product/PricingServiceManager.sol +3 -3
  357. package/contracts/product/Product.sol +67 -46
  358. package/contracts/product/{ProductService.sol → RiskService.sol} +7 -10
  359. package/contracts/product/RiskServiceManager.sol +39 -0
  360. package/contracts/registry/ChainNft.sol +65 -32
  361. package/contracts/registry/IRegistry.sol +55 -15
  362. package/contracts/registry/IRegistryService.sol +0 -9
  363. package/contracts/registry/Registry.sol +336 -197
  364. package/contracts/registry/RegistryAdmin.sol +150 -51
  365. package/contracts/registry/RegistryService.sol +55 -48
  366. package/contracts/registry/RegistryServiceManager.sol +2 -2
  367. package/contracts/registry/ReleaseRegistry.sol +12 -6
  368. package/contracts/registry/ServiceAuthorizationV3.sol +6 -8
  369. package/contracts/shared/Component.sol +12 -32
  370. package/contracts/shared/ComponentService.sol +17 -16
  371. package/contracts/shared/ComponentServiceManager.sol +8 -5
  372. package/contracts/shared/ComponentVerifyingService.sol +2 -3
  373. package/contracts/shared/ContractLib.sol +38 -0
  374. package/contracts/shared/IComponent.sol +0 -1
  375. package/contracts/shared/IInstanceLinkedComponent.sol +0 -7
  376. package/contracts/shared/INftOwnable.sol +2 -0
  377. package/contracts/shared/IPolicyHolder.sol +12 -22
  378. package/contracts/shared/InitializableERC165.sol +2 -2
  379. package/contracts/shared/InstanceLinkedComponent.sol +5 -6
  380. package/contracts/shared/NftOwnable.sol +21 -5
  381. package/contracts/shared/PolicyHolder.sol +15 -52
  382. package/contracts/shared/Registerable.sol +4 -4
  383. package/contracts/shared/RegistryLinked.sol +3 -2
  384. package/contracts/shared/Service.sol +16 -11
  385. package/contracts/shared/TokenHandler.sol +99 -22
  386. package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
  387. package/contracts/staking/IStaking.sol +2 -1
  388. package/contracts/staking/IStakingService.sol +0 -3
  389. package/contracts/staking/StakeManagerLib.sol +18 -25
  390. package/contracts/staking/Staking.sol +11 -29
  391. package/contracts/staking/StakingManager.sol +8 -6
  392. package/contracts/staking/StakingReader.sol +12 -5
  393. package/contracts/staking/StakingService.sol +3 -17
  394. package/contracts/staking/StakingServiceManager.sol +2 -2
  395. package/contracts/staking/TargetManagerLib.sol +7 -3
  396. package/contracts/type/Amount.sol +15 -0
  397. package/contracts/type/ClaimId.sol +6 -1
  398. package/contracts/type/NftId.sol +1 -0
  399. package/contracts/type/ObjectType.sol +16 -11
  400. package/contracts/type/PayoutId.sol +10 -10
  401. package/contracts/type/RiskId.sol +15 -1
  402. package/contracts/type/Seconds.sol +8 -0
  403. package/contracts/type/StateId.sol +1 -0
  404. package/contracts/type/UFixed.sol +4 -0
  405. package/contracts/upgradeability/ProxyManager.sol +67 -34
  406. package/contracts/upgradeability/Versionable.sol +2 -2
  407. package/package.json +2 -1
  408. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  409. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  410. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
  411. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  412. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
  413. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
  414. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
  415. package/artifacts/contracts/shared/TokenTransferLib.sol/TokenTransferLib.dbg.json +0 -4
  416. package/artifacts/contracts/shared/TokenTransferLib.sol/TokenTransferLib.json +0 -42
  417. package/contracts/product/ProductServiceManager.sol +0 -39
  418. package/contracts/shared/InitializableCustom.sol +0 -177
  419. package/contracts/shared/TokenTransferLib.sol +0 -60
@@ -2,12 +2,12 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {Amount} from "../type/Amount.sol";
5
- import {ClaimId} from "../type/ClaimId.sol";
5
+ import {ClaimId, ClaimIdLib} from "../type/ClaimId.sol";
6
6
  import {DistributorType} from "../type/DistributorType.sol";
7
7
  import {Key32} from "../type/Key32.sol";
8
8
  import {NftId} from "../type/NftId.sol";
9
- import {COMPONENT, DISTRIBUTOR, DISTRIBUTION, PRODUCT, POLICY, POOL, BUNDLE} from "../type/ObjectType.sol";
10
- import {PayoutId} from "../type/PayoutId.sol";
9
+ import {COMPONENT, DISTRIBUTOR, DISTRIBUTION, PREMIUM, PRODUCT, POLICY, POOL, BUNDLE} from "../type/ObjectType.sol";
10
+ import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
11
11
  import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../type/Referral.sol";
12
12
  import {RequestId} from "../type/RequestId.sol";
13
13
  import {RiskId} from "../type/RiskId.sol";
@@ -26,6 +26,7 @@ import {IRisk} from "../instance/module/IRisk.sol";
26
26
  import {TimestampLib} from "../type/Timestamp.sol";
27
27
 
28
28
  import {InstanceStore} from "./InstanceStore.sol";
29
+ import {BundleSet} from "./BundleSet.sol";
29
30
 
30
31
 
31
32
  contract InstanceReader {
@@ -37,6 +38,7 @@ contract InstanceReader {
37
38
 
38
39
  IInstance internal _instance;
39
40
  InstanceStore internal _store;
41
+ BundleSet internal _bundleSet;
40
42
 
41
43
  /// @dev This initializer needs to be called from the instance itself.
42
44
  function initialize() public {
@@ -56,6 +58,7 @@ contract InstanceReader {
56
58
  _initialized = true;
57
59
  _instance = IInstance(instanceAddress);
58
60
  _store = _instance.getInstanceStore();
61
+ _bundleSet = _instance.getBundleSet();
59
62
  }
60
63
 
61
64
 
@@ -80,6 +83,41 @@ contract InstanceReader {
80
83
  return _store.getState(toPolicyKey(policyNftId));
81
84
  }
82
85
 
86
+ function getPremiumInfo(NftId policyNftId)
87
+ public
88
+ view
89
+ returns (IPolicy.PremiumInfo memory info)
90
+ {
91
+ bytes memory data = _store.getData(toPremiumKey(policyNftId));
92
+ if (data.length > 0) {
93
+ return abi.decode(data, (IPolicy.PremiumInfo));
94
+ }
95
+ }
96
+
97
+ function getPremiumInfoState(NftId policyNftId)
98
+ public
99
+ view
100
+ returns (StateId state)
101
+ {
102
+ return _store.getState(toPremiumKey(policyNftId));
103
+ }
104
+
105
+ function activeBundles(NftId poolNftId)
106
+ public
107
+ view
108
+ returns (uint256 bundles)
109
+ {
110
+ return _bundleSet.activeBundles(poolNftId);
111
+ }
112
+
113
+ function getActiveBundleNftId(NftId poolNftId, uint256 idx)
114
+ public
115
+ view
116
+ returns (NftId bundleNftId)
117
+ {
118
+ return _bundleSet.getActiveBundleNftId(poolNftId, idx);
119
+ }
120
+
83
121
  function getBundleState(NftId bundleNftId)
84
122
  public
85
123
  view
@@ -88,14 +126,8 @@ contract InstanceReader {
88
126
  return _store.getState(toBundleKey(bundleNftId));
89
127
  }
90
128
 
91
- /// @dev returns true iff policy may be closed
92
- /// a policy can be closed all conditions below are met
93
- /// - policy exists
94
- /// - has been activated
95
- /// - is not yet closed
96
- /// - has no open claims
97
- /// - claim amount matches sum insured amount or is expired
98
- function policyIsCloseable(NftId policyNftId)
129
+ /// @dev Returns true iff policy is active.
130
+ function policyIsActive(NftId policyNftId)
99
131
  public
100
132
  view
101
133
  returns (bool isCloseable)
@@ -104,17 +136,27 @@ contract InstanceReader {
104
136
 
105
137
  if (info.productNftId.eqz()) { return false; } // not closeable: policy does not exist (or does not belong to this instance)
106
138
  if (info.activatedAt.eqz()) { return false; } // not closeable: not yet activated
107
- if (info.closedAt.gtz()) { return false; } // not closeable: already closed
108
- if (info.openClaimsCount > 0) { return false; } // not closeable: has open claims
139
+ if (info.activatedAt > TimestampLib.blockTimestamp()) { return false; } // not yet active
140
+ if (info.expiredAt <= TimestampLib.blockTimestamp()) { return false; } // already expired
141
+
142
+ return true;
143
+ }
109
144
 
110
- // closeable: if sum of claims matches sum insured a policy may be closed prior to the expiry date
111
- if (info.claimAmount == info.sumInsuredAmount) { return true; }
145
+ function claims(NftId policyNftId)
146
+ public
147
+ view
148
+ returns (uint16 claims)
149
+ {
150
+ return getPolicyInfo(policyNftId).claimsCount;
151
+ }
112
152
 
113
- // not closeable: not yet expired
114
- if (TimestampLib.blockTimestamp() < info.expiredAt) { return false; }
115
153
 
116
- // all conditionsl to close the policy are met
117
- return true;
154
+ function getClaimId(uint idx)
155
+ public
156
+ view
157
+ returns (ClaimId claimId)
158
+ {
159
+ return ClaimIdLib.toClaimId(idx + 1);
118
160
  }
119
161
 
120
162
  function getClaimInfo(NftId policyNftId, ClaimId claimId)
@@ -128,6 +170,7 @@ contract InstanceReader {
128
170
  }
129
171
  }
130
172
 
173
+
131
174
  function getClaimState(NftId policyNftId, ClaimId claimId)
132
175
  public
133
176
  view
@@ -136,6 +179,34 @@ contract InstanceReader {
136
179
  return _store.getState(claimId.toKey32(policyNftId));
137
180
  }
138
181
 
182
+
183
+ function payouts(NftId policyNftId, ClaimId claimId)
184
+ public
185
+ view
186
+ returns (uint24 payouts)
187
+ {
188
+ return getClaimInfo(policyNftId, claimId).payoutsCount;
189
+ }
190
+
191
+
192
+ function getPayoutId(ClaimId claimId, uint24 idx)
193
+ public
194
+ view
195
+ returns (PayoutId payoutId)
196
+ {
197
+ return PayoutIdLib.toPayoutId(claimId, idx + 1);
198
+ }
199
+
200
+
201
+ function getRemainingClaimableAmount(NftId policyNftId)
202
+ public
203
+ view
204
+ returns (Amount remainingClaimableAmount)
205
+ {
206
+ IPolicy.PolicyInfo memory info = getPolicyInfo(policyNftId);
207
+ return info.sumInsuredAmount - info.claimAmount;
208
+ }
209
+
139
210
  function getPayoutInfo(NftId policyNftId, PayoutId payoutId)
140
211
  public
141
212
  view
@@ -166,6 +237,19 @@ contract InstanceReader {
166
237
  }
167
238
  }
168
239
 
240
+ function getWallet(NftId componentNftId)
241
+ public
242
+ view
243
+ returns (address tokenHandler)
244
+ {
245
+ bytes memory data = _store.getData(toComponentKey(componentNftId));
246
+
247
+ if (data.length > 0) {
248
+ IComponents.ComponentInfo memory info = abi.decode(data, (IComponents.ComponentInfo));
249
+ return info.wallet;
250
+ }
251
+ }
252
+
169
253
  function getTokenHandler(NftId componentNftId)
170
254
  public
171
255
  view
@@ -364,6 +448,9 @@ contract InstanceReader {
364
448
  return policyNftId.toKey32(POLICY());
365
449
  }
366
450
 
451
+ function toPremiumKey(NftId policyNftId) public pure returns (Key32) {
452
+ return policyNftId.toKey32(PREMIUM());
453
+ }
367
454
 
368
455
  function toDistributorKey(NftId distributorNftId) public pure returns (Key32) {
369
456
  return distributorNftId.toKey32(DISTRIBUTOR());
@@ -60,7 +60,7 @@ contract InstanceService is
60
60
 
61
61
  modifier onlyInstance() {
62
62
  address instanceAddress = msg.sender;
63
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
63
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
64
64
  if (instanceNftId.eqz()) {
65
65
  revert ErrorInstanceServiceNotRegistered(instanceAddress);
66
66
  }
@@ -132,7 +132,7 @@ contract InstanceService is
132
132
  virtual
133
133
  onlyInstance()
134
134
  {
135
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
135
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
136
136
  _stakingService.setInstanceLockingPeriod(
137
137
  instanceNftId,
138
138
  stakeLockingPeriod);
@@ -144,7 +144,7 @@ contract InstanceService is
144
144
  virtual
145
145
  onlyInstance()
146
146
  {
147
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
147
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
148
148
  _stakingService.setInstanceRewardRate(
149
149
  instanceNftId,
150
150
  rewardRate);
@@ -156,7 +156,7 @@ contract InstanceService is
156
156
  virtual
157
157
  onlyInstance()
158
158
  {
159
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
159
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
160
160
  _stakingService.refillInstanceRewardReserves(
161
161
  instanceNftId,
162
162
  rewardProvider,
@@ -170,7 +170,7 @@ contract InstanceService is
170
170
  onlyInstance()
171
171
  returns (Amount newBalance)
172
172
  {
173
- NftId instanceNftId = getRegistry().getNftId(msg.sender);
173
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
174
174
  _stakingService.withdrawInstanceRewardReserves(
175
175
  instanceNftId,
176
176
  dipAmount);
@@ -193,8 +193,7 @@ contract InstanceService is
193
193
  NftId instanceNftId = registry.getObjectInfo(componentAddress).parentNftId;
194
194
 
195
195
  IInstance instance = IInstance(
196
- registry.getObjectInfo(
197
- instanceNftId).objectAddress);
196
+ registry.getObjectAddress(instanceNftId));
198
197
 
199
198
  // no revert in case already locked
200
199
  // TODO refactor/implement
@@ -314,7 +313,7 @@ contract InstanceService is
314
313
 
315
314
  InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
316
315
  instanceAdmin.initializeComponentAuthorization(
317
- address(component),
316
+ component,
318
317
  component.getAuthorization());
319
318
  }
320
319
 
@@ -422,21 +421,20 @@ contract InstanceService is
422
421
  bytes memory data
423
422
  )
424
423
  internal
425
- initializer
426
424
  virtual override
425
+ initializer()
427
426
  {
428
427
  (
429
- address registryAddress,,
430
- //address managerAddress
428
+ address registryAddress,
431
429
  address authority
432
- ) = abi.decode(data, (address, address, address));
430
+ ) = abi.decode(data, (address, address));
433
431
 
434
- initializeService(registryAddress, authority, owner);
432
+ _initializeService(registryAddress, authority, owner);
435
433
 
436
434
  _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
437
435
  _stakingService = IStakingService(_getServiceAddress(STAKING()));
438
436
 
439
- registerInterface(type(IInstanceService).interfaceId);
437
+ _registerInterface(type(IInstanceService).interfaceId);
440
438
  }
441
439
 
442
440
 
@@ -12,16 +12,15 @@ contract InstanceServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with instance 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
- InstanceService instSrv = new InstanceService{salt: salt}();
21
- // bytes memory initCode = type(InstanceService).creationCode;
22
- bytes memory data = abi.encode(registryAddress, address(this), authority);
23
- IVersionable versionable = deployDetermenistic(
24
- address(instSrv),
19
+ InstanceService svc = new InstanceService{salt: salt}();
20
+ bytes memory data = abi.encode(registry, authority);
21
+ IVersionable versionable = initialize(
22
+ registry,
23
+ address(svc),
25
24
  data,
26
25
  salt);
27
26
 
@@ -7,7 +7,7 @@ import {Amount} from "../type/Amount.sol";
7
7
  import {Key32} from "../type/Key32.sol";
8
8
  import {NftId} from "../type/NftId.sol";
9
9
  import {ClaimId} from "../type/ClaimId.sol";
10
- import {ObjectType, BUNDLE, POLICY, POOL, PRODUCT, COMPONENT, DISTRIBUTOR} from "../type/ObjectType.sol";
10
+ import {ObjectType, BUNDLE, POLICY, POOL, PREMIUM, PRODUCT, COMPONENT, DISTRIBUTOR} from "../type/ObjectType.sol";
11
11
  import {RequestId} from "../type/RequestId.sol";
12
12
  import {RiskId} from "../type/RiskId.sol";
13
13
  import {StateId} from "../type/StateId.sol";
@@ -195,6 +195,16 @@ contract InstanceStore is
195
195
  _updateState(_toNftKey32(policyNftId, POLICY()), newState);
196
196
  }
197
197
 
198
+
199
+ //--- Premium (Policy) ----------------------------------------------//
200
+ function createPremium(NftId policyNftId, IPolicy.PremiumInfo memory premium) external restricted() {
201
+ _create(_toNftKey32(policyNftId, PREMIUM()), abi.encode(premium));
202
+ }
203
+
204
+ function updatePremiumState(NftId policyNftId, StateId newState) external restricted() {
205
+ _updateState(_toNftKey32(policyNftId, PREMIUM()), newState);
206
+ }
207
+
198
208
  //--- Claim -------------------------------------------------------------//
199
209
  function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
200
210
  _create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
@@ -3,7 +3,7 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
5
5
 
6
- import {COMPONENT, BUNDLE, POLICY, REQUEST, RISK, CLAIM, PAYOUT, POOL, PRODUCT, DISTRIBUTION, DISTRIBUTOR, DISTRIBUTOR_TYPE, REFERRAL} from "../../type/ObjectType.sol";
6
+ import {COMPONENT, BUNDLE, POLICY, REQUEST, RISK, CLAIM, PAYOUT, POOL, PREMIUM, PRODUCT, DISTRIBUTION, DISTRIBUTOR, DISTRIBUTOR_TYPE, REFERRAL} from "../../type/ObjectType.sol";
7
7
  import {ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, COLLATERALIZED, REVOKED, SUBMITTED, CONFIRMED, DECLINED, EXPECTED, PAID, FULFILLED, FAILED, CANCELLED} from "../../type/StateId.sol";
8
8
  import {Lifecycle} from "../../shared/Lifecycle.sol";
9
9
 
@@ -23,6 +23,7 @@ contract ObjectLifecycle is
23
23
  _setupBundleLifecycle();
24
24
  _setupComponentLifecycle();
25
25
  _setupPolicyLifecycle();
26
+ _setupPremiumLifecycle();
26
27
  _setupClaimLifecycle();
27
28
  _setupPayoutLifecycle();
28
29
  _setupRiskLifecycle();
@@ -57,6 +58,11 @@ contract ObjectLifecycle is
57
58
  setStateTransition(POLICY(), COLLATERALIZED(), CLOSED());
58
59
  }
59
60
 
61
+ function _setupPremiumLifecycle() private {
62
+ setInitialState(PREMIUM(), EXPECTED());
63
+ setStateTransition(PREMIUM(), EXPECTED(), PAID());
64
+ }
65
+
60
66
  function _setupClaimLifecycle() private {
61
67
  setInitialState(CLAIM(), SUBMITTED());
62
68
  setStateTransition(CLAIM(), SUBMITTED(), CONFIRMED());
@@ -24,6 +24,7 @@ interface IComponents {
24
24
  struct ProductInfo {
25
25
  NftId distributionNftId;
26
26
  NftId poolNftId;
27
+ bool isProcessingFundedClaims; // custom logic to react to pool events for funded claims
27
28
  Fee productFee; // product fee on net premium
28
29
  Fee processingFee; // product fee on payout amounts
29
30
  Fee distributionFee; // distribution fee for sales that do not include commissions
@@ -35,9 +36,10 @@ interface IComponents {
35
36
 
36
37
 
37
38
  struct PoolInfo {
38
- RoleId bundleOwnerRole; // the required role for bundle owners
39
39
  Amount maxBalanceAmount; // max balance amount allowed for pool
40
- bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
40
+ RoleId bundleOwnerRole; // the required role for bundle owners
41
+ bool isInterceptingBundleTransfers; // custom logic for bundle nft transfers
42
+ bool isProcessingConfirmedClaims; // custom logic for claims confirmation
41
43
  bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
42
44
  bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
43
45
  UFixed collateralizationLevel; // factor to calculate collateral for sum insurance (default 100%)
@@ -11,7 +11,7 @@ import {Timestamp} from "../../type/Timestamp.sol";
11
11
 
12
12
  interface IPolicy {
13
13
 
14
- struct Premium {
14
+ struct PremiumInfo {
15
15
  // premium splitting per target wallet
16
16
  Amount productFeeAmount;
17
17
  Amount distributionFeeAndCommissionAmount;
@@ -19,26 +19,26 @@ interface IPolicy {
19
19
 
20
20
  // detailed positions
21
21
  // this is the net premium calculated by the product
22
- uint256 netPremiumAmount;
22
+ Amount netPremiumAmount;
23
23
  // fullPremium = netPremium + all fixed amounts + all variable amounts (excl commission and minDistribtuionOwnerFee variable part)
24
- uint256 fullPremiumAmount;
24
+ Amount fullPremiumAmount;
25
25
  // effective premium = fullPremium - discount
26
- uint256 premiumAmount;
27
- uint256 productFeeFixAmount;
28
- uint256 poolFeeFixAmount;
29
- uint256 bundleFeeFixAmount;
30
- uint256 distributionFeeFixAmount;
31
- uint256 productFeeVarAmount;
32
- uint256 poolFeeVarAmount;
33
- uint256 bundleFeeVarAmount;
34
- uint256 distributionFeeVarAmount;
35
- uint256 distributionOwnerFeeFixAmount;
26
+ Amount premiumAmount;
27
+ Amount productFeeFixAmount;
28
+ Amount poolFeeFixAmount;
29
+ Amount bundleFeeFixAmount;
30
+ Amount distributionFeeFixAmount;
31
+ Amount productFeeVarAmount;
32
+ Amount poolFeeVarAmount;
33
+ Amount bundleFeeVarAmount;
34
+ Amount distributionFeeVarAmount;
35
+ Amount distributionOwnerFeeFixAmount;
36
36
  // this is the remaining amount when the commission and discount are subtracted from the distribution fee variable part (must be at least the minDistributionOwnerFee)
37
- uint256 distributionOwnerFeeVarAmount;
37
+ Amount distributionOwnerFeeVarAmount;
38
38
  // this value is based on distributor type referenced in the referral
39
- uint256 commissionAmount;
39
+ Amount commissionAmount;
40
40
  // this is based on referral used
41
- uint256 discountAmount;
41
+ Amount discountAmount;
42
42
  }
43
43
 
44
44
  /// @dev policy data for the full policy lifecycle
@@ -49,7 +49,6 @@ interface IPolicy {
49
49
  RiskId riskId;
50
50
  Amount sumInsuredAmount;
51
51
  Amount premiumAmount; // expected premium at application time
52
- Amount premiumPaidAmount; // actual paid premium
53
52
  Seconds lifetime;
54
53
  // policy application data, no changes after applying for a policy
55
54
  bytes applicationData;
@@ -67,10 +66,10 @@ interface IPolicy {
67
66
  struct ClaimInfo {
68
67
  Amount claimAmount;
69
68
  Amount paidAmount;
70
- uint8 payoutsCount;
71
- uint8 openPayoutsCount;
72
- bytes submissionData; // claim submission data, no changes after submitting the claim
73
- bytes processData; // data that may include information supporting confirm or decline
69
+ uint24 payoutsCount;
70
+ uint24 openPayoutsCount;
71
+ bytes submissionData; // use case specific claim submission data, no changes after submitting the claim
72
+ bytes processData; // use case specific data that may include information supporting confirm or decline
74
73
  Timestamp closedAt; // payment of confirmed claim amount (or declinedAt)
75
74
  }
76
75
 
@@ -78,7 +77,8 @@ interface IPolicy {
78
77
  struct PayoutInfo {
79
78
  ClaimId claimId;
80
79
  Amount amount;
81
- bytes data;
82
- Timestamp paidAt; // payoment of confirmed claim amount (or declinedAt)
80
+ address beneficiary; // for address(0) beneficiary is policy nft owner
81
+ bytes data; // use case specific supporting data
82
+ Timestamp paidAt; // timestamp for actual payout
83
83
  }
84
84
  }
@@ -71,6 +71,7 @@ abstract contract Oracle is
71
71
  return false;
72
72
  }
73
73
 
74
+ /// @dev Not relevant for oracle components
74
75
  function withdrawFees(Amount amount)
75
76
  external
76
77
  virtual
@@ -113,7 +114,7 @@ abstract contract Oracle is
113
114
  $._oracleService = IOracleService(_getServiceAddress(ORACLE()));
114
115
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
115
116
 
116
- registerInterface(type(IOracleComponent).interfaceId);
117
+ _registerInterface(type(IOracleComponent).interfaceId);
117
118
  }
118
119
 
119
120
 
@@ -27,14 +27,16 @@ contract OracleService is
27
27
  bytes memory data
28
28
  )
29
29
  internal
30
- initializer
31
30
  virtual override
31
+ initializer()
32
32
  {
33
- address initialOwner;
34
- address registryAddress;
35
- (registryAddress, initialOwner) = abi.decode(data, (address, address));
36
- initializeService(registryAddress, address(0), owner);
37
- registerInterface(type(IOracleService).interfaceId);
33
+ (
34
+ address registryAddress,
35
+ address authority
36
+ ) = abi.decode(data, (address, address));
37
+
38
+ _initializeService(registryAddress, authority, owner);
39
+ _registerInterface(type(IOracleService).interfaceId);
38
40
  }
39
41
 
40
42
  function request(
@@ -46,6 +48,7 @@ contract OracleService is
46
48
  external
47
49
  virtual
48
50
  // restricted() // add authz
51
+ onlyNftOfType(oracleNftId, ORACLE())
49
52
  returns (
50
53
  RequestId requestId
51
54
  )
@@ -64,35 +67,40 @@ contract OracleService is
64
67
  ORACLE(),
65
68
  true); // only active
66
69
 
67
- // check that requester and oracle share same instance
68
- if (componentInfo.parentNftId != oracleInfo.parentNftId) {
69
- revert ErrorOracleServiceInstanceMismatch(componentInfo.parentNftId, oracleInfo.parentNftId);
70
- }
70
+ {
71
+ // TODO move to stronger validation, requester and oracle need to belong to same product cluster
72
+ // check that requester and oracle share same instance
73
+ if (componentInfo.parentNftId != oracleInfo.parentNftId) {
74
+ revert ErrorOracleServiceInstanceMismatch(componentInfo.parentNftId, oracleInfo.parentNftId);
75
+ }
71
76
 
72
- // check expiriyAt >= now
73
- if (expiryAt < TimestampLib.blockTimestamp()) {
74
- revert ErrorOracleServiceExpiryInThePast(TimestampLib.blockTimestamp(), expiryAt);
75
- }
77
+ // check expiriyAt >= now
78
+ if (expiryAt < TimestampLib.blockTimestamp()) {
79
+ revert ErrorOracleServiceExpiryInThePast(TimestampLib.blockTimestamp(), expiryAt);
80
+ }
76
81
 
77
- // check callbackMethodName.length > 0
78
- if (bytes(callbackMethodName).length == 0) {
79
- revert ErrorOracleServiceCallbackMethodNameEmpty();
82
+ // check callbackMethodName.length > 0
83
+ if (bytes(callbackMethodName).length == 0) {
84
+ revert ErrorOracleServiceCallbackMethodNameEmpty();
85
+ }
80
86
  }
81
87
 
82
- // create request info
83
- IOracle.RequestInfo memory request = IOracle.RequestInfo({
84
- requesterNftId: componentNftId,
85
- callbackMethodName: callbackMethodName,
86
- oracleNftId: oracleNftId,
87
- requestData: requestData,
88
- responseData: "",
89
- respondedAt: TimestampLib.zero(),
90
- expiredAt: expiryAt,
91
- isCancelled: false
92
- });
93
-
94
- // store request with instance
95
- requestId = instance.getInstanceStore().createRequest(request);
88
+ {
89
+ // create request info
90
+ IOracle.RequestInfo memory request = IOracle.RequestInfo({
91
+ requesterNftId: componentNftId,
92
+ callbackMethodName: callbackMethodName,
93
+ oracleNftId: oracleNftId,
94
+ requestData: requestData,
95
+ responseData: "",
96
+ respondedAt: TimestampLib.zero(),
97
+ expiredAt: expiryAt,
98
+ isCancelled: false
99
+ });
100
+
101
+ // store request with instance
102
+ requestId = instance.getInstanceStore().createRequest(request);
103
+ }
96
104
 
97
105
  // call oracle component
98
106
  IOracleComponent(oracleInfo.objectAddress).request(
@@ -214,7 +222,7 @@ contract OracleService is
214
222
 
215
223
  // call oracle component
216
224
  // TODO add check that oracle is active?
217
- address oracleAddress = getRegistry().getObjectInfo(request.oracleNftId).objectAddress;
225
+ address oracleAddress = getRegistry().getObjectAddress(request.oracleNftId);
218
226
  IOracleComponent(oracleAddress).cancel(requestId);
219
227
 
220
228
  emit LogOracleServiceRequestCancelled(requestId, requesterNftId);
@@ -267,7 +275,7 @@ contract OracleService is
267
275
  returns(IInstance instance)
268
276
  {
269
277
  NftId instanceNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
270
- address instanceAddress = getRegistry().getObjectInfo(instanceNftId).objectAddress;
278
+ address instanceAddress = getRegistry().getObjectAddress(instanceNftId);
271
279
  return IInstance(instanceAddress);
272
280
  }
273
281
 
@@ -12,15 +12,15 @@ contract OracleServiceManager is ProxyManager {
12
12
  /// @dev initializes proxy manager with service implementation and deploys instance
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
- OracleService orclSrv = new OracleService{salt: salt}();
21
- bytes memory data = abi.encode(registryAddress, address(this), authority);
22
- IVersionable versionable = deployDetermenistic(
23
- address(orclSrv),
19
+ OracleService svc = new OracleService{salt: salt}();
20
+ bytes memory data = abi.encode(registry, authority);
21
+ IVersionable versionable = initialize(
22
+ registry,
23
+ address(svc),
24
24
  data,
25
25
  salt);
26
26