@etherisc/gif-next 0.0.2-ba07940-332 → 0.0.2-ba5b255-091

Sign up to get free protection for your applications and to get access to all the features.
Files changed (479) hide show
  1. package/README.md +27 -6
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +1007 -0
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +744 -0
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
  7. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +791 -0
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +452 -243
  10. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
  11. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
  12. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
  13. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
  14. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +202 -5
  16. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +222 -21
  18. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +348 -184
  21. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +100 -13
  23. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  25. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +92 -285
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +207 -33
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +44 -162
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +309 -168
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  35. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +89 -51
  36. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  37. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +31 -131
  38. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  39. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +177 -67
  40. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  41. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +93 -139
  43. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +188 -46
  45. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  46. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +247 -287
  47. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  48. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +207 -33
  49. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +161 -244
  52. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
  53. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +644 -0
  54. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +76 -155
  56. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +130 -131
  58. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
  59. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +644 -0
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +288 -226
  62. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
  63. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +644 -0
  64. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  65. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +193 -45
  66. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  67. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +192 -30
  68. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  69. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +177 -12
  70. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  71. package/artifacts/contracts/instance/Instance.sol/Instance.json +221 -67
  72. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +775 -306
  74. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +226 -46
  76. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +713 -201
  78. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +203 -85
  80. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  81. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +46 -34
  82. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  83. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +421 -371
  84. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
  85. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +853 -0
  86. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  87. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  88. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  89. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  91. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  93. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  94. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +16 -5
  95. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +4 -0
  96. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +168 -0
  97. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  100. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  101. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  102. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  103. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +66 -167
  105. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +189 -35
  107. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +36 -71
  110. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  111. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +27 -3
  112. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  113. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +50 -103
  114. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  115. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +112 -81
  116. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  117. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +69 -27
  118. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +49 -102
  120. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  121. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +188 -46
  122. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  123. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +127 -331
  124. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  125. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +53 -87
  126. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  127. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +56 -136
  128. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  129. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +36 -95
  130. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  131. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +163 -226
  132. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  133. package/artifacts/contracts/pool/Pool.sol/Pool.json +49 -126
  134. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +4 -0
  135. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +456 -0
  136. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  137. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +302 -363
  138. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  139. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +93 -51
  140. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  141. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +165 -57
  142. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  143. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +54 -24
  144. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  145. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +155 -193
  146. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  147. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +207 -33
  148. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  149. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +244 -179
  150. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  151. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +74 -64
  152. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  153. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +103 -10
  154. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  155. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +142 -20
  156. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  157. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +112 -56
  158. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  159. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +48 -3
  160. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  161. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +142 -162
  162. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  163. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +58 -7
  164. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  165. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +211 -180
  166. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +4 -0
  167. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +293 -0
  168. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  169. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +76 -50
  170. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  171. package/artifacts/contracts/product/PricingService.sol/PricingService.json +120 -76
  172. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  173. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +60 -38
  174. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  175. package/artifacts/contracts/product/Product.sol/Product.json +155 -193
  176. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  177. package/artifacts/contracts/product/RiskService.sol/RiskService.json +143 -77
  178. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  179. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +66 -24
  180. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
  182. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  183. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +50 -2
  184. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  185. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +31 -7
  186. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +4 -0
  187. package/artifacts/contracts/registry/IRelease.sol/IRelease.json +24 -0
  188. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  189. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  190. package/artifacts/contracts/registry/Registry.sol/Registry.json +88 -40
  191. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  192. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +559 -415
  193. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
  194. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
  195. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  196. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +69 -46
  197. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  198. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +42 -20
  199. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
  200. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +1966 -0
  201. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  202. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  203. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  204. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +332 -54
  205. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  206. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  207. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  208. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
  209. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  210. package/artifacts/contracts/shared/Component.sol/Component.json +49 -88
  211. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  212. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +228 -440
  213. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  214. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +65 -63
  215. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  216. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +27 -16
  217. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  218. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +509 -4
  219. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
  220. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
  221. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
  222. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
  223. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +4 -0
  224. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +40 -0
  225. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  226. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +36 -57
  227. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  228. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +123 -262
  229. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  230. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +36 -71
  231. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  232. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  233. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  234. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  235. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  236. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +120 -1
  237. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  238. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  239. package/artifacts/contracts/shared/IService.sol/IService.json +27 -3
  240. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  241. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
  242. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  243. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +49 -102
  244. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  245. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  246. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  247. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  248. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  249. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  250. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  251. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  252. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  253. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +118 -62
  254. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  255. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  256. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  257. package/artifacts/contracts/shared/Service.sol/Service.json +27 -16
  258. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  259. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +327 -73
  260. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
  261. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +484 -0
  262. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  263. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +88 -24
  264. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  265. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +116 -90
  266. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  267. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +127 -3
  268. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  269. package/artifacts/contracts/staking/Staking.sol/Staking.json +193 -193
  270. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
  271. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
  272. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  273. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  274. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  275. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +61 -45
  276. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  277. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +30 -57
  278. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  279. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +180 -49
  280. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  281. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +50 -24
  282. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  283. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +143 -129
  284. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  285. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +33 -23
  286. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  287. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/Amount.sol/AmountLib.json +3 -3
  289. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  290. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  291. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  292. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  294. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  295. package/artifacts/contracts/type/Fee.sol/FeeLib.json +3 -3
  296. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  297. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  298. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +4 -0
  299. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
  300. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -4
  302. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  303. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  304. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  305. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +33 -31
  306. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  307. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  308. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  309. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  310. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  311. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  312. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  313. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +69 -7
  314. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  315. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +79 -15
  316. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  317. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  318. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +21 -2
  319. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  320. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
  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/Timestamp.sol/TimestampLib.dbg.json +1 -1
  324. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +2 -2
  325. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  326. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +3 -3
  327. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  328. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -21
  329. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  330. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +101 -2
  331. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  332. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  333. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +18 -2
  334. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  335. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  336. package/contracts/accounting/AccountingService.sol +262 -0
  337. package/contracts/accounting/AccountingServiceManager.sol +38 -0
  338. package/contracts/accounting/IAccountingService.sol +45 -0
  339. package/contracts/authorization/AccessAdmin.sol +301 -192
  340. package/contracts/authorization/AccessAdminLib.sol +183 -0
  341. package/contracts/authorization/AccessManagerCloneable.sol +146 -4
  342. package/contracts/authorization/Authorization.sol +307 -231
  343. package/contracts/authorization/IAccessAdmin.sol +69 -36
  344. package/contracts/authorization/IAuthorization.sol +21 -1
  345. package/contracts/distribution/BasicDistribution.sol +18 -16
  346. package/contracts/distribution/BasicDistributionAuthorization.sol +22 -9
  347. package/contracts/distribution/Distribution.sol +36 -77
  348. package/contracts/distribution/DistributionService.sol +84 -53
  349. package/contracts/distribution/DistributionServiceManager.sol +1 -1
  350. package/contracts/distribution/IDistributionComponent.sol +0 -9
  351. package/contracts/distribution/IDistributionService.sol +22 -20
  352. package/contracts/examples/fire/FirePool.sol +10 -11
  353. package/contracts/examples/fire/FirePoolAuthorization.sol +2 -1
  354. package/contracts/examples/fire/FireProduct.sol +16 -11
  355. package/contracts/examples/fire/FireProductAuthorization.sol +2 -1
  356. package/contracts/examples/unpermissioned/SimpleDistribution.sol +39 -8
  357. package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
  358. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
  359. package/contracts/examples/unpermissioned/SimplePool.sol +26 -5
  360. package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
  361. package/contracts/examples/unpermissioned/SimpleProduct.sol +36 -8
  362. package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
  363. package/contracts/instance/BundleSet.sol +42 -38
  364. package/contracts/instance/IInstance.sol +61 -18
  365. package/contracts/instance/IInstanceService.sol +31 -9
  366. package/contracts/instance/Instance.sol +107 -53
  367. package/contracts/instance/InstanceAdmin.sol +310 -115
  368. package/contracts/instance/InstanceAuthorizationV3.sol +99 -40
  369. package/contracts/instance/InstanceReader.sol +209 -33
  370. package/contracts/instance/InstanceService.sol +205 -115
  371. package/contracts/instance/InstanceServiceManager.sol +1 -1
  372. package/contracts/instance/InstanceStore.sol +13 -2
  373. package/contracts/instance/RiskSet.sol +118 -0
  374. package/contracts/instance/base/ObjectCounter.sol +1 -2
  375. package/contracts/instance/base/ObjectLifecycle.sol +4 -2
  376. package/contracts/instance/base/ObjectSet.sol +31 -33
  377. package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
  378. package/contracts/instance/module/IComponents.sol +3 -4
  379. package/contracts/instance/module/IDistribution.sol +5 -2
  380. package/contracts/instance/module/IPolicy.sol +2 -1
  381. package/contracts/instance/module/IRisk.sol +3 -0
  382. package/contracts/oracle/BasicOracle.sol +1 -3
  383. package/contracts/oracle/BasicOracleAuthorization.sol +3 -12
  384. package/contracts/oracle/Oracle.sol +1 -3
  385. package/contracts/oracle/OracleService.sol +92 -73
  386. package/contracts/oracle/OracleServiceManager.sol +1 -1
  387. package/contracts/pool/BasicPool.sol +19 -2
  388. package/contracts/pool/BasicPoolAuthorization.sol +22 -14
  389. package/contracts/pool/BundleService.sol +88 -154
  390. package/contracts/pool/BundleServiceManager.sol +1 -1
  391. package/contracts/pool/IBundleService.sol +15 -43
  392. package/contracts/pool/IPoolComponent.sol +1 -5
  393. package/contracts/pool/IPoolService.sol +58 -62
  394. package/contracts/pool/Pool.sol +95 -81
  395. package/contracts/pool/PoolLib.sol +216 -0
  396. package/contracts/pool/PoolService.sol +418 -211
  397. package/contracts/pool/PoolServiceManager.sol +1 -1
  398. package/contracts/product/ApplicationService.sol +39 -16
  399. package/contracts/product/ApplicationServiceManager.sol +1 -1
  400. package/contracts/product/BasicProduct.sol +2 -2
  401. package/contracts/product/BasicProductAuthorization.sol +24 -10
  402. package/contracts/product/ClaimService.sol +177 -136
  403. package/contracts/product/ClaimServiceManager.sol +1 -1
  404. package/contracts/product/IApplicationService.sol +8 -2
  405. package/contracts/product/IClaimService.sol +14 -2
  406. package/contracts/product/IPolicyService.sol +26 -11
  407. package/contracts/product/IPricingService.sol +1 -0
  408. package/contracts/product/IProductComponent.sol +4 -1
  409. package/contracts/product/IRiskService.sol +7 -7
  410. package/contracts/product/PolicyService.sol +244 -263
  411. package/contracts/product/PolicyServiceLib.sol +65 -0
  412. package/contracts/product/PolicyServiceManager.sol +1 -1
  413. package/contracts/product/PricingService.sol +32 -20
  414. package/contracts/product/PricingServiceManager.sol +3 -3
  415. package/contracts/product/Product.sol +59 -23
  416. package/contracts/product/RiskService.sol +89 -31
  417. package/contracts/product/RiskServiceManager.sol +1 -1
  418. package/contracts/registry/ChainNft.sol +4 -2
  419. package/contracts/registry/IRegistry.sol +10 -15
  420. package/contracts/registry/IRelease.sol +26 -0
  421. package/contracts/registry/Registry.sol +16 -3
  422. package/contracts/registry/RegistryAdmin.sol +145 -335
  423. package/contracts/registry/RegistryAuthorization.sol +267 -0
  424. package/contracts/registry/RegistryService.sol +3 -3
  425. package/contracts/registry/RegistryServiceManager.sol +1 -1
  426. package/contracts/registry/ReleaseAdmin.sol +253 -0
  427. package/contracts/registry/ReleaseLifecycle.sol +2 -0
  428. package/contracts/registry/ReleaseRegistry.sol +150 -134
  429. package/contracts/registry/ServiceAuthorizationV3.sol +180 -40
  430. package/contracts/registry/TokenRegistry.sol +6 -8
  431. package/contracts/shared/Component.sol +52 -107
  432. package/contracts/shared/ComponentService.sol +264 -291
  433. package/contracts/shared/ComponentServiceManager.sol +1 -1
  434. package/contracts/shared/ComponentVerifyingService.sol +16 -14
  435. package/contracts/shared/ContractLib.sol +246 -3
  436. package/contracts/shared/IComponent.sol +1 -17
  437. package/contracts/shared/IComponentService.sol +18 -26
  438. package/contracts/shared/IInstanceLinkedComponent.sol +0 -11
  439. package/contracts/shared/IRegisterable.sol +15 -4
  440. package/contracts/shared/IService.sol +3 -5
  441. package/contracts/shared/InitializableERC165.sol +9 -1
  442. package/contracts/shared/InstanceLinkedComponent.sol +4 -22
  443. package/contracts/shared/NftOwnable.sol +10 -6
  444. package/contracts/shared/PolicyHolder.sol +1 -1
  445. package/contracts/shared/Registerable.sol +41 -20
  446. package/contracts/shared/RegistryLinked.sol +7 -13
  447. package/contracts/shared/Service.sol +8 -27
  448. package/contracts/shared/TokenHandler.sol +275 -72
  449. package/contracts/shared/TokenHandlerDeployerLib.sol +10 -2
  450. package/contracts/staking/IStaking.sol +17 -10
  451. package/contracts/staking/IStakingService.sol +16 -1
  452. package/contracts/staking/Staking.sol +95 -46
  453. package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +80 -23
  454. package/contracts/staking/StakingReader.sol +6 -16
  455. package/contracts/staking/StakingService.sol +85 -14
  456. package/contracts/staking/StakingServiceManager.sol +5 -4
  457. package/contracts/staking/StakingStore.sol +2 -1
  458. package/contracts/type/Key32.sol +2 -2
  459. package/contracts/type/Key32Set.sol +62 -0
  460. package/contracts/type/NftId.sol +6 -0
  461. package/contracts/type/ObjectType.sol +53 -35
  462. package/contracts/type/RiskId.sol +26 -8
  463. package/contracts/type/RoleId.sol +27 -4
  464. package/contracts/type/Selector.sol +5 -0
  465. package/contracts/type/Timestamp.sol +0 -5
  466. package/contracts/type/UFixed.sol +9 -119
  467. package/contracts/type/Version.sol +54 -5
  468. package/contracts/upgradeability/ProxyManager.sol +1 -1
  469. package/package.json +4 -4
  470. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +0 -4
  471. package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +0 -1196
  472. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
  473. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -129
  474. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
  475. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
  476. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +0 -4
  477. package/artifacts/contracts/type/UFixed.sol/MathLib.json +0 -16
  478. package/contracts/authorization/ReleaseAccessManager.sol +0 -38
  479. package/contracts/instance/module/IAccess.sol +0 -46
