@etherisc/gif-next 0.0.2-8bdd2eb-413 → 0.0.2-8c1d8cd-727

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 (528) hide show
  1. package/README.md +49 -4
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
  3. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1293 -0
  4. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
  5. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1206 -0
  6. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
  7. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +414 -0
  8. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
  9. package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
  10. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
  11. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1060 -0
  12. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
  13. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +295 -0
  14. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
  15. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +167 -0
  16. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
  17. package/artifacts/contracts/{shared/AccessManagerCustom.sol/AccessManagerCustom.json → authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json} +28 -25
  18. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
  19. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +253 -0
  20. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
  21. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1402 -0
  22. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
  23. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +470 -0
  24. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +133 -501
  26. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +319 -229
  28. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +115 -103
  30. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +164 -210
  32. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +194 -47
  34. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
  35. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
  36. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
  37. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1538 -0
  38. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  39. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +470 -0
  40. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  41. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2077 -0
  42. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  43. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -0
  44. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  45. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  46. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  47. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1471 -0
  48. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  49. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1231 -0
  50. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  51. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1592 -0
  52. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  53. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2095 -0
  54. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
  55. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +703 -0
  56. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  57. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +105 -103
  58. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  59. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +163 -111
  60. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  61. package/artifacts/contracts/instance/Instance.sol/Instance.json +108 -243
  62. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  63. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1210 -265
  64. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
  65. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +561 -0
  66. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  67. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +682 -189
  68. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +210 -268
  70. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +83 -95
  72. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +502 -282
  74. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  75. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  76. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  77. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +0 -53
  78. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
  79. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
  80. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
  81. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +223 -0
  82. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
  83. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
  84. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  85. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  86. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  87. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  88. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  89. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  90. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  91. package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
  92. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
  93. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +1039 -0
  94. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
  95. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +478 -0
  96. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
  97. package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +52 -0
  98. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
  99. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +788 -0
  100. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
  101. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +709 -0
  102. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
  103. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +907 -0
  104. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
  105. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +966 -0
  106. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
  107. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +722 -0
  108. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
  109. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1299 -0
  110. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
  111. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +470 -0
  112. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  113. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +517 -157
  114. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +176 -88
  116. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  117. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +271 -1
  118. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  119. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +125 -319
  120. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +410 -192
  122. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  123. package/artifacts/contracts/pool/Pool.sol/Pool.json +165 -632
  124. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  125. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +524 -331
  126. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  127. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +111 -83
  128. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  129. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +95 -158
  130. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  131. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +79 -91
  132. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
  133. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1173 -0
  134. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
  135. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +470 -0
  136. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  137. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +322 -169
  138. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  139. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +126 -98
  140. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  141. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +47 -0
  142. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  143. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +189 -6
  144. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +336 -118
  146. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  147. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +127 -85
  148. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  149. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +154 -137
  150. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  151. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +44 -2
  152. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  153. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +451 -295
  154. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  155. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +123 -95
  156. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  157. package/artifacts/contracts/product/PricingService.sol/PricingService.json +207 -283
  158. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  159. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +96 -112
  160. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  161. package/artifacts/contracts/product/Product.sol/Product.json +168 -434
  162. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  163. package/artifacts/contracts/product/RiskService.sol/RiskService.json +622 -0
  164. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  165. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +694 -0
  166. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  167. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  168. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  169. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +311 -55
  170. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  171. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +55 -146
  172. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  173. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
  174. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  175. package/artifacts/contracts/registry/Registry.sol/Registry.json +537 -112
  176. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  177. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1640 -161
  178. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  179. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +96 -265
  180. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  181. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +74 -70
  182. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
  183. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +205 -0
  184. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
  185. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1067 -0
  186. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
  187. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +272 -0
  188. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  189. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
  190. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  191. package/artifacts/contracts/shared/Component.sol/Component.json +65 -236
  192. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +532 -239
  194. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  195. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +136 -110
  196. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  197. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +51 -103
  198. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  199. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
  200. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +55 -54
  202. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  203. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +487 -12
  204. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  205. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +98 -80
  206. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +45 -3
  208. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  209. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +34 -3
  210. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  211. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
  212. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  213. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
  214. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  215. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +29 -0
  216. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  217. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  218. package/artifacts/contracts/shared/IService.sol/IService.json +42 -0
  219. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
  220. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
  221. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  222. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +111 -318
  223. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  224. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +55 -88
  225. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  226. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -62
  227. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
  228. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
  229. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  230. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
  231. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  232. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
  233. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  234. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +58 -89
  235. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  236. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  237. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  238. package/artifacts/contracts/shared/Service.sol/Service.json +51 -103
  239. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  240. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +330 -11
  241. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
  242. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
  243. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  244. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +82 -55
  245. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  246. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +78 -28
  247. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  248. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +97 -101
  249. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  250. package/artifacts/contracts/staking/Staking.sol/Staking.json +168 -325
  251. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
  252. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +205 -0
  253. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  254. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +103 -104
  255. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  256. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +7 -12
  257. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  258. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +123 -198
  259. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  260. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +76 -92
  261. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  262. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +241 -147
  263. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  264. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +59 -23
  265. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  266. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
  267. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/Amount.sol/AmountLib.json +61 -8
  269. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
  271. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  273. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +4 -4
  275. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  276. package/artifacts/contracts/type/Fee.sol/FeeLib.json +17 -12
  277. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  279. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +4 -4
  281. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  282. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  283. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +149 -2
  285. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  287. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
  289. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
  290. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
  291. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  292. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +60 -4
  293. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  294. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +219 -6
  295. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
  297. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
  298. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
  299. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
  300. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
  301. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  302. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
  303. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
  304. package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
  305. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  306. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +36 -4
  307. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  308. package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
  309. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  310. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +71 -2
  311. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  312. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  313. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  314. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +21 -2
  315. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
  316. package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
  317. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  318. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +602 -0
  319. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  320. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
  321. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
  322. package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
  323. package/contracts/authorization/AccessAdmin.sol +596 -0
  324. package/contracts/authorization/AccessManagerCloneable.sol +16 -0
  325. package/contracts/authorization/Authorization.sol +289 -0
  326. package/contracts/authorization/IAccess.sol +49 -0
  327. package/contracts/authorization/IAccessAdmin.sol +137 -0
  328. package/contracts/authorization/IAuthorization.sol +60 -0
  329. package/contracts/authorization/IServiceAuthorization.sol +40 -0
  330. package/contracts/authorization/ReleaseAccessManager.sol +38 -0
  331. package/contracts/authorization/ServiceAuthorization.sol +106 -0
  332. package/contracts/distribution/BasicDistribution.sol +139 -0
  333. package/contracts/distribution/BasicDistributionAuthorization.sol +47 -0
  334. package/contracts/distribution/Distribution.sol +140 -116
  335. package/contracts/distribution/DistributionService.sol +140 -83
  336. package/contracts/distribution/DistributionServiceManager.sol +8 -11
  337. package/contracts/distribution/IDistributionComponent.sol +26 -40
  338. package/contracts/distribution/IDistributionService.sol +23 -3
  339. package/contracts/examples/fire/DamageLevel.sol +59 -0
  340. package/contracts/examples/fire/FirePool.sol +75 -0
  341. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  342. package/contracts/examples/fire/FireProduct.sol +418 -0
  343. package/contracts/examples/fire/FireProductAuthorization.sol +44 -0
  344. package/contracts/examples/fire/FireUSD.sol +26 -0
  345. package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
  346. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  347. package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
  348. package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
  349. package/contracts/instance/{BundleManager.sol → BundleSet.sol} +23 -23
  350. package/contracts/instance/IInstance.sol +28 -41
  351. package/contracts/instance/IInstanceService.sol +27 -36
  352. package/contracts/instance/Instance.sol +124 -127
  353. package/contracts/instance/InstanceAdmin.sol +216 -270
  354. package/contracts/instance/InstanceAuthorizationV3.sol +194 -0
  355. package/contracts/instance/InstanceReader.sol +162 -32
  356. package/contracts/instance/InstanceService.sol +177 -128
  357. package/contracts/instance/InstanceServiceManager.sol +8 -13
  358. package/contracts/instance/InstanceStore.sol +49 -22
  359. package/contracts/instance/base/BalanceStore.sol +11 -6
  360. package/contracts/instance/base/Cloneable.sol +2 -25
  361. package/contracts/instance/base/ObjectCounter.sol +21 -0
  362. package/contracts/instance/base/ObjectLifecycle.sol +111 -0
  363. package/contracts/instance/base/{ObjectManager.sol → ObjectSet.sol} +11 -14
  364. package/contracts/instance/module/IBundle.sol +1 -1
  365. package/contracts/instance/module/IComponents.sol +10 -11
  366. package/contracts/instance/module/IDistribution.sol +0 -1
  367. package/contracts/instance/module/IPolicy.sol +24 -24
  368. package/contracts/mock/Dip.sol +1 -1
  369. package/contracts/oracle/BasicOracle.sol +47 -0
  370. package/contracts/oracle/BasicOracleAuthorization.sol +46 -0
  371. package/contracts/oracle/IOracle.sol +36 -0
  372. package/contracts/oracle/IOracleComponent.sol +33 -0
  373. package/contracts/oracle/IOracleService.sol +66 -0
  374. package/contracts/oracle/Oracle.sol +156 -0
  375. package/contracts/oracle/OracleService.sol +291 -0
  376. package/contracts/oracle/OracleServiceManager.sol +39 -0
  377. package/contracts/pool/BasicPool.sol +154 -0
  378. package/contracts/pool/BasicPoolAuthorization.sol +57 -0
  379. package/contracts/pool/BundleService.sol +284 -87
  380. package/contracts/pool/BundleServiceManager.sol +8 -11
  381. package/contracts/pool/IBundleService.sol +42 -5
  382. package/contracts/pool/IPoolComponent.sol +24 -68
  383. package/contracts/pool/IPoolService.sol +56 -39
  384. package/contracts/pool/Pool.sol +184 -148
  385. package/contracts/pool/PoolService.sol +262 -171
  386. package/contracts/pool/PoolServiceManager.sol +6 -9
  387. package/contracts/product/ApplicationService.sol +75 -70
  388. package/contracts/product/ApplicationServiceManager.sol +6 -6
  389. package/contracts/product/BasicProduct.sol +53 -0
  390. package/contracts/product/BasicProductAuthorization.sol +42 -0
  391. package/contracts/product/ClaimService.sol +321 -151
  392. package/contracts/product/ClaimServiceManager.sol +6 -6
  393. package/contracts/product/IApplicationService.sol +1 -0
  394. package/contracts/product/IClaimService.sol +34 -4
  395. package/contracts/product/IPolicyService.sol +34 -32
  396. package/contracts/product/IPricingService.sol +10 -10
  397. package/contracts/product/IProductComponent.sol +26 -9
  398. package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
  399. package/contracts/product/PolicyService.sol +424 -202
  400. package/contracts/product/PolicyServiceManager.sol +6 -9
  401. package/contracts/product/PricingService.sol +59 -60
  402. package/contracts/product/PricingServiceManager.sol +5 -8
  403. package/contracts/product/Product.sol +211 -133
  404. package/contracts/product/{ProductService.sol → RiskService.sol} +18 -46
  405. package/contracts/product/RiskServiceManager.sol +39 -0
  406. package/contracts/registry/ChainNft.sol +68 -38
  407. package/contracts/registry/IRegistry.sol +69 -22
  408. package/contracts/registry/IRegistryService.sol +3 -10
  409. package/contracts/registry/ITransferInterceptor.sol +1 -2
  410. package/contracts/registry/Registry.sol +354 -213
  411. package/contracts/registry/RegistryAdmin.sol +360 -149
  412. package/contracts/registry/RegistryService.sol +44 -69
  413. package/contracts/registry/RegistryServiceManager.sol +4 -9
  414. package/contracts/registry/ReleaseLifecycle.sol +30 -0
  415. package/contracts/registry/ReleaseRegistry.sol +501 -0
  416. package/contracts/registry/ServiceAuthorizationV3.sol +194 -0
  417. package/contracts/registry/TokenRegistry.sol +2 -2
  418. package/contracts/shared/Component.sol +48 -61
  419. package/contracts/shared/ComponentService.sol +322 -173
  420. package/contracts/shared/ComponentServiceManager.sol +10 -7
  421. package/contracts/shared/ComponentVerifyingService.sol +36 -21
  422. package/contracts/shared/ContractLib.sol +38 -0
  423. package/contracts/shared/IComponent.sol +10 -6
  424. package/contracts/shared/IComponentService.sol +40 -11
  425. package/contracts/shared/IInstanceLinkedComponent.sol +11 -16
  426. package/contracts/shared/IKeyValueStore.sol +1 -0
  427. package/contracts/shared/ILifecycle.sol +3 -2
  428. package/contracts/shared/INftOwnable.sol +2 -0
  429. package/contracts/shared/IPolicyHolder.sol +12 -22
  430. package/contracts/shared/IRegisterable.sol +11 -0
  431. package/contracts/shared/IService.sol +8 -1
  432. package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +3 -3
  433. package/contracts/shared/InstanceLinkedComponent.sol +106 -37
  434. package/contracts/shared/KeyValueStore.sol +7 -3
  435. package/contracts/shared/Lifecycle.sol +30 -63
  436. package/contracts/shared/{NftIdSetManager.sol → NftIdSet.sol} +1 -1
  437. package/contracts/shared/NftOwnable.sol +29 -9
  438. package/contracts/shared/PolicyHolder.sol +17 -57
  439. package/contracts/shared/Registerable.sol +19 -9
  440. package/contracts/shared/RegistryLinked.sol +3 -2
  441. package/contracts/shared/Service.sol +43 -36
  442. package/contracts/shared/TokenHandler.sol +100 -19
  443. package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
  444. package/contracts/staking/IStaking.sol +3 -3
  445. package/contracts/staking/IStakingService.sol +22 -14
  446. package/contracts/staking/StakeManagerLib.sol +70 -25
  447. package/contracts/staking/Staking.sol +86 -140
  448. package/contracts/staking/StakingLifecycle.sol +23 -0
  449. package/contracts/staking/StakingManager.sol +10 -12
  450. package/contracts/staking/StakingReader.sol +23 -20
  451. package/contracts/staking/StakingService.sol +69 -82
  452. package/contracts/staking/StakingServiceManager.sol +4 -5
  453. package/contracts/staking/StakingStore.sol +93 -60
  454. package/contracts/staking/TargetManagerLib.sol +7 -3
  455. package/contracts/type/Amount.sol +27 -5
  456. package/contracts/type/Blocknumber.sol +7 -1
  457. package/contracts/type/ClaimId.sol +6 -1
  458. package/contracts/type/NftId.sol +1 -0
  459. package/contracts/type/ObjectType.sol +175 -68
  460. package/contracts/type/PayoutId.sol +10 -10
  461. package/contracts/type/Referral.sol +1 -0
  462. package/contracts/type/RequestId.sol +75 -0
  463. package/contracts/type/RiskId.sol +15 -1
  464. package/contracts/type/RoleId.sol +97 -78
  465. package/contracts/type/Seconds.sol +21 -1
  466. package/contracts/type/Selector.sol +102 -0
  467. package/contracts/type/StateId.sol +27 -1
  468. package/contracts/type/String.sol +53 -0
  469. package/contracts/type/Timestamp.sol +17 -3
  470. package/contracts/type/UFixed.sol +38 -9
  471. package/contracts/type/Version.sol +3 -1
  472. package/contracts/{shared → upgradeability}/ProxyManager.sol +71 -38
  473. package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
  474. package/contracts/{shared → upgradeability}/Versionable.sol +2 -2
  475. package/package.json +9 -5
  476. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
  477. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -778
  478. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +0 -4
  479. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +0 -204
  480. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
  481. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +0 -256
  482. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  483. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  484. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -679
  485. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  486. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -694
  487. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
  488. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -1292
  489. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +0 -4
  490. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +0 -137
  491. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +0 -4
  492. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +0 -4
  493. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +0 -1715
  494. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +0 -4
  495. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +0 -1728
  496. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +0 -4
  497. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +0 -1806
  498. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +0 -4
  499. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +0 -1824
  500. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
  501. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
  502. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +0 -4
  503. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +0 -1562
  504. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +0 -4
  505. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +0 -1600
  506. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
  507. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
  508. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
  509. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +0 -4
  510. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +0 -306
  511. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
  512. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -617
  513. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
  514. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
  515. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
  516. package/contracts/instance/InstanceAuthorizationsLib.sol +0 -349
  517. package/contracts/product/ProductServiceManager.sol +0 -42
  518. package/contracts/registry/ReleaseManager.sol +0 -599
  519. package/contracts/registry/ServiceAuthorizationsLib.sol +0 -173
  520. package/contracts/shared/AccessManagerCustom.sol +0 -736
  521. package/contracts/shared/AccessManagerExtended.sol +0 -470
  522. package/contracts/shared/AccessManagerExtendedInitializeable.sol +0 -13
  523. package/contracts/shared/AccessManagerExtendedWithDisable.sol +0 -137
  524. package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +0 -14
  525. package/contracts/shared/IAccessManagerExtended.sol +0 -74
  526. package/contracts/shared/IAccessManagerExtendedWithDisable.sol +0 -18
  527. package/contracts/shared/InitializableCustom.sol +0 -177
  528. /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IRegistry} from "../registry/IRegistry.sol";
