@etherisc/gif-next 0.0.2-abde86b-349 → 0.0.2-acc7efa-771

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 (398) hide show
  1. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +96 -37
  3. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  4. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  5. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +67 -11
  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 +60 -13
  9. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +40 -3
  11. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
  13. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
  14. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +1196 -0
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
  17. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +154 -94
  19. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +77 -17
  21. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  22. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +94 -58
  23. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +120 -86
  25. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +72 -60
  27. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +81 -58
  29. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +29 -0
  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 +1501 -0
  35. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  36. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +470 -0
  37. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  38. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2042 -0
  39. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  40. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -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 +1 -1
  44. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +156 -96
  45. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  46. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +137 -77
  47. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  48. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +213 -135
  49. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +518 -171
  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 +53 -31
  55. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  56. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +29 -84
  57. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  58. package/artifacts/contracts/instance/Instance.sol/Instance.json +62 -40
  59. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  60. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +148 -118
  61. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  62. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +57 -97
  63. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  64. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +113 -130
  65. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  66. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +72 -130
  67. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  68. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +48 -40
  69. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  70. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +174 -103
  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 +46 -5
  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 +135 -75
  89. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  90. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +77 -17
  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 +76 -53
  94. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  95. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +43 -9
  96. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  97. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +89 -53
  98. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  99. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +86 -47
  100. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +48 -36
  102. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  103. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +89 -71
  104. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +82 -22
  106. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  107. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +180 -82
  108. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  109. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +90 -58
  110. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  111. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +53 -0
  112. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  113. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +76 -58
  114. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  115. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +136 -120
  116. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  117. package/artifacts/contracts/pool/Pool.sol/Pool.json +89 -58
  118. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +209 -180
  120. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +63 -47
  122. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  123. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +66 -32
  124. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  125. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +45 -33
  126. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  127. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +134 -54
  128. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  129. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +77 -17
  130. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  131. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +167 -82
  132. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +82 -58
  134. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  135. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +29 -0
  136. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  137. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +56 -0
  138. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  139. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +58 -0
  140. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  141. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +80 -51
  142. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  143. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +121 -54
  144. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +29 -0
  146. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  147. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +139 -60
  148. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  149. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +67 -47
  150. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  151. package/artifacts/contracts/product/PricingService.sol/PricingService.json +149 -107
  152. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  153. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +61 -45
  154. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  155. package/artifacts/contracts/product/Product.sol/Product.json +134 -54
  156. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  157. package/artifacts/contracts/product/RiskService.sol/RiskService.json +60 -26
  158. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +42 -30
  160. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  161. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  162. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  163. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +48 -15
  164. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +114 -35
  166. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  167. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
  168. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  169. package/artifacts/contracts/registry/Registry.sol/Registry.json +92 -51
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  171. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +193 -165
  172. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +145 -61
  174. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +41 -29
  176. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  177. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
  178. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  179. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +121 -223
  180. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
  182. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  183. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  184. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  185. package/artifacts/contracts/shared/Component.sol/Component.json +68 -28
  186. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  187. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +350 -155
  188. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +83 -63
  190. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +42 -0
  192. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +2 -2
  194. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  195. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +55 -28
  196. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  197. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +321 -19
  198. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +76 -53
  200. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
  202. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  203. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
  204. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  205. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
  206. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  208. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +29 -0
  209. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  210. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  211. package/artifacts/contracts/shared/IService.sol/IService.json +29 -0
  212. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  213. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  214. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +89 -53
  215. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  216. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
  217. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  218. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -1
  219. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  220. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  221. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  222. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +18 -2
  223. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  224. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  225. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  226. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +66 -8
  227. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  228. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  229. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  230. package/artifacts/contracts/shared/Service.sol/Service.json +42 -0
  231. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  232. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  233. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  234. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  235. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  236. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +55 -28
  237. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  238. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +29 -21
  239. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  240. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
  241. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  242. package/artifacts/contracts/staking/Staking.sol/Staking.json +138 -78
  243. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  244. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
  245. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  246. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +68 -42
  247. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  248. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +7 -12
  249. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  250. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +66 -53
  251. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  252. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +45 -33
  253. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  254. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +144 -103
  255. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  256. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
  257. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  258. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/Amount.sol/AmountLib.json +32 -8
  260. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  262. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  263. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  264. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  265. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  266. package/artifacts/contracts/type/Fee.sol/FeeLib.json +2 -2
  267. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  268. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  269. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  271. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  272. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  273. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +2 -2
  275. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  276. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  277. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  279. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  281. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
  283. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  285. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
  290. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  291. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  292. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  294. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  295. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  296. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  297. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  298. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +28 -12
  299. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  300. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  301. package/contracts/authorization/AccessAdmin.sol +65 -61
  302. package/contracts/authorization/Authorization.sol +106 -38
  303. package/contracts/authorization/IAccess.sol +1 -0
  304. package/contracts/authorization/IAccessAdmin.sol +4 -2
  305. package/contracts/authorization/IAuthorization.sol +13 -7
  306. package/contracts/authorization/IServiceAuthorization.sol +3 -1
  307. package/contracts/authorization/ReleaseAccessManager.sol +38 -0
  308. package/contracts/authorization/ServiceAuthorization.sol +26 -10
  309. package/contracts/distribution/BasicDistribution.sol +2 -1
  310. package/contracts/distribution/Distribution.sol +6 -16
  311. package/contracts/distribution/DistributionService.sol +52 -34
  312. package/contracts/distribution/IDistributionComponent.sol +1 -1
  313. package/contracts/examples/fire/DamageLevel.sol +59 -0
  314. package/contracts/examples/fire/FirePool.sol +87 -0
  315. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  316. package/contracts/examples/fire/FireProduct.sol +428 -0
  317. package/contracts/examples/fire/FireProductAuthorization.sol +44 -0
  318. package/contracts/examples/fire/FireUSD.sol +26 -0
  319. package/contracts/examples/unpermissioned/SimpleDistribution.sol +4 -4
  320. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -4
  321. package/contracts/examples/unpermissioned/SimplePool.sol +11 -6
  322. package/contracts/examples/unpermissioned/SimpleProduct.sol +17 -23
  323. package/contracts/instance/IInstance.sol +4 -1
  324. package/contracts/instance/IInstanceService.sol +0 -20
  325. package/contracts/instance/Instance.sol +20 -17
  326. package/contracts/instance/InstanceAdmin.sol +16 -27
  327. package/contracts/instance/InstanceAuthorizationV3.sol +9 -19
  328. package/contracts/instance/InstanceReader.sol +9 -33
  329. package/contracts/instance/InstanceService.sol +13 -68
  330. package/contracts/instance/module/IComponents.sol +7 -4
  331. package/contracts/oracle/BasicOracle.sol +0 -1
  332. package/contracts/oracle/IOracleService.sol +2 -1
  333. package/contracts/oracle/Oracle.sol +4 -15
  334. package/contracts/oracle/OracleService.sol +37 -27
  335. package/contracts/pool/BasicPool.sol +18 -28
  336. package/contracts/pool/BasicPoolAuthorization.sol +0 -1
  337. package/contracts/pool/BundleService.sol +24 -1
  338. package/contracts/pool/IBundleService.sol +9 -0
  339. package/contracts/pool/IPoolService.sol +2 -6
  340. package/contracts/pool/Pool.sol +17 -41
  341. package/contracts/pool/PoolService.sol +41 -64
  342. package/contracts/product/BasicProduct.sol +8 -12
  343. package/contracts/product/BasicProductAuthorization.sol +0 -1
  344. package/contracts/product/ClaimService.sol +46 -28
  345. package/contracts/product/IClaimService.sol +2 -1
  346. package/contracts/product/IPolicyService.sol +3 -0
  347. package/contracts/product/IPricingService.sol +9 -9
  348. package/contracts/product/IProductComponent.sol +6 -0
  349. package/contracts/product/PolicyService.sol +50 -13
  350. package/contracts/product/PricingService.sol +4 -7
  351. package/contracts/product/Product.sol +54 -55
  352. package/contracts/registry/ChainNft.sol +6 -9
  353. package/contracts/registry/IRegistry.sol +4 -3
  354. package/contracts/registry/IRegistryService.sol +6 -4
  355. package/contracts/registry/ITransferInterceptor.sol +1 -2
  356. package/contracts/registry/Registry.sol +14 -4
  357. package/contracts/registry/RegistryAdmin.sol +7 -23
  358. package/contracts/registry/RegistryService.sol +37 -55
  359. package/contracts/registry/ReleaseLifecycle.sol +6 -3
  360. package/contracts/registry/ReleaseRegistry.sol +201 -191
  361. package/contracts/registry/ServiceAuthorizationV3.sol +14 -19
  362. package/contracts/shared/Component.sol +25 -28
  363. package/contracts/shared/ComponentService.sol +224 -130
  364. package/contracts/shared/ComponentVerifyingService.sol +22 -12
  365. package/contracts/shared/IComponent.sol +6 -2
  366. package/contracts/shared/IComponentService.sol +25 -13
  367. package/contracts/shared/IInstanceLinkedComponent.sol +3 -11
  368. package/contracts/shared/ILifecycle.sol +3 -1
  369. package/contracts/shared/INftOwnable.sol +2 -0
  370. package/contracts/shared/IRegisterable.sol +11 -0
  371. package/contracts/shared/InstanceLinkedComponent.sol +67 -25
  372. package/contracts/shared/KeyValueStore.sol +1 -1
  373. package/contracts/shared/Lifecycle.sol +15 -4
  374. package/contracts/shared/NftOwnable.sol +19 -3
  375. package/contracts/shared/Registerable.sol +15 -5
  376. package/contracts/shared/Service.sol +4 -7
  377. package/contracts/staking/IStakingService.sol +0 -3
  378. package/contracts/staking/Staking.sol +2 -3
  379. package/contracts/staking/StakingReader.sol +12 -5
  380. package/contracts/staking/StakingService.sol +1 -15
  381. package/contracts/type/Amount.sol +15 -0
  382. package/contracts/type/ClaimId.sol +6 -1
  383. package/contracts/type/NftId.sol +1 -0
  384. package/contracts/type/ObjectType.sol +1 -0
  385. package/contracts/type/RiskId.sol +15 -1
  386. package/contracts/type/RoleId.sol +0 -12
  387. package/contracts/type/StateId.sol +14 -1
  388. package/contracts/upgradeability/ProxyManager.sol +2 -1
  389. package/package.json +2 -1
  390. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +0 -4
  391. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +0 -290
  392. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +0 -4
  393. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +0 -390
  394. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
  395. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
  396. package/contracts/authorization/IModuleAuthorization.sol +0 -21
  397. package/contracts/authorization/ModuleAuthorization.sol +0 -78
  398. package/contracts/shared/InitializableCustom.sol +0 -177
