@etherisc/gif-next 0.0.2-e769e2e-077 → 0.0.2-e79d227-681

Sign up to get free protection for your applications and to get access to all the features.
Files changed (535) hide show
  1. package/README.md +77 -10
  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/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
  5. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
  6. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +4 -0
  7. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +1206 -0
  8. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +4 -0
  9. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +414 -0
  10. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
  11. package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
  12. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
  13. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1060 -0
  14. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +4 -0
  15. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +295 -0
  16. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
  17. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +167 -0
  18. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
  19. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +1196 -0
  20. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
  21. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +253 -0
  22. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +4 -0
  23. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +1324 -0
  24. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +4 -0
  25. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +470 -0
  26. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +154 -546
  28. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +380 -229
  30. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +198 -96
  32. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +186 -238
  34. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  35. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +223 -47
  36. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
  37. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
  38. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
  39. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1429 -0
  40. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  41. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +502 -0
  42. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  43. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1979 -0
  44. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  45. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -0
  46. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  47. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1430 -0
  50. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  51. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1177 -0
  52. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  53. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1606 -0
  54. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  55. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2281 -0
  56. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +4 -0
  57. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +808 -0
  58. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  59. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +153 -86
  60. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  61. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +181 -119
  62. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  63. package/artifacts/contracts/instance/Instance.sol/Instance.json +174 -215
  64. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
  65. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +1666 -0
  66. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
  67. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +574 -0
  68. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +876 -160
  70. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +260 -268
  72. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +163 -81
  74. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +506 -338
  76. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
  77. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +810 -0
  78. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  79. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  80. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  81. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +0 -53
  82. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
  83. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
  84. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +4 -0
  85. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +223 -0
  86. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +4 -0
  87. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +181 -0
  88. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  89. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +8 -116
  90. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  91. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  92. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  93. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  94. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  95. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +4 -0
  96. package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
  97. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +4 -0
  98. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +961 -0
  99. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +4 -0
  100. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +478 -0
  101. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
  102. package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +52 -0
  103. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
  104. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +776 -0
  105. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
  106. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +709 -0
  107. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
  108. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +877 -0
  109. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
  110. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +990 -0
  111. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
  112. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +766 -0
  113. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +4 -0
  114. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +1254 -0
  115. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +4 -0
  116. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +502 -0
  117. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  118. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +456 -187
  119. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  120. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +218 -80
  121. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  122. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +264 -26
  123. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  124. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +115 -354
  125. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  126. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +464 -223
  127. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  128. package/artifacts/contracts/pool/Pool.sol/Pool.json +152 -682
  129. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  130. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +590 -382
  131. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  132. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +190 -76
  133. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  134. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +147 -161
  135. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  136. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +147 -77
  137. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +4 -0
  138. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +1148 -0
  139. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +4 -0
  140. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +470 -0
  141. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  142. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +343 -168
  143. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  144. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +200 -90
  145. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  146. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +88 -8
  147. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  148. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +196 -7
  149. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  150. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +364 -121
  151. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  152. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +134 -86
  153. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  154. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +176 -160
  155. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  156. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +51 -3
  157. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  158. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +475 -294
  159. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  160. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +199 -81
  161. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  162. package/artifacts/contracts/product/PricingService.sol/PricingService.json +229 -275
  163. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  164. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +172 -102
  165. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  166. package/artifacts/contracts/product/Product.sol/Product.json +201 -486
  167. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  168. package/artifacts/contracts/product/RiskService.sol/RiskService.json +638 -0
  169. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  170. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +718 -0
  171. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  172. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  173. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  174. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +412 -35
  175. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  176. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +225 -196
  177. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  178. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
  179. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  180. package/artifacts/contracts/registry/Registry.sol/Registry.json +761 -87
  181. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
  182. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1899 -0
  183. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  184. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +278 -306
  185. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  186. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +154 -78
  187. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +4 -0
  188. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +205 -0
  189. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +4 -0
  190. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +1067 -0
  191. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
  192. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +272 -0
  193. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  194. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +185 -135
  195. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  196. package/artifacts/contracts/shared/Component.sol/Component.json +79 -274
  197. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  198. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +626 -252
  199. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  200. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +209 -99
  201. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  202. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +55 -101
  203. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  204. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +488 -0
  205. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
  206. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
  207. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
  208. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
  209. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  210. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +74 -79
  211. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  212. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +561 -13
  213. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  214. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +120 -108
  215. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  216. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +45 -13
  217. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  218. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +34 -3
  219. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  220. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +23 -1
  221. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  222. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +16 -30
  223. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  224. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +36 -1
  225. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  226. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  227. package/artifacts/contracts/shared/IService.sol/IService.json +49 -1
  228. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
  229. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
  230. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  231. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +129 -360
  232. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  233. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +55 -98
  234. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  235. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -62
  236. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +4 -0
  237. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +306 -0
  238. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  239. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +26 -55
  240. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  241. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +20 -124
  242. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  243. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +62 -87
  244. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  245. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  246. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  247. package/artifacts/contracts/shared/Service.sol/Service.json +55 -101
  248. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  249. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +697 -25
  250. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
  251. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +395 -0
  252. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
  253. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +172 -0
  254. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  255. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +462 -634
  256. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  257. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +546 -48
  258. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
  259. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +440 -0
  260. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  261. package/artifacts/contracts/staking/Staking.sol/Staking.json +613 -871
  262. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +4 -0
  263. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +205 -0
  264. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  265. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +185 -81
  266. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
  267. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +587 -0
  268. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  269. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +633 -173
  270. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  271. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +166 -68
  272. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
  273. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2283 -0
  274. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
  275. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +607 -0
  276. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  277. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
  278. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/Amount.sol/AmountLib.json +121 -4
  280. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +40 -2
  282. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  284. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +4 -4
  286. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/Fee.sol/FeeLib.json +17 -12
  288. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  289. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  290. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +4 -0
  291. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
  292. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +47 -4
  294. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  295. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  296. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  297. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +149 -2
  298. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  300. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
  302. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
  303. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
  304. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  305. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +99 -5
  306. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  307. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +219 -6
  308. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  309. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +124 -2
  310. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
  311. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
  312. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
  313. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
  314. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  315. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
  316. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
  317. package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
  318. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  319. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +36 -4
  320. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  321. package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
  322. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  323. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +71 -2
  324. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  325. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  326. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  327. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +21 -2
  328. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +4 -0
  329. package/artifacts/contracts/{shared → upgradeability}/IVersionable.sol/IVersionable.json +1 -1
  330. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +4 -0
  331. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +618 -0
  332. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
  333. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
  334. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +4 -0
  335. package/artifacts/contracts/{shared → upgradeability}/Versionable.sol/Versionable.json +1 -1
  336. package/contracts/authorization/AccessAdmin.sol +616 -0
  337. package/contracts/authorization/AccessManagerCloneable.sol +16 -0
  338. package/contracts/authorization/Authorization.sol +289 -0
  339. package/contracts/authorization/IAccess.sol +49 -0
  340. package/contracts/authorization/IAccessAdmin.sol +137 -0
  341. package/contracts/authorization/IAuthorization.sol +60 -0
  342. package/contracts/authorization/IServiceAuthorization.sol +40 -0
  343. package/contracts/authorization/ReleaseAccessManager.sol +38 -0
  344. package/contracts/authorization/ServiceAuthorization.sol +106 -0
  345. package/contracts/distribution/BasicDistribution.sol +139 -0
  346. package/contracts/distribution/BasicDistributionAuthorization.sol +47 -0
  347. package/contracts/distribution/Distribution.sol +145 -124
  348. package/contracts/distribution/DistributionService.sol +156 -99
  349. package/contracts/distribution/DistributionServiceManager.sol +13 -25
  350. package/contracts/distribution/IDistributionComponent.sol +27 -41
  351. package/contracts/distribution/IDistributionService.sol +29 -10
  352. package/contracts/examples/fire/DamageLevel.sol +59 -0
  353. package/contracts/examples/fire/FirePool.sol +86 -0
  354. package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
  355. package/contracts/examples/fire/FireProduct.sol +431 -0
  356. package/contracts/examples/fire/FireProductAuthorization.sol +44 -0
  357. package/contracts/examples/fire/FireUSD.sol +26 -0
  358. package/contracts/examples/unpermissioned/SimpleDistribution.sol +58 -0
  359. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  360. package/contracts/examples/unpermissioned/SimplePool.sol +108 -0
  361. package/contracts/examples/unpermissioned/SimpleProduct.sol +345 -0
  362. package/contracts/instance/BundleSet.sol +130 -0
  363. package/contracts/instance/IInstance.sol +39 -44
  364. package/contracts/instance/IInstanceService.sol +33 -42
  365. package/contracts/instance/Instance.sol +137 -124
  366. package/contracts/instance/InstanceAdmin.sol +278 -0
  367. package/contracts/instance/InstanceAuthorizationV3.sol +217 -0
  368. package/contracts/instance/InstanceReader.sol +249 -36
  369. package/contracts/instance/InstanceService.sol +227 -151
  370. package/contracts/instance/InstanceServiceManager.sol +14 -29
  371. package/contracts/instance/InstanceStore.sol +85 -57
  372. package/contracts/instance/RiskSet.sol +119 -0
  373. package/contracts/instance/base/BalanceStore.sol +12 -7
  374. package/contracts/instance/base/Cloneable.sol +2 -25
  375. package/contracts/instance/base/ObjectCounter.sol +21 -0
  376. package/contracts/instance/base/ObjectLifecycle.sol +111 -0
  377. package/contracts/instance/base/ObjectSet.sol +78 -0
  378. package/contracts/instance/module/IAccess.sol +2 -10
  379. package/contracts/instance/module/IBundle.sol +1 -1
  380. package/contracts/instance/module/IComponents.sol +11 -13
  381. package/contracts/instance/module/IDistribution.sol +0 -1
  382. package/contracts/instance/module/IPolicy.sol +26 -25
  383. package/contracts/instance/module/IRisk.sol +1 -0
  384. package/contracts/mock/Dip.sol +26 -0
  385. package/contracts/oracle/BasicOracle.sol +47 -0
  386. package/contracts/oracle/BasicOracleAuthorization.sol +46 -0
  387. package/contracts/oracle/IOracle.sol +36 -0
  388. package/contracts/oracle/IOracleComponent.sol +33 -0
  389. package/contracts/oracle/IOracleService.sol +66 -0
  390. package/contracts/oracle/Oracle.sol +156 -0
  391. package/contracts/oracle/OracleService.sol +309 -0
  392. package/contracts/oracle/OracleServiceManager.sol +39 -0
  393. package/contracts/pool/BasicPool.sol +175 -0
  394. package/contracts/pool/BasicPoolAuthorization.sol +68 -0
  395. package/contracts/pool/BundleService.sol +232 -122
  396. package/contracts/pool/BundleServiceManager.sol +13 -25
  397. package/contracts/pool/IBundleService.sol +34 -18
  398. package/contracts/pool/IPoolComponent.sol +20 -70
  399. package/contracts/pool/IPoolService.sol +57 -51
  400. package/contracts/pool/Pool.sol +208 -162
  401. package/contracts/pool/PoolService.sol +372 -181
  402. package/contracts/pool/PoolServiceManager.sol +12 -24
  403. package/contracts/product/ApplicationService.sol +90 -84
  404. package/contracts/product/ApplicationServiceManager.sol +12 -9
  405. package/contracts/product/BasicProduct.sol +49 -0
  406. package/contracts/product/BasicProductAuthorization.sol +42 -0
  407. package/contracts/product/ClaimService.sol +331 -153
  408. package/contracts/product/ClaimServiceManager.sol +12 -9
  409. package/contracts/product/IApplicationService.sol +7 -3
  410. package/contracts/product/IClaimService.sol +35 -5
  411. package/contracts/product/IPolicyService.sol +47 -35
  412. package/contracts/product/IPricingService.sol +11 -11
  413. package/contracts/product/IProductComponent.sol +26 -9
  414. package/contracts/product/{IProductService.sol → IRiskService.sol} +2 -2
  415. package/contracts/product/PolicyService.sol +524 -262
  416. package/contracts/product/PolicyServiceManager.sol +12 -27
  417. package/contracts/product/PricingService.sol +64 -64
  418. package/contracts/product/PricingServiceManager.sol +12 -24
  419. package/contracts/product/Product.sol +189 -139
  420. package/contracts/product/{ProductService.sol → RiskService.sol} +35 -50
  421. package/contracts/product/RiskServiceManager.sol +39 -0
  422. package/contracts/registry/ChainNft.sol +68 -37
  423. package/contracts/registry/IRegistry.sol +90 -28
  424. package/contracts/registry/IRegistryService.sol +26 -43
  425. package/contracts/registry/ITransferInterceptor.sol +1 -2
  426. package/contracts/registry/Registry.sol +424 -228
  427. package/contracts/registry/RegistryAdmin.sol +451 -0
  428. package/contracts/registry/RegistryService.sol +63 -149
  429. package/contracts/registry/RegistryServiceManager.sol +23 -30
  430. package/contracts/registry/ReleaseLifecycle.sol +30 -0
  431. package/contracts/registry/ReleaseRegistry.sol +485 -0
  432. package/contracts/registry/ServiceAuthorizationV3.sol +175 -0
  433. package/contracts/registry/TokenRegistry.sol +187 -59
  434. package/contracts/shared/Component.sol +56 -125
  435. package/contracts/shared/ComponentService.sol +411 -201
  436. package/contracts/shared/ComponentServiceManager.sol +10 -7
  437. package/contracts/shared/ComponentVerifyingService.sol +40 -23
  438. package/contracts/shared/ContractLib.sol +224 -0
  439. package/contracts/shared/IComponent.sol +11 -18
  440. package/contracts/shared/IComponentService.sol +52 -13
  441. package/contracts/shared/IInstanceLinkedComponent.sol +11 -16
  442. package/contracts/shared/IKeyValueStore.sol +2 -1
  443. package/contracts/shared/ILifecycle.sol +3 -2
  444. package/contracts/shared/INftOwnable.sol +3 -1
  445. package/contracts/shared/IPolicyHolder.sol +12 -17
  446. package/contracts/shared/IRegisterable.sol +11 -0
  447. package/contracts/shared/IService.sol +9 -2
  448. package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +4 -4
  449. package/contracts/shared/InstanceLinkedComponent.sol +103 -43
  450. package/contracts/shared/KeyValueStore.sol +30 -68
  451. package/contracts/shared/Lifecycle.sol +30 -63
  452. package/contracts/shared/NftIdSet.sol +65 -0
  453. package/contracts/shared/NftOwnable.sol +31 -22
  454. package/contracts/shared/PolicyHolder.sol +18 -50
  455. package/contracts/shared/Registerable.sol +19 -11
  456. package/contracts/shared/RegistryLinked.sol +9 -14
  457. package/contracts/shared/Service.sol +44 -37
  458. package/contracts/shared/TokenHandler.sol +358 -27
  459. package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
  460. package/contracts/staking/IStaking.sol +133 -37
  461. package/contracts/staking/IStakingService.sol +93 -41
  462. package/contracts/staking/StakeManagerLib.sol +224 -0
  463. package/contracts/staking/Staking.sol +394 -101
  464. package/contracts/staking/StakingLifecycle.sol +23 -0
  465. package/contracts/staking/StakingManager.sol +24 -18
  466. package/contracts/staking/StakingReader.sol +190 -0
  467. package/contracts/staking/StakingService.sol +282 -42
  468. package/contracts/staking/StakingServiceManager.sol +10 -7
  469. package/contracts/staking/StakingStore.sol +605 -0
  470. package/contracts/staking/TargetManagerLib.sol +211 -0
  471. package/contracts/type/AddressSet.sol +1 -1
  472. package/contracts/type/Amount.sol +39 -3
  473. package/contracts/type/Blocknumber.sol +20 -2
  474. package/contracts/type/ClaimId.sol +6 -1
  475. package/contracts/type/Fee.sol +1 -1
  476. package/contracts/type/Key32.sol +2 -2
  477. package/contracts/type/Key32Set.sol +62 -0
  478. package/contracts/type/NftId.sol +16 -4
  479. package/contracts/type/NftIdSet.sol +1 -1
  480. package/contracts/type/ObjectType.sol +178 -65
  481. package/contracts/type/PayoutId.sol +10 -10
  482. package/contracts/type/Referral.sol +2 -1
  483. package/contracts/type/RequestId.sol +75 -0
  484. package/contracts/type/RiskId.sol +31 -5
  485. package/contracts/type/RoleId.sol +98 -74
  486. package/contracts/type/Seconds.sol +48 -1
  487. package/contracts/type/Selector.sol +102 -0
  488. package/contracts/type/StateId.sol +41 -2
  489. package/contracts/type/String.sol +53 -0
  490. package/contracts/type/Timestamp.sol +17 -3
  491. package/contracts/type/UFixed.sol +38 -9
  492. package/contracts/type/Version.sol +4 -2
  493. package/contracts/{shared → upgradeability}/ProxyManager.sol +90 -27
  494. package/contracts/{shared → upgradeability}/UpgradableProxyWithAdmin.sol +1 -3
  495. package/contracts/{shared → upgradeability}/Versionable.sol +2 -2
  496. package/package.json +11 -7
  497. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +0 -4
  498. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +0 -778
  499. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +0 -4
  500. package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +0 -1348
  501. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +0 -4
  502. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +0 -132
  503. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +0 -4
  504. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +0 -256
  505. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  506. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  507. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -673
  508. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  509. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -636
  510. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +0 -4
  511. package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +0 -308
  512. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +0 -4
  513. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +0 -688
  514. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +0 -4
  515. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +0 -137
  516. package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
  517. package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
  518. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
  519. package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
  520. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +0 -4
  521. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +0 -4
  522. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +0 -569
  523. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +0 -4
  524. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +0 -129
  525. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +0 -4
  526. package/contracts/instance/BundleManager.sol +0 -126
  527. package/contracts/instance/InstanceAccessManager.sol +0 -543
  528. package/contracts/instance/InstanceAuthorizationsLib.sol +0 -336
  529. package/contracts/instance/base/ObjectManager.sol +0 -82
  530. package/contracts/product/ProductServiceManager.sol +0 -54
  531. package/contracts/registry/RegistryAccessManager.sol +0 -213
  532. package/contracts/registry/ReleaseManager.sol +0 -375
  533. package/contracts/registry/ServiceAuthorizationsLib.sol +0 -173
  534. package/contracts/shared/AccessManagerUpgradeableInitializeable.sol +0 -13
  535. /package/contracts/{shared → upgradeability}/IVersionable.sol +0 -0