5
5
  import {IInstance} from "../instance/IInstance.sol";
6
- import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
7
6
  import {IComponentService} from "../shared/IComponentService.sol";
8
7
  import {IInstanceService} from "../instance/IInstanceService.sol";
9
8
  import {IRegistryService} from "../registry/IRegistryService.sol";
@@ -13,30 +12,14 @@ import {IPolicy} from "../instance/module/IPolicy.sol";
13
12
 
14
13
  import {Amount, AmountLib} from "../type/Amount.sol";
15
14
  import {NftId, NftIdLib} from "../type/NftId.sol";
16
- import {Fee, FeeLib} from "../type/Fee.sol";
17
- import {PRODUCT_SERVICE_ROLE, DISTRIBUTION_OWNER_ROLE} from "../type/RoleId.sol";
18
15
  import {KEEP_STATE} from "../type/StateId.sol";
19
16
  import {ObjectType, COMPONENT, DISTRIBUTION, INSTANCE, DISTRIBUTION, DISTRIBUTOR, REGISTRY} from "../type/ObjectType.sol";
20
- import {Version, VersionLib} from "../type/Version.sol";
21
- import {RoleId} from "../type/RoleId.sol";
22
-
23
- import {IVersionable} from "../shared/IVersionable.sol";
24
- import {Versionable} from "../shared/Versionable.sol";
25
-
26
- import {IService} from "../shared/IService.sol";
27
- import {Service} from "../shared/Service.sol";
28
17
  import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
