@etherisc/gif-next 0.0.2-89c8f37-711 → 0.0.2-8a72793-100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (520) hide show
  1. package/README.md +34 -8
  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 +476 -86
  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/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +202 -5
  14. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +273 -16
  16. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +371 -54
  19. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +139 -15
  21. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +165 -391
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +261 -27
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +103 -321
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +321 -369
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +129 -119
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +115 -143
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  38. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +196 -133
  39. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
  40. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
  41. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
  42. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1475 -0
  43. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
  44. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +644 -0
  45. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
  46. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2040 -0
  47. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
  48. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +644 -0
  49. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
  50. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +4 -0
  52. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1479 -0
  53. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
  54. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +644 -0
  55. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
  56. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1195 -0
  57. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
  58. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1655 -0
  59. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
  60. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +644 -0
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
  62. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2426 -0
  63. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
  64. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +644 -0
  65. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  66. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +193 -45
  67. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  68. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +204 -38
  69. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  70. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +127 -95
  71. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  72. package/artifacts/contracts/instance/Instance.sol/Instance.json +222 -125
  73. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  74. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +784 -181
  75. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  76. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +205 -90
  77. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  78. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1002 -303
  79. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  80. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +155 -280
  81. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  82. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +96 -96
  83. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  84. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +651 -514
  85. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
  86. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +853 -0
  87. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  89. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  91. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  92. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  93. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +46 -5
  94. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  95. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +16 -5
  96. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +4 -0
  97. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +168 -0
  98. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  100. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  101. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  102. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  103. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +114 -340
  106. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +243 -29
  108. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +102 -130
  111. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  112. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +69 -11
  113. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  114. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +90 -308
  115. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  116. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +153 -190
  117. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  118. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +122 -88
  119. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  120. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +119 -387
  121. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  122. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +261 -27
  123. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  124. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +275 -314
  125. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  126. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +122 -108
  127. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  128. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +172 -97
  129. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  130. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +124 -219
  131. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  132. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +464 -312
  133. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  134. package/artifacts/contracts/pool/Pool.sol/Pool.json +109 -394
  135. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +4 -0
  136. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +456 -0
  137. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  138. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +653 -532
  139. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  140. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +163 -97
  141. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  142. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +134 -184
  143. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  144. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +91 -93
  145. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  146. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +243 -400
  147. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  148. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +261 -27
  149. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  150. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +415 -234
  151. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  152. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +140 -114
  153. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  154. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +94 -9
  155. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  156. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +308 -16
  157. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  158. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +354 -106
  159. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  160. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +136 -83
  161. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  162. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +235 -202
  163. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
  164. package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +57 -4
  165. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  166. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +439 -302
  167. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +4 -0
  168. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +293 -0
  169. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  170. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +141 -99
  171. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  172. package/artifacts/contracts/product/PricingService.sol/PricingService.json +227 -314
  173. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  174. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +120 -122
  175. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  176. package/artifacts/contracts/product/Product.sol/Product.json +241 -398
  177. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
  178. package/artifacts/contracts/product/RiskService.sol/RiskService.json +637 -0
  179. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
  180. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +724 -0
  181. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  182. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +59 -16
  183. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  184. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +334 -34
  185. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  186. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +144 -41
  187. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +4 -0
  188. package/artifacts/contracts/registry/IRelease.sol/IRelease.json +24 -0
  189. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  190. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
  191. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  192. package/artifacts/contracts/registry/Registry.sol/Registry.json +540 -95
  193. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  194. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +650 -193
  195. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
  196. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
  197. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  198. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +109 -292
  199. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  200. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +94 -80
  201. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +4 -0
  202. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +2099 -0
  203. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  204. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
  205. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  206. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +443 -241
  207. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  208. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
  209. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  210. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +4 -4
  211. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  212. package/artifacts/contracts/shared/Component.sol/Component.json +76 -265
  213. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  214. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +461 -625
  215. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  216. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +131 -131
  217. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  218. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +57 -111
  219. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
  220. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +578 -0
  221. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
  222. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
  223. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
  224. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
  225. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +4 -0
  226. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.json +40 -0
  227. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  228. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +89 -88
  229. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  230. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +431 -284
  231. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  232. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +102 -130
  233. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  234. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
  235. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  236. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
  237. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  238. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
  239. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  240. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +15 -47
  241. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  242. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +148 -0
  243. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  244. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  245. package/artifacts/contracts/shared/IService.sol/IService.json +55 -2
  246. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  247. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -22
  248. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  249. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +89 -307
  250. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  251. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
  252. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  253. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -1
  254. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  255. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  256. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  257. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
  258. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  259. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
  260. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  261. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +122 -97
  262. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  263. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
  264. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  265. package/artifacts/contracts/shared/Service.sol/Service.json +57 -111
  266. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  267. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +585 -12
  268. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
  269. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +484 -0
  270. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
  271. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +172 -0
  272. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  273. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +140 -113
  274. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  275. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +77 -16
  276. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  277. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +76 -106
  278. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  279. package/artifacts/contracts/staking/Staking.sol/Staking.json +210 -366
  280. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  281. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
  282. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  283. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +122 -95
  284. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  285. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -11
  286. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  287. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +122 -164
  288. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  289. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +99 -85
  290. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  291. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +149 -108
  292. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  293. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +55 -24
  294. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  295. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  296. package/artifacts/contracts/type/Amount.sol/AmountLib.json +33 -9
  297. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  298. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +28 -4
  300. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  302. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  303. package/artifacts/contracts/type/Fee.sol/FeeLib.json +3 -3
  304. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  305. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  306. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +4 -0
  307. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
  308. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  309. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -4
  310. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  311. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  312. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  313. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +33 -31
  314. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  315. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
  316. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  317. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  318. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  319. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  320. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  321. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +118 -5
  322. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  323. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +79 -15
  324. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  325. package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
  326. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  327. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +21 -2
  328. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  329. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +2 -2
  330. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  331. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +15 -2
  332. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  333. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  334. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
  335. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  336. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +16 -3
  337. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  338. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -21
  339. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  340. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +101 -2
  341. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  342. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  343. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +71 -70
  344. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  345. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  346. package/contracts/accounting/AccountingService.sol +262 -0
  347. package/contracts/accounting/AccountingServiceManager.sol +38 -0
  348. package/contracts/accounting/IAccountingService.sol +45 -0
  349. package/contracts/authorization/AccessAdmin.sol +389 -149
  350. package/contracts/authorization/AccessManagerCloneable.sol +147 -4
  351. package/contracts/authorization/Authorization.sol +351 -204
  352. package/contracts/authorization/IAccess.sol +1 -0
  353. package/contracts/authorization/IAccessAdmin.sol +64 -29
  354. package/contracts/authorization/IAuthorization.sol +33 -7
  355. package/contracts/authorization/IServiceAuthorization.sol +3 -1
  356. package/contracts/authorization/ServiceAuthorization.sol +26 -10
  357. package/contracts/distribution/BasicDistribution.sol +15 -12
  358. package/contracts/distribution/BasicDistributionAuthorization.sol +22 -9
  359. package/contracts/distribution/Distribution.sol +42 -48
  360. package/contracts/distribution/DistributionService.sol +125 -104
  361. package/contracts/distribution/DistributionServiceManager.sol +6 -6
  362. package/contracts/distribution/IDistributionComponent.sol +1 -1
  363. package/contracts/distribution/IDistributionService.sol +28 -24
  364. package/contracts/examples/fire/DamageLevel.sol +59 -0
  365. package/contracts/examples/fire/FirePool.sol +90 -0
  366. package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
  367. package/contracts/examples/fire/FireProduct.sol +438 -0
  368. package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
  369. package/contracts/examples/fire/FireUSD.sol +26 -0
  370. package/contracts/examples/unpermissioned/SimpleDistribution.sol +57 -0
  371. package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
  372. package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
  373. package/contracts/examples/unpermissioned/SimplePool.sol +106 -0
  374. package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
  375. package/contracts/examples/unpermissioned/SimpleProduct.sol +377 -0
  376. package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
  377. package/contracts/instance/BundleSet.sol +42 -38
  378. package/contracts/instance/IInstance.sol +60 -43
  379. package/contracts/instance/IInstanceService.sol +21 -30
  380. package/contracts/instance/Instance.sol +106 -71
  381. package/contracts/instance/InstanceAdmin.sol +287 -102
  382. package/contracts/instance/InstanceAuthorizationV3.sol +92 -61
  383. package/contracts/instance/InstanceReader.sol +275 -43
  384. package/contracts/instance/InstanceService.sol +196 -189
  385. package/contracts/instance/InstanceServiceManager.sol +6 -7
  386. package/contracts/instance/InstanceStore.sol +23 -2
  387. package/contracts/instance/RiskSet.sol +118 -0
  388. package/contracts/instance/base/ObjectCounter.sol +1 -2
  389. package/contracts/instance/base/ObjectLifecycle.sol +11 -4
  390. package/contracts/instance/base/ObjectSet.sol +31 -33
  391. package/contracts/instance/base/ObjectSetHelperLib.sol +30 -0
  392. package/contracts/instance/module/IBundle.sol +1 -1
  393. package/contracts/instance/module/IComponents.sol +14 -14
  394. package/contracts/instance/module/IDistribution.sol +2 -1
  395. package/contracts/instance/module/IPolicy.sol +26 -25
  396. package/contracts/instance/module/IRisk.sol +3 -0
  397. package/contracts/oracle/BasicOracle.sol +0 -1
  398. package/contracts/oracle/BasicOracleAuthorization.sol +3 -12
  399. package/contracts/oracle/IOracleService.sol +2 -1
  400. package/contracts/oracle/Oracle.sol +7 -17
  401. package/contracts/oracle/OracleService.sol +113 -81
  402. package/contracts/oracle/OracleServiceManager.sol +6 -6
  403. package/contracts/pool/BasicPool.sol +38 -27
  404. package/contracts/pool/BasicPoolAuthorization.sol +32 -11
  405. package/contracts/pool/BundleService.sol +179 -125
  406. package/contracts/pool/BundleServiceManager.sol +6 -6
  407. package/contracts/pool/IBundleService.sol +29 -34
  408. package/contracts/pool/IPoolComponent.sol +19 -15
  409. package/contracts/pool/IPoolService.sol +90 -75
  410. package/contracts/pool/Pool.sol +145 -128
  411. package/contracts/pool/PoolLib.sol +216 -0
  412. package/contracts/pool/PoolService.sol +540 -217
  413. package/contracts/pool/PoolServiceManager.sol +4 -4
  414. package/contracts/product/ApplicationService.sol +72 -43
  415. package/contracts/product/ApplicationServiceManager.sol +4 -4
  416. package/contracts/product/BasicProduct.sol +11 -12
  417. package/contracts/product/BasicProductAuthorization.sol +24 -11
  418. package/contracts/product/ClaimService.sol +368 -153
  419. package/contracts/product/ClaimServiceManager.sol +4 -4
  420. package/contracts/product/IApplicationService.sol +6 -2
  421. package/contracts/product/IClaimService.sol +44 -8
  422. package/contracts/product/IPolicyService.sol +53 -38
  423. package/contracts/product/IPricingService.sol +10 -10
  424. package/contracts/product/IProductComponent.sol +27 -5
  425. package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
  426. package/contracts/product/PolicyService.sol +446 -281
  427. package/contracts/product/PolicyServiceLib.sol +65 -0
  428. package/contracts/product/PolicyServiceManager.sol +4 -4
  429. package/contracts/product/PricingService.sol +66 -62
  430. package/contracts/product/PricingServiceManager.sol +4 -4
  431. package/contracts/product/Product.sol +166 -89
  432. package/contracts/product/RiskService.sol +145 -0
  433. package/contracts/product/RiskServiceManager.sol +39 -0
  434. package/contracts/registry/ChainNft.sol +72 -40
  435. package/contracts/registry/IRegistry.sol +60 -28
  436. package/contracts/registry/IRegistryService.sol +5 -12
  437. package/contracts/registry/IRelease.sol +26 -0
  438. package/contracts/registry/ITransferInterceptor.sol +1 -2
  439. package/contracts/registry/Registry.sol +357 -203
  440. package/contracts/registry/RegistryAdmin.sol +290 -182
  441. package/contracts/registry/RegistryAuthorization.sol +266 -0
  442. package/contracts/registry/RegistryService.sol +37 -48
  443. package/contracts/registry/RegistryServiceManager.sol +3 -3
  444. package/contracts/registry/ReleaseAdmin.sol +252 -0
  445. package/contracts/registry/ReleaseLifecycle.sol +8 -3
  446. package/contracts/registry/ReleaseRegistry.sol +264 -232
  447. package/contracts/registry/ServiceAuthorizationV3.sol +181 -52
  448. package/contracts/registry/TokenRegistry.sol +6 -8
  449. package/contracts/shared/Component.sol +73 -126
  450. package/contracts/shared/ComponentService.sol +424 -386
  451. package/contracts/shared/ComponentServiceManager.sol +8 -5
  452. package/contracts/shared/ComponentVerifyingService.sol +28 -17
  453. package/contracts/shared/ContractLib.sol +263 -0
  454. package/contracts/shared/IComponent.sol +8 -17
  455. package/contracts/shared/IComponentService.sol +40 -38
  456. package/contracts/shared/IInstanceLinkedComponent.sol +6 -32
  457. package/contracts/shared/ILifecycle.sol +3 -1
  458. package/contracts/shared/INftOwnable.sol +2 -0
  459. package/contracts/shared/IPolicyHolder.sol +12 -22
  460. package/contracts/shared/IRegisterable.sol +23 -1
  461. package/contracts/shared/IService.sol +3 -5
  462. package/contracts/shared/InitializableERC165.sol +10 -2
  463. package/contracts/shared/InstanceLinkedComponent.sol +73 -48
  464. package/contracts/shared/KeyValueStore.sol +1 -1
  465. package/contracts/shared/Lifecycle.sol +15 -4
  466. package/contracts/shared/NftOwnable.sol +29 -9
  467. package/contracts/shared/PolicyHolder.sol +15 -52
  468. package/contracts/shared/Registerable.sol +52 -21
  469. package/contracts/shared/RegistryLinked.sol +9 -14
  470. package/contracts/shared/Service.sol +15 -32
  471. package/contracts/shared/TokenHandler.sol +310 -26
  472. package/contracts/shared/TokenHandlerDeployerLib.sol +20 -0
  473. package/contracts/staking/IStaking.sol +11 -9
  474. package/contracts/staking/IStakingService.sol +8 -3
  475. package/contracts/staking/StakeManagerLib.sol +19 -26
  476. package/contracts/staking/Staking.sol +71 -61
  477. package/contracts/staking/StakingManager.sol +8 -6
  478. package/contracts/staking/StakingReader.sol +13 -6
  479. package/contracts/staking/StakingService.sol +54 -35
  480. package/contracts/staking/StakingServiceManager.sol +6 -5
  481. package/contracts/staking/TargetManagerLib.sol +7 -3
  482. package/contracts/type/Amount.sol +15 -0
  483. package/contracts/type/ClaimId.sol +6 -1
  484. package/contracts/type/Key32.sol +2 -2
  485. package/contracts/type/Key32Set.sol +62 -0
  486. package/contracts/type/NftId.sol +7 -0
  487. package/contracts/type/ObjectType.sol +57 -34
  488. package/contracts/type/PayoutId.sol +10 -10
  489. package/contracts/type/RiskId.sol +35 -4
  490. package/contracts/type/RoleId.sol +23 -15
  491. package/contracts/type/Seconds.sol +21 -1
  492. package/contracts/type/Selector.sol +5 -0
  493. package/contracts/type/StateId.sol +15 -1
  494. package/contracts/type/Timestamp.sol +4 -5
  495. package/contracts/type/UFixed.sol +13 -119
  496. package/contracts/type/Version.sol +54 -5
  497. package/contracts/upgradeability/ProxyManager.sol +68 -34
  498. package/contracts/upgradeability/Versionable.sol +2 -2
  499. package/package.json +4 -3
  500. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +0 -4
  501. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +0 -290
  502. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +0 -4
  503. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +0 -390
  504. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +0 -4
  505. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +0 -129
  506. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
  507. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
  508. package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
  509. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
  510. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
  511. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
  512. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
  513. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +0 -4
  514. package/artifacts/contracts/type/UFixed.sol/MathLib.json +0 -16
  515. package/contracts/authorization/IModuleAuthorization.sol +0 -21
  516. package/contracts/authorization/ModuleAuthorization.sol +0 -78
  517. package/contracts/instance/module/IAccess.sol +0 -46
  518. package/contracts/product/ProductService.sol +0 -99
  519. package/contracts/product/ProductServiceManager.sol +0 -39
  520. package/contracts/shared/InitializableCustom.sol +0 -177
@@ -5,13 +5,23 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
5
5
  import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
6
6
  import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
7
7
 
8
- import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
9
8
  import {IAccessAdmin} from "./IAccessAdmin.sol";
9
+ import {IAuthorization} from "./IAuthorization.sol";
10
+ import {IRegistry} from "../registry/IRegistry.sol";
11
+
12
+ import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
13
+ import {ContractLib} from "../shared/ContractLib.sol";
14
+ import {NftId, NftIdLib} from "../type/NftId.sol";
15
+ import {ObjectType} from "../type/ObjectType.sol";
10
16
  import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
11
17
  import {Selector, SelectorLib, SelectorSetLib} from "../type/Selector.sol";
12
18
  import {Str, StrLib} from "../type/String.sol";
13
- import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
19
+ import {TimestampLib} from "../type/Timestamp.sol";
20
+ import {VersionPart} from "../type/Version.sol";
14
21
 
22
+ interface IAccessManagedChecker {
23
+ function authority() external view returns (address);
24
+ }
15
25
 
16
26
  /**
17
27
  * @dev A generic access amin contract that implements role based access control based on OpenZeppelin's AccessManager contract.
@@ -28,13 +38,23 @@ contract AccessAdmin is
28
38
  string public constant ADMIN_ROLE_NAME = "AdminRole";
29
39
  string public constant PUBLIC_ROLE_NAME = "PublicRole";
30
40
 
31
- /// @dev the OpenZeppelin access manager driving the access admin contract
41
+ /// @dev admin name used for logging only
42
+ string internal _adminName;
43
+
44
+ /// @dev the access manager driving the access admin contract
45
+ /// hold link to registry and release version
32
46
  AccessManagerCloneable internal _authority;
33
47
 
48
+ /// @dev the authorization contract used for initial access control
49
+ IAuthorization internal _authorization;
50
+
34
51
  /// @dev stores the deployer address and allows to create initializers
35
52
  /// that are restricted to the deployer address.
36
53
  address internal _deployer;
37
54
 
55
+ /// @dev the linked NFT ID
56
+ NftId internal _linkedNftId;
57
+
38
58
  /// @dev store role info per role id
39
59
  mapping(RoleId roleId => RoleInfo info) internal _roleInfo;
40
60
 
@@ -67,37 +87,42 @@ contract AccessAdmin is
67
87
 
68
88
  modifier onlyDeployer() {
69
89
  // special case for cloned AccessAdmin contracts
70
- // IMPORTANT cloning and _initializeAuthority needs to be done in a single transaction
90
+ // IMPORTANT cloning and initialize authority needs to be done in a single transaction
71
91
  if (_deployer == address(0)) {
72
92
  _deployer = msg.sender;
73
93
  }
74
94
 
75
95
  if (msg.sender != _deployer) {
76
- revert ErrorNotDeployer();
96
+ revert ErrorAccessAdminNotDeployer();
77
97
  }
78
98
  _;
79
99
  }
80
100
 
81
101
  modifier onlyRoleAdmin(RoleId roleId) {
82
- if (!roleExists(roleId)) {
83
- revert ErrorRoleUnknown(roleId);
84
- }
102
+ _checkRoleExists(roleId, false);
85
103
 
86
104
  if (!hasAdminRole(msg.sender, roleId)) {
87
- revert ErrorNotAdminOfRole(_roleInfo[roleId].adminRoleId);
105
+ revert ErrorAccessAdminNotAdminOfRole(_roleInfo[roleId].adminRoleId);
88
106
  }
89
107
  _;
90
108
  }
91
109
 
92
110
  modifier onlyRoleMember(RoleId roleId) {
93
111
  if (!hasRole(msg.sender, roleId)) {
94
- revert ErrorNotRoleOwner(roleId);
112
+ revert ErrorAccessAdminNotRoleOwner(roleId);
95
113
  }
96
114
  _;
97
115
  }
98
116
 
99
- modifier onlyExistingRole(RoleId roleId) {
100
- _checkRoleId(roleId);
117
+ modifier onlyExistingRole(
118
+ RoleId roleId,
119
+ bool onlyActiveRole,
120
+ bool allowLockedRoles
121
+ )
122
+ {
123
+ if (!allowLockedRoles) {
124
+ _checkRoleExists(roleId, onlyActiveRole);
125
+ }
101
126
  _;
102
127
  }
103
128
 
@@ -106,14 +131,212 @@ contract AccessAdmin is
106
131
  _;
107
132
  }
108
133
 
109
- constructor() {
110
- _deployer = msg.sender;
111
- _authority = new AccessManagerCloneable();
134
+ //-------------- initialization functions ------------------------------//
135
+
136
+ // event LogAccessAdminDebug(string message);
137
+
138
+ /// @dev Initializes this admin with the provided accessManager (and authorization specification).
139
+ /// Internally initializes access manager with this admin and creates basic role setup.
140
+ function initialize(
141
+ address authority,
142
+ string memory adminName
143
+ )
144
+ public
145
+ initializer()
146
+ {
147
+ __AccessAdmin_init(authority, adminName);
148
+ }
149
+
150
+
151
+ function __AccessAdmin_init(
152
+ address authority,
153
+ string memory adminName
154
+ )
155
+ internal
156
+ onlyInitializing()
157
+ onlyDeployer()
158
+ {
159
+ // checks
160
+ // check authority is contract
161
+ if (!ContractLib.isContract(authority)) {
162
+ revert ErrorAccessAdminAuthorityNotContract(authority);
163
+ }
164
+
165
+ // check name not empty
166
+ if (bytes(adminName).length == 0) {
167
+ revert ErrorAccessAdminAccessManagerEmptyName();
168
+ }
169
+
170
+ _authority = AccessManagerCloneable(authority);
112
171
  _authority.initialize(address(this));
113
172
 
114
- _setAuthority(address(_authority)); // set authority for oz access managed
115
- _createAdminAndPublicRoles();
116
- _disableInitializers();
173
+ // delayed additional check for authority after its initialization
174
+ if (!ContractLib.isAuthority(authority)) {
175
+ revert ErrorAccessAdminAccessManagerNotAccessManager(authority);
176
+ }
177
+
178
+ // effects
179
+ // set and initialize this access manager contract as
180
+ // the admin (ADMIN_ROLE) of the provided authority
181
+ __AccessManaged_init(authority);
182
+
183
+ // set name for logging
184
+ _adminName = adminName;
185
+
186
+ // set initial linked NFT ID to zero
187
+ _linkedNftId = NftIdLib.zero();
188
+
189
+ // create admin and public roles
190
+ _initializeAdminAndPublicRoles();
191
+ }
192
+
193
+
194
+ /// @dev check if target exists and reverts if it doesn't
195
+ function _checkTarget(
196
+ address target
197
+ )
198
+ internal
199
+ view
200
+ {
201
+ // check not yet created
202
+ if (!targetExists(target)) {
203
+ revert ErrorAccessAdminTargetNotCreated(target);
204
+ }
205
+ }
206
+
207
+ function _checkIsRegistered(
208
+ address registry,
209
+ address target,
210
+ ObjectType expectedType
211
+ )
212
+ internal
213
+ view
214
+ {
215
+ ObjectType tagetType = IRegistry(registry).getObjectInfo(target).objectType;
216
+ if (tagetType.eqz()) {
217
+ revert ErrorAccessAdminNotRegistered(target);
218
+ }
219
+
220
+ if (tagetType != expectedType) {
221
+ revert ErrorAccessAdminTargetTypeMismatch(target, expectedType, tagetType);
222
+ }
223
+ }
224
+
225
+ /// @dev check if target exists and and has expected type, reverts if it doesn't
226
+ function _checkTargetWithType(
227
+ address target,
228
+ ObjectType expectedType
229
+ )
230
+ internal
231
+ view
232
+ {
233
+ // check target exists
234
+ _checkTarget(target);
235
+
236
+ // check target type
237
+ ObjectType tagetType = _authority.getRegistry().getObjectInfo(target).objectType;
238
+ if (tagetType != expectedType) {
239
+ revert ErrorAccessAdminTargetTypeMismatch(target, expectedType, tagetType);
240
+ }
241
+
242
+ // target release is checked during component/instance registration
243
+ }
244
+
245
+
246
+ function _checkAuthorization(
247
+ address authorization,
248
+ ObjectType expectedDomain,
249
+ VersionPart expectedRelease,
250
+ bool checkAlreadyInitialized
251
+ )
252
+ internal
253
+ view
254
+ {
255
+ // checks
256
+ // check not yet initialized
257
+ if (checkAlreadyInitialized && address(_authorization) != address(0)) {
258
+ revert ErrorAccessAdminAlreadyInitialized(address(_authorization));
259
+ }
260
+
261
+ // check contract type matches
262
+ if (!ContractLib.supportsInterface(authorization, type(IAuthorization).interfaceId)) {
263
+ revert ErrorAccessAdminNotAuthorization(authorization);
264
+ }
265
+
266
+ // check domain matches
267
+ ObjectType domain = IAuthorization(authorization).getDomain();
268
+ if (domain != expectedDomain) {
269
+ revert ErrorAccessAdminDomainMismatch(authorization, expectedDomain, domain);
270
+ }
271
+
272
+ // check release matches
273
+ VersionPart authorizationRelease = IAuthorization(authorization).getRelease();
274
+ if (authorizationRelease != expectedRelease) {
275
+ revert ErrorAccessAdminReleaseMismatch(authorization, getRelease(), authorizationRelease);
276
+ }
277
+ }
278
+
279
+
280
+ function getRelease() public view virtual returns (VersionPart release) {
281
+ return _authority.getRelease();
282
+ }
283
+
284
+
285
+ function getRegistry() public view returns (IRegistry registry) {
286
+ return _authority.getRegistry();
287
+ }
288
+
289
+
290
+ function getLinkedNftId() external view returns (NftId linkedNftId) {
291
+ return _linkedNftId;
292
+ }
293
+
294
+
295
+ function getLinkedOwner() external view returns (address linkedOwner) {
296
+ return getRegistry().ownerOf(_linkedNftId);
297
+ }
298
+
299
+
300
+
301
+ function isLocked() public view returns (bool locked) {
302
+ return _authority.isLocked();
303
+ }
304
+
305
+ function _linkToNftOwnable(address registerable) internal {
306
+ if (!getRegistry().isRegistered(registerable)) {
307
+ revert ErrorAccessAdminNotRegistered(registerable);
308
+ }
309
+
310
+ _linkedNftId = getRegistry().getNftIdForAddress(registerable);
311
+ }
312
+
313
+ function _initializeAdminAndPublicRoles()
314
+ internal
315
+ virtual
316
+ onlyInitializing()
317
+ {
318
+ RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
319
+
320
+ // setup admin role
321
+ _createRoleUnchecked(
322
+ ADMIN_ROLE(),
323
+ toRole({
324
+ adminRoleId: ADMIN_ROLE(),
325
+ roleType: RoleType.Contract,
326
+ maxMemberCount: 1,
327
+ name: ADMIN_ROLE_NAME}));
328
+
329
+ // add this contract as admin role member
330
+ _roleMembers[adminRoleId].add(address(this));
331
+
332
+ // setup public role
333
+ _createRoleUnchecked(
334
+ PUBLIC_ROLE(),
335
+ toRole({
336
+ adminRoleId: ADMIN_ROLE(),
337
+ roleType: RoleType.Gif,
338
+ maxMemberCount: type(uint32).max,
339
+ name: PUBLIC_ROLE_NAME}));
117
340
  }
118
341
 
119
342
  //--- view functions for roles ------------------------------------------//
@@ -154,6 +377,7 @@ contract AccessAdmin is
154
377
  return _roleMembers[roleId].at(idx);
155
378
  }
156
379
 
380
+ // TODO false because not role member or because role not exists?
157
381
  function hasRole(address account, RoleId roleId) public view returns (bool) {
158
382
  (bool isMember, ) = _authority.hasRole(
159
383
  RoleId.unwrap(roleId),
@@ -219,18 +443,6 @@ contract AccessAdmin is
219
443
  selector.toBytes4()));
220
444
  }
221
445
 
222
- function isAccessManaged(address target) public view returns (bool) {
223
- if (!_isContract(target)) {
224
- return false;
225
- }
226
-
227
- (bool success, ) = target.staticcall(
228
- abi.encodeWithSelector(
229
- AccessManagedUpgradeable.authority.selector));
230
-
231
- return success;
232
- }
233
-
234
446
  function canCall(address caller, address target, Selector selector) external virtual view returns (bool can) {
235
447
  (can, ) = _authority.canCall(caller, target, selector.toBytes4());
236
448
  }
@@ -241,7 +453,8 @@ contract AccessAdmin is
241
453
  adminRoleId: adminRoleId,
242
454
  roleType: roleType,
243
455
  maxMemberCount: maxMemberCount,
244
- createdAt: TimestampLib.blockTimestamp()
456
+ createdAt: TimestampLib.blockTimestamp(),
457
+ pausedAt: TimestampLib.max()
245
458
  });
246
459
  }
247
460
 
@@ -258,6 +471,17 @@ contract AccessAdmin is
258
471
 
259
472
  //--- internal/private functions -------------------------------------------------//
260
473
 
474
+ function _createTargetWithRole(
475
+ address target,
476
+ string memory targetName,
477
+ RoleId targetRoleId
478
+ )
479
+ internal
480
+ {
481
+ _createTarget(target, targetName, true, false);
482
+ _grantRoleToAccount(targetRoleId, target);
483
+ }
484
+
261
485
  function _authorizeTargetFunctions(
262
486
  address target,
263
487
  RoleId roleId,
@@ -266,14 +490,21 @@ contract AccessAdmin is
266
490
  internal
267
491
  {
268
492
  if (roleId == getAdminRole()) {
269
- revert ErrorAuthorizeForAdminRoleInvalid(target);
493
+ revert ErrorAccessAdminAuthorizeForAdminRoleInvalid(target);
270
494
  }
271
495
 
272
- bool addFunctions = true;
273
- bytes4[] memory functionSelectors = _processFunctionSelectors(target, functions, addFunctions);
496
+ (
497
+ bytes4[] memory functionSelectors,
498
+ string[] memory functionNames
499
+ ) = _processFunctionSelectors(target, functions, true);
274
500
 
275
501
  // apply authz via access manager
276
- _grantRoleAccessToFunctions(target, roleId, functionSelectors);
502
+ _grantRoleAccessToFunctions(
503
+ target,
504
+ roleId,
505
+ functionSelectors,
506
+ functionNames,
507
+ false); // allow locked roles
277
508
  }
278
509
 
279
510
  function _unauthorizeTargetFunctions(
@@ -282,9 +513,17 @@ contract AccessAdmin is
282
513
  )
283
514
  internal
284
515
  {
285
- bool addFunctions = false;
286
- bytes4[] memory functionSelectors = _processFunctionSelectors(target, functions, addFunctions);
287
- _grantRoleAccessToFunctions(target, getAdminRole(), functionSelectors);
516
+ (
517
+ bytes4[] memory functionSelectors,
518
+ string[] memory functionNames
519
+ ) = _processFunctionSelectors(target, functions, false);
520
+
521
+ _grantRoleAccessToFunctions(
522
+ target,
523
+ getAdminRole(),
524
+ functionSelectors,
525
+ functionNames,
526
+ true); // allowLockedRoles
288
527
  }
289
528
 
290
529
  function _processFunctionSelectors(
@@ -293,12 +532,15 @@ contract AccessAdmin is
293
532
  bool addFunctions
294
533
  )
295
534
  internal
535
+ onlyExistingTarget(target)
296
536
  returns (
297
- bytes4[] memory functionSelectors
537
+ bytes4[] memory functionSelectors,
538
+ string[] memory functionNames
298
539
  )
299
540
  {
300
541
  uint256 n = functions.length;
301
542
  functionSelectors = new bytes4[](n);
543
+ functionNames = new string[](n);
302
544
  FunctionInfo memory func;
303
545
  Selector selector;
304
546
 
@@ -315,70 +557,7 @@ contract AccessAdmin is
315
557
 
316
558
  // add bytes4 selector to function selector array
317
559
  functionSelectors[i] = selector.toBytes4();
318
- }
319
- }
320
-
321
- function _initializeAuthority(
322
- address authorityAddress
323
- )
324
- internal
325
- virtual
326
- onlyInitializing()
327
- onlyDeployer()
328
- {
329
- if (authority() != address(0)) {
330
- revert ErrorAuthorityAlreadySet();
331
- }
332
-
333
- _authority = AccessManagerCloneable(authorityAddress);
334
- __AccessManaged_init(address(_authority));
335
- }
336
-
337
-
338
- function _initializeAdminAndPublicRoles()
339
- internal
340
- virtual
341
- onlyInitializing()
342
- {
343
- _createAdminAndPublicRoles();
344
- }
345
-
346
-
347
- /// @dev internal setup function that can be used in both constructor and initializer.
348
- function _createAdminAndPublicRoles()
349
- internal
350
- {
351
- RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
352
- FunctionInfo[] memory functions;
353
-
354
- // setup admin role
355
- _createRoleUnchecked(
356
- ADMIN_ROLE(),
357
- toRole({
358
- adminRoleId: ADMIN_ROLE(),
359
- roleType: RoleType.Contract,
360
- maxMemberCount: 1,
361
- name: ADMIN_ROLE_NAME}));
362
-
363
- // add this contract as admin role member
364
- _roleMembers[adminRoleId].add(address(this));
365
-
366
- // setup public role
367
- _createRoleUnchecked(
368
- PUBLIC_ROLE(),
369
- toRole({
370
- adminRoleId: ADMIN_ROLE(),
371
- roleType: RoleType.Gif,
372
- maxMemberCount: type(uint32).max,
373
- name: PUBLIC_ROLE_NAME}));
374
- }
375
-
376
- /// @dev check if target exists and reverts if it doesn't
377
- function _checkTarget(address target)
378
- internal
379
- {
380
- if (_targetInfo[target].createdAt.eqz()) {
381
- revert ErrorTargetUnknown(target);
560
+ functionNames[i] = func.name.toString();
382
561
  }
383
562
  }
384
563
 
@@ -386,78 +565,82 @@ contract AccessAdmin is
386
565
  function _grantRoleAccessToFunctions(
387
566
  address target,
388
567
  RoleId roleId,
389
- bytes4[] memory functionSelectors
568
+ bytes4[] memory functionSelectors,
569
+ string[] memory functionNames,
570
+ bool allowLockedRoles // admin and public roles are locked
390
571
  )
391
572
  internal
573
+ onlyExistingTarget(target)
574
+ onlyExistingRole(roleId, true, allowLockedRoles)
392
575
  {
576
+
393
577
  _authority.setTargetFunctionRole(
394
578
  target,
395
579
  functionSelectors,
396
580
  RoleId.unwrap(roleId));
397
581
 
398
- // implizit logging: rely on OpenZeppelin log TargetFunctionRoleUpdated
582
+ // log function grantings
583
+ for (uint256 i = 0; i < functionSelectors.length; i++) {
584
+ emit LogAccessAdminFunctionGranted(
585
+ _adminName,
586
+ target,
587
+ string(abi.encodePacked(
588
+ functionNames[i],
589
+ "(): ",
590
+ _getRoleName(roleId))));
591
+ }
399
592
  }
400
593
 
594
+
401
595
  /// @dev grant the specified role to the provided account
402
596
  function _grantRoleToAccount(RoleId roleId, address account)
403
597
  internal
598
+ onlyExistingRole(roleId, true, false)
404
599
  {
405
- _checkRoleId(roleId);
406
-
407
600
  // check max role members will not be exceeded
408
601
  if (_roleMembers[roleId].length() >= _roleInfo[roleId].maxMemberCount) {
409
- revert ErrorRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
602
+ revert ErrorAccessAdminRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
410
603
  }
411
604
 
412
605
  // check account is contract for contract role
413
- // TODO implement
414
- if (_roleInfo[roleId].roleType == RoleType.Contract) {
606
+ if (
607
+ _roleInfo[roleId].roleType == RoleType.Contract &&
608
+ !ContractLib.isContract(account) // will fail in account's constructor
609
+ ) {
610
+ revert ErrorAccessAdminRoleMemberNotContract(roleId, account);
415
611
  }
416
612
 
613
+ // TODO check account already have roleId
417
614
  _roleMembers[roleId].add(account);
418
615
  _authority.grantRole(
419
616
  RoleId.unwrap(roleId),
420
617
  account,
421
618
  0);
422
619
 
423
- // indirect logging: rely on OpenZeppelin log RoleGranted
620
+ emit LogAccessAdminRoleGranted(_adminName, account, _getRoleName(roleId));
424
621
  }
425
622
 
426
623
  /// @dev revoke the specified role from the provided account
427
624
  function _revokeRoleFromAccount(RoleId roleId, address account)
428
625
  internal
626
+ onlyExistingRole(roleId, false, false)
429
627
  {
430
- _checkRoleId(roleId);
431
628
 
432
629
  // check role removal is permitted
433
630
  if (_roleInfo[roleId].roleType == RoleType.Contract) {
434
- revert ErrorRoleRemovalDisabled(roleId);
631
+ revert ErrorAccessAdminRoleMemberRemovalDisabled(roleId, account);
435
632
  }
436
633
 
634
+ // TODO check account have roleId?
437
635
  _roleMembers[roleId].remove(account);
438
636
  _authority.revokeRole(
439
637
  RoleId.unwrap(roleId),
440
638
  account);
441
639
 
442
- // indirect logging: rely on OpenZeppelin log RoleGranted
640
+ emit LogAccessAdminRoleRevoked(_adminName, account, _roleInfo[roleId].name.toString());
443
641
  }
444
642
 
445
643
 
446
- function _checkRoleId(RoleId roleId)
447
- internal
448
- {
449
- if (_roleInfo[roleId].createdAt.eqz()) {
450
- revert ErrorRoleUnknown(roleId);
451
- }
452
-
453
- uint64 roleIdInt = RoleId.unwrap(roleId);
454
- if (roleIdInt == _authority.ADMIN_ROLE()
455
- || roleIdInt == _authority.PUBLIC_ROLE())
456
- {
457
- revert ErrorRoleIsLocked(roleId);
458
- }
459
- }
460
-
461
644
  /// @dev Creates a role based on the provided parameters.
462
645
  /// Checks that the provided role and role id and role name not already used.
463
646
  function _createRole(
@@ -468,24 +651,24 @@ contract AccessAdmin is
468
651
  {
469
652
  // check role does not yet exist
470
653
  if(roleExists(roleId)) {
471
- revert ErrorRoleAlreadyCreated(
654
+ revert ErrorAccessAdminRoleAlreadyCreated(
472
655
  roleId,
473
656
  _roleInfo[roleId].name.toString());
474
657
  }
475
658
 
476
659
  // check admin role exists
477
660
  if(!roleExists(info.adminRoleId)) {
478
- revert ErrorRoleAdminNotExisting(info.adminRoleId);
661
+ revert ErrorAccessAdminRoleAdminNotExisting(info.adminRoleId);
479
662
  }
480
663
 
481
664
  // check role name is not empty
482
665
  if(info.name.length() == 0) {
483
- revert ErrorRoleNameEmpty(roleId);
666
+ revert ErrorAccessAdminRoleNameEmpty(roleId);
484
667
  }
485
668
 
486
669
  // check role name is not used for another role
487
670
  if(_roleForName[info.name].exists) {
488
- revert ErrorRoleNameAlreadyExists(
671
+ revert ErrorAccessAdminRoleNameAlreadyExists(
489
672
  roleId,
490
673
  info.name.toString(),
491
674
  _roleForName[info.name].roleId);
@@ -513,7 +696,7 @@ contract AccessAdmin is
513
696
  // add role to list of roles
514
697
  _roleIds.push(roleId);
515
698
 
516
- emit LogRoleCreated(roleId, info.roleType, info.adminRoleId, info.name.toString());
699
+ emit LogAccessAdminRoleCreated(_adminName, roleId, info.roleType, info.adminRoleId, info.name.toString());
517
700
  }
518
701
 
519
702
 
@@ -524,11 +707,10 @@ contract AccessAdmin is
524
707
  bool custom
525
708
  )
526
709
  internal
527
- nonReentrant()
528
710
  {
529
711
  // check target does not yet exist
530
712
  if(targetExists(target)) {
531
- revert ErrorTargetAlreadyCreated(
713
+ revert ErrorAccessAdminTargetAlreadyCreated(
532
714
  target,
533
715
  _targetInfo[target].name.toString());
534
716
  }
@@ -536,27 +718,27 @@ contract AccessAdmin is
536
718
  // check target name is not empty
537
719
  Str name = StrLib.toStr(targetName);
538
720
  if(name.length() == 0) {
539
- revert ErrorTargetNameEmpty(target);
721
+ revert ErrorAccessAdminTargetNameEmpty(target);
540
722
  }
541
723
 
542
724
  // check target name is not used for another target
543
725
  if( _targetForName[name] != address(0)) {
544
- revert ErrorTargetNameAlreadyExists(
726
+ revert ErrorAccessAdminTargetNameAlreadyExists(
545
727
  target,
546
728
  targetName,
547
729
  _targetForName[name]);
548
730
  }
549
731
 
550
732
  // check target is an access managed contract
551
- if (!isAccessManaged(target)) {
552
- revert ErrorTargetNotAccessManaged(target);
733
+ if (!_isAccessManaged(target)) {
734
+ revert ErrorAccessAdminTargetNotAccessManaged(target);
553
735
  }
554
736
 
555
737
  // check target shares authority with this contract
556
738
  if (checkAuthority) {
557
739
  address targetAuthority = AccessManagedUpgradeable(target).authority();
558
740
  if (targetAuthority != authority()) {
559
- revert ErrorTargetAuthorityMismatch(authority(), targetAuthority);
741
+ revert ErrorAccessAdminTargetAuthorityMismatch(authority(), targetAuthority);
560
742
  }
561
743
  }
562
744
 
@@ -573,19 +755,77 @@ contract AccessAdmin is
573
755
  // add role to list of roles
574
756
  _targets.push(target);
575
757
 
576
- emit LogTargetCreated(target, targetName);
758
+ emit LogAccessAdminTargetCreated(_adminName, target, targetName);
577
759
  }
578
760
 
579
- function _isContract(address target)
761
+
762
+ function _setTargetLocked(address target, bool locked)
580
763
  internal
581
- view
764
+ onlyExistingTarget(target)
765
+ {
766
+ _authority.setTargetClosed(target, locked);
767
+ }
768
+
769
+
770
+ function _isAccessManaged(address target)
771
+ internal
772
+ view
582
773
  returns (bool)
583
774
  {
584
- uint256 size;
585
- assembly {
586
- size := extcodesize(target)
775
+ if (!ContractLib.isContract(target)) {
776
+ return false;
777
+ }
778
+
779
+ (bool success, ) = target.staticcall(
780
+ abi.encodeWithSelector(
781
+ IAccessManagedChecker.authority.selector));
782
+
783
+ return success;
784
+ }
785
+
786
+
787
+ function _getAccountName(address account) internal view returns (string memory) {
788
+ if (targetExists(account)) {
789
+ return _targetInfo[account].name.toString();
790
+ }
791
+ return "<unknown-account>";
792
+ }
793
+
794
+
795
+ function _getRoleName(RoleId roleId) internal view returns (string memory) {
796
+ if (roleExists(roleId)) {
797
+ return _roleInfo[roleId].name.toString();
798
+ }
799
+ return "<unknown-role>";
800
+ }
801
+
802
+
803
+ function _checkRoleExists(
804
+ RoleId roleId,
805
+ bool onlyActiveRole
806
+ )
807
+ internal
808
+ view
809
+ {
810
+ if (!roleExists(roleId)) {
811
+ revert ErrorAccessAdminRoleUnknown(roleId);
812
+ }
813
+
814
+ uint64 roleIdInt = RoleId.unwrap(roleId);
815
+ if (roleIdInt == _authority.ADMIN_ROLE()) {
816
+ revert ErrorAccessAdminRoleIsLocked(roleId);
817
+ }
818
+
819
+ // check if role is disabled
820
+ if (onlyActiveRole && _roleInfo[roleId].pausedAt <= TimestampLib.blockTimestamp()) {
821
+ revert ErrorAccessAdminRoleIsPaused(roleId);
822
+ }
823
+ }
824
+
825
+
826
+ function _checkRegistry(address registry) internal view {
827
+ if (!ContractLib.isRegistry(registry)) {
828
+ revert ErrorAccessAdminNotRegistry(registry);
587
829
  }
588
- return size > 0;
589
830
  }
590
-
591
831
  }