@@ -4,15 +4,21 @@ pragma solidity ^0.8.20;
4
4
  import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
5
5
  import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
6
6
 
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";
7
12
  import {NftId} from "../type/NftId.sol";
8
13
  import {RoleId} from "../type/RoleId.sol";
9
- import {ADMIN_ROLE, INSTANCE_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE, INSTANCE_ROLE} from "../type/RoleId.sol";
10
- import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../type/ObjectType.sol";
14
+ import {SecondsLib} from "../type/Seconds.sol";
15
+ import {UFixed, UFixedLib} from "../type/UFixed.sol";
16
+ import {ADMIN_ROLE} from "../type/RoleId.sol";
17
+ import {ObjectType, INSTANCE, BUNDLE, APPLICATION, CLAIM, DISTRIBUTION, INSTANCE, POLICY, POOL, PRODUCT, REGISTRY, STAKING} from "../type/ObjectType.sol";
11
18
 
12
19
  import {Service} from "../shared/Service.sol";
13
20
  import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
14
21
  import {IService} from "../shared/IService.sol";
15
- import {AccessManagerUpgradeableInitializeable} from "../shared/AccessManagerUpgradeableInitializeable.sol";
16
22
 
17
23
  import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
18
24
  import {IPoolComponent} from "../pool/IPoolComponent.sol";