@@ -1,167 +1,205 @@
1
1
  // SPDX-License-Identifier: UNLICENSED
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
5
-
6
- import {AccessAdmin} from "../authorization/AccessAdmin.sol";
7
- import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
8
- import {IAccessAdmin} from "../authorization/IAccessAdmin.sol";
4
+ import {IAccess} from "../authorization/IAccess.sol";
9
5
  import {IAuthorization} from "../authorization/IAuthorization.sol";
10
6
  import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
11
- import {IAuthorization} from "../authorization/IAuthorization.sol";
12
7
  import {IRegistry} from "../registry/IRegistry.sol";
13
8
  import {IInstance} from "./IInstance.sol";
14
- import {IService} from "../shared/IService.sol";
15
- import {ObjectType, ObjectTypeLib, ALL, POOL, RELEASE} from "../type/ObjectType.sol";
16
- import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
9
+
10
+ import {AccessAdmin} from "../authorization/AccessAdmin.sol";
11
+ import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
12
+ import {NftId} from "../type/NftId.sol";
13
+ import {ObjectType, INSTANCE, ORACLE} from "../type/ObjectType.sol";
14
+ import {RoleId, RoleIdLib} from "../type/RoleId.sol";
17
15
  import {Str, StrLib} from "../type/String.sol";
