@etherisc/gif-next 0.0.2-da2c7dd-538 → 0.0.2-da87b00-860

Sign up to get free protection for your applications and to get access to all the features.
Files changed (469) hide show
  1. package/README.md +57 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +106 -38
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +91 -45
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  7. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +58 -6
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +573 -288
  10. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +1289 -0
  12. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +8 -39
  14. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +295 -47
  16. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +452 -210
  19. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +119 -14
  21. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +246 -16
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +420 -27
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +64 -142
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +275 -59
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +21 -88
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +448 -148
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +143 -77
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +20 -87
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  38. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +296 -20
  39. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  41. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +109 -100
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  43. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +274 -58
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  45. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +145 -124
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  47. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +274 -58
  48. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +126 -166
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  52. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +274 -58
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  54. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +39 -63
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  56. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +130 -138
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  58. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +274 -58
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +333 -180
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  62. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +274 -58
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  64. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  66. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +427 -28
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  68. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +335 -12
  69. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  70. package/artifacts/contracts/instance/Instance.sol/Instance.json +430 -62
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  72. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +822 -402
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  74. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +299 -58
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  76. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +619 -402
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +367 -64
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  80. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +83 -55
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  82. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +448 -374
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  84. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +101 -88
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +8 -8
  87. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  89. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  91. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  93. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  95. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +20 -20
  96. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  100. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  101. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  103. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +33 -35
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +294 -53
  106. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +19 -21
  109. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +29 -0
  111. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  112. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +19 -21
  113. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  114. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +87 -42
  115. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  116. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +96 -50
  117. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  118. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +59 -69
  119. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  120. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +274 -58
  121. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  122. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +300 -123
  123. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  124. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +124 -58
  125. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  126. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +186 -33
  127. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  128. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +29 -31
  129. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  130. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +238 -19
  131. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  132. package/artifacts/contracts/pool/Pool.sol/Pool.json +29 -31
  133. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  134. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +100 -34
  135. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  136. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +346 -87
  137. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  138. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +121 -63
  139. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  140. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +273 -50
  141. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  142. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +103 -41
  143. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  144. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +46 -48
  145. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  146. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +274 -58
  147. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  148. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +142 -102
  149. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  150. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +113 -75
  151. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  152. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +208 -1
  153. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  154. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +50 -10
  155. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  156. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +55 -0
  157. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  158. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +50 -0
  159. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  160. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +40 -42
  161. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  162. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +224 -18
  163. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  164. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +157 -86
  165. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  166. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +511 -21
  167. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  168. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +118 -72
  169. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  170. package/artifacts/contracts/product/PricingService.sol/PricingService.json +116 -114
  171. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  172. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +100 -70
  173. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  174. package/artifacts/contracts/product/Product.sol/Product.json +40 -42
  175. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  176. package/artifacts/contracts/product/RiskService.sol/RiskService.json +258 -44
  177. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  178. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +84 -42
  179. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  180. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  181. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +33 -22
  182. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  183. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +29 -0
  184. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  185. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  186. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  187. package/artifacts/contracts/registry/Registry.sol/Registry.json +71 -60
  188. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  189. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +704 -472
  190. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
  191. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +1074 -0
  192. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  193. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +47 -18
  194. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  195. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +76 -38
  196. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  197. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +710 -407
  198. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  199. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  200. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  201. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +184 -128
  202. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  203. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +437 -26
  204. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  205. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +119 -59
  206. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  207. package/artifacts/contracts/shared/Component.sol/Component.json +19 -21
  208. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  209. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +212 -232
  210. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  211. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +113 -71
  212. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  213. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +130 -39
  214. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  215. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  216. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  217. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +2 -2
  218. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  219. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +19 -21
  220. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  221. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +119 -147
  222. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  223. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +19 -21
  224. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  225. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +6 -6
  226. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  227. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  228. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +19 -0
  229. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  230. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  231. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +19 -0
  232. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  233. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  234. package/artifacts/contracts/shared/IService.sol/IService.json +29 -0
  235. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  236. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
  237. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  238. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +19 -21
  239. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  240. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +6 -6
  241. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  242. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  243. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  244. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  245. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +21 -2
  246. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  247. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  248. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  249. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -0
  250. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  251. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  252. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  253. package/artifacts/contracts/shared/Service.sol/Service.json +29 -0
  254. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  255. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  256. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  257. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  258. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  259. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  260. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  261. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1450 -140
  262. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  263. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +161 -110
  264. package/artifacts/contracts/staking/ITargetLimitHandler.sol/ITargetLimitHandler.dbg.json +4 -0
  265. package/artifacts/contracts/staking/ITargetLimitHandler.sol/ITargetLimitHandler.json +50 -0
  266. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  267. package/artifacts/contracts/staking/Staking.sol/Staking.json +1624 -272
  268. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
  269. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +470 -0
  270. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  271. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +135 -68
  272. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  273. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +294 -177
  274. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  275. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +200 -157
  276. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  277. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +86 -52
  278. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  279. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +1600 -818
  280. package/artifacts/contracts/staking/TargetHandler.sol/TargetHandler.dbg.json +4 -0
  281. package/artifacts/contracts/staking/TargetHandler.sol/TargetHandler.json +309 -0
  282. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  283. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +159 -87
  284. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  285. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Amount.sol/AmountLib.json +10 -10
  287. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +45 -19
  289. package/artifacts/contracts/type/ChainId.sol/ChainIdLib.dbg.json +4 -0
  290. package/artifacts/contracts/type/ChainId.sol/ChainIdLib.json +193 -0
  291. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  292. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  293. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  294. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  295. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/Fee.sol/FeeLib.json +93 -37
  297. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  298. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  299. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  300. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  301. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  302. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  303. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  304. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  305. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  306. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +33 -31
  307. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  308. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  309. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  310. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  311. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  312. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  313. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  314. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  315. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  316. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +39 -218
  317. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  318. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +45 -2
  319. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  320. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  321. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  322. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  323. package/artifacts/contracts/type/String.sol/StrLib.json +50 -2
  324. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  325. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +3 -3
  326. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  327. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +60 -36
  328. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  329. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  330. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  331. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +56 -2
  332. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  333. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.json +10 -0
  334. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  335. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +65 -27
  336. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  337. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +15 -2
  338. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  339. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.json +10 -0
  340. package/contracts/accounting/AccountingService.sol +15 -3
  341. package/contracts/accounting/IAccountingService.sol +4 -2
  342. package/contracts/authorization/AccessAdmin.sol +389 -298
  343. package/contracts/authorization/AccessAdminLib.sol +396 -0
  344. package/contracts/authorization/AccessManagerCloneable.sol +40 -31
  345. package/contracts/authorization/Authorization.sol +60 -228
  346. package/contracts/authorization/IAccess.sol +25 -7
  347. package/contracts/authorization/IAccessAdmin.sol +81 -80
  348. package/contracts/authorization/IAuthorization.sol +3 -51
  349. package/contracts/authorization/IServiceAuthorization.sol +55 -17
  350. package/contracts/authorization/ServiceAuthorization.sol +248 -34
  351. package/contracts/distribution/BasicDistribution.sol +6 -6
  352. package/contracts/distribution/BasicDistributionAuthorization.sol +11 -4
  353. package/contracts/distribution/Distribution.sol +10 -52
  354. package/contracts/distribution/DistributionService.sol +154 -64
  355. package/contracts/distribution/IDistributionComponent.sol +3 -10
  356. package/contracts/distribution/IDistributionService.sol +24 -10
  357. package/contracts/examples/fire/FirePool.sol +0 -4
  358. package/contracts/examples/fire/FireProduct.sol +6 -10
  359. package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
  360. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
  361. package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
  362. package/contracts/examples/unpermissioned/SimpleProduct.sol +83 -23
  363. package/contracts/instance/IInstance.sol +87 -12
  364. package/contracts/instance/IInstanceService.sol +52 -7
  365. package/contracts/instance/Instance.sol +148 -48
  366. package/contracts/instance/InstanceAdmin.sol +227 -281
  367. package/contracts/instance/InstanceAuthorizationV3.sol +79 -26
  368. package/contracts/instance/InstanceReader.sol +375 -380
  369. package/contracts/instance/InstanceService.sol +230 -134
  370. package/contracts/instance/RiskSet.sol +10 -2
  371. package/contracts/instance/base/BalanceStore.sol +4 -6
  372. package/contracts/instance/base/ObjectLifecycle.sol +2 -6
  373. package/contracts/instance/module/IBundle.sol +6 -5
  374. package/contracts/instance/module/IComponents.sol +16 -5
  375. package/contracts/instance/module/IDistribution.sol +19 -7
  376. package/contracts/instance/module/IPolicy.sol +28 -8
  377. package/contracts/instance/module/IRisk.sol +2 -0
  378. package/contracts/oracle/BasicOracle.sol +2 -4
  379. package/contracts/oracle/BasicOracleAuthorization.sol +18 -2
  380. package/contracts/oracle/IOracle.sol +9 -4
  381. package/contracts/oracle/Oracle.sol +2 -4
  382. package/contracts/oracle/OracleService.sol +8 -8
  383. package/contracts/pool/BasicPool.sol +3 -16
  384. package/contracts/pool/BasicPoolAuthorization.sol +10 -5
  385. package/contracts/pool/BundleService.sol +34 -43
  386. package/contracts/pool/IBundleService.sol +14 -13
  387. package/contracts/pool/IPoolService.sol +7 -2
  388. package/contracts/pool/Pool.sol +4 -16
  389. package/contracts/pool/PoolLib.sol +127 -2
  390. package/contracts/pool/PoolService.sol +41 -184
  391. package/contracts/product/ApplicationService.sol +83 -15
  392. package/contracts/product/BasicProduct.sol +1 -3
  393. package/contracts/product/BasicProductAuthorization.sol +11 -4
  394. package/contracts/product/ClaimService.sol +56 -58
  395. package/contracts/product/IApplicationService.sol +24 -2
  396. package/contracts/product/IClaimService.sol +5 -4
  397. package/contracts/product/IPolicyService.sol +9 -2
  398. package/contracts/product/IPricingService.sol +1 -0
  399. package/contracts/product/IRiskService.sol +21 -3
  400. package/contracts/product/PolicyService.sol +31 -68
  401. package/contracts/product/PolicyServiceLib.sol +79 -5
  402. package/contracts/product/PricingService.sol +33 -31
  403. package/contracts/product/Product.sol +38 -14
  404. package/contracts/product/RiskService.sol +55 -9
  405. package/contracts/registry/IRegistry.sol +15 -9
  406. package/contracts/registry/IRelease.sol +6 -3
  407. package/contracts/registry/Registry.sol +15 -9
  408. package/contracts/registry/RegistryAdmin.sol +100 -263
  409. package/contracts/registry/RegistryAuthorization.sol +336 -0
  410. package/contracts/registry/RegistryService.sol +1 -1
  411. package/contracts/registry/ReleaseAdmin.sol +62 -112
  412. package/contracts/registry/ReleaseRegistry.sol +57 -43
  413. package/contracts/registry/ServiceAuthorizationV3.sol +128 -33
  414. package/contracts/registry/TokenRegistry.sol +56 -52
  415. package/contracts/shared/Component.sol +18 -31
  416. package/contracts/shared/ComponentService.sol +239 -244
  417. package/contracts/shared/ContractLib.sol +134 -75
  418. package/contracts/shared/IComponent.sol +1 -4
  419. package/contracts/shared/IComponentService.sol +21 -22
  420. package/contracts/shared/IKeyValueStore.sol +1 -1
  421. package/contracts/shared/INftOwnable.sol +2 -0
  422. package/contracts/shared/IRegisterable.sol +0 -1
  423. package/contracts/shared/InitializableERC165.sol +9 -1
  424. package/contracts/shared/InstanceLinkedComponent.sol +4 -7
  425. package/contracts/shared/KeyValueStore.sol +3 -3
  426. package/contracts/shared/NftOwnable.sol +4 -2
  427. package/contracts/shared/PolicyHolder.sol +3 -2
  428. package/contracts/shared/Registerable.sol +1 -4
  429. package/contracts/shared/Service.sol +6 -4
  430. package/contracts/shared/TokenHandler.sol +5 -4
  431. package/contracts/staking/IStaking.sol +266 -64
  432. package/contracts/staking/IStakingService.sol +44 -82
  433. package/contracts/staking/ITargetLimitHandler.sol +17 -0
  434. package/contracts/staking/Staking.sol +473 -202
  435. package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +55 -84
  436. package/contracts/staking/StakingManager.sol +4 -3
  437. package/contracts/staking/StakingReader.sol +58 -77
  438. package/contracts/staking/StakingService.sol +49 -158
  439. package/contracts/staking/StakingServiceManager.sol +1 -0
  440. package/contracts/staking/StakingStore.sol +1089 -330
  441. package/contracts/staking/TargetHandler.sol +132 -0
  442. package/contracts/staking/TargetManagerLib.sol +69 -46
  443. package/contracts/type/Amount.sol +4 -0
  444. package/contracts/type/Blocknumber.sol +15 -15
  445. package/contracts/type/ChainId.sol +101 -0
  446. package/contracts/type/Fee.sol +8 -8
  447. package/contracts/type/NftId.sol +3 -3
  448. package/contracts/type/ObjectType.sol +21 -17
  449. package/contracts/type/RoleId.sol +57 -59
  450. package/contracts/type/Seconds.sol +19 -0
  451. package/contracts/type/String.sol +12 -0
  452. package/contracts/type/Timestamp.sol +4 -2
  453. package/contracts/type/UFixed.sol +28 -10
  454. package/contracts/type/Version.sol +39 -0
  455. package/contracts/upgradeability/IVersionable.sol +3 -0
  456. package/contracts/upgradeability/ProxyManager.sol +25 -11
  457. package/contracts/upgradeability/UpgradableProxyWithAdmin.sol +12 -2
  458. package/contracts/upgradeability/Versionable.sol +6 -3
  459. package/package.json +2 -2
  460. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +0 -4
  461. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +0 -24
  462. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +0 -4
  463. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +0 -485
  464. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
  465. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
  466. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +0 -4
  467. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +0 -205
  468. package/contracts/shared/ComponentVerifyingService.sol +0 -128
  469. package/contracts/staking/StakingLifecycle.sol +0 -23