@@ -20,16 +26,18 @@ import {IProductComponent} from "../product/IProductComponent.sol";
20
26
 
21
27
  import {IRegistry} from "../registry/IRegistry.sol";
22
28
  import {IRegistryService} from "../registry/IRegistryService.sol";
23
- import {ChainNft} from "../registry/ChainNft.sol";
29
+ import {IStakingService} from "../staking/IStakingService.sol";
30
+ import {TargetManagerLib} from "../staking/TargetManagerLib.sol";
24
31
 
25
32
  import {Instance} from "./Instance.sol";
26
33
  import {IInstance} from "./IInstance.sol";
27
- import {InstanceAccessManager} from "./InstanceAccessManager.sol";
34
+ import {InstanceAdmin} from "./InstanceAdmin.sol";
28
35
  import {IInstanceService} from "./IInstanceService.sol";
29
36
  import {InstanceReader} from "./InstanceReader.sol";
30
- import {BundleManager} from "./BundleManager.sol";
31
37
  import {InstanceStore} from "./InstanceStore.sol";
32
- import {InstanceAuthorizationsLib} from "./InstanceAuthorizationsLib.sol";
38
+ import {Seconds} from "../type/Seconds.sol";
39
+ import {VersionPart, VersionPartLib} from "../type/Version.sol";
40
+
33
41
 