18
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
19
- import {VersionPart} from "../type/Version.sol";
17
+ import {TimestampLib} from "../type/Timestamp.sol";
18
+ import {VersionPart, VersionPartLib} from "../type/Version.sol";
20
19
 
21
20
 
22
21
  contract InstanceAdmin is
23
22
  AccessAdmin
24
23
  {
25
24
  string public constant INSTANCE_TARGET_NAME = "Instance";
26
- string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
27
25
  string public constant INSTANCE_ADMIN_TARGET_NAME = "InstanceAdmin";
26
+ string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
28
27
  string public constant BUNDLE_SET_TARGET_NAME = "BundleSet";
28
+ string public constant RISK_SET_TARGET_NAME = "RiskSet";
29
+
30
+ error ErrorInstanceAdminNotInstanceService(address caller);
29
31
 
30
- uint64 public constant CUSTOM_ROLE_ID_MIN = 10000; // MUST be even
32
+ error ErrorInstanceAdminNotRegistered(address instance);
33
+ error ErrorInstanceAdminNotInstance(address instance);
34
+ error ErrorInstanceAdminAlreadyAuthorized(address instance);
35
+
36
+ error ErrorInstanceAdminNotComponentRole(RoleId roleId);
37
+ error ErrorInstanceAdminRoleAlreadyExists(RoleId roleId);
38
+ error ErrorInstanceAdminRoleTypeNotContract(RoleId roleId, IAccess.RoleType roleType);
31
39
 
32
- error ErrorInstanceAdminNotRegistered(address target);
33
- error ErrorInstanceAdminAlreadyAuthorized(address target);
34
40
  error ErrorInstanceAdminReleaseMismatch();
35
41
  error ErrorInstanceAdminExpectedTargetMissing(string targetName);
36
42
 
37
- IInstance _instance;
43
+ IInstance internal _instance;
38
44
  IRegistry internal _registry;
39
- uint64 _idNext;
45
+ VersionPart internal _release;
46
+ uint64 internal _customIdNext;
47
+
48
+ mapping(address target => RoleId roleId) internal _targetRoleId;
49
+ uint64 internal _components;
40
50
 
41
- IAuthorization _instanceAuthorization;
51
+ modifier onlyInstanceService() {
52
+ if (msg.sender != _registry.getServiceAddress(INSTANCE(), getRelease())) {
53
+ revert ErrorInstanceAdminNotInstanceService(msg.sender);
54
+ }
55
+ _;
56
+ }
42
57
 
43
58
  /// @dev Only used for master instance admin.
44
- /// Contracts created via constructor come with disabled initializers.
45
- constructor(
46
- IAuthorization instanceAuthorization
47
- )
48
- AccessAdmin()
49
- {
50
- _instanceAuthorization = instanceAuthorization;
59
+ constructor(address accessManager) {
60
+ initialize(
61
+ accessManager,
62
+ "MasterInstanceAdmin");
51
63
  }
52
64
 
53
- /// @dev Initializes this instance admin with the provided instances authorization specification.
54
- /// Internally the function creates an instance specific OpenZeppelin AccessManager that is used as the authority
55
- /// for the inststance authorizatios.
56
- /// Important: Initialization of this instance admin is only complete after calling function initializeInstance.
57
- function initialize(
58
- AccessManagerCloneable accessManager,
59
- IAuthorization instanceAuthorization
65
+
66
+ /// @dev Completes the initialization of this instance admin using the provided instance, registry and version.
67
+ /// Important: Initialization of instance admin is only complete after calling this function.
68
+ /// Important: The instance MUST be registered and all instance supporting contracts must be wired to this instance.
69
+ function completeSetup(
70
+ address registry,
71
+ address instance,
72
+ address authorization,
73
+ VersionPart release
60
74
  )
61
75
  external
62
- initializer()
76
+ reinitializer(uint64(release.toInt()))
77
+ onlyDeployer()
63
78
  {
64
- // create new access manager for this instance admin
65
- _initializeAuthority(address(accessManager));
79
+ // checks
80
+ _checkRegistry(registry);
81
+ _checkIsRegistered(registry, instance, INSTANCE());
66
82
 
67
- // create basic instance independent setup
68
- _createAdminAndPublicRoles();
69
-
70
- // store instance authorization specification
71
- _instanceAuthorization = IAuthorization(instanceAuthorization);
72
- }
83
+ AccessManagerCloneable(
84
+ authority()).completeSetup(
85
+ registry,
86
+ release);
73
87
 
74
- function _checkTargetIsReadyForAuthorization(address target)
75
- internal
76
- view
77
- {
78
- if (address(_registry) != address(0) && !_registry.isRegistered(target)) {
79
- revert ErrorInstanceAdminNotRegistered(target);
80
- }
88
+ _checkAuthorization(authorization, INSTANCE(), release, true);
81
89
 
82
- if (targetExists(target)) {
83
- revert ErrorInstanceAdminAlreadyAuthorized(target);
84
- }
85
- }
90
+ // effects
91
+ _registry = IRegistry(registry);
92
+ _release = release;
86
93
 
87
- /// @dev Completes the initialization of this instance admin using the provided instance.
88
- /// Important: The instance MUST be registered and all instance supporting contracts must be wired to this instance.
89
- function initializeInstanceAuthorization(address instanceAddress)
90
- external
91
- {
92
- _checkTargetIsReadyForAuthorization(instanceAddress);
94
+ _instance = IInstance(instance);
95
+ _authorization = IAuthorization(authorization);
96
+ _components = 0;
97
+ _customIdNext = 0;
93
98
 
94
- _idNext = CUSTOM_ROLE_ID_MIN;
95
- _instance = IInstance(instanceAddress);
96
- _registry = _instance.getRegistry();
99
+ // link nft ownability to instance
100
+ _linkToNftOwnable(instance);
97
101
 
98
- // check matching releases
99
- if (_instanceAuthorization.getRelease() != _instance.getRelease()) {
100
- revert ErrorInstanceAdminReleaseMismatch();
101
- }
102
+ // create instance role and target
103
+ _setupInstance(instance);
102
104
 
103
105
  // add instance authorization
104
- _createRoles(_instanceAuthorization);
105
- _createModuleTargetsWithRoles();
106
- _createTargetAuthorizations(_instanceAuthorization);
106
+ _createRoles(_authorization);
107
+ // _createTargets(_authorization);
108
+ _setupInstanceHelperTargetsWithRoles();
109
+ _createTargetAuthorizations(_authorization);
110
+ }
111
+
112
+
113
+ function _createTargets(IAuthorization authorization)
114
+ internal
115
+ {
116
+ _createTargetWithRole(address(this), INSTANCE_ADMIN_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(INSTANCE_ADMIN_TARGET_NAME)));
117
+ _createTargetWithRole(address(_instance.getInstanceStore()), INSTANCE_STORE_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(INSTANCE_STORE_TARGET_NAME)));
118
+ _createTargetWithRole(address(_instance.getBundleSet()), BUNDLE_SET_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(BUNDLE_SET_TARGET_NAME)));
119
+ _createTargetWithRole(address(_instance.getRiskSet()), RISK_SET_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(RISK_SET_TARGET_NAME)));
107
120
  }