@@ -3,32 +3,30 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
5
5
 
6
+ import {IAccess} from "../authorization/IAccess.sol";
6
7
  import {IAuthorization} from "../authorization/IAuthorization.sol";
7
- import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
8
- import {Amount} from "../type/Amount.sol";
9
- import {BundleSet} from "./BundleSet.sol";
10
- import {RiskSet} from "./RiskSet.sol";
11
- import {ChainNft} from "../registry/ChainNft.sol";
12
- import {NftId} from "../type/NftId.sol";
13
- import {RoleId} from "../type/RoleId.sol";
14
- import {UFixed} from "../type/UFixed.sol";
15
- import {ObjectType, INSTANCE, COMPONENT, INSTANCE, REGISTRY, STAKING} from "../type/ObjectType.sol";
16
-
17
- import {Service} from "../shared/Service.sol";
18
-
8
+ import {IComponentService} from "../shared/IComponentService.sol";
9
+ import {IInstance} from "./IInstance.sol";
10
+ import {IInstanceService} from "./IInstanceService.sol";
19
11
  import {IRegistry} from "../registry/IRegistry.sol";
20
12
  import {IRegistryService} from "../registry/IRegistryService.sol";
21
13
  import {IStakingService} from "../staking/IStakingService.sol";
22
- import {TargetManagerLib} from "../staking/TargetManagerLib.sol";
23
14
 