29
- import {InstanceService} from "../instance/InstanceService.sol";
30
- import {IComponent} from "../shared/IComponent.sol";
31
- import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
32
18
  import {IDistributionService} from "./IDistributionService.sol";
33
- import {IPricingService} from "../product/IPricingService.sol";
34
-
35
- import {UFixed, UFixedLib} from "../type/UFixed.sol";
19
+ import {UFixed} from "../type/UFixed.sol";
36
20
  import {DistributorType, DistributorTypeLib} from "../type/DistributorType.sol";
37
- import {ReferralId, ReferralStatus, ReferralLib} from "../type/Referral.sol";
38
- import {Timestamp, TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
39
- import {Key32} from "../type/Key32.sol";
21
+ import {ReferralId, ReferralLib} from "../type/Referral.sol";
22
+ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
40
23
  import {IDistribution} from "../instance/module/IDistribution.sol";
41
24
  import {InstanceStore} from "../instance/InstanceStore.sol";
42
25
 
@@ -45,12 +28,6 @@ contract DistributionService is
45
28
  ComponentVerifyingService,
46
29
  IDistributionService
47
30
  {
48
- using NftIdLib for NftId;
49
- using TimestampLib for Timestamp;
50
- using UFixedLib for UFixed;
51
- using FeeLib for Fee;
52
- using ReferralLib for ReferralId;
53
-
54
31
  IComponentService private _componentService;
55
32
  IInstanceService private _instanceService;
56
33
  IRegistryService private _registryService;
@@ -60,25 +37,21 @@ contract DistributionService is
60
37
  bytes memory data
61
38
  )
62
39
  internal
63
- initializer
64
40
  virtual override
41
+ initializer()
65
42
  {
66
- address initialOwner;
67
- address registryAddress;
68
- (registryAddress, initialOwner) = abi.decode(data, (address, address));
69
- // TODO while DistributionService is not deployed in DistributionServiceManager constructor
70
- // owner is DistributionServiceManager deployer
71
- initializeService(registryAddress, address(0), owner);
43
+ (
44
+ address registryAddress,
45
+ address authority
46
+ ) = abi.decode(data, (address, address));
47
+
48
+ _initializeService(registryAddress, authority, owner);
72
49
 
73
50
  _componentService = IComponentService(_getServiceAddress(COMPONENT()));
74
51
  _instanceService = IInstanceService(_getServiceAddress(INSTANCE()));
75
52
  _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
76
53
 
77
- registerInterface(type(IDistributionService).interfaceId);
78
- }
79
-
80
- function getDomain() public pure override returns(ObjectType) {
81
- return DISTRIBUTION();
54
+ _registerInterface(type(IDistributionService).interfaceId);
82
55
  }
83
56
 
84
57
 
@@ -100,12 +73,19 @@ contract DistributionService is
100
73
  InstanceReader instanceReader = instance.getInstanceReader();
101
74
 
102
75
  {
103
- NftId productNftId = _getProductNftId(instanceReader, distributionNftId);
76
+ NftId productNftId = _getProductNftId(distributionNftId);
104
77
  IComponents.ProductInfo memory productInfo = instance.getInstanceReader().getProductInfo(productNftId);
105
- UFixed variableFeesPartsTotal = productInfo.minDistributionOwnerFee.fractionalFee.add(commissionPercentage);
106
- UFixed maxDiscountPercentageLimit = productInfo.distributionFee.fractionalFee.sub(variableFeesPartsTotal);
78
+
79
+ UFixed variableDistributionFees = productInfo.distributionFee.fractionalFee;
80
+ UFixed variableFeesPartsTotal = productInfo.minDistributionOwnerFee.fractionalFee + commissionPercentage;
81
+
82
+ if (variableFeesPartsTotal > variableDistributionFees) {
83
+ revert ErrorDistributionServiceVariableFeesTooHight(variableDistributionFees.toInt1000(), variableFeesPartsTotal.toInt1000());
84
+ }
85
+ UFixed maxDiscountPercentageLimit = variableDistributionFees - variableFeesPartsTotal;
86
+
107
87
  if (maxDiscountPercentage.gt(maxDiscountPercentageLimit)) {
108
- revert ErrorIDistributionServiceMaxDiscountTooHigh(maxDiscountPercentage.toInt(), maxDiscountPercentageLimit.toInt());
88
+ revert ErrorDistributionServiceMaxDiscountTooHigh(maxDiscountPercentage.toInt1000(), maxDiscountPercentageLimit.toInt1000());
109
89
  }
110
90
  }
111
91
 
@@ -151,7 +131,6 @@ contract DistributionService is
151
131
  distributorType,
152
132
  true, // active
153
133
  data,
154
- AmountLib.zero(),
155
134
  0);