108
121
 
109
122
 
110
123
  /// @dev Initializes the authorization for the specified component.
111
124
  /// Important: The component MUST be registered.
112
125
  function initializeComponentAuthorization(
113
- IInstanceLinkedComponent component
126
+ address componentAddress,
127
+ ObjectType expectedType
114
128
  )
115
129
  external
130
+ restricted()
116
131
  {
117
- _checkTargetIsReadyForAuthorization(address(component));
132
+ // checks
133
+ _checkIsRegistered(address(getRegistry()), componentAddress, expectedType);
118
134
 
119
- // get authorization specification
135
+ IInstanceLinkedComponent component = IInstanceLinkedComponent(componentAddress);
120
136
  IAuthorization authorization = component.getAuthorization();
137
+ _checkAuthorization(address(authorization), expectedType, getRelease(), false);
121
138
 
122
- // create roles
139
+ // effects
140
+ // setup target and role for component (including token handler if applicable)
141
+ _setupComponentAndTokenHandler(component, expectedType);
142
+
143
+ // create other roles and function authorizations
123
144
  _createRoles(authorization);
145
+ _createTargetAuthorizations(authorization);
146
+ }
147
+
148
+ function getRelease()
149
+ public
150
+ view
151
+ override
152
+ returns (VersionPart release)
153
+ {
154
+ return _release;
155
+ }
156
+
124
157
 