24
- import {IComponentService} from "../shared/IComponentService.sol";
15
+ import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
16
+ import {Amount} from "../type/Amount.sol";
17
+ import {BundleSet} from "./BundleSet.sol";
25
18
  import {Instance} from "./Instance.sol";
26
- import {IInstance} from "./IInstance.sol";
27
19
  import {InstanceAdmin} from "./InstanceAdmin.sol";
28
- import {IInstanceService} from "./IInstanceService.sol";
29
20
  import {InstanceReader} from "./InstanceReader.sol";
30
21
  import {InstanceStore} from "./InstanceStore.sol";
22
+ import {NftId} from "../type/NftId.sol";
23
+ import {ObjectType, INSTANCE, COMPONENT, INSTANCE, REGISTRY, STAKING} from "../type/ObjectType.sol";
24
+ import {RiskSet} from "./RiskSet.sol";
25
+ import {RoleId} from "../type/RoleId.sol";
31
26
  import {Seconds} from "../type/Seconds.sol";
27
+ import {Service} from "../shared/Service.sol";
28
+ import {TargetManagerLib} from "../staking/TargetManagerLib.sol";
29
+ import {UFixed} from "../type/UFixed.sol";
32
30
  import {VersionPart} from "../type/Version.sol";
33
31
 
34
32
 