34
42
  contract InstanceService is
35
43
  Service,
@@ -40,13 +48,38 @@ contract InstanceService is
40
48
  bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
41
49
 
42
50
  IRegistryService internal _registryService;
43
- address internal _masterOzAccessManager;
44
- address internal _masterInstanceAccessManager;
51
+ IStakingService internal _stakingService;
52
+
53
+ address internal _masterAccessManager;
54
+ address internal _masterInstanceAdmin;
45
55
  address internal _masterInstance;
46
56
  address internal _masterInstanceReader;
47
- address internal _masterInstanceBundleManager;
57
+ address internal _masterInstanceBundleSet;
58
+ address internal _masterInstanceRiskSet;
48
59
  address internal _masterInstanceStore;
49
60
 
61
+
62
+ modifier onlyInstance() {
63
+ address instanceAddress = msg.sender;
64
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
65
+ if (instanceNftId.eqz()) {
66
+ revert ErrorInstanceServiceNotRegistered(instanceAddress);
67
+ }
68
+
69
+ ObjectType objectType = getRegistry().getObjectInfo(instanceNftId).objectType;
70
+ if (objectType != INSTANCE()) {
71
+ revert ErrorInstanceServiceNotInstance(instanceAddress, objectType);
72
+ }
73
+
74
+ VersionPart instanceVersion = IInstance(instanceAddress).getRelease();
75
+ if (instanceVersion != getVersion().toMajorPart()) {
76
+ revert ErrorInstanceServiceInstanceVersionMismatch(instanceAddress, instanceVersion);
77
+ }
78
+
79
+ _;
80
+ }
81
+
82
+
50
83
  modifier onlyInstanceOwner(NftId instanceNftId) {
51
84
  if(msg.sender != getRegistry().ownerOf(instanceNftId)) {
52
85
  revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
@@ -54,78 +87,101 @@ contract InstanceService is
54
87
  _;
55
88
  }
56
89
 
90
+ // TODO check component - service - instance version match
91
+ modifier onlyComponent() {
92
+ if (! getRegistry().isRegisteredComponent(msg.sender)) {
93
+ revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
94
+ }
95
+ _;
96
+ }
57
97
 
58
- function createInstanceClone()
98
+ function createInstance()
59
99
  external
60
100
  returns (
61
- Instance clonedInstance,
62
- NftId clonedInstanceNftId
101
+ IInstance instance,
102
+ NftId instanceNftId
63
103
  )
64
104
  {
105
+ // tx sender will become instance owner
65
106
  address instanceOwner = msg.sender;
66
- AccessManagerUpgradeableInitializeable clonedOzAccessManager = AccessManagerUpgradeableInitializeable(
67
- Clones.clone(_masterOzAccessManager));
68
107
 
69
- // initially grants ADMIN_ROLE to this (being the instance service).
70
- // This will allow the instance service to bootstrap the authorizations of the instance.
71
- // Instance service will not use oz access manager directlly but through instance access manager instead
72
- // Instance service will renounce ADMIN_ROLE when bootstraping is finished
73
- clonedOzAccessManager.initialize(address(this));
108
+ // create instance admin and instance
109
+ InstanceAdmin instanceAdmin = _createInstanceAdmin();
110
+ instance = _createInstance(instanceAdmin, instanceOwner);
74
111
 
75
- clonedInstance = Instance(Clones.clone(_masterInstance));
76
- clonedInstance.initialize(
77
- address(clonedOzAccessManager),
78
- address(getRegistry()),
79
- instanceOwner);
80
- // initialize and set before instance reader
81
- InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
82
- clonedInstanceStore.initialize(address(clonedInstance));
83
- clonedInstance.setInstanceStore(clonedInstanceStore);
84
-
85
- InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
86
- clonedInstanceReader.initialize(address(clonedInstance));
87
- clonedInstance.setInstanceReader(clonedInstanceReader);
88
-
89
- BundleManager clonedBundleManager = BundleManager(Clones.clone(_masterInstanceBundleManager));
90
- clonedBundleManager.initialize(address(clonedInstance));
91
- clonedInstance.setBundleManager(clonedBundleManager);
92
-
93
- InstanceAccessManager clonedInstanceAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
94
- clonedOzAccessManager.grantRole(ADMIN_ROLE().toInt(), address(clonedInstanceAccessManager), 0);
95
- clonedInstanceAccessManager.initialize(address(clonedInstance));
96
- clonedInstance.setInstanceAccessManager(clonedInstanceAccessManager);
97
-
98
- // TODO amend setters with instance specific , policy manager ...
99
-
100
- // TODO library does external calls -> but it is registry and access manager -> find out is it best practice
101
- InstanceAuthorizationsLib.grantInitialAuthorizations(
102
- clonedInstanceAccessManager,
103
- clonedInstance,
104
- clonedBundleManager,
105
- clonedInstanceStore,
106
- instanceOwner,
107
- getRegistry(),
108
- getVersion().toMajorPart());
112
+ // register cloned instance with registry
113
+ instanceNftId = _registryService.registerInstance(
114
+ instance, instanceOwner).nftId;
109
115
 
110
- clonedOzAccessManager.renounceRole(ADMIN_ROLE().toInt(), address(this));
116
+ // register cloned instance as staking target
117
+ _stakingService.createInstanceTarget(
118
+ instanceNftId,
119
+ TargetManagerLib.getDefaultLockingPeriod(),
120
+ TargetManagerLib.getDefaultRewardRate());
111
121
 
112
- IRegistry.ObjectInfo memory info = _registryService.registerInstance(clonedInstance, instanceOwner);
113
- clonedInstanceNftId = info.nftId;
122
+ // MUST be set after instance is set up and registered
123
+ instanceAdmin.initializeInstanceAuthorization(address(instance));
114
124
 
115
125
  emit LogInstanceCloned(
116
- address(clonedOzAccessManager),
117
- address(clonedInstanceAccessManager),
118
- address(clonedInstance),
119
- address(clonedInstanceStore),
120
- address(clonedBundleManager),
121
- address(clonedInstanceReader),
122
- clonedInstanceNftId);
126
+ instanceNftId,
127
+ address(instance));
128
+ }
129
+
130
+
131
+ function setStakingLockingPeriod(Seconds stakeLockingPeriod)
132
+ external
133
+ virtual
134
+ onlyInstance()
135
+ {
136
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
137
+ _stakingService.setInstanceLockingPeriod(
138
+ instanceNftId,
139
+ stakeLockingPeriod);
140
+ }
141
+
142
+
143
+ function setStakingRewardRate(UFixed rewardRate)
144
+ external
145
+ virtual
146
+ onlyInstance()
147
+ {
148
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
149
+ _stakingService.setInstanceRewardRate(
150
+ instanceNftId,
151
+ rewardRate);
152
+ }
153
+
154
+
155
+ function refillStakingRewardReserves(address rewardProvider, Amount dipAmount)
156
+ external
157
+ virtual
158
+ onlyInstance()
159
+ {
160
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
161
+ _stakingService.refillInstanceRewardReserves(
162
+ instanceNftId,
163
+ rewardProvider,
164
+ dipAmount);
165
+ }
166
+
167
+
168
+ function withdrawStakingRewardReserves(Amount dipAmount)
169
+ external
170
+ virtual
171
+ onlyInstance()
172
+ returns (Amount newBalance)
173
+ {
174
+ NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
175
+ _stakingService.withdrawInstanceRewardReserves(
176
+ instanceNftId,
177
+ dipAmount);
123
178
  }