125
- // create component target
158
+ // create instance role and target
159
+ function _setupInstance(address instance) internal {
160
+
161
+ // create instance role
162
+ RoleId instanceRoleId = _authorization.getTargetRole(
163
+ _authorization.getMainTarget());
164
+
165
+ _createRole(
166
+ instanceRoleId,
167
+ _authorization.getRoleInfo(instanceRoleId));
168
+
169
+ // create instance target
126
170
  _createTarget(
127
- address(component),
128
- authorization.getTargetName(),
171
+ instance,
172
+ _authorization.getMainTargetName(),
129
173
  true, // checkAuthority
130
174
  false); // custom
131
175
 
132
- _createTarget(
133
- address(component.getTokenHandler()),
134
- string(abi.encodePacked(authorization.getTargetName(), "TH")),
135
- true,
136
- false);
137
-
138
- FunctionInfo[] memory functions = new FunctionInfo[](3);
139
- functions[0] = toFunction(TokenHandler.collectTokens.selector, "collectTokens");
140
- functions[1] = toFunction(TokenHandler.collectTokensToThreeRecipients.selector, "collectTokensToThreeRecipients");
141
- functions[2] = toFunction(TokenHandler.distributeTokens.selector, "distributeTokens");
142
-
143
- // FIXME: make this a bit nicer and work with IAuthorization. Use a specific role, not public - access to TokenHandler must be restricted
144
- _authorizeTargetFunctions(
145
- address(component.getTokenHandler()),
146
- getPublicRole(),
147
- functions);
148
-
176
+ // assign instance role to instance
149
177
  _grantRoleToAccount(
150
- authorization.getTargetRole(
151
- authorization.getMainTarget()),
152
- address(component));
153
-
154
- _createTargetAuthorizations(authorization);
178
+ instanceRoleId,
179
+ instance);
155
180
  }