@@ -11,7 +11,7 @@ import {IOracleComponent} from "./IOracleComponent.sol";
11
11
  import {IOracleService} from "./IOracleService.sol";
12
12
  import {IRegistry} from "../registry/IRegistry.sol";
13
13
  import {NftId} from "../type/NftId.sol";
14
- import {ObjectType, COMPONENT, ORACLE, INSTANCE} from "../type/ObjectType.sol";
14
+ import {ObjectType, COMPONENT, ORACLE, PRODUCT} from "../type/ObjectType.sol";
15
15
  import {RequestId} from "../type/RequestId.sol";
16
16
  import {StateId, ACTIVE, KEEP_STATE, FULFILLED, FAILED, CANCELLED} from "../type/StateId.sol";
17
17
  import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
@@ -48,6 +48,7 @@ contract OracleService is
48
48
  external
49
49
  virtual
50
50
  // restricted() // add authz
51
+ onlyNftOfType(oracleNftId, ORACLE())
51
52
  returns (
52
53
  RequestId requestId
53
54
  )
@@ -66,36 +67,45 @@ contract OracleService is
66
67
  ORACLE(),
67
68
  true); // only active
68
69
 
69
- // TODO move to stronger validation, requester and oracle need to belong to same product cluster
70
- // check that requester and oracle share same instance
71
- if (componentInfo.parentNftId != oracleInfo.parentNftId) {
72
- revert ErrorOracleServiceInstanceMismatch(componentInfo.parentNftId, oracleInfo.parentNftId);
73
- }
70
+ {
71
+ // check that requester and oracle share same product cluster
72
+ if (componentInfo.objectType == PRODUCT()) {
73
+ if (oracleInfo.parentNftId != componentInfo.nftId) {
74
+ revert ErrorOracleServiceProductMismatch(componentInfo.objectType, componentInfo.nftId, oracleInfo.parentNftId);
75
+ }
76
+ } else {
77
+ if (oracleInfo.parentNftId != componentInfo.parentNftId) {
78
+ revert ErrorOracleServiceProductMismatch(componentInfo.objectType, componentInfo.parentNftId, oracleInfo.parentNftId);
79
+ }
80
+ }
74
81
 
75
- // check expiriyAt >= now
76
- if (expiryAt < TimestampLib.blockTimestamp()) {
77
- revert ErrorOracleServiceExpiryInThePast(TimestampLib.blockTimestamp(), expiryAt);
78
- }
82
+ // check expiriyAt >= now
83
+ if (expiryAt < TimestampLib.blockTimestamp()) {
84
+ revert ErrorOracleServiceExpiryInThePast(TimestampLib.blockTimestamp(), expiryAt);
85
+ }
79
86
 
80
- // check callbackMethodName.length > 0
81
- if (bytes(callbackMethodName).length == 0) {
82
- revert ErrorOracleServiceCallbackMethodNameEmpty();
87
+ // check callbackMethodName.length > 0
88
+ if (bytes(callbackMethodName).length == 0) {
89
+ revert ErrorOracleServiceCallbackMethodNameEmpty();
90
+ }
83
91
  }
84
92
 
85
- // create request info
86
- IOracle.RequestInfo memory request = IOracle.RequestInfo({
87
- requesterNftId: componentNftId,
88
- callbackMethodName: callbackMethodName,
89
- oracleNftId: oracleNftId,
90
- requestData: requestData,
91
- responseData: "",
92
- respondedAt: TimestampLib.zero(),
93
- expiredAt: expiryAt,
94
- isCancelled: false
95
- });
96
-
97
- // store request with instance
98
- requestId = instance.getInstanceStore().createRequest(request);
93
+ {
94
+ // create request info
95
+ IOracle.RequestInfo memory request = IOracle.RequestInfo({
96
+ requesterNftId: componentNftId,
97
+ callbackMethodName: callbackMethodName,
98
+ oracleNftId: oracleNftId,
99
+ requestData: requestData,
100
+ responseData: "",
101
+ respondedAt: TimestampLib.zero(),
102
+ expiredAt: expiryAt,
103
+ isCancelled: false
104
+ });
105
+
106
+ // store request with instance
107
+ requestId = instance.getInstanceStore().createRequest(request);
108
+ }
99
109
 
100
110
  // call oracle component
101
111
  IOracleComponent(oracleInfo.objectAddress).request(
@@ -1,22 +1,15 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Amount, AmountLib} from "../type/Amount.sol";
5
- import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
6
- import {Fee, FeeLib} from "../type/Fee.sol";
4
+ import {Amount} from "../type/Amount.sol";
5
+ import {Fee} from "../type/Fee.sol";
7
6
  import {IAuthorization} from "../authorization/IAuthorization.sol";
8
- import {IBundleService} from "./IBundleService.sol";
9
- import {IPoolComponent} from "./IPoolComponent.sol";
10
- import {IPoolService} from "./IPoolService.sol";
11
7
  import {IComponents} from "../instance/module/IComponents.sol";
12
- import {IComponentService} from "../shared/IComponentService.sol";
13
- import {NftId, NftIdLib} from "../type/NftId.sol";
14
- import {BUNDLE, COMPONENT, POOL} from "../type/ObjectType.sol";
15
- import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
8
+ import {NftId} from "../type/NftId.sol";
9
+ import {BUNDLE} from "../type/ObjectType.sol";
10
+ import {RoleId} from "../type/RoleId.sol";
16
11
  import {Seconds} from "../type/Seconds.sol";
17
12
  import {Timestamp} from "../type/Timestamp.sol";
18
- import {TokenHandler} from "../shared/TokenHandler.sol";
19
- import {UFixed, UFixedLib} from "../type/UFixed.sol";
20
13
 
21
14
  import {Pool} from "./Pool.sol";
22
15
 
@@ -26,10 +19,11 @@ abstract contract BasicPool is
26
19
 
27
20
  function _initializeBasicPool(
28
21
  address registry,
29
- NftId instanceNftId,
30
- IAuthorization authorization,
31
- address token,
22
+ NftId productNftId,
32
23
  string memory name,
24
+ address token,
25
+ IComponents.PoolInfo memory poolInfo,
26
+ IAuthorization authorization,
33
27
  address initialOwner
34
28
  )
35
29
  internal
@@ -38,13 +32,12 @@ abstract contract BasicPool is
38
32
  {
39
33
  _initializePool(
40
34
  registry,
41
- instanceNftId,
35
+ productNftId,
42
36
  name,
43
37
  token,
38
+ poolInfo,
44
39
  authorization,
45
- false, // isInterceptingNftTransfers,
46
40
  initialOwner,
47
- "", // registryData
48
41
  ""); // componentData
49
42
  }
50
43
 
@@ -56,6 +49,7 @@ abstract contract BasicPool is
56
49
  virtual
57
50
  restricted()
58
51
  onlyBundleOwner(bundleNftId)
52
+ onlyNftOfType(bundleNftId, BUNDLE())
59
53
  {
60
54
  _stake(bundleNftId, amount);
61
55
  }
@@ -69,6 +63,7 @@ abstract contract BasicPool is
69
63
  virtual
70
64
  restricted()
71
65
  onlyBundleOwner(bundleNftId)
66
+ onlyNftOfType(bundleNftId, BUNDLE())
72
67
  {
73
68
  _unstake(bundleNftId, amount);
74
69
  }
@@ -82,6 +77,7 @@ abstract contract BasicPool is
82
77
  virtual
83
78
  restricted()
84
79
  onlyBundleOwner(bundleNftId)
80
+ onlyNftOfType(bundleNftId, BUNDLE())
85
81
  returns(Timestamp newExpiredAt)
86
82
  {
87
83
  return _extend(bundleNftId, lifetimeExtension);
@@ -93,6 +89,7 @@ abstract contract BasicPool is
93
89
  virtual
94
90
  restricted()
95
91
  onlyBundleOwner(bundleNftId)
92
+ onlyNftOfType(bundleNftId, BUNDLE())
96
93
  {
97
94
  _lockBundle(bundleNftId);
98
95
  }
@@ -103,6 +100,7 @@ abstract contract BasicPool is
103
100
  virtual
104
101
  restricted()
105
102
  onlyBundleOwner(bundleNftId)
103
+ onlyNftOfType(bundleNftId, BUNDLE())
106
104
  {
107
105
  _unlockBundle(bundleNftId);
108
106
  }
@@ -113,6 +111,7 @@ abstract contract BasicPool is
113
111
  virtual
114
112
  restricted()
115
113
  onlyBundleOwner(bundleNftId)
114
+ onlyNftOfType(bundleNftId, BUNDLE())
116
115
  {
117
116
  _closeBundle(bundleNftId);
118
117
  }
@@ -126,6 +125,7 @@ abstract contract BasicPool is
126
125
  virtual
127
126
  restricted()
128
127
  onlyBundleOwner(bundleNftId)
128
+ onlyNftOfType(bundleNftId, BUNDLE())
129
129
  {
130
130
  _setBundleFee(bundleNftId, fee);
131
131
  }
@@ -141,16 +141,6 @@ abstract contract BasicPool is
141
141
  }
142
142
 
143
143
 
144
- function setBundleOwnerRole(RoleId bundleOwnerRole)
145
- public
146
- virtual
147
- restricted()
148
- onlyOwner()
149
- {
150
- _setBundleOwnerRole(bundleOwnerRole);
151
- }
152
-
153
-
154
144
  function setFees(
155
145
  Fee memory poolFee,
156
146
  Fee memory stakingFee,
@@ -44,7 +44,6 @@ contract BasicPoolAuthorization
44
44
  _authorize(functions, BasicPool.setBundleFee.selector, "setBundleFee");
45
45
 
46
46
  _authorize(functions, BasicPool.setMaxBalanceAmount.selector, "setMaxBalanceAmount");
47
- _authorize(functions, BasicPool.setBundleOwnerRole.selector, "setBundleOwnerRole");
48
47
  _authorize(functions, BasicPool.setFees.selector, "setFees");
49
48
  _authorize(functions, BasicPool.stake.selector, "stake");
50
49
  _authorize(functions, BasicPool.unstake.selector, "unstake");
@@ -367,7 +367,7 @@ contract BundleService is
367
367
  restricted
368
368
  {
369
369
  // ensure policy is closeable
370
- if (!instance.getInstanceReader().policyIsCloseable(policyNftId)) {
370
+ if (!policyIsCloseable(instance, policyNftId)) {
371
371
  revert ErrorBundleServicePolicyNotCloseable(policyNftId);
372
372
  }
373
373
 
@@ -416,6 +416,29 @@ contract BundleService is
416
416
  }
417
417
  }
418
418
 
419
+ /// @inheritdoc IBundleService
420
+ function policyIsCloseable(IInstance instance, NftId policyNftId)
421
+ public
422
+ view
423
+ returns (bool isCloseable)
424
+ {
425
+ IPolicy.PolicyInfo memory info = instance.getInstanceReader().getPolicyInfo(policyNftId);
426
+
427
+ if (info.productNftId.eqz()) { return false; } // not closeable: policy does not exist (or does not belong to this instance)
428
+ if (info.activatedAt.eqz()) { return false; } // not closeable: not yet activated
429
+ if (info.closedAt.gtz()) { return false; } // not closeable: already closed
430
+ if (info.openClaimsCount > 0) { return false; } // not closeable: has open claims
431
+
432
+ // closeable: if sum of claims matches sum insured a policy may be closed prior to the expiry date
433
+ if (info.claimAmount == info.sumInsuredAmount) { return true; }
434
+
435
+ // not closeable: not yet expired
436
+ if (TimestampLib.blockTimestamp() < info.expiredAt) { return false; }
437
+
438
+ // all conditionsl to close the policy are met
439
+ return true;
440
+ }
441
+
419
442
  /// @dev links policy to bundle
420
443
  function _linkPolicy(IInstance instance, NftId policyNftId)
421
444
  internal
@@ -131,4 +131,13 @@ interface IBundleService is IService {
131
131
  /// @return withdrawnAmount the effective withdrawn amount
132
132
  function withdrawBundleFees(NftId bundleNftId, Amount amount) external returns (Amount withdrawnAmount);
133
133
 
134
+ /// @dev returns true iff policy may be closed
135
+ /// a policy can be closed all conditions below are met
136
+ /// - policy exists
137
+ /// - has been activated
138
+ /// - is not yet closed
139
+ /// - has no open claims
140
+ /// - claim amount matches sum insured amount or is expired
141
+ function policyIsCloseable(IInstance instance, NftId policyNftId) external view returns (bool isCloseable);
142
+
134
143
  }
@@ -34,10 +34,6 @@ interface IPoolService is IService {
34
34
  error ErrorPoolServiceInvalidTransferAmount(Amount expectedAmount, Amount actualAmount);
35
35
  error ErrorPoolServiceBundlePoolMismatch(NftId bundleNftId, NftId poolNftId);
36
36
  error ErrorPoolServiceMaxBalanceAmountExceeded(NftId poolNftId, Amount maxBalanceAmount, Amount currentBalanceAmount, Amount transferAmount);
37
-
38
- /// @dev defines the required role for bundle owners for the calling pool
39
- /// default implementation returns PUBLIC ROLE
40
- function setBundleOwnerRole(RoleId bundleOwnerRole) external;
41
37
 
42
38
  /// @dev sets the max balance amount for the calling pool
43
39
  function setMaxBalanceAmount(Amount maxBalanceAmount) external;
@@ -72,10 +68,10 @@ interface IPoolService is IService {
72
68
  ) external;
73
69
 
74
70
 
75
- /// @dev reduces the locked collateral in the bundle associated with the specified policy
71
+ /// @dev reduces the locked collateral in the bundle associated with the specified policy and updates pool/bundle counters
76
72
  /// every payout of a policy reduces the collateral by the payout amount
77
73
  /// may only be called by the claim service for unlocked pool components
78
- function reduceCollateral(
74
+ function processPayout(
79
75
  IInstance instance,
80
76
  address token,
81
77
  NftId policyNftId,
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {Amount, AmountLib} from "../type/Amount.sol";
5
- import {BUNDLE, COMPONENT, POOL} from "../type/ObjectType.sol";
5
+ import {BUNDLE, COMPONENT, POLICY, POOL} from "../type/ObjectType.sol";
6
6
  import {ClaimId} from "../type/ClaimId.sol";
7
7
  import {IBundleService} from "./IBundleService.sol";
8
8
  import {IAuthorization} from "../authorization/IAuthorization.sol";
@@ -11,13 +11,12 @@ import {IPoolService} from "./IPoolService.sol";
11
11
  import {IComponents} from "../instance/module/IComponents.sol";
12
12
  import {IComponentService} from "../shared/IComponentService.sol";
13
13
  import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
14
- import {Fee, FeeLib} from "../type/Fee.sol";
15
- import {NftId, NftIdLib} from "../type/NftId.sol";
14
+ import {Fee} from "../type/Fee.sol";
15
+ import {NftId} from "../type/NftId.sol";
16
16
  import {RoleId, PUBLIC_ROLE} from "../type/RoleId.sol";
17
17
  import {Seconds} from "../type/Seconds.sol";
18
18
  import {Timestamp} from "../type/Timestamp.sol";
19
- import {TokenHandler} from "../shared/TokenHandler.sol";
20
- import {UFixed, UFixedLib} from "../type/UFixed.sol";
19
+ import {UFixed} from "../type/UFixed.sol";
21
20
 
22
21
  abstract contract Pool is
23
22
  InstanceLinkedComponent,
@@ -27,6 +26,7 @@ abstract contract Pool is
27
26
  bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
28
27
 
29
28
  struct PoolStorage {
29
+ IComponents.PoolInfo _poolInfo;
30
30
  IComponentService _componentService;
31
31
  IPoolService _poolService;
32
32
  IBundleService _bundleService;
@@ -41,16 +41,6 @@ abstract contract Pool is
41
41
  }
42
42
 
43
43
 
44
- function register()
45
- external
46
- virtual
47
- onlyOwner()
48
- {
49
- _getPoolStorage()._componentService.registerPool();
50
- _approveTokenHandler(type(uint256).max);
51
- }
52
-
53
-
54
44
  /// @dev see {IPoolComponent.verifyApplication}
55
45
  function verifyApplication(
56
46
  NftId applicationNftId,
@@ -62,6 +52,7 @@ abstract contract Pool is
62
52
  public
63
53
  virtual
64
54
  restricted()
55
+ onlyNftOfType(applicationNftId, POLICY())
65
56
  {
66
57
  if(!applicationMatchesBundle(
67
58
  applicationNftId,
@@ -87,6 +78,7 @@ abstract contract Pool is
87
78
  public
88
79
  virtual
89
80
  restricted()
81
+ onlyNftOfType(policyNftId, POLICY())
90
82
  {
91
83
  // default implementation is empty
92
84
  }
@@ -105,6 +97,8 @@ abstract contract Pool is
105
97
  public
106
98
  virtual
107
99
  view
100
+ onlyNftOfType(applicationNftId, POLICY())
101
+ onlyNftOfType(bundleNftId, BUNDLE())
108
102
  returns (bool isMatching)
109
103
  {
110
104
  return true;
@@ -116,6 +110,7 @@ abstract contract Pool is
116
110
  virtual
117
111
  restricted()
118
112
  onlyBundleOwner(bundleNftId)
113
+ onlyNftOfType(bundleNftId, BUNDLE())
119
114
  returns (Amount withdrawnAmount)
120
115
  {
121
116
  return _withdrawBundleFees(bundleNftId, amount);
@@ -128,29 +123,19 @@ abstract contract Pool is
128
123
  view
129
124
  returns (IComponents.PoolInfo memory poolInfo)
130
125
  {
131
- return IComponents.PoolInfo({
132
- maxBalanceAmount: AmountLib.max(),
133
- bundleOwnerRole: PUBLIC_ROLE(),
134
- isInterceptingBundleTransfers: isNftInterceptor(),
135
- isProcessingConfirmedClaims: false,
136
- isExternallyManaged: false,
137
- isVerifyingApplications: false,
138
- collateralizationLevel: UFixedLib.toUFixed(1),
139
- retentionLevel: UFixedLib.toUFixed(1)
140
- });
126
+ return _getPoolStorage()._poolInfo;
141
127
  }
142
128
 
143
129
  // Internals
144
130
 
145
131
  function _initializePool(
146
132
  address registry,
147
- NftId instanceNftId,
133
+ NftId productNftId,
148
134
  string memory name,
149
135
  address token,
136
+ IComponents.PoolInfo memory poolInfo,
150
137
  IAuthorization authorization,
151
- bool isInterceptingNftTransfers,
152
138
  address initialOwner,
153
- bytes memory registryData, // writeonly data that will saved in the object info record of the registry
154
139
  bytes memory componentData // component specifidc data
155
140
  )
156
141
  internal
@@ -159,17 +144,18 @@ abstract contract Pool is
159
144
  {
160
145
  _initializeInstanceLinkedComponent(
161
146
  registry,
162
- instanceNftId,
147
+ productNftId,
163
148
  name,
164
149
  token,
165
150
  POOL(),
166
151
  authorization,
167
- isInterceptingNftTransfers,
152
+ poolInfo.isInterceptingBundleTransfers,
168
153
  initialOwner,
169
- registryData,
170
154
  componentData);
171
155
 
172
156
  PoolStorage storage $ = _getPoolStorage();
157
+
158
+ $._poolInfo = poolInfo;
173
159
  $._poolService = IPoolService(_getServiceAddress(POOL()));
174
160
  $._bundleService = IBundleService(_getServiceAddress(BUNDLE()));
175
161
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
@@ -276,16 +262,6 @@ abstract contract Pool is
276
262
  _getPoolStorage()._poolService.setMaxBalanceAmount(maxBalanceAmount);
277
263
  }
278
264
 
279
- /// @dev Sets the required role to create/own bundles.
280
- /// May only be called once after setting up a pool.
281
- /// May only be called by pool owner.
282
- function _setBundleOwnerRole(RoleId bundleOwnerRole)
283
- internal
284
- virtual
285
- {
286
- _getPoolStorage()._poolService.setBundleOwnerRole(bundleOwnerRole);
287
- }
288
-
289
265
 
290
266
  /// @dev Update pool fees to the specified values.
291
267
  /// Pool fee: are deducted from the premium amount and goes to the pool owner.
@@ -36,9 +36,6 @@ contract PoolService is
36
36
  {
37
37
  IBundleService internal _bundleService;
38
38
  IComponentService internal _componentService;
39
- IInstanceService private _instanceService;
40
- IRegistryService private _registryService;
41
-
42
39
  IStaking private _staking;
43
40
 
44
41
  function _initialize(
@@ -56,11 +53,8 @@ contract PoolService is
56
53
 
57
54
  _initializeService(registryAddress, authority, owner);
58
55
 
59
- _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
60
56
  _bundleService = IBundleService(_getServiceAddress(BUNDLE()));
61
- _instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
62
57
  _componentService = IComponentService(_getServiceAddress(COMPONENT()));
63
-
64
58
  _staking = IStaking(getRegistry().getStakingAddress());
65
59
 
66
60
  _registerInterface(type(IPoolService).interfaceId);
@@ -84,28 +78,6 @@ contract PoolService is
84
78
  }
85
79
 
86
80
 
87
- function setBundleOwnerRole(RoleId bundleOwnerRole)
88
- external
89
- virtual
90
- {
91
- (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
92
- InstanceReader instanceReader = instance.getInstanceReader();
93
-
94
- IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
95
- IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
96
-
97
- // bundle owner role may only be set once per pool
98
- if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
99
- revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
100
- }
101
-
102
- poolInfo.bundleOwnerRole = bundleOwnerRole;
103
- instance.getInstanceStore().updatePool(poolNftId, poolInfo, KEEP_STATE());
104
-
105
- emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
106
- }
107
-
108
-
109
81
  /// @inheritdoc IPoolService
110
82
  function createBundle(
111
83
  address bundleOwner, // initial bundle owner
@@ -133,17 +105,6 @@ contract PoolService is
133
105
  }
134
106
 
135
107
 
136
- function _getStakingFee(InstanceReader instanceReader, NftId poolNftId)
137
- internal
138
- virtual
139
- view
140
- returns (Fee memory stakingFee)
141
- {
142
- NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
143
- return instanceReader.getProductInfo(productNftId).stakingFee;
144
- }
145
-
146
-
147
108
  function closeBundle(NftId bundleNftId)
148
109
  external
149
110
  virtual
@@ -184,7 +145,7 @@ contract PoolService is
184
145
  {
185
146
  (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
186
147
  InstanceReader instanceReader = instance.getInstanceReader();
187
- NftId productNftId = instanceReader.getComponentInfo(poolNftId).productNftId;
148
+ NftId productNftId = _getProductNftId(poolNftId);
188
149
 
189
150
  // check policy matches with calling pool
190
151
  IPolicy.PolicyInfo memory policyInfo = instanceReader.getPolicyInfo(policyNftId);
@@ -210,6 +171,7 @@ contract PoolService is
210
171
  external
211
172
  virtual
212
173
  // TODO: restricted() (once #462 is done)
174
+ onlyNftOfType(bundleNftId, BUNDLE())
213
175
  returns(Amount netAmount)
214
176
  {
215
177
  (NftId poolNftId,, IInstance instance) = _getAndVerifyActiveComponent(POOL());
@@ -228,15 +190,20 @@ contract PoolService is
228
190
  }
229
191
  }
230
192
 
231
-
232
193
  // calculate fees
194
+ IRegistry registry = getRegistry();
233
195
  Amount feeAmount;
234
- (
235
- feeAmount,
236
- netAmount
237
- ) = FeeLib.calculateFee(
238
- _getStakingFee(instanceReader, poolNftId),
239
- amount);
196
+
197
+ {
198
+ NftId productNftId = registry.getObjectInfo(poolNftId).parentNftId;
199
+ Fee memory stakingFee = instanceReader.getProductInfo(productNftId).stakingFee;
200
+ (
201
+ feeAmount,
202
+ netAmount
203
+ ) = FeeLib.calculateFee(
204
+ stakingFee,
205
+ amount);
206
+ }
240
207
 
241
208
  // do all the bookkeeping
242
209
  _componentService.increasePoolBalance(
@@ -248,7 +215,7 @@ contract PoolService is
248
215
  _bundleService.stake(instance, bundleNftId, netAmount);
249
216
 
250
217
  // collect tokens from bundle owner
251
- address bundleOwner = getRegistry().ownerOf(bundleNftId);
218
+ address bundleOwner = registry.ownerOf(bundleNftId);
252
219
  emit LogPoolServiceBundleStaked(instance.getNftId(), poolNftId, bundleNftId, amount, netAmount);
253
220
 
254
221
  // TODO only collect staking token when pool is not externally managed
@@ -291,14 +258,15 @@ contract PoolService is
291
258
  AmountLib.zero());
292
259
 
293
260
  IComponents.ComponentInfo memory poolComponentInfo = instanceReader.getComponentInfo(poolNftId);
294
- address poolWallet = poolComponentInfo.wallet;
261
+
295
262
  // transfer amount to bundle owner
296
263
  address owner = getRegistry().ownerOf(bundleNftId);
297
264
  emit LogPoolServiceBundleUnstaked(instance.getNftId(), poolNftId, bundleNftId, unstakedAmount);
298
265
  poolComponentInfo.tokenHandler.distributeTokens(
299
- poolWallet,
266
+ poolComponentInfo.wallet,
300
267
  owner,
301
268
  unstakedAmount);
269
+
302
270
  return unstakedAmount;
303
271
  }
304
272
 
@@ -329,12 +297,12 @@ contract PoolService is
329
297
  external
330
298
  virtual
331
299
  restricted()
300
+ onlyNftOfType(bundleNftId, BUNDLE())
332
301
  {
333
302
  IRegistry registry = getRegistry();
334
- IRegistry.ObjectInfo memory bundleObjectInfo = registry.getObjectInfo(bundleNftId);
335
- IRegistry.ObjectInfo memory poolObjectInfo = registry.getObjectInfo(bundleObjectInfo.parentNftId);
336
- IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
337
- IInstance instance = IInstance(instanceObjectInfo.objectAddress);
303
+ IRegistry.ObjectInfo memory bundleInfo = registry.getObjectInfo(bundleNftId);
304
+ IRegistry.ObjectInfo memory poolInfo = registry.getObjectInfo(bundleInfo.parentNftId);
305
+ IInstance instance = _getInstanceForComponent(registry, poolInfo);
338
306
 
339
307
  Amount poolFeeAmount = premium.poolFeeFixAmount + premium.poolFeeVarAmount;
340
308
  Amount bundleFeeAmount = premium.bundleFeeFixAmount + premium.bundleFeeVarAmount;
@@ -343,13 +311,13 @@ contract PoolService is
343
311
  InstanceStore instanceStore = instance.getInstanceStore();
344
312
  _componentService.increasePoolBalance(
345
313
  instanceStore,
346
- poolObjectInfo.nftId,
314
+ poolInfo.nftId,
347
315
  bundleNetAmount + bundleFeeAmount,
348
316
  poolFeeAmount);
349
317
 
350
318
  _componentService.increaseBundleBalance(
351
319
  instanceStore,
352
- bundleObjectInfo.nftId,
320
+ bundleInfo.nftId,
353
321
  bundleNetAmount,
354
322
  bundleFeeAmount);
355
323
  }
@@ -391,16 +359,9 @@ contract PoolService is
391
359
  instance.getNftId(),
392
360
  token,
393
361
  totalCollateralAmount);
394
-
395
- // hierarhical riskpool setup
396
- // TODO loop in with pool component to guarantee availability of external capital
397
- if(totalCollateralAmount > localCollateralAmount) {
398
-
399
- }
400
362
  }
401
363
 
402
-
403
- function reduceCollateral(
364
+ function processPayout(
404
365
  IInstance instance,
405
366
  address token,
406
367
  NftId policyNftId,
@@ -411,6 +372,22 @@ contract PoolService is
411
372
  virtual
412
373
  restricted()
413
374
  {
375
+ NftId bundleNftId = policyInfo.bundleNftId;
376
+ NftId poolNftId = getRegistry().getObjectInfo(bundleNftId).parentNftId;
377
+ InstanceStore instanceStore = instance.getInstanceStore();
378
+
379
+ _componentService.decreasePoolBalance(
380
+ instanceStore,
381
+ poolNftId,
382
+ payoutAmount,
383
+ AmountLib.zero());
384
+
385
+ _componentService.decreaseBundleBalance(
386
+ instanceStore,
387
+ bundleNftId,
388
+ payoutAmount,
389
+ AmountLib.zero());
390
+
414
391
  _bundleService.releaseCollateral(
415
392
  instance,
416
393
  policyNftId,