@etherisc/gif-next 0.0.2-7edde36-170 → 0.0.2-7ee1666-376

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