124
179
 
125
180
 
126
181
  function setComponentLocked(bool locked)
127
182
  external
128
183
  virtual
184
+ onlyComponent()
129
185
  {
130
186
  // checks
131
187
  address componentAddress = msg.sender;
@@ -137,18 +193,14 @@ contract InstanceService is
137
193
  IRegistry registry = getRegistry();
138
194
  NftId instanceNftId = registry.getObjectInfo(componentAddress).parentNftId;
139
195
 
140
- if (instanceNftId.eqz()) {
141
- revert ErrorInstanceServiceComponentNotRegistered(componentAddress);
142
- }
143
-
144
196
  IInstance instance = IInstance(
145
- registry.getObjectInfo(
146
- instanceNftId).objectAddress);
197
+ registry.getObjectAddress(instanceNftId));
147
198
 
148
- // interaction
149
- instance.getInstanceAccessManager().setTargetLockedByService(
150
- componentAddress,
151
- locked);
199
+ // no revert in case already locked
200
+ // TODO refactor/implement
201
+ // instance.getInstanceAdmin().setTargetLockedByService(
202
+ // componentAddress,
203
+ // locked);
152
204
  }
153
205
 
154
206
 
@@ -156,49 +208,51 @@ contract InstanceService is
156
208
  return _masterInstanceReader;