156
181
 
157
- /// @dev Creates a custom role
158
- // TODO implement
159
- // function createRole()
160
- // external
161
- // restricted()
162
- // {
163
-
164
- // }
182
+ /// @dev Creates a custom role.
183
+ function createRole(
184
+ string memory roleName,
185
+ RoleId adminRoleId,
186
+ uint32 maxMemberCount
187
+ )
188
+ external
189
+ restricted()
190
+ returns (RoleId roleId)
191
+ {
192
+ roleId = RoleIdLib.toCustomRoleId(_customIdNext++);
193
+ _createRole(
194
+ roleId,
195
+ RoleInfo({
196
+ adminRoleId: adminRoleId,
197
+ roleType: IAccess.RoleType.Custom,
198
+ maxMemberCount: maxMemberCount,
199
+ name: StrLib.toStr(roleName),
200
+ createdAt: TimestampLib.zero(),
201
+ pausedAt: TimestampLib.zero()}));
202
+ }
165
203
 
166
204
  /// @dev Grants the provided role to the specified account
167
205
  function grantRole(
@@ -173,13 +211,154 @@ contract InstanceAdmin is
173
211
  _grantRoleToAccount(roleId, account);
174
212
  }
175
213
 
214
+ /// @dev Revokes the provided role from the specified account
215
+ function revokeRole(
216
+ RoleId roleId,
217
+ address account)
218
+ external
219
+ restricted()
220
+ {
221
+ _revokeRoleFromAccount(roleId, account);
222
+ }
223
+
224
+
225
+ function setInstanceLocked(bool locked)
226
+ external
227
+ // not restricted(): need to operate on locked instances to unlock instance
228
+ onlyInstanceService()
229
+ {
230
+ AccessManagerCloneable accessManager = AccessManagerCloneable(authority());
231
+ accessManager.setLocked(locked);
232
+ }
233
+
234
+
235
+ function setTargetLocked(address target, bool locked)
236
+ external
237
+ // not restricted(): might need to operate on targets while instance is locked
238
+ onlyInstanceService()
239
+ {
240
+ _setTargetLocked(target, locked);
241
+ }
242
+
243
+
244
+ function setComponentLocked(address target, bool locked)
245
+ external
246
+ restricted()
247
+ {
248
+ _setTargetLocked(target, locked);
249
+ }
250
+
251
+ /// @dev Returns the number of components that have been registered with this instance.
252
+ function components()
253
+ external
254
+ view
255
+ returns (uint64)
256
+ {
257
+ return _components;
258
+ }
259
+
176
260
  /// @dev Returns the instance authorization specification used to set up this instance admin.