156
135
 
157
136
  instance.getInstanceStore().createDistributor(distributorNftId, info);
@@ -184,6 +163,7 @@ contract DistributionService is
184
163
  )
185
164
  external
186
165
  virtual
166
+ onlyNftOfType(distributorNftId, DISTRIBUTOR())
187
167
  returns (ReferralId referralId)
188
168
  {
189
169
  (NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
@@ -195,86 +175,160 @@ contract DistributionService is
195
175
  revert ErrorIDistributionServiceExpirationInvalid(expiryAt);
196
176
  }
197
177
 
198
- InstanceReader instanceReader = instance.getInstanceReader();
199
- DistributorType distributorType = instanceReader.getDistributorInfo(distributorNftId).distributorType;
200
- IDistribution.DistributorTypeInfo memory distributorTypeData = instanceReader.getDistributorTypeInfo(distributorType);
178
+ {
179
+ InstanceReader instanceReader = instance.getInstanceReader();
180
+ DistributorType distributorType = instanceReader.getDistributorInfo(distributorNftId).distributorType;
181
+ IDistribution.DistributorTypeInfo memory distributorTypeData = instanceReader.getDistributorTypeInfo(distributorType);
201
182
 
202
- if (distributorTypeData.maxReferralCount < maxReferrals) {
203
- revert ErrorIDistributionServiceMaxReferralsExceeded(distributorTypeData.maxReferralCount);
204
- }
205
- if (distributorTypeData.minDiscountPercentage > discountPercentage) {
206
- revert ErrorIDistributionServiceDiscountTooLow(distributorTypeData.minDiscountPercentage.toInt(), discountPercentage.toInt());
207
- }
208
- if (distributorTypeData.maxDiscountPercentage < discountPercentage) {
209
- revert ErrorIDistributionServiceDiscountTooHigh(distributorTypeData.maxDiscountPercentage.toInt(), discountPercentage.toInt());
210
- }
211
- if (expiryAt.toInt() - TimestampLib.blockTimestamp().toInt() > distributorTypeData.maxReferralLifetime) {
212
- revert ErrorIDistributionServiceExpiryTooLong(distributorTypeData.maxReferralLifetime, expiryAt.toInt());
183
+ if (distributorTypeData.maxReferralCount < maxReferrals) {
184
+ revert ErrorIDistributionServiceMaxReferralsExceeded(distributorTypeData.maxReferralCount);
185
+ }
186
+ if (distributorTypeData.minDiscountPercentage > discountPercentage) {
187
+ revert ErrorIDistributionServiceDiscountTooLow(distributorTypeData.minDiscountPercentage.toInt(), discountPercentage.toInt());
188
+ }
189
+ if (distributorTypeData.maxDiscountPercentage < discountPercentage) {
190
+ revert ErrorIDistributionServiceDiscountTooHigh(distributorTypeData.maxDiscountPercentage.toInt(), discountPercentage.toInt());
191
+ }
192
+ if (expiryAt.toInt() - TimestampLib.blockTimestamp().toInt() > distributorTypeData.maxReferralLifetime) {
193
+ revert ErrorIDistributionServiceExpiryTooLong(distributorTypeData.maxReferralLifetime, expiryAt.toInt());
194
+ }
213
195
  }
214
196
 
215
- referralId = ReferralLib.toReferralId(distributionNftId, code);
216
- IDistribution.ReferralInfo memory info = IDistribution.ReferralInfo(
217
- distributorNftId,
218
- code,
219
- discountPercentage,
220
- maxReferrals,
221
- 0, // used referrals
222
- expiryAt,
223
- data
224
- );
225
-
226
- instance.getInstanceStore().createReferral(referralId, info);
227
- return referralId;
197
+ {
198
+ referralId = ReferralLib.toReferralId(distributionNftId, code);
199
+ IDistribution.ReferralInfo memory info = IDistribution.ReferralInfo(
200
+ distributorNftId,
201
+ code,
202
+ discountPercentage,
203
+ maxReferrals,
204
+ 0, // used referrals
205
+ expiryAt,
206
+ data
207
+ );
208
+
209
+ instance.getInstanceStore().createReferral(referralId, info);
210
+ }
228
211
  }
229
212
 
213
+ /// @inheritdoc IDistributionService
214
+ function processReferral(
215
+ NftId distributionNftId,
216
+ ReferralId referralId
217
+ )
218
+ external
219
+ virtual
220
+ restricted()
221
+ onlyNftOfType(distributionNftId, DISTRIBUTION())
222
+ {
223
+ if (referralIsValid(distributionNftId, referralId)) {
224
+ IRegistry registry = getRegistry();
225
+ IRegistry.ObjectInfo memory distributionInfo = registry.getObjectInfo(distributionNftId);
226
+ IInstance instance = _getInstanceForComponent(registry, distributionInfo);
227
+
228
+ // update book keeping for referral info
229
+ IDistribution.ReferralInfo memory referralInfo = instance.getInstanceReader().getReferralInfo(referralId);
230
+ referralInfo.usedReferrals += 1;
231
+ instance.getInstanceStore().updateReferral(referralId, referralInfo, KEEP_STATE());
232
+ }
233
+ }
230
234
 
231
235
  function processSale(
232
236
  NftId distributionNftId, // assume always of distribution type
233
237
  ReferralId referralId,
234
- IPolicy.Premium memory premium
238
+ IPolicy.PremiumInfo memory premium
235
239
  )
236
240
  external
237
241
  virtual
238
- restricted
242
+ restricted()
243
+ onlyNftOfType(distributionNftId, DISTRIBUTION())
239
244
  {
240
- IInstance instance = _getInstanceForDistribution(distributionNftId);
245
+ IRegistry registry = getRegistry();
246
+ IRegistry.ObjectInfo memory distributionInfo = registry.getObjectInfo(distributionNftId);
247
+ IInstance instance = _getInstanceForComponent(registry, distributionInfo);
241
248
  InstanceReader reader = instance.getInstanceReader();
242
249
  InstanceStore store = instance.getInstanceStore();
243
250
 
244
251
  // get distribution owner fee amount
245
- Amount distributionOwnerFee = AmountLib.toAmount(premium.distributionOwnerFeeFixAmount + premium.distributionOwnerFeeVarAmount);
252
+ Amount distributionOwnerFee = premium.distributionOwnerFeeFixAmount + premium.distributionOwnerFeeVarAmount;
246
253
 
247
254
  // update referral/distributor info if applicable
248
255
  if (referralIsValid(distributionNftId, referralId)) {
249
256
 
250
257
  // increase distribution balance by commission amount and distribution owner fee
251
- Amount commissionAmount = AmountLib.toAmount(premium.commissionAmount);
258
+ Amount commissionAmount = premium.commissionAmount;
252
259
  _componentService.increaseDistributionBalance(store, distributionNftId, commissionAmount, distributionOwnerFee);
253
260
 
254
261
  // update book keeping for referral info
255
262
  IDistribution.ReferralInfo memory referralInfo = reader.getReferralInfo(referralId);
256
- referralInfo.usedReferrals += 1;
257
- store.updateReferral(referralId, referralInfo, KEEP_STATE());
263
+
264
+ _componentService.increaseDistributorBalance(store, referralInfo.distributorNftId, AmountLib.zero(), commissionAmount);
258
265
 
259
266
  // update book keeping for distributor info
260
267
  IDistribution.DistributorInfo memory distributorInfo = reader.getDistributorInfo(referralInfo.distributorNftId);
261
- // TODO refactor sum of commission amount into a fee balance for distributors
262
- distributorInfo.commissionAmount = distributorInfo.commissionAmount + commissionAmount;
263
268
  distributorInfo.numPoliciesSold += 1;
264
269
  store.updateDistributor(referralInfo.distributorNftId, distributorInfo, KEEP_STATE());
265
270
  } else {
266
-
267
271
  // increase distribution balance by distribution owner fee
268
272
  _componentService.increaseDistributionBalance(store, distributionNftId, AmountLib.zero(), distributionOwnerFee);
269
273
  }
270
274
  }
271
275
 
272
- function referralIsValid(NftId distributionNftId, ReferralId referralId) public view returns (bool isValid) {
276
+ /// @inheritdoc IDistributionService
277
+ function withdrawCommission(NftId distributorNftId, Amount amount)
278
+ public
279
+ virtual
280
+ // TODO: restricted() (once #462 is done)
281
+ onlyNftOfType(distributorNftId, DISTRIBUTOR())
282
+ returns (Amount withdrawnAmount)
283
+ {
284
+ (NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
285
+ InstanceReader reader = instance.getInstanceReader();
286
+
287
+ IComponents.ComponentInfo memory distributionInfo = reader.getComponentInfo(distributionNftId);
288
+ address distributionWallet = distributionInfo.wallet;
289
+
290
+ Amount commissionAmount = reader.getFeeAmount(distributorNftId);
291
+
292
+ // determine withdrawn amount
293
+ withdrawnAmount = amount;
294
+ if (withdrawnAmount.gte(AmountLib.max())) {
295
+ withdrawnAmount = commissionAmount;
296
+ } else {
297
+ if (withdrawnAmount.gt(commissionAmount)) {
298
+ revert ErrorDistributionServiceCommissionWithdrawAmountExceedsLimit(withdrawnAmount, commissionAmount);
299
+ }
300
+ }
301
+
302
+ // decrease fee counters by withdrawnAmount and update distributor info
303
+ {
304
+ InstanceStore store = instance.getInstanceStore();
305
+ // decrease fee counter for distribution balance
306
+ _componentService.decreaseDistributionBalance(store, distributionNftId, withdrawnAmount, AmountLib.zero());
307
+ // decrease fee counter for distributor fee
308
+ _componentService.decreaseDistributorBalance(store, distributorNftId, AmountLib.zero(), withdrawnAmount);
309
+ }
310
+
311
+ // transfer amount to distributor
312
+ {
313
+ address distributor = getRegistry().ownerOf(distributorNftId);
314
+ emit LogDistributionServiceCommissionWithdrawn(distributorNftId, distributor, address(distributionInfo.token), withdrawnAmount);
315
+ distributionInfo.tokenHandler.distributeTokens(distributionWallet, distributor, withdrawnAmount);
316
+ }
317
+ }
318
+
319
+ function referralIsValid(NftId distributionNftId, ReferralId referralId)
320
+ public
321
+ view
322
+ onlyNftOfType(distributionNftId, DISTRIBUTION())
323
+ returns (bool isValid)
324
+ {
273
325
  if (distributionNftId.eqz() || referralId.eqz()) {
274
326
  return false;
275
327
  }
276
328
 
277
- IInstance instance = _getInstanceForDistribution(distributionNftId);
329
+ IRegistry registry = getRegistry();
330
+ IRegistry.ObjectInfo memory distributionInfo = registry.getObjectInfo(distributionNftId);
331
+ IInstance instance = _getInstanceForComponent(registry, distributionInfo);
278
332
  IDistribution.ReferralInfo memory info = instance.getInstanceReader().getReferralInfo(referralId);
279
333
 
280
334
  if (info.distributorNftId.eqz()) {
@@ -291,8 +345,11 @@ contract DistributionService is
291
345
  returns(IInstance instance)
292
346
  {
293
347
  NftId instanceNftId = getRegistry().getObjectInfo(distributionNftId).parentNftId;
294
- address instanceAddress = getRegistry().getObjectInfo(instanceNftId).objectAddress;
348
+ address instanceAddress = getRegistry().getObjectAddress(instanceNftId);
295
349
  return IInstance(instanceAddress);
296
350
  }
297
351
 
352
+ function _getDomain() internal pure override returns(ObjectType) {
353
+ return DISTRIBUTION();
354
+ }
298
355
  }
@@ -1,12 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IVersionable} from "../shared/IVersionable.sol";
5
- import {ProxyManager} from "../shared/ProxyManager.sol";
4
+ import {IVersionable} from "../upgradeability/IVersionable.sol";
5
+ import {ProxyManager} from "../upgradeability/ProxyManager.sol";
6
6
  import {DistributionService} from "./DistributionService.sol";
7
- import {Registry} from "../registry/Registry.sol";
8
- import {RegistryService} from "../registry/RegistryService.sol";
9
- import {REGISTRY} from "../type/ObjectType.sol";
10
7
 
11
8
  contract DistributionServiceManager is ProxyManager {
12
9
 
@@ -15,15 +12,15 @@ contract DistributionServiceManager is ProxyManager {
15
12
  /// @dev initializes proxy manager with distribution service implementation and deploys instance
16
13
  constructor(
17
14
  address authority,
18
- address registryAddress,
15
+ address registry,
19
16
  bytes32 salt
20
17
  )
21
- ProxyManager(registryAddress)
22
18
  {
23
- DistributionService distSrv = new DistributionService{salt: salt}();
24
- bytes memory data = abi.encode(registryAddress, address(this), authority);
25
- IVersionable versionable = deployDetermenistic(
26
- address(distSrv),
19
+ DistributionService svc = new DistributionService{salt: salt}();
20
+ bytes memory data = abi.encode(registry, authority);
21
+ IVersionable versionable = initialize(
22
+ registry,
23
+ address(svc),
27
24
  data,
28
25
  salt);
29
26
 
@@ -1,66 +1,52 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Fee} from "../type/Fee.sol";
4
+ import {Amount} from "../type/Amount.sol";
5
5
  import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
6
- import {ReferralId, ReferralStatus} from "../type/Referral.sol";
7
6
  import {NftId} from "../type/NftId.sol";
8
- import {DistributorType} from "../type/DistributorType.sol";
7
+ import {ReferralId, ReferralStatus} from "../type/Referral.sol";
9
8
  import {UFixed} from "../type/UFixed.sol";
10
- import {Timestamp} from "../type/Timestamp.sol";
11
9
 
12
10
  interface IDistributionComponent is IInstanceLinkedComponent {
13
11
 
14
- event LogDistributorUpdated(address to, address caller);
12
+ error ErrorDistributionNotDistributor(address distributor);
13
+ error ErrorDistributionAlreadyDistributor(address distributor, NftId distributorNftId);
15
14
 
16
- function setFees(
17
- Fee memory distributionFee,
18
- Fee memory minDistributionOwnerFee
19
- ) external;
15
+ event LogDistributorUpdated(address to, address operator);
20
16
 
21
- function createDistributorType(
22
- string memory name,
23
- UFixed minDiscountPercentage,
24
- UFixed maxDiscountPercentage,
25
- UFixed commissionPercentage,
26
- uint32 maxReferralCount,
27
- uint32 maxReferralLifetime,
28
- bool allowSelfReferrals,
29
- bool allowRenewals,
30
- bytes memory data
31
- ) external returns (DistributorType distributorType);
17
+ /// @dev Returns true iff the provided address is registered as a distributor with this distribution component.
18
+ function isDistributor(address candidate) external view returns (bool);
32
19
 
33
- function createDistributor(
34
- address distributor,
35
- DistributorType distributorType,
36
- bytes memory data
37
- ) external returns(NftId distributorNftId);
20
+ /// @dev Returns the distributor Nft Id for the provided address
21
+ function getDistributorNftId(address distributor) external view returns (NftId distributorNftId);
38
22
 
39
- function updateDistributorType(
40
- NftId distributorNftId,
41
- DistributorType distributorType,
42
- bytes memory data
43
- ) external;
23
+ function getDiscountPercentage(
24
+ string memory referralCode
25
+ ) external view returns (UFixed discountPercentage, ReferralStatus status);
26
+
27
+ function getReferralId(
28
+ string memory referralCode
29
+ ) external returns (ReferralId referralId);
44
30
 
45
31
  function calculateRenewalFeeAmount(
46
32
  ReferralId referralId,
47
33
  uint256 netPremiumAmount
48
34
  ) external view returns (uint256 feeAmount);
49
35
 
50
- /// @dev callback from product service when a policy is renews for a specific referralId
36
+ /// @dev Callback function to process a renewal of a policy.
37
+ /// The default implementation is empty.
38
+ /// Overwrite this function to implement a use case specific behaviour.
51
39
  function processRenewal(
52
40
  ReferralId referralId,
53
41
  uint256 feeAmount
54
42
  ) external;
55
43
 
56
- function getDiscountPercentage(
57
- string memory referralCode
58
- ) external view returns (UFixed discountPercentage, ReferralStatus status);
59
-
60
- function getReferralId(
61
- string memory referralCode
62
- ) external returns (ReferralId referralId);
63
-
64
- /// @dev returns true iff the component needs to be called when selling/renewing policis
44
+ /// @dev Returns true to ensure component is called when transferring distributor Nft Ids.
65
45
  function isVerifying() external view returns (bool verifying);
46
+
47
+ /// @dev Withdraw commission for the distributor
48
+ /// @param distributorNftId the distributor Nft Id
49
+ /// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
50
+ /// @return withdrawnAmount the effective withdrawn amount
51
+ function withdrawCommission(NftId distributorNftId, Amount amount) external returns (Amount withdrawnAmount);
66
52
  }
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Amount} from "../type/Amount.sol";
5
5
  import {NftId} from "../type/NftId.sol";
6
- import {Fee} from "../type/Fee.sol";
7
6
  import {IPolicy} from "../instance/module/IPolicy.sol";
8
7
  import {IService} from "../shared/IService.sol";
9
8
  import {UFixed} from "../type/UFixed.sol";
@@ -13,6 +12,7 @@ import {Timestamp} from "../type/Timestamp.sol";
13
12
 
14
13
 
15
14
  interface IDistributionService is IService {
15
+
16
16
  error ErrorDistributionServiceCallerNotRegistered(address caller);
17
17
  error ErrorIDistributionServiceParentNftIdNotInstance(NftId nftId, NftId parentNftId);
18
18
  error ErrorIDistributionServiceCallerNotDistributor(address caller);
@@ -25,10 +25,17 @@ interface IDistributionService is IService {
25
25
  error ErrorIDistributionServiceExpirationInvalid(Timestamp expiryAt);
26
26
  error ErrorIDistributionServiceCommissionTooHigh(uint256 commissionPercentage, uint256 maxCommissionPercentage);
27
27
  error ErrorIDistributionServiceMinFeeTooHigh(uint256 minFee, uint256 limit);
28
- error ErrorIDistributionServiceMaxDiscountTooHigh(uint256 maxDiscountPercentage, uint256 limit);
28
+
29
+ error ErrorDistributionServiceCommissionWithdrawAmountExceedsLimit(Amount amount, Amount limit);
30
+
31
+ error ErrorDistributionServiceVariableFeesTooHight(uint256 maxDiscountPercentage, uint256 limit);
32
+ error ErrorDistributionServiceMaxDiscountTooHigh(uint256 maxDiscountPercentage, uint256 limit);
33
+
29
34
  error ErrorIDistributionServiceReferralInvalid(NftId distributionNftId, ReferralId referralId);
30
35
  error ErrorDistributionServiceInvalidFeeTransferred(Amount transferredDistributionFeeAmount, Amount expectedDistributionFeeAmount);
31
36
 
37
+ event LogDistributionServiceCommissionWithdrawn(NftId distributorNftId, address recipient, address tokenAddress, Amount amount);
38
+
32
39
  function createDistributorType(
33
40
  string memory name,
34
41
  UFixed minDiscountPercentage,
@@ -67,15 +74,28 @@ interface IDistributionService is IService {
67
74
  external
68
75
  returns (ReferralId referralId);
69
76
 
77
+ /// @dev callback from product service when a referral is used.
78
+ /// Calling this will increment the referral usage counter.
79
+ function processReferral(
80
+ NftId distributionNftId,
81
+ ReferralId referralId
82
+ ) external;
83
+
70
84
  /// @dev callback from product service when selling a policy for a specific referralId
71
85
  function processSale(
72
86
  NftId distributionNftId,
73
87
  ReferralId referralId,
74
- IPolicy.Premium memory premium
88
+ IPolicy.PremiumInfo memory premium
75
89
  ) external;
76
90
 
77
91
  function referralIsValid(
78
92
  NftId distributorNftId,
79
93
  ReferralId referralId
80
94
  ) external view returns (bool isValid);
95
+
96
+ /// @dev Withdraw commission for the distributor
97
+ /// @param distributorNftId the distributor Nft Id
98
+ /// @param amount the amount to withdraw. If set to AMOUNT_MAX, the full commission available is withdrawn
99
+ /// @return withdrawnAmount the effective withdrawn amount
100
+ function withdrawCommission(NftId distributorNftId, Amount amount) external returns (Amount withdrawnAmount);
81
101
  }
@@ -0,0 +1,59 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ type DamageLevel is uint8;
5
+
6
+ // type bindings
7
+ using {
8
+ DamageLevelLib.eq,
9
+ DamageLevelLib.eqz,
10
+ DamageLevelLib.toInt
11
+ } for DamageLevel global;
12
+
13
+ // solhint-disable-next-line func-name-mixedcase
14
+ function DAMAGE_SMALL() pure returns (DamageLevel) {
15
+ return DamageLevel.wrap(1);
16
+ }
17
+
18
+ // solhint-disable-next-line func-name-mixedcase
19
+ function DAMAGE_MEDIUM() pure returns (DamageLevel) {
20
+ return DamageLevel.wrap(2);
21
+ }
22
+
23
+ // solhint-disable-next-line func-name-mixedcase
24
+ function DAMAGE_LARGE() pure returns (DamageLevel) {
25
+ return DamageLevel.wrap(3);
26
+ }
27
+
28
+ library DamageLevelLib {
29
+
30
+ error ErrorDamageLeveLibInvalidDamageLevel(uint8 damageLevel);
31
+
32
+ function zero() internal pure returns (DamageLevel) {
33
+ return DamageLevel.wrap(0);
34
+ }
35
+
36
+ function toDamageLevel(uint8 damage) internal pure returns (DamageLevel) {
37
+ if (damage == 1) {
38
+ return DAMAGE_SMALL();
39
+ } else if (damage == 2) {
40
+ return DAMAGE_MEDIUM();
41
+ } else if (damage == 3) {
42
+ return DAMAGE_LARGE();
43
+ } else {
44
+ revert ErrorDamageLeveLibInvalidDamageLevel(damage);
45
+ }
46
+ }
47
+
48
+ function toInt(DamageLevel damageLevel) internal pure returns (uint8) {
49
+ return uint8(DamageLevel.unwrap(damageLevel));
50
+ }
51
+
52
+ function eq(DamageLevel a, DamageLevel b) internal pure returns (bool) {
53
+ return DamageLevel.unwrap(a) == DamageLevel.unwrap(b);
54
+ }
55
+
56
+ function eqz(DamageLevel a) internal pure returns (bool) {
57
+ return DamageLevel.unwrap(a) == 0;
58
+ }
59
+ }
@@ -0,0 +1,75 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Amount, AmountLib} from "../../type/Amount.sol";
5
+ import {BasicPool} from "../../pool/BasicPool.sol";
6
+ import {BasicPoolAuthorization} from "../../pool/BasicPoolAuthorization.sol";
7
+ import {Fee} from "../../type/Fee.sol";
8
+ import {IAuthorization} from "../../authorization/IAuthorization.sol";
9
+ import {NftId} from "../../type/NftId.sol";
10
+ import {Seconds} from "../../type/Timestamp.sol";
11
+ import {UFixed} from "../../type/UFixed.sol";
12
+
13
+ contract FirePool is
14
+ BasicPool
15
+ {
16
+
17
+ constructor(
18
+ address registry,
19
+ NftId instanceNftId,
20
+ string memory componentName,
21
+ address token,
22
+ IAuthorization authorization
23
+ )
24
+ {
25
+ address initialOwner = msg.sender;
26
+ _intialize(
27
+ registry,
28
+ instanceNftId,
29
+ componentName,
30
+ token,
31
+ authorization,
32
+ initialOwner);
33
+ }
34
+
35
+ function _intialize(
36
+ address registry,
37
+ NftId instanceNftId,
38
+ string memory componentName,
39
+ address token,
40
+ IAuthorization authorization,
41
+ address initialOwner
42
+ )
43
+ internal
44
+ initializer
45
+ {
46
+ _initializeBasicPool(
47
+ registry,
48
+ instanceNftId,
49
+ authorization,
50
+ token,
51
+ componentName,
52
+ initialOwner);
53
+ }
54
+
55
+ function createBundle(
56
+ Fee memory fee,
57
+ Amount initialAmount,
58
+ Seconds lifetime
59
+ )
60
+ external
61
+ virtual
62
+ restricted()
63
+ returns(NftId bundleNftId, Amount netStakedAmount)
64
+ {
65
+ address owner = msg.sender;
66
+ bundleNftId = _createBundle(
67
+ owner,
68
+ fee,
69
+ lifetime,
70
+ "" // filter
71
+ );
72
+ netStakedAmount = _stake(bundleNftId, initialAmount);
73
+ }
74
+
75
+ }