157
209
  }
158
210
 
159
- // From IService
160
- function getDomain() public pure override returns(ObjectType) {
161
- return INSTANCE();
162
- }
163
-
164
211
  function setAndRegisterMasterInstance(address instanceAddress)
165
212
  external
166
213
  onlyOwner
167
214
  returns(NftId masterInstanceNftId)
168
215
  {
169
216
  if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
170
- if(_masterOzAccessManager != address(0)) { revert ErrorInstanceServiceMasterOzAccessManagerAlreadySet(); }
171
- if(_masterInstanceAccessManager != address(0)) { revert ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet(); }
172
- if(_masterInstanceBundleManager != address(0)) { revert ErrorInstanceServiceMasterBundleManagerAlreadySet(); }
173
-
217
+ if(_masterInstanceAdmin != address(0)) { revert ErrorInstanceServiceMasterInstanceAdminAlreadySet(); }
218
+ if(_masterInstanceBundleSet != address(0)) { revert ErrorInstanceServiceMasterBundleSetAlreadySet(); }
219
+ if(_masterInstanceRiskSet != address(0)) { revert ErrorInstanceServiceMasterRiskSetAlreadySet(); }
174
220
  if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
175
221
 
176
222
  IInstance instance = IInstance(instanceAddress);
177
- InstanceAccessManager instanceAccessManager = instance.getInstanceAccessManager();
178
- address instanceAccessManagerAddress = address(instanceAccessManager);
223
+ address accessManagerAddress = instance.authority();
224
+ InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
225
+ address instanceAdminAddress = address(instanceAdmin);
179
226
  InstanceReader instanceReader = instance.getInstanceReader();
180
227
  address instanceReaderAddress = address(instanceReader);
181
- BundleManager bundleManager = instance.getBundleManager();
182
- address bundleManagerAddress = address(bundleManager);
228
+ BundleSet bundleSet = instance.getBundleSet();
229
+ address bundleSetAddress = address(bundleSet);
230
+ RiskSet riskSet = instance.getRiskSet();
231
+ address riskSetAddress = address(riskSet);
183
232
  InstanceStore instanceStore = instance.getInstanceStore();
184
233
  address instanceStoreAddress = address(instanceStore);
185
234
 
186
- if(instanceAccessManagerAddress == address(0)) { revert ErrorInstanceServiceInstanceAccessManagerZero(); }
235
+ if(accessManagerAddress == address(0)) { revert ErrorInstanceServiceAccessManagerZero(); }
236
+ if(instanceAdminAddress == address(0)) { revert ErrorInstanceServiceInstanceAdminZero(); }
187
237
  if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
188
- if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
238
+ if(bundleSetAddress == address(0)) { revert ErrorInstanceServiceBundleSetZero(); }
239
+ if(riskSetAddress == address(0)) { revert ErrorInstanceServiceRiskSetZero(); }
189
240
  if(instanceStoreAddress == address(0)) { revert ErrorInstanceServiceInstanceStoreZero(); }
190
241
 
191
- if(instance.authority() != instanceAccessManager.authority()) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
192
- if(bundleManager.authority() != instanceAccessManager.authority()) { revert ErrorInstanceServiceBundleManagerAuthorityMismatch(); }
193
- if(instanceStore.authority() != instanceAccessManager.authority()) { revert ErrorInstanceServiceInstanceStoreAuthorityMismatch(); }
194
- if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
242
+ if(instance.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
243
+ if(bundleSet.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceBundleSetAuthorityMismatch(); }
244
+ if(riskSet.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceRiskSetAuthorityMismatch(); }
245
+ if(instanceStore.authority() != instanceAdmin.authority()) { revert ErrorInstanceServiceInstanceStoreAuthorityMismatch(); }
246
+ if(bundleSet.getInstance() != instance) { revert ErrorInstanceServiceBundleSetInstanceMismatch(); }
247
+ if(riskSet.getInstance() != instance) { revert ErrorInstanceServiceRiskSetInstanceMismatch(); }
195
248
  if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
196
249
 
197
- _masterOzAccessManager = instance.authority();
198
- _masterInstanceAccessManager = instanceAccessManagerAddress;
250
+ _masterAccessManager = accessManagerAddress;
251
+ _masterInstanceAdmin = instanceAdminAddress;
199
252
  _masterInstance = instanceAddress;
200
253
  _masterInstanceReader = instanceReaderAddress;
201
- _masterInstanceBundleManager = bundleManagerAddress;
254
+ _masterInstanceBundleSet = bundleSetAddress;
255
+ _masterInstanceRiskSet = riskSetAddress;
202
256
  _masterInstanceStore = instanceStoreAddress;
203
257
 
204
258
  IInstance masterInstance = IInstance(_masterInstance);
@@ -206,7 +260,7 @@ contract InstanceService is
206
260
  masterInstanceNftId = info.nftId;
207
261
  }
208
262
 
209
- function setMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
263
+ function upgradeMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
210
264
  if(_masterInstanceReader == address(0)) { revert ErrorInstanceServiceMasterInstanceReaderNotSet(); }
211
265
  if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderAddressZero(); }
212
266
  if(instanceReaderAddress == _masterInstanceReader) { revert ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader(); }
@@ -220,57 +274,67 @@ contract InstanceService is
220
274
  function upgradeInstanceReader(NftId instanceNftId)
221
275
  external
222
276
  onlyInstanceOwner(instanceNftId)
277
+ onlyNftOfType(instanceNftId, INSTANCE())
223
278
  {
224
279
  IRegistry registry = getRegistry();
225
280
  IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
226
281
  Instance instance = Instance(instanceInfo.objectAddress);
227
282
 
228
283
  InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
229
- upgradedInstanceReaderClone.initialize(address(instance));
284
+ upgradedInstanceReaderClone.initializeWithInstance(address(instance));
230
285
  instance.setInstanceReader(upgradedInstanceReaderClone);
231
286
  }
232
287
 
233
-
234
- function createGifTarget(
235
- NftId instanceNftId,
236
- address targetAddress,
237
- string memory targetName,
238
- bytes4[][] memory selectors,
239
- RoleId[] memory roles
240
- )
241
- external
288
+ /// @dev create new cloned instance admin
289
+ /// function used to setup a new instance
290
+ function _createInstanceAdmin()
291
+ internal
242
292
  virtual
243
- restricted()
293
+ returns (InstanceAdmin clonedInstanceAdmin)
244
294
  {
245
- _createGifTarget(
246
- instanceNftId,
247
- targetAddress,
248
- targetName,
249
- roles,
250
- selectors
251
- );
295
+ // start with setting up a new OZ access manager
296
+ AccessManagerCloneable clonedAccessManager = AccessManagerCloneable(
297
+ Clones.clone(_masterAccessManager));
298
+
299
+ // set up the instance admin
300
+ clonedInstanceAdmin = InstanceAdmin(Clones.clone(_masterInstanceAdmin));
301
+ clonedAccessManager.initialize(
302
+ address(clonedInstanceAdmin)); // grant ADMIN_ROLE to instance admin
303
+
304
+ address authorization = address(
305
+ InstanceAdmin(_masterInstanceAdmin).getInstanceAuthorization());
306
+ clonedInstanceAdmin.initialize(
307
+ clonedAccessManager,
308
+ authorization);
252
309
  }
253
310
 
254
311
 
255
- function createComponentTarget(
256
- NftId instanceNftId,
257
- address targetAddress,
258
- string memory targetName,
259
- bytes4[][] memory selectors,
260
- RoleId[] memory roles
312
+ /// @dev create new cloned instance
313
+ /// function used to setup a new instance
314
+ function _createInstance(
315
+ InstanceAdmin instanceAdmin,
316
+ address instanceOwner
261
317
  )
262
- external
318
+ internal
263
319
  virtual
264
- // TODO re-enable once role - contract association is fixed
265
- // restricted()
320
+ returns (IInstance)
266
321
  {
267
- _createGifTarget(
268
- instanceNftId,
269
- targetAddress,
270
- targetName,
271
- roles,
272
- selectors
273
- );
322
+ InstanceStore clonedInstanceStore = InstanceStore(Clones.clone(address(_masterInstanceStore)));
323
+ BundleSet clonedBundleSet = BundleSet(Clones.clone(_masterInstanceBundleSet));
324
+ RiskSet clonedRiskSet = RiskSet(Clones.clone(_masterInstanceRiskSet));
325
+ InstanceReader clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
326
+
327
+ // clone instance
328
+ Instance clonedInstance = Instance(Clones.clone(_masterInstance));
329
+ clonedInstance.initialize(
330
+ instanceAdmin,
331
+ clonedInstanceStore,
332
+ clonedBundleSet,
333
+ clonedRiskSet,
334
+ clonedInstanceReader,
335
+ getRegistry(),
336
+ instanceOwner);
337
+ return clonedInstance;
274
338
  }
275
339
 
276
340
 
@@ -285,18 +349,21 @@ contract InstanceService is
285
349
  internal
286
350
  virtual
287
351
  {
352
+ // TODO instanceAdmin will check target instance match anyway
288
353
  (
289
354
  IInstance instance, // or instanceInfo
290
355
  // or targetInfo
291
356
  ) = _validateInstanceAndComponent(instanceNftId, targetAddress);
292
357
 
293
- InstanceAccessManager accessManager = instance.getInstanceAccessManager();
294
- accessManager.createGifTarget(targetAddress, targetName);
358
+ InstanceAdmin instanceAdmin = instance.getInstanceAdmin();
359
+
360
+ // TODO refactor/implement
361
+ // instanceAdmin.createGifTarget(targetAddress, targetName);
362
+
295
363
  // set proposed target config
296
- // TODO restriction: gif targets are set only once and only here?
297
- // assume config is a mix of gif and custom roles and no further configuration by INSTANCE_OWNER_ROLE is ever needed?
298
364
  for(uint roleIdx = 0; roleIdx < roles.length; roleIdx++) {
299
- accessManager.setCoreTargetFunctionRole(targetName, selectors[roleIdx], roles[roleIdx]);
365
+ // TODO refactor/implement
366
+ // instanceAdmin.setTargetFunctionRoleByService(targetName, selectors[roleIdx], roles[roleIdx]);
300
367
  }
301
368
  }
302
369
 
@@ -306,23 +373,20 @@ contract InstanceService is
306
373
  bytes memory data
307
374
  )
308
375
  internal
309
- initializer
310
376
  virtual override
377
+ initializer()
311
378
  {
312
379
  (
313
380
  address registryAddress,
314
- address initialOwner
381
+ address authority
315
382
  ) = abi.decode(data, (address, address));
316
383
 
317
- _registryService = IRegistryService(
318
- IRegistry(registryAddress).getServiceAddress(
319
- REGISTRY(),
320
- getVersion().toMajorPart()));
384
+ _initializeService(registryAddress, authority, owner);
321
385
 
322
- // TODO while InstanceService is not deployed in InstanceServiceManager constructor
323
- // owner is InstanceServiceManager deployer
324
- initializeService(registryAddress, address(0), owner);
325
- registerInterface(type(IInstanceService).interfaceId);
386
+ _registryService = IRegistryService(_getServiceAddress(REGISTRY()));
387
+ _stakingService = IStakingService(_getServiceAddress(STAKING()));
388
+
389
+ _registerInterface(type(IInstanceService).interfaceId);
326
390
  }
327
391
 
328
392
 
@@ -334,15 +398,27 @@ contract InstanceService is
334
398
  IRegistry registry = getRegistry();
335
399
  IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
336
400
  if(instanceInfo.objectType != INSTANCE()) {
337
- revert ErrorInstanceServiceNotInstance(instanceNftId);
401
+ revert ErrorInstanceServiceNotInstanceNftId(instanceNftId);
338
402
  }
339
403
 
340
- IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
341
- if(componentInfo.parentNftId != instanceNftId) {
342
- revert ErrorInstanceServiceInstanceComponentMismatch(instanceNftId, componentInfo.nftId);
404
+ if (registry.getNftIdForAddress(componentAddress).gtz()) {
405
+ IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
406
+
407
+ if(componentInfo.parentNftId != instanceNftId) {
408
+ revert ErrorInstanceServiceInstanceComponentMismatch(instanceNftId, componentInfo.nftId);
409
+ }
410
+
411
+ componentNftId = componentInfo.nftId;
412
+ } else {
413
+
343
414
  }
344
415
 
345
416
  instance = Instance(instanceInfo.objectAddress);
346
- componentNftId = componentInfo.nftId;
417
+
418
+ }
419
+
420
+ // From IService
421
+ function _getDomain() internal pure override returns(ObjectType) {
422
+ return INSTANCE();
347
423
  }
348
424
  }
@@ -1,45 +1,30 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {Instance} from "./Instance.sol";
5
- import {IVersionable} from "../shared/IVersionable.sol";
6
- import {ProxyManager} from "../shared/ProxyManager.sol";
4
+ import {IVersionable} from "../upgradeability/IVersionable.sol";
5
+ import {ProxyManager} from "../upgradeability/ProxyManager.sol";
7
6
  import {InstanceService} from "./InstanceService.sol";
8
- import {Registry} from "../registry/Registry.sol";
9
- import {RegistryService} from "../registry/RegistryService.sol";
10
- import {REGISTRY} from "../type/ObjectType.sol";
11
7
 
12
8
  contract InstanceServiceManager is ProxyManager {
13
9
 
14
10
  InstanceService private _instanceService;
15
11
 
16
- /// @dev initializes proxy manager with instance service implementation and deploys instance
12
+ /// @dev initializes proxy manager with instance service implementation
17
13
  constructor(
18
- address registryAddress
19
- )
20
- ProxyManager(registryAddress)
14
+ address authority,
15
+ address registry,
16
+ bytes32 salt
17
+ )
21
18
  {
22
- InstanceService instSrv = new InstanceService();
23
- // bytes memory initCode = type(InstanceService).creationCode;
24
- bytes memory data = abi.encode(registryAddress, address(this));
25
- IVersionable versionable = deploy(
26
- address(instSrv),
27
- data);
19
+ InstanceService svc = new InstanceService{salt: salt}();
20
+ bytes memory data = abi.encode(registry, authority);
21
+ IVersionable versionable = initialize(
22
+ registry,
23
+ address(svc),
24
+ data,
25
+ salt);
28
26
 
29
27
  _instanceService = InstanceService(address(versionable));
30
-
31
- // TODO `this` must have a role or own nft to register service
32
- //Registry registry = Registry(registryAddress);
33
- //address registryServiceAddress = registry.getServiceAddress(REGISTRY(), _instanceService.getMajorVersion());
34
- //RegistryService registryService = RegistryService(registryServiceAddress);
35
- //registryService.registerService(_instanceService);
36
- // RegistryService registryService = _instanceService.getRegistryService();
37
-
38
- // TODO no nft to link yet
39
- // link ownership of instance service manager ot nft owner of instance service
40
- //_linkToNftOwnable(
41
- // address(registryAddress),
42
- // address(_instanceService));
43
28
  }
44
29
 
45
30
  //--- view functions ----------------------------------------------------//