@@ -53,46 +51,138 @@ contract InstanceService is
53
51
  address internal _masterInstanceStore;
54
52
 
55
53
 
56
- modifier onlyInstance() {
57
- address instanceAddress = msg.sender;
58
- NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
59
- if (instanceNftId.eqz()) {
60
- revert ErrorInstanceServiceNotRegistered(instanceAddress);
61
- }
54
+ modifier onlyInstance() {
55
+ _checkInstance(msg.sender, getRelease());
56
+ _;
57
+ }
62
58
 
63
- ObjectType objectType = getRegistry().getObjectInfo(instanceNftId).objectType;
64
- if (objectType != INSTANCE()) {
65
- revert ErrorInstanceServiceNotInstance(instanceAddress, objectType);
66
- }
67
59
 
68
- VersionPart instanceVersion = IInstance(instanceAddress).getRelease();
69
- if (instanceVersion != getVersion().toMajorPart()) {
70
- revert ErrorInstanceServiceInstanceVersionMismatch(instanceAddress, instanceVersion);
71
- }
60
+ /// @inheritdoc IInstanceService
61
+ function createRole(
62
+ string memory roleName,
63
+ RoleId adminRoleId,
64
+ uint32 maxMemberCount
65
+ )
66
+ external
67
+ restricted()
68
+ onlyInstance()
69
+ returns (RoleId roleId)
70
+ {
71
+ IInstance instance = IInstance(msg.sender);
72
+ roleId = instance.getInstanceAdmin().createRole(
73
+ roleName,
74
+ adminRoleId,
75
+ maxMemberCount);
76
+ }
72
77
 
73
- _;
78
+
79
+ /// @inheritdoc IInstanceService
80
+ function setRoleActive(RoleId roleId, bool active)
81
+ external
82
+ restricted()
83
+ onlyInstance()
84
+ {
85
+ IInstance instance = IInstance(msg.sender);
86
+ instance.getInstanceAdmin().setRoleActive(roleId, active);
74
87
  }
75
88
 
76
89
 
77
- modifier onlyInstanceOwner(NftId instanceNftId) {
78
- if(msg.sender != getRegistry().ownerOf(instanceNftId)) {
79
- revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
80
- }
81
- _;
90
+ /// @inheritdoc IInstanceService
91
+ function grantRole(RoleId roleId, address account)
92
+ external
93
+ restricted()
94
+ onlyInstance()
95
+ {
96
+ IInstance instance = IInstance(msg.sender);
97
+ instance.getInstanceAdmin().grantRole(roleId, account);
82
98
  }
83
99
 
84
100
 
85
- // TODO check component - service - instance version match
86
- modifier onlyComponent() {
87
- if (! getRegistry().isRegisteredComponent(msg.sender)) {
88
- revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
89
- }
90
- _;
101
+ /// @inheritdoc IInstanceService
102
+ function revokeRole(RoleId roleId, address account)
103
+ external
104
+ restricted()
105
+ onlyInstance()
106
+ {
107
+ IInstance instance = IInstance(msg.sender);
108
+ instance.getInstanceAdmin().revokeRole(roleId, account);
91
109
  }
92
110
 
93
- function createInstance()
111
+
112
+ /// @inheritdoc IInstanceService
113
+ function createTarget(address target, string memory name)
114
+ external
115
+ restricted()
116
+ onlyInstance()
117
+ returns (RoleId contractRoleId)
118
+ {
119
+ IInstance instance = IInstance(msg.sender);
120
+ return instance.getInstanceAdmin().createTarget(target, name);
121
+ }
122
+
123
+
124
+ /// @inheritdoc IInstanceService
125
+ function authorizeFunctions(
126
+ address target,
127
+ RoleId roleId,
128
+ IAccess.FunctionInfo[] memory functions
129
+ )
94
130
  external
95
131
  restricted()
132
+ onlyInstance()
133
+ {
134
+ IInstance instance = IInstance(msg.sender);
135
+ return instance.getInstanceAdmin().authorizeFunctions(target, roleId, functions);
136
+ }
137
+
138
+
139
+ /// @inheritdoc IInstanceService
140
+ function unauthorizeFunctions(
141
+ address target,
142
+ IAccess.FunctionInfo[] memory functions
143
+ )
144
+ external
145
+ restricted()
146
+ onlyInstance()
147
+ {
148
+ IInstance instance = IInstance(msg.sender);
149
+ return instance.getInstanceAdmin().unauthorizeFunctions(target, functions);
150
+ }
151
+
152
+
153
+ /// @inheritdoc IInstanceService
154
+ function setTargetLocked(address target, bool locked)
155
+ external
156
+ virtual
157
+ restricted()
158
+ onlyInstance()
159
+ {
160
+ address instanceAddress = msg.sender;
161
+ IInstance(instanceAddress).getInstanceAdmin().setTargetLocked(target, locked);
162
+ }
163
+
164
+
165
+ /// @inheritdoc IInstanceService
166
+ function setInstanceLocked(bool locked)
167
+ external
168
+ virtual
169
+ restricted()
170
+ onlyInstance()
171
+ {
172
+ address instanceAddress = msg.sender;
173
+ IInstance(instanceAddress).getInstanceAdmin().setInstanceLocked(locked);
174
+
175
+ emit LogInstanceServiceInstanceLocked(
176
+ getRegistry().getNftIdForAddress(instanceAddress),
177
+ locked);
178
+ }
179
+
180
+
181
+ /// @inheritdoc IInstanceService
182
+ function createInstance(bool allowAnyToken)
183
+ external
184
+ virtual
185
+ restricted()
96
186
  returns (
97
187
  IInstance instance,
98
188
  NftId instanceNftId
@@ -102,27 +192,32 @@ contract InstanceService is
102
192
  address instanceOwner = msg.sender;
103
193
 
104
194
  // create instance admin and instance
105
- InstanceAdmin instanceAdmin = _createInstanceAdmin();
106
- instance = _createInstance(instanceAdmin, instanceOwner);
195
+ InstanceAdmin instanceAdmin = _cloneNewInstanceAdmin();
196
+ instance = _createInstance(instanceAdmin, instanceOwner, allowAnyToken);
107
197
 
108
198
  // register cloned instance with registry
109
199
  instanceNftId = _registryService.registerInstance(
110
200
  instance, instanceOwner).nftId;
111
201
 
202
+ // MUST be set after instance is set up and registered
203
+ IAuthorization instanceAuthorization = InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization();
204
+ instanceAdmin.completeSetup(
205
+ address(getRegistry()),
206
+ address(instanceAuthorization),
207
+ getRelease(),
208
+ address(instance));
209
+
210
+ // hard checks for newly cloned instance
211
+ assert(address(instance.getRegistry()) == address(getRegistry()));
212
+ assert(instance.getRelease() == getRelease());
213
+
112
214
  // register cloned instance as staking target
113
215
  _stakingService.createInstanceTarget(
114
216
  instanceNftId,
115
217
  TargetManagerLib.getDefaultLockingPeriod(),
116
218
  TargetManagerLib.getDefaultRewardRate());
117
219
 
118
- // MUST be set after instance is set up and registered
119
- IAuthorization instanceAuthorization = InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization();
120
- VersionPart release = AccessManagerCloneable(authority()).getRelease();
121
- instanceAdmin.completeSetup(
122
- address(instance),
123
- address(instanceAuthorization));
124
-
125
- emit LogInstanceCloned(
220
+ emit LogInstanceServiceInstanceCreated(
126
221
  instanceNftId,
127
222
  address(instance));
128
223
  }
@@ -153,22 +248,35 @@ contract InstanceService is
153
248
  rewardRate);
154
249
  }
155
250
 
251
+ function setStakingMaxAmount(Amount maxStakedAmount)
252
+ external
253
+ virtual
254
+ restricted()
255
+ onlyInstance()
256
+ {
257
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
258
+ _stakingService.setInstanceMaxStakedAmount(
259
+ instanceNftId,
260
+ maxStakedAmount);
261
+ }
262
+
156
263
 
157
- function refillStakingRewardReserves(address rewardProvider, Amount dipAmount)
264
+ function refillInstanceRewardReserves(address rewardProvider, Amount dipAmount)
158
265
  external
159
266
  virtual
160
267
  restricted()
161
268
  onlyInstance()
269
+ returns (Amount newBalance)
162
270
  {
163
271
  NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
164
- _stakingService.refillInstanceRewardReserves(
272
+ newBalance = _stakingService.refillInstanceRewardReserves(
165
273
  instanceNftId,
166
274
  rewardProvider,
167
275
  dipAmount);
168
276
  }
169
277
 
170
278
 
171
- function withdrawStakingRewardReserves(Amount dipAmount)
279
+ function withdrawInstanceRewardReserves(Amount dipAmount)
172
280
  external
173
281
  virtual
174
282
  restricted()
@@ -176,29 +284,36 @@ contract InstanceService is
176
284
  returns (Amount newBalance)
177
285
  {
178
286
  NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
179
- _stakingService.withdrawInstanceRewardReserves(
287
+ newBalance = _stakingService.withdrawInstanceRewardReserves(
180
288
  instanceNftId,
181
289
  dipAmount);
182
290
  }
183
291
 
184
- function upgradeInstanceReader(NftId instanceNftId)
292
+
293
+ function upgradeInstanceReader()
185
294
  external
186
- nonReentrant()
295
+ virtual
187
296
  restricted()
188
- onlyInstanceOwner(instanceNftId)
189
- onlyNftOfType(instanceNftId, INSTANCE())
297
+ onlyInstance()
190
298
  {
191
- IRegistry registry = getRegistry();
192
- IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
193
- Instance instance = Instance(instanceInfo.objectAddress);
299
+ address instanceAddress = msg.sender;
300
+ IInstance instance = IInstance(msg.sender);
194
301
 
195
- InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
196
- upgradedInstanceReaderClone.initializeWithInstance(address(instance));
302
+ InstanceReader upgradedInstanceReaderClone = InstanceReader(
303
+ Clones.clone(address(_masterInstanceReader)));
304
+
305
+ upgradedInstanceReaderClone.initializeWithInstance(instanceAddress);
197
306
  instance.setInstanceReader(upgradedInstanceReaderClone);
307
+
308
+ emit LogInstanceServiceInstanceReaderUpgraded(
309
+ getRegistry().getNftIdForAddress(instanceAddress),
310
+ address(upgradedInstanceReaderClone));
198
311
  }
199
312
 
313
+
200
314
  function setAndRegisterMasterInstance(address instanceAddress)
201
315
  external
316
+ virtual
202
317
  onlyOwner()
203
318
  returns(NftId masterInstanceNftId)
204
319
  {
@@ -249,8 +364,10 @@ contract InstanceService is
249
364
  masterInstanceNftId = info.nftId;
250
365
  }
251
366
 
367
+
252
368
  function upgradeMasterInstanceReader(address instanceReaderAddress)
253
369
  external
370
+ virtual
254
371
  onlyOwner
255
372
  {
256
373
  if(_masterInstanceReader == address(0)) { revert ErrorInstanceServiceMasterInstanceReaderNotSet(); }
@@ -261,30 +378,37 @@ contract InstanceService is
261
378
  if(instanceReader.getInstance() != IInstance(_masterInstance)) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch(); }
262
379
 
263
380
  _masterInstanceReader = instanceReaderAddress;
381
+
382
+ emit LogInstanceServiceMasterInstanceReaderUpgraded(
383
+ getRegistry().getNftIdForAddress(_masterInstance),
384
+ instanceReaderAddress);
264
385
  }
265
386
 
266
- function getMasterInstanceReader() external view returns (address) {
387
+ function getMasterInstanceReader() external virtual view returns (address) {
267
388
  return _masterInstanceReader;
268
389
  }
269
390
 
391
+ //--- internal functions --------------------------------------------------------//
392
+
270
393
  /// @dev create new cloned instance admin
271
394
  /// function used to setup a new instance
272
- function _createInstanceAdmin()
395
+ function _cloneNewInstanceAdmin()
273
396
  internal
274
397
  virtual
275
- returns (InstanceAdmin clonedInstanceAdmin)
398
+ returns (InstanceAdmin clonedAdmin)
276
399
  {
277
- // start with setting up a new OZ access manager
278
- // TODO consider _masterInstanceAdmin.authority() instead of _masterAccessManager
400
+ // clone instance specific access manager
279
401
  AccessManagerCloneable clonedAccessManager = AccessManagerCloneable(
280
- Clones.clone(_masterAccessManager));
402
+ Clones.clone(
403
+ InstanceAdmin(_masterInstanceAdmin).authority()));
281
404
 
282
405
  // set up the instance admin
283
- clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
284
- clonedInstanceAdmin.initialize(
285
- clonedAccessManager,
286
- getRegistry(),
287
- getRelease());
406
+ clonedAdmin = InstanceAdmin(
407
+ Clones.clone(_masterInstanceAdmin));
408
+
409
+ clonedAdmin.initialize(
410
+ address(clonedAccessManager),
411
+ "InstanceAdmin");
288
412
  }
289
413
 
290
414
 
@@ -292,61 +416,31 @@ contract InstanceService is
292
416
  /// function used to setup a new instance
293
417
  function _createInstance(
294
418
  InstanceAdmin instanceAdmin,
295
- address instanceOwner
419
+ address instanceOwner,
420
+ bool allowAnyToken
296
421
  )
297
422
  internal
298
423
  virtual
299
424
  returns (IInstance)
300
425
  {
301
- InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
302
- BundleSet clonedBundleSet = BundleSet(Clones.clone(_masterInstanceBundleSet));
303
- RiskSet clonedRiskSet = RiskSet(Clones.clone(_masterInstanceRiskSet));
304
- InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
305
-
306
426
  // clone instance
307
427
  Instance clonedInstance = Instance(Clones.clone(_masterInstance));
308
428
  clonedInstance.initialize(
309
429
  instanceAdmin,
310
- clonedInstanceStore,
311
- clonedBundleSet,
312
- clonedRiskSet,
313
- clonedInstanceReader,
430
+ InstanceStore(Clones.clone(address(_masterInstanceStore))),
431
+ BundleSet(Clones.clone(_masterInstanceBundleSet)),
432
+ RiskSet(Clones.clone(_masterInstanceRiskSet)),
433
+ InstanceReader(Clones.clone(address(_masterInstanceReader))),
314
434
  getRegistry(),
315
- instanceOwner);
435
+ getRelease(),
436
+ instanceOwner,
437
+ allowAnyToken);
438
+
316
439
  return clonedInstance;
317
440
  }
318
441
 
319
442
 
320
- /// all gif targets MUST be children of instanceNftId
321
- function _createGifTarget(
322
- NftId instanceNftId,
323
- address targetAddress,
324
- string memory targetName,
325
- RoleId[] memory roles,
326
- bytes4[][] memory selectors
327
- )
328
- internal
329
- virtual
330
- {
331
- // TODO instanceAdmin will check target instance match anyway
332
- (
333
- IInstance instance, // or instanceInfo
334
- // or targetInfo
335
- ) = _validateInstanceAndComponent(instanceNftId, targetAddress);
336
-
337
- InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
338
-
339
- // TODO refactor/implement
340
- // instanceAdmin.createGifTarget(targetAddress, targetName);
341
-
342
- // set proposed target config
343
- for(uint roleIdx = 0; roleIdx < roles.length; roleIdx++) {
344
- // TODO refactor/implement
345
- // instanceAdmin.setTargetFunctionRoleByService(targetName, selectors[roleIdx], roles[roleIdx]);
346
- }
347
- }
348
-
349
- /// @dev top level initializer
443
+ /// @dev top level initializer (upgradable contract)
350
444
  function _initialize(
351
445
  address owner,
352
446
  bytes memory data
@@ -370,33 +464,35 @@ contract InstanceService is
370
464
  }
371
465
 
372
466
 
373
- function _validateInstanceAndComponent(NftId instanceNftId, address componentAddress)
467
+ function _checkInstance(
468
+ address instanceAddress,
469
+ VersionPart expectedRelease
470
+ )
374
471
  internal
472
+ virtual
375
473
  view
376
- returns (IInstance instance, NftId componentNftId)
377
474
  {
378
475
  IRegistry registry = getRegistry();
379
- IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
380
- if(instanceInfo.objectType != INSTANCE()) {
381
- revert ErrorInstanceServiceNotInstanceNftId(instanceNftId);
476
+
477
+ NftId instanceNftId = registry.getNftIdForAddress(instanceAddress);
478
+ if (instanceNftId.eqz()) {
479
+ revert ErrorInstanceServiceNotRegistered(instanceAddress);
382
480
  }
383
481
 
384
- if (registry.getNftIdForAddress(componentAddress).gtz()) {
385
- IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
482
+ ObjectType objectType = registry.getObjectInfo(instanceNftId).objectType;
483
+ if (objectType != INSTANCE()) {
484
+ revert ErrorInstanceServiceNotInstance(instanceAddress, objectType);
485
+ }
386
486
 
387
- if(componentInfo.parentNftId != instanceNftId) {
388
- revert ErrorInstanceServiceInstanceComponentMismatch(instanceNftId, componentInfo.nftId);
487
+ if (expectedRelease.gtz()) {
488
+ VersionPart instanceRelease = IInstance(instanceAddress).getRelease();
489
+ if (instanceRelease != expectedRelease) {
490
+ revert ErrorInstanceServiceInstanceVersionMismatch(instanceNftId, expectedRelease, instanceRelease);
389
491
  }
390
-
391
- componentNftId = componentInfo.nftId;
392
- } else {
393
-
394
492
  }
395
-
396
- instance = Instance(instanceInfo.objectAddress);
397
-
398
493
  }
399
494
 
495
+
400
496
  // From IService
401
497
  function _getDomain() internal pure override returns(ObjectType) {
402
498
  return INSTANCE();
@@ -19,7 +19,6 @@ contract RiskSet is
19
19
  event LogRiskSetRiskAdded(NftId productNftId, RiskId riskId);
20
20
  event LogRiskSetRiskActive(NftId poolNftId, RiskId riskId);
21
21
  event LogRiskSetRiskPaused(NftId poolNftId, RiskId riskId);
22
- event LogRiskSetRiskArchived(NftId poolNftId, RiskId riskId);
23
22
 
24
23
  error ErrorRiskSetRiskLocked(RiskId riskId, NftId policyNftId);
25
24
  error ErrorRiskSetRiskUnknown(RiskId riskId);
@@ -73,7 +72,7 @@ contract RiskSet is
73
72
  }
74
73
 
75
74
  /// @dev Applications linked to paused/archived risks may not be underwritten
76
- function pause(RiskId riskId) external restricted() {
75
+ function deactivate(RiskId riskId) external restricted() {
77
76
  NftId productNftId = ObjectSetHelperLib.getProductNftId(_instanceAddress, riskId);
78
77
  _deactivate(productNftId, riskId.toKey32());
79
78
  emit LogRiskSetRiskPaused(productNftId, riskId);
@@ -92,6 +91,15 @@ contract RiskSet is
92
91
  }
93
92
  }
94
93
 
94
+ function hasRisk(NftId productNftId, RiskId riskId)
95
+ public
96
+ view
97
+ returns (bool)
98
+ {
99
+ Key32 riskKey32 = riskId.toKey32();
100
+ return _contains(productNftId, riskKey32);
101
+ }
102
+
95
103
  function risks(NftId productNftId) external view returns(uint256) {
96
104
  return _objects(productNftId);
97
105
  }
@@ -24,13 +24,12 @@ contract BalanceStore {
24
24
  mapping(NftId nftId => Amount balance) private _balanceAmount;
25
25
  mapping(NftId nftId => Amount locked) private _lockedAmount;
26
26
  mapping(NftId nftId => Amount fees) private _feeAmount;
27
- mapping(NftId nftId => bool isRegistered) private _isRegistered;
28
27
 
29
- // TODO check if this is made redundant by *Info struct updates
28
+ // used to indicate if the target has been registered as well as when it was last updated (not used externally atm)
30
29
  mapping(NftId nftId => Blocknumber lastUpdatedIn) private _lastUpdatedIn;
31
30
 
32
31
  modifier onlyRegisteredTarget(NftId targetNftId) {
33
- if (!_isRegistered[targetNftId]) {
32
+ if (!_lastUpdatedIn[targetNftId].gtz()) {
34
33
  revert ErrorBalanceStoreTargetNotRegistered(targetNftId);
35
34
  }
36
35
  _;
@@ -55,11 +54,10 @@ contract BalanceStore {
55
54
  }
56
55
 
57
56
  function _registerBalanceTarget(NftId targetNftId) internal {
58
- if (_isRegistered[targetNftId]) {
57
+ if (_lastUpdatedIn[targetNftId].gtz()) {
59
58
  revert ErrorBalanceStoreTargetAlreadyRegistered(targetNftId);
60
59
  }
61
60
 
62
- _isRegistered[targetNftId] = true;
63
61
  _setLastUpdatedIn(targetNftId);
64
62
 
65
63
  emit LogBalanceStoreTargetRegistered(targetNftId);
@@ -118,6 +116,6 @@ contract BalanceStore {
118
116
 
119
117
  //--- internal/private functions ----------------------------------------//
120
118
  function _setLastUpdatedIn(NftId targetNftId) internal {
121
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
119
+ _lastUpdatedIn[targetNftId] = BlocknumberLib.current();
122
120
  }
123
121
  }
@@ -44,10 +44,7 @@ contract ObjectLifecycle is
44
44
 
45
45
  function _setupBundleLifecycle() private {
46
46
  setInitialState(BUNDLE(), ACTIVE());
47
- setStateTransition(BUNDLE(), ACTIVE(), PAUSED());
48
47
  setStateTransition(BUNDLE(), ACTIVE(), CLOSED());
49
- setStateTransition(BUNDLE(), PAUSED(), ACTIVE());
50
- setStateTransition(BUNDLE(), PAUSED(), CLOSED());
51
48
  }
52
49
 
53
50
  function _setupPolicyLifecycle() private {
@@ -69,6 +66,7 @@ contract ObjectLifecycle is
69
66
  setStateTransition(CLAIM(), SUBMITTED(), CONFIRMED());
70
67
  setStateTransition(CLAIM(), SUBMITTED(), DECLINED());
71
68
  setStateTransition(CLAIM(), CONFIRMED(), CLOSED());
69
+ setStateTransition(CLAIM(), CONFIRMED(), CANCELLED());
72
70
  }
73
71
 
74
72
  function _setupPayoutLifecycle() private {
@@ -79,9 +77,7 @@ contract ObjectLifecycle is
79
77
 
80
78
  function _setupRiskLifecycle() private {
81
79
  setInitialState(RISK(), ACTIVE());
82
- setStateTransition(RISK(), ACTIVE(), PAUSED());
83
- setStateTransition(RISK(), PAUSED(), ACTIVE());
84
- setStateTransition(RISK(), PAUSED(), ARCHIVED());
80
+ setStateTransition(RISK(), ACTIVE(), CLOSED());
85
81
  }
86
82
 
87
83
  function _setupRequestLifecycle() private {
@@ -1,20 +1,21 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Amount} from "../../type/Amount.sol";
5
4
  import {NftId} from "../../type/NftId.sol";
6
5
  import {Fee} from "../../type/Fee.sol";
7
- import {Seconds} from "../../type/Seconds.sol";
8
6
  import {Timestamp} from "../../type/Timestamp.sol";
9
7
 
10
8
  interface IBundle {
11
9
 
12
10
  struct BundleInfo {
13
- NftId poolNftId;
14
- Fee fee; // bundle fee on net premium amounts
15
- bytes filter; // required conditions for applications to be considered for collateralization by this bundle
11
+ // slot 0
16
12
  Timestamp activatedAt;
17
13
  Timestamp expiredAt; // no new policies starting with this timestamp
18
14
  Timestamp closedAt; // no open policies, locked amount = 0
15
+ NftId poolNftId;
16
+ // slot 1
17
+ Fee fee; // bundle fee on net premium amounts
18
+ // slot 2
19
+ bytes filter; // required conditions for applications to be considered for collateralization by this bundle
19
20
  }
20
21
  }