177
261
  function getInstanceAuthorization()
178
262
  external
179
263
  view
180
264
  returns (IAuthorization instanceAuthorizaion)
181
265
  {
182
- return _instanceAuthorization;
266
+ return _authorization;
267
+ }
268
+
269
+ // ------------------- Internal functions ------------------- //
270
+
271
+ function _setupComponentAndTokenHandler(
272
+ IInstanceLinkedComponent component,
273
+ ObjectType componentType
274
+ )
275
+ internal
276
+ {
277
+
278
+ IAuthorization authorization = component.getAuthorization();
279
+ string memory targetName = authorization.getMainTargetName();
280
+
281
+ // create component role and target
282
+ RoleId componentRoleId = _createComponentRoleId(component, authorization);
283
+
284
+ // create component's target
285
+ _createTarget(
286
+ address(component),
287
+ targetName,
288
+ true, // checkAuthority
289
+ false); // custom
290
+
291
+ // create component's token handler target if app
292
+ if (componentType != ORACLE()) {
293
+ NftId componentNftId = _registry.getNftIdForAddress(address(component));
294
+ address tokenHandler = address(
295
+ _instance.getInstanceReader().getComponentInfo(
296
+ componentNftId).tokenHandler);
297
+
298
+ _createTarget(
299
+ tokenHandler,
300
+ authorization.getTokenHandlerName(),
301
+ true,
302
+ false);
303
+
304
+ // token handler does not require its own role
305
+ // token handler is not calling other components
306
+ }
307
+
308
+ // assign component role to component
309
+ _grantRoleToAccount(
310
+ componentRoleId,
311
+ address(component));
312
+ }
313
+
314
+
315
+ function _createComponentRoleId(
316
+ IInstanceLinkedComponent component,
317
+ IAuthorization authorization
318
+ )
319
+ internal
320
+ returns (RoleId componentRoleId)
321
+ {
322
+ // checks
323
+ // check component is not yet authorized
324
+ if (_targetRoleId[address(component)].gtz()) {
325
+ revert ErrorInstanceAdminAlreadyAuthorized(address(component));
326
+ }
327
+
328
+ // check generic component role
329
+ RoleId genericComponentRoleId = authorization.getTargetRole(
330
+ authorization.getMainTarget());
331
+
332
+ if (!genericComponentRoleId.isComponentRole()) {
333
+ revert ErrorInstanceAdminNotComponentRole(genericComponentRoleId);
334
+ }
335
+
336
+ // check component role does not exist
337
+ componentRoleId = toComponentRole(
338
+ genericComponentRoleId,
339
+ _components);
340
+
341
+ if (roleExists(componentRoleId)) {
342
+ revert ErrorInstanceAdminRoleAlreadyExists(componentRoleId);
343
+ }
344
+
345
+ // check role info
346
+ IAccess.RoleInfo memory roleInfo = authorization.getRoleInfo(
347
+ genericComponentRoleId);
348
+
349
+ if (roleInfo.roleType != IAccess.RoleType.Contract) {
350
+ revert ErrorInstanceAdminRoleTypeNotContract(
351
+ componentRoleId,
352
+ roleInfo.roleType);
353
+ }
354
+
355
+ // effects
356
+ _targetRoleId[address(component)] = componentRoleId;
357
+ _components++;
358
+
359
+ _createRole(
360
+ componentRoleId,
361
+ roleInfo);
183
362
  }
184
363
 
185
364
 
@@ -187,13 +366,18 @@ contract InstanceAdmin is
187
366
  internal
188
367
  {
189
368
  RoleId[] memory roles = authorization.getRoles();
369
+ RoleId mainTargetRoleId = authorization.getTargetRole(
370
+ authorization.getMainTarget());
371
+
190
372
  RoleId roleId;
191
373
  RoleInfo memory roleInfo;
192
374
 
193
375
  for(uint256 i = 0; i < roles.length; i++) {
376
+
194
377
  roleId = roles[i];
195
378
 
196
- if (!roleExists(roleId)) {
379
+ // skip main target role, create role if not exists
380
+ if (roleId != mainTargetRoleId && !roleExists(roleId)) {
197
381
  _createRole(
198
382
  roleId,
199
383
  authorization.getRoleInfo(roleId));
@@ -202,6 +386,16 @@ contract InstanceAdmin is
202
386
  }
203
387
 
204
388
 
389
+ function toComponentRole(RoleId roleId, uint64 componentIdx)
390
+ internal
391
+ pure
392
+ returns (RoleId)
393
+ {
394
+ return RoleIdLib.toRoleId(
395
+ RoleIdLib.toInt(roleId) + componentIdx);
396
+ }
397
+
398
+
205
399
  function _createTargetAuthorizations(IAuthorization authorization)
206
400
  internal
207
401
  {
@@ -234,7 +428,7 @@ contract InstanceAdmin is
234
428
  {
235
429
  // check that target name is defined in authorization specification
236
430
  Str name = StrLib.toStr(targetName);
237
- if (!_instanceAuthorization.targetExists(name)) {
431
+ if (!_authorization.targetExists(name)) {
238
432
  revert ErrorInstanceAdminExpectedTargetMissing(targetName);
239
433
  }
240
434
 
@@ -242,28 +436,29 @@ contract InstanceAdmin is
242
436
  _createTarget(
243
437
  target,
244
438
  targetName,
245
- false, // check authority TODO check normal targets, don't check service targets (they share authority with registry admin)
439
+ false, // check authority TODO check normal targets, don't check service targets (they share authority with release admin)
246
440
  false);
247
441
 
248
442
  // assign target role if defined
249
- RoleId targetRoleId = _instanceAuthorization.getTargetRole(name);
443
+ RoleId targetRoleId = _authorization.getTargetRole(name);
250
444
  if (targetRoleId != RoleIdLib.zero()) {
251
445
  _grantRoleToAccount(targetRoleId, target);
252
446
  }
253
447
  }
254
448
 
255
- function _createModuleTargetsWithRoles()
449
+ function _setupInstanceHelperTargetsWithRoles()
256
450
  internal
257
451
  {
452
+
258
453
  // create module targets
259
- _checkAndCreateTargetWithRole(address(_instance), INSTANCE_TARGET_NAME);
260
454
  _checkAndCreateTargetWithRole(address(_instance.getInstanceStore()), INSTANCE_STORE_TARGET_NAME);
261
455
  _checkAndCreateTargetWithRole(address(_instance.getInstanceAdmin()), INSTANCE_ADMIN_TARGET_NAME);
262
456
  _checkAndCreateTargetWithRole(address(_instance.getBundleSet()), BUNDLE_SET_TARGET_NAME);
457
+ _checkAndCreateTargetWithRole(address(_instance.getRiskSet()), RISK_SET_TARGET_NAME);
263
458
 
264
- // create targets for services that need to access the module targets
265
- ObjectType[] memory serviceDomains = _instanceAuthorization.getServiceDomains();
266
- VersionPart release = _instanceAuthorization.getRelease();
459
+ // create targets for services that need to access the instance targets
460
+ ObjectType[] memory serviceDomains = _authorization.getServiceDomains();
461
+ VersionPart release = _authorization.getRelease();
267
462
  ObjectType serviceDomain;
268
463
 
269
464
  for (uint256 i = 0; i < serviceDomains.length; i++) {
@@ -271,7 +466,7 @@ contract InstanceAdmin is
271
466
 
272
467
  _checkAndCreateTargetWithRole(
273
468
  _registry.getServiceAddress(serviceDomain, release),
274
- _instanceAuthorization.getServiceTarget(serviceDomain).toString());
469
+ _authorization.getServiceTarget(serviceDomain).toString());
275
470
  }
276
471
  }
277
472
  }