@etherisc/gif-next 0.0.2-9e6b423-414 → 0.0.2-9f51324-299

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 (337) hide show
  1. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +2 -2
  3. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +2 -2
  5. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +97 -267
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
  10. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +36 -652
  12. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +2 -2
  14. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +47 -222
  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 +27 -175
  19. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +12 -85
  21. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +16 -246
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +27 -420
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +3 -3
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +60 -221
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +114 -167
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +60 -72
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +0 -29
  38. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  39. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +2 -2
  41. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +59 -220
  43. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2 -2
  45. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +59 -220
  47. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +3 -3
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +59 -220
  52. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +2 -2
  54. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +2 -2
  56. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +59 -220
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2 -2
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +59 -220
  62. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  64. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +32 -310
  66. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +0 -182
  68. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  69. package/artifacts/contracts/instance/Instance.sol/Instance.json +72 -322
  70. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +292 -605
  72. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +56 -242
  74. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +290 -478
  76. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +26 -208
  78. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +14 -14
  80. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2 -2
  82. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  84. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  86. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  87. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  89. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  91. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  93. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
  95. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  100. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +2 -2
  103. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +56 -234
  105. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
  111. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
  113. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  114. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +59 -220
  116. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +108 -92
  118. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +55 -31
  120. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  122. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  123. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  124. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  125. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +26 -92
  126. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  127. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +2 -2
  128. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  129. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +2 -2
  130. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  131. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +36 -60
  132. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +19 -15
  134. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  135. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  136. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +59 -220
  137. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  138. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +78 -78
  139. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  140. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +40 -40
  141. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  143. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  146. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  147. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  148. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +2 -2
  149. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  150. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +26 -82
  151. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +2 -2
  153. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.json +2 -2
  155. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
  157. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  158. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskService.sol/RiskService.json +2 -2
  160. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  161. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +2 -2
  162. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  163. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  164. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  166. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  167. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  168. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  169. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +249 -378
  171. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +1 -1
  172. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +68 -243
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  174. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  176. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +10 -10
  177. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  178. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +186 -384
  179. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  181. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +76 -128
  183. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  184. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +26 -437
  185. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  186. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  187. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +54 -54
  190. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +28 -28
  192. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  194. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +45 -16
  195. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  196. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  197. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  200. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  202. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  203. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  204. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  205. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  206. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  208. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  209. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  210. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  211. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  212. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  213. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  214. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  215. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  216. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  217. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  218. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  219. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  220. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  221. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  222. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  223. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  224. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  225. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  226. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  227. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  228. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  229. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  230. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  231. package/artifacts/contracts/staking/Staking.sol/Staking.json +8 -8
  232. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +1 -1
  233. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +2 -2
  234. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  235. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  236. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  237. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +5 -5
  238. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  239. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  240. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  241. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +2 -2
  242. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  243. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +2 -2
  244. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  245. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  246. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  247. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +3 -3
  248. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  249. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  253. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  255. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  257. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  258. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  259. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  260. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  262. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  263. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  264. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  265. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +6 -6
  266. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  267. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  268. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  269. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  270. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  271. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  272. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  273. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  274. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +218 -39
  276. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/String.sol/StrLib.json +2 -50
  282. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  286. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  287. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  288. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
  289. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  290. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  291. package/contracts/authorization/AccessAdmin.sol +185 -261
  292. package/contracts/authorization/AccessAdminLib.sol +7 -220
  293. package/contracts/authorization/Authorization.sol +229 -38
  294. package/contracts/authorization/IAccess.sol +4 -14
  295. package/contracts/authorization/IAccessAdmin.sol +45 -19
  296. package/contracts/authorization/IAuthorization.sol +56 -3
  297. package/contracts/authorization/IServiceAuthorization.sol +17 -55
  298. package/contracts/authorization/ServiceAuthorization.sol +33 -247
  299. package/contracts/distribution/BasicDistributionAuthorization.sol +4 -11
  300. package/contracts/distribution/Distribution.sol +1 -2
  301. package/contracts/distribution/DistributionService.sol +33 -75
  302. package/contracts/distribution/IDistributionComponent.sol +1 -3
  303. package/contracts/distribution/IDistributionService.sol +4 -10
  304. package/contracts/instance/IInstance.sol +4 -43
  305. package/contracts/instance/IInstanceService.sol +3 -28
  306. package/contracts/instance/Instance.sol +39 -80
  307. package/contracts/instance/InstanceAdmin.sol +229 -162
  308. package/contracts/instance/InstanceAuthorizationV3.sol +28 -58
  309. package/contracts/instance/InstanceReader.sol +389 -371
  310. package/contracts/instance/InstanceService.sol +53 -105
  311. package/contracts/oracle/BasicOracleAuthorization.sol +2 -18
  312. package/contracts/pool/BasicPoolAuthorization.sol +3 -9
  313. package/contracts/pool/BundleService.sol +9 -8
  314. package/contracts/pool/PoolLib.sol +0 -44
  315. package/contracts/product/ApplicationService.sol +26 -4
  316. package/contracts/product/BasicProductAuthorization.sol +4 -9
  317. package/contracts/product/ClaimService.sol +20 -11
  318. package/contracts/product/PolicyService.sol +2 -2
  319. package/contracts/product/PolicyServiceLib.sol +0 -20
  320. package/contracts/registry/RegistryAdmin.sol +97 -27
  321. package/contracts/registry/RegistryAuthorization.sol +25 -35
  322. package/contracts/registry/ReleaseAdmin.sol +100 -42
  323. package/contracts/registry/ReleaseRegistry.sol +9 -12
  324. package/contracts/registry/ServiceAuthorizationV3.sol +20 -32
  325. package/contracts/registry/TokenRegistry.sol +4 -2
  326. package/contracts/shared/ComponentService.sol +5 -22
  327. package/contracts/shared/ContractLib.sol +45 -9
  328. package/contracts/shared/IRegisterable.sol +1 -0
  329. package/contracts/shared/Service.sol +4 -6
  330. package/contracts/staking/Staking.sol +5 -4
  331. package/contracts/staking/TargetManagerLib.sol +1 -1
  332. package/contracts/type/ObjectType.sol +3 -16
  333. package/contracts/type/RoleId.sol +59 -57
  334. package/contracts/type/String.sol +0 -12
  335. package/contracts/upgradeability/ProxyManager.sol +2 -2
  336. package/contracts/upgradeability/Versionable.sol +1 -4
  337. package/package.json +1 -1
@@ -5,26 +5,24 @@ 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 {IAccess} from "./IAccess.sol";
9
8
  import {IAccessAdmin} from "./IAccessAdmin.sol";
10
9
  import {IAuthorization} from "./IAuthorization.sol";
11
10
  import {IRegistry} from "../registry/IRegistry.sol";
12
11
 
13
- import {ADMIN_ROLE_NAME, PUBLIC_ROLE_NAME} from "./AccessAdmin.sol";
14
12
  import {AccessAdminLib} from "./AccessAdminLib.sol";
15
13
  import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
16
14
  import {ContractLib} from "../shared/ContractLib.sol";
17
15
  import {NftId, NftIdLib} from "../type/NftId.sol";
18
16
  import {ObjectType} from "../type/ObjectType.sol";
19
17
  import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
20
- import {Selector, SelectorSetLib} from "../type/Selector.sol";
18
+ import {Selector, SelectorLib, SelectorSetLib} from "../type/Selector.sol";
21
19
  import {Str, StrLib} from "../type/String.sol";
22
20
  import {TimestampLib} from "../type/Timestamp.sol";
23
21
  import {VersionPart} from "../type/Version.sol";
24
22
 
25
- function ADMIN_ROLE_NAME() pure returns (string memory) { return "AdminRole"; }
26
- function PUBLIC_ROLE_NAME() pure returns (string memory) { return "PublicRole"; }
27
-
23
+ interface IAccessManagedChecker {
24
+ function authority() external view returns (address);
25
+ }
28
26
 
29
27
  /**
30
28
  * @dev A generic access amin contract that implements role based access control based on OpenZeppelin's AccessManager contract.
@@ -38,6 +36,9 @@ contract AccessAdmin is
38
36
  {
39
37
  using EnumerableSet for EnumerableSet.AddressSet;
40
38
 
39
+ string public constant ADMIN_ROLE_NAME = "AdminRole";
40
+ string public constant PUBLIC_ROLE_NAME = "PublicRole";
41
+
41
42
  /// @dev admin name used for logging only
42
43
  string internal _adminName;
43
44
 
@@ -85,9 +86,6 @@ contract AccessAdmin is
85
86
  /// @dev temporary dynamic functions array
86
87
  bytes4[] private _functions;
87
88
 
88
- // @dev target type specific role id counters
89
- mapping(TargetType => uint64) internal _nextRoleId;
90
-
91
89
  modifier onlyDeployer() {
92
90
  // special case for cloned AccessAdmin contracts
93
91
  // IMPORTANT cloning and initialize authority needs to be done in a single transaction
@@ -101,9 +99,45 @@ contract AccessAdmin is
101
99
  _;
102
100
  }
103
101
 
102
+ modifier onlyRoleMember(RoleId roleId, address account) {
103
+ _checkRoleExists(roleId, false);
104
+
105
+ if (!hasRole(account, roleId)) {
106
+ revert ErrorAccessAdminNotRoleOwner(roleId, account);
107
+ }
108
+ _;
109
+ }
110
+
111
+ modifier onlyRoleAdmin(RoleId roleId, address account) {
112
+ _checkRoleExists(roleId, false);
113
+
114
+ if (!hasAdminRole(account, roleId)) {
115
+ revert ErrorAccessAdminNotAdminOfRole(_roleInfo[roleId].adminRoleId, account);
116
+ }
117
+ _;
118
+ }
119
+
120
+ modifier onlyExistingRole(
121
+ RoleId roleId,
122
+ bool onlyActiveRole,
123
+ bool allowLockedRoles
124
+ )
125
+ {
126
+ if (!allowLockedRoles) {
127
+ _checkRoleExists(roleId, onlyActiveRole);
128
+ }
129
+ _;
130
+ }
131
+
132
+ modifier onlyExistingTarget(address target) {
133
+ _checkTargetExists(target);
134
+ _;
135
+ }
104
136
 
105
137
  //-------------- initialization functions ------------------------------//
106
138
 
139
+ // event LogAccessAdminDebug(string message);
140
+
107
141
  /// @dev Initializes this admin with the provided accessManager (and authorization specification).
108
142
  /// Internally initializes access manager with this admin and creates basic role setup.
109
143
  function initialize(
@@ -126,7 +160,7 @@ contract AccessAdmin is
126
160
  onlyDeployer()
127
161
  {
128
162
  // checks
129
- // only contract check (authority might not yet be initialized at this time)
163
+ // check authority is contract
130
164
  if (!ContractLib.isContract(authority)) {
131
165
  revert ErrorAccessAdminAuthorityNotContract(authority);
132
166
  }
@@ -159,7 +193,6 @@ contract AccessAdmin is
159
193
  _initializeAdminAndPublicRoles();
160
194
  }
161
195
 
162
- //--- view functions for access amdin ---------------------------------------//
163
196
 
164
197
  function getRelease() public view virtual returns (VersionPart release) {
165
198
  return _authority.getRelease();
@@ -208,35 +241,18 @@ contract AccessAdmin is
208
241
  return RoleId.wrap(_authority.PUBLIC_ROLE());
209
242
  }
210
243
 
211
- function roleExists(string memory name) public view returns (bool exists) {
212
- // special case for admin and public roles
213
- if (StrLib.eq(name, ADMIN_ROLE_NAME()) || StrLib.eq(name, PUBLIC_ROLE_NAME())) {
214
- return true;
215
- }
216
-
217
- return _roleForName[StrLib.toStr(name)].roleId.gtz();
218
- }
219
-
220
244
  function roleExists(RoleId roleId) public view returns (bool exists) {
221
245
  return _roleInfo[roleId].createdAt.gtz();
222
246
  }
223
247
 
224
- function getRoleForName(string memory name) public view returns (RoleId roleId) {
248
+ function getRoleForName(string memory name) external view returns (RoleId roleId) {
225
249
  return _roleForName[StrLib.toStr(name)].roleId;
226
250
  }
227
251
 
228
- function getRoleInfo(RoleId roleId) public view returns (RoleInfo memory) {
252
+ function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory) {
229
253
  return _roleInfo[roleId];
230
254
  }
231
255
 
232
- function isRoleActive(RoleId roleId) external view returns (bool isActive) {
233
- return _roleInfo[roleId].pausedAt > TimestampLib.blockTimestamp();
234
- }
235
-
236
- function isRoleCustom(RoleId roleId) external view returns (bool isActive) {
237
- return _roleInfo[roleId].roleType == RoleType.Custom;
238
- }
239
-
240
256
  function roleMembers(RoleId roleId) external view returns (uint256 numberOfMembers) {
241
257
  return _roleMembers[roleId].length();
242
258
  }
@@ -245,15 +261,21 @@ contract AccessAdmin is
245
261
  return _roleMembers[roleId].at(idx);
246
262
  }
247
263
 
248
- function isRoleMember(RoleId roleId, address account) public view returns (bool) {
264
+ // TODO false because not role member or because role not exists?
265
+ function hasRole(address account, RoleId roleId) public view returns (bool) {
249
266
  (bool isMember, ) = _authority.hasRole(
250
267
  RoleId.unwrap(roleId),
251
268
  account);
252
269
  return isMember;
253
270
  }
254
271
 
255
- function isRoleAdmin(RoleId roleId, address account) public virtual view returns (bool) {
256
- return isRoleMember(_roleInfo[roleId].adminRoleId, account);
272
+ function hasAdminRole(address account, RoleId roleId)
273
+ public
274
+ virtual
275
+ view
276
+ returns (bool)
277
+ {
278
+ return hasRole(account, _roleInfo[roleId].adminRoleId);
257
279
  }
258
280
 
259
281
  //--- view functions for targets ----------------------------------------//
@@ -270,7 +292,7 @@ contract AccessAdmin is
270
292
  return _targets[idx];
271
293
  }
272
294
 
273
- function getTargetInfo(address target) public view returns (TargetInfo memory targetInfo) {
295
+ function getTargetInfo(address target) external view returns (TargetInfo memory targetInfo) {
274
296
  return _targetInfo[target];
275
297
  }
276
298
 
@@ -279,7 +301,7 @@ contract AccessAdmin is
279
301
  }
280
302
 
281
303
  function isTargetLocked(address target) public view returns (bool locked) {
282
- return _authority.isLocked() || _authority.isTargetClosed(target);
304
+ return _authority.isTargetClosed(target);
283
305
  }
284
306
 
285
307
  function authorizedFunctions(address target) external view returns (uint256 numberOfFunctions) {
@@ -319,12 +341,13 @@ contract AccessAdmin is
319
341
  _linkedNftId = getRegistry().getNftIdForAddress(registerable);
320
342
  }
321
343
 
322
-
323
344
  function _initializeAdminAndPublicRoles()
324
345
  internal
325
346
  virtual
326
347
  onlyInitializing()
327
348
  {
349
+ RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
350
+
328
351
  // setup admin role
329
352
  _createRoleUnchecked(
330
353
  ADMIN_ROLE(),
@@ -332,147 +355,147 @@ contract AccessAdmin is
332
355
  adminRoleId: ADMIN_ROLE(),
333
356
  roleType: RoleType.Contract,
334
357
  maxMemberCount: 1,
335
- name: ADMIN_ROLE_NAME()}));
358
+ name: ADMIN_ROLE_NAME}));
336
359
 
337
- // add this contract as admin role member, as contract roles cannot be revoked
338
- // and max member count is 1 for admin role this access admin contract will
339
- // always be the only admin of the access manager.
340
- _roleMembers[
341
- RoleIdLib.toRoleId(_authority.ADMIN_ROLE())].add(address(this));
360
+ // add this contract as admin role member
361
+ _roleMembers[adminRoleId].add(address(this));
342
362
 
343
363
  // setup public role
344
364
  _createRoleUnchecked(
345
365
  PUBLIC_ROLE(),
346
366
  AccessAdminLib.toRole({
347
367
  adminRoleId: ADMIN_ROLE(),
348
- roleType: RoleType.Core,
368
+ roleType: RoleType.Gif,
349
369
  maxMemberCount: type(uint32).max,
350
- name: PUBLIC_ROLE_NAME()}));
370
+ name: PUBLIC_ROLE_NAME}));
351
371
  }
352
372
 
353
-
354
- /// @dev Authorize the functions of the target for the specified role.
355
- function _authorizeFunctions(IAuthorization authorization, Str target, RoleId roleId)
356
- internal
357
- {
358
- _authorizeTargetFunctions(
359
- getTargetForName(target),
360
- _toAuthorizedRoleId(authorization, roleId),
361
- authorization.getAuthorizedFunctions(
362
- target,
363
- roleId),
364
- true);
365
- }
366
-
367
-
368
- function _toAuthorizedRoleId(IAuthorization authorization, RoleId roleId)
373
+ function _createTargetWithRole(
374
+ address target,
375
+ string memory targetName,
376
+ RoleId targetRoleId
377
+ )
369
378
  internal
370
- returns (RoleId authorizedRoleId)
371
379
  {
372
- // special case for service roles (service roles have predefined role ids)
373
- if (roleId.isServiceRole()) {
374
-
375
- // create service role if missing
376
- if (!roleExists(roleId)) {
377
- _createRole(
378
- roleId,
379
- AccessAdminLib.toRole(
380
- ADMIN_ROLE(),
381
- RoleType.Contract,
382
- 1,
383
- authorization.getRoleName(roleId)));
384
- }
385
-
386
- return roleId;
387
- }
388
-
389
- string memory roleName = authorization.getRoleInfo(roleId).name.toString();
390
- return authorizedRoleId = getRoleForName(roleName);
380
+ _createTarget(target, targetName, true, false);
381
+ _grantRoleToAccount(targetRoleId, target);
391
382
  }
392
383
 
393
-
394
384
  function _authorizeTargetFunctions(
395
385
  address target,
396
386
  RoleId roleId,
397
- FunctionInfo[] memory functions,
398
- bool addFunctions
387
+ FunctionInfo[] memory functions
399
388
  )
400
389
  internal
401
390
  {
402
- if (addFunctions && roleId == getAdminRole()) {
391
+ if (roleId == getAdminRole()) {
403
392
  revert ErrorAccessAdminAuthorizeForAdminRoleInvalid(target);
404
393
  }
405
394
 
395
+ (
396
+ bytes4[] memory functionSelectors,
397
+ string[] memory functionNames
398
+ ) = _processFunctionSelectors(target, functions, true);
399
+
406
400
  // apply authz via access manager
407
401
  _grantRoleAccessToFunctions(
408
402
  target,
409
403
  roleId,
410
- functions,
411
- addFunctions); // add functions
404
+ functionSelectors,
405
+ functionNames,
406
+ false); // allow locked roles
412
407
  }
413
408
 
409
+ function _unauthorizeTargetFunctions(
410
+ address target,
411
+ FunctionInfo[] memory functions
412
+ )
413
+ internal
414
+ {
415
+ (
416
+ bytes4[] memory functionSelectors,
417
+ string[] memory functionNames
418
+ ) = _processFunctionSelectors(target, functions, false);
414
419
 
415
- /// @dev grant the specified role access to all functions in the provided selector list
416
- function _grantRoleAccessToFunctions(
420
+ _grantRoleAccessToFunctions(
421
+ target,
422
+ getAdminRole(),
423
+ functionSelectors,
424
+ functionNames,
425
+ true); // allowLockedRoles
426
+ }
427
+
428
+ function _processFunctionSelectors(
417
429
  address target,
418
- RoleId roleId,
419
430
  FunctionInfo[] memory functions,
420
431
  bool addFunctions
421
432
  )
422
433
  internal
434
+ onlyExistingTarget(target)
435
+ returns (
436
+ bytes4[] memory functionSelectors,
437
+ string[] memory functionNames
438
+ )
423
439
  {
424
- _checkTargetExists(target);
425
- _checkRoleExists(roleId, true, true);
426
-
427
- _authority.setTargetFunctionRole(
428
- target,
429
- AccessAdminLib.getSelectors(functions),
430
- RoleId.unwrap(roleId));
431
-
432
- // update function set and log function grantings
433
- for (uint256 i = 0; i < functions.length; i++) {
434
- _updateFunctionAccess(
435
- target,
436
- roleId,
437
- functions[i],
438
- addFunctions);
440
+ uint256 n = functions.length;
441
+ functionSelectors = new bytes4[](n);
442
+ functionNames = new string[](n);
443
+ FunctionInfo memory func;
444
+ Selector selector;
445
+
446
+ for (uint256 i = 0; i < n; i++) {
447
+ func = functions[i];
448
+ selector = func.selector;
449
+
450
+ // add function selector to target selector set if not in set
451
+ if (addFunctions) { SelectorSetLib.add(_targetFunctions[target], selector); }
452
+ else { SelectorSetLib.remove(_targetFunctions[target], selector); }
453
+
454
+ // set function name
455
+ _functionInfo[target][selector] = func;
456
+
457
+ // add bytes4 selector to function selector array
458
+ functionSelectors[i] = selector.toBytes4();
459
+ functionNames[i] = func.name.toString();
439
460
  }
440
461
  }
441
462
 
442
-
443
- function _updateFunctionAccess(
444
- address target,
445
- RoleId roleId,
446
- FunctionInfo memory func,
447
- bool addFunction
463
+ /// @dev grant the specified role access to all functions in the provided selector list
464
+ function _grantRoleAccessToFunctions(
465
+ address target,
466
+ RoleId roleId,
467
+ bytes4[] memory functionSelectors,
468
+ string[] memory functionNames,
469
+ bool allowLockedRoles // admin and public roles are locked
448
470
  )
449
471
  internal
472
+ onlyExistingTarget(target)
473
+ onlyExistingRole(roleId, true, allowLockedRoles)
450
474
  {
451
- // update functions info
452
- Selector selector = func.selector;
453
- _functionInfo[target][selector] = func;
454
475
 
455
- // update function sets
456
- if (addFunction) { SelectorSetLib.add(_targetFunctions[target], selector); }
457
- else { SelectorSetLib.remove(_targetFunctions[target], selector); }
476
+ _authority.setTargetFunctionRole(
477
+ target,
478
+ functionSelectors,
479
+ RoleId.unwrap(roleId));
458
480
 
459
- // logging
460
- emit LogAccessAdminFunctionGranted(
461
- _adminName,
462
- target,
463
- string(abi.encodePacked(
464
- func.name.toString(),
465
- "(): ",
466
- _getRoleName(roleId))));
481
+ // log function grantings
482
+ for (uint256 i = 0; i < functionSelectors.length; i++) {
483
+ emit LogAccessAdminFunctionGranted(
484
+ _adminName,
485
+ target,
486
+ string(abi.encodePacked(
487
+ functionNames[i],
488
+ "(): ",
489
+ _getRoleName(roleId))));
490
+ }
467
491
  }
468
492
 
469
493
 
470
494
  /// @dev grant the specified role to the provided account
471
495
  function _grantRoleToAccount(RoleId roleId, address account)
472
496
  internal
497
+ onlyExistingRole(roleId, true, false)
473
498
  {
474
- _checkRoleExists(roleId, true, false);
475
-
476
499
  // check max role members will not be exceeded
477
500
  if (_roleMembers[roleId].length() >= _roleInfo[roleId].maxMemberCount) {
478
501
  revert ErrorAccessAdminRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
@@ -486,7 +509,7 @@ contract AccessAdmin is
486
509
  revert ErrorAccessAdminRoleMemberNotContract(roleId, account);
487
510
  }
488
511
 
489
- // effects
512
+ // TODO check account already have roleId
490
513
  _roleMembers[roleId].add(account);
491
514
  _authority.grantRole(
492
515
  RoleId.unwrap(roleId),
@@ -496,19 +519,18 @@ contract AccessAdmin is
496
519
  emit LogAccessAdminRoleGranted(_adminName, account, _getRoleName(roleId));
497
520
  }
498
521
 
499
-
500
522
  /// @dev revoke the specified role from the provided account
501
523
  function _revokeRoleFromAccount(RoleId roleId, address account)
502
524
  internal
525
+ onlyExistingRole(roleId, false, false)
503
526
  {
504
- _checkRoleExists(roleId, false, false);
505
527
 
506
- // check for attempt to revoke contract role
528
+ // check role removal is permitted
507
529
  if (_roleInfo[roleId].roleType == RoleType.Contract) {
508
530
  revert ErrorAccessAdminRoleMemberRemovalDisabled(roleId, account);
509
531
  }
510
532
 
511
- // effects
533
+ // TODO check account have roleId?
512
534
  _roleMembers[roleId].remove(account);
513
535
  _authority.revokeRole(
514
536
  RoleId.unwrap(roleId),
@@ -526,84 +548,21 @@ contract AccessAdmin is
526
548
  )
527
549
  internal
528
550
  {
529
- // skip admin and public roles (they are created during initialization)
530
- if (roleId == ADMIN_ROLE() || roleId == PUBLIC_ROLE()) {
531
- return;
532
- }
533
-
534
551
  AccessAdminLib.checkRoleCreation(this, roleId, info);
535
552
  _createRoleUnchecked(roleId, info);
536
553
  }
537
554
 
538
555
 
539
- /// @dev Activates or deactivates role.
540
- /// The role activ property is indirectly controlled over the pausedAt timestamp.
541
- function _setRoleActive(RoleId roleId, bool active)
542
- internal
543
- {
544
- if (active) {
545
- _roleInfo[roleId].pausedAt = TimestampLib.max();
546
- } else {
547
- _roleInfo[roleId].pausedAt = TimestampLib.blockTimestamp();
548
- }
549
- }
550
-
551
-
552
- function _createManagedTarget(
553
- address target,
554
- string memory targetName,
555
- TargetType targetType
556
- )
557
- internal
558
- returns (RoleId contractRoleId)
559
- {
560
- return _createTarget(target, targetName, targetType, true);
561
- }
562
-
563
-
564
- function _createUncheckedTarget(
565
- address target,
566
- string memory targetName,
567
- TargetType targetType
568
- )
569
- internal
570
- {
571
- _createTarget(target, targetName, targetType, false);
572
- }
573
-
574
-
575
556
  function _createTarget(
576
557
  address target,
577
558
  string memory targetName,
578
- TargetType targetType,
579
- bool checkAuthority
559
+ bool checkAuthority,
560
+ bool custom
580
561
  )
581
- private
582
- returns (RoleId contractRoleId)
562
+ internal
583
563
  {
584
- // checks
585
564
  AccessAdminLib.checkTargetCreation(this, target, targetName, checkAuthority);
586
-
587
- // effects
588
- contractRoleId = _createTargetUnchecked(
589
- target,
590
- targetName,
591
- targetType,
592
- checkAuthority);
593
-
594
- // deal with token handler, if applicable
595
- (
596
- address tokenHandler,
597
- string memory tokenHandlerName
598
- ) = AccessAdminLib.getTokenHandler(target, targetName, targetType);
599
-
600
- if (tokenHandler != address(0)) {
601
- _createTargetUnchecked(
602
- tokenHandler,
603
- tokenHandlerName,
604
- targetType,
605
- checkAuthority);
606
- }
565
+ _createTargetUnchecked(target, targetName, custom);
607
566
  }
608
567
 
609
568
 
@@ -615,7 +574,6 @@ contract AccessAdmin is
615
574
  {
616
575
  // create role info
617
576
  info.createdAt = TimestampLib.blockTimestamp();
618
- info.pausedAt = TimestampLib.max();
619
577
  _roleInfo[roleId] = info;
620
578
 
621
579
  // create role name info
@@ -630,79 +588,35 @@ contract AccessAdmin is
630
588
  }
631
589
 
632
590
 
633
- /// @dev Creates a new target and a corresponding contract role.
634
- /// The function assigns the role to the target and logs the creation.
635
591
  function _createTargetUnchecked(
636
592
  address target,
637
593
  string memory targetName,
638
- TargetType targetType,
639
- bool managed
594
+ bool custom
640
595
  )
641
596
  internal
642
- returns (RoleId targetRoleId)
643
597
  {
644
- // create target role (if not existing)
645
- string memory roleName;
646
- (targetRoleId, roleName) = _getOrCreateTargetRoleIdAndName(target, targetName, targetType);
647
-
648
- if (!roleExists(targetRoleId)) {
649
- _createRole(
650
- targetRoleId,
651
- AccessAdminLib.toRole(ADMIN_ROLE(), IAccess.RoleType.Contract, 1, roleName));
652
- }
653
-
654
598
  // create target info
655
599
  Str name = StrLib.toStr(targetName);
656
600
  _targetInfo[target] = TargetInfo({
657
601
  name: name,
658
- targetType: targetType,
659
- roleId: targetRoleId,
602
+ isCustom: custom,
660
603
  createdAt: TimestampLib.blockTimestamp()
661
604
  });
662
605
 
663
606
  // create name to target mapping
664
607
  _targetForName[name] = target;
665
608
 
666
- // add target to list of targets
609
+ // add role to list of roles
667
610
  _targets.push(target);
668
611
 
669
- // grant contract role to target
670
- _grantRoleToAccount(targetRoleId, target);
671
-
672
- emit LogAccessAdminTargetCreated(_adminName, targetName, managed, target, targetRoleId);
673
- }
674
-
675
-
676
- function _getOrCreateTargetRoleIdAndName(
677
- address target,
678
- string memory targetName,
679
- TargetType targetType
680
- )
681
- internal
682
- returns (
683
- RoleId roleId,
684
- string memory roleName
685
- )
686
- {
687
- // get roleId
688
- if (targetType == TargetType.Service || targetType == TargetType.GenericService) {
689
- roleId = AccessAdminLib.getServiceRoleId(target, targetType);
690
- } else {
691
- roleId = AccessAdminLib.getTargetRoleId(target, targetType, _nextRoleId[targetType]);
692
-
693
- // increment target type specific role id counter
694
- _nextRoleId[targetType]++;
695
- }
696
-
697
- // create role name
698
- roleName = AccessAdminLib.toRoleName(targetName);
612
+ emit LogAccessAdminTargetCreated(_adminName, target, targetName);
699
613
  }
700
614
 
701
615
 
702
616
  function _setTargetLocked(address target, bool locked)
703
617
  internal
618
+ onlyExistingTarget(target)
704
619
  {
705
- _checkTargetExists(target);
706
620
  _authority.setTargetClosed(target, locked);
707
621
  }
708
622
 
@@ -719,7 +633,6 @@ contract AccessAdmin is
719
633
  address authorization,
720
634
  ObjectType expectedDomain,
721
635
  VersionPart expectedRelease,
722
- bool expectServiceAuthorization,
723
636
  bool checkAlreadyInitialized
724
637
  )
725
638
  internal
@@ -730,15 +643,13 @@ contract AccessAdmin is
730
643
  authorization,
731
644
  expectedDomain,
732
645
  expectedRelease,
733
- expectServiceAuthorization,
734
646
  checkAlreadyInitialized);
735
647
  }
736
648
 
737
649
 
738
650
  function _checkRoleExists(
739
651
  RoleId roleId,
740
- bool onlyActiveRole,
741
- bool allowAdminAndPublicRoles
652
+ bool onlyActiveRole
742
653
  )
743
654
  internal
744
655
  view
@@ -747,15 +658,9 @@ contract AccessAdmin is
747
658
  revert ErrorAccessAdminRoleUnknown(roleId);
748
659
  }
749
660
 
750
- if (!allowAdminAndPublicRoles) {
751
- if (roleId == ADMIN_ROLE()) {
752
- revert ErrorAccessAdminInvalidUserOfAdminRole();
753
- }
754
-
755
- // check role is not public role
756
- if (roleId == PUBLIC_ROLE()) {
757
- revert ErrorAccessAdminInvalidUserOfPublicRole();
758
- }
661
+ uint64 roleIdInt = RoleId.unwrap(roleId);
662
+ if (roleIdInt == _authority.ADMIN_ROLE()) {
663
+ revert ErrorAccessAdminRoleIsLocked(roleId);
759
664
  }
760
665
 
761
666
  // check if role is disabled
@@ -765,6 +670,7 @@ contract AccessAdmin is
765
670
  }
766
671
 
767
672
 
673
+
768
674
  /// @dev check if target exists and reverts if it doesn't
769
675
  function _checkTargetExists(
770
676
  address target
@@ -777,4 +683,22 @@ contract AccessAdmin is
777
683
  revert ErrorAccessAdminTargetNotCreated(target);
778
684
  }
779
685
  }
686
+
687
+
688
+ function _checkIsRegistered(
689
+ address registry,
690
+ address target,
691
+ ObjectType expectedType
692
+ )
693
+ internal
694
+ view
695
+ {
696
+ AccessAdminLib.checkIsRegistered(registry, target, expectedType);
697
+ }
698
+
699
+ function _checkRegistry(address registry) internal view {
700
+ if (!ContractLib.isRegistry(registry)) {
701
+ revert ErrorAccessAdminNotRegistry(registry);
702
+ }
703
+ }
780
704
  }