@etherisc/gif-next 0.0.2-8bdd2eb-413 → 0.0.2-8d9d4d6-542

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 (324) hide show
  1. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1502 -0
  3. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
  4. package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
  5. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
  6. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1168 -0
  7. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +4 -0
  8. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +110 -0
  9. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
  10. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +129 -0
  11. package/artifacts/contracts/authorization/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
  12. package/artifacts/contracts/authorization/InstanceAdmin.sol/InstanceAdmin.json +1639 -0
  13. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +4 -0
  14. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +134 -0
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +171 -0
  17. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  19. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +108 -79
  20. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +48 -40
  22. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +13 -0
  25. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  26. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +32 -101
  27. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  28. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +58 -65
  29. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  30. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +120 -1
  31. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  32. package/artifacts/contracts/instance/Instance.sol/Instance.json +72 -79
  33. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  34. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +22 -22
  35. package/artifacts/contracts/instance/InstanceAdminNew.sol/InstanceAdminNew.dbg.json +4 -0
  36. package/artifacts/contracts/instance/InstanceAdminNew.sol/InstanceAdminNew.json +1676 -0
  37. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
  38. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +289 -0
  39. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +1 -1
  40. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +70 -46
  41. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  42. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +192 -56
  43. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  44. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +201 -34
  45. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  46. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +41 -17
  47. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  48. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +248 -108
  49. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  50. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  51. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  52. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +0 -53
  53. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
  54. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
  55. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  56. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +2 -71
  57. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  58. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  59. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  63. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  64. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
  65. package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +10 -0
  66. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
  67. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +759 -0
  68. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
  69. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +675 -0
  70. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
  71. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +1146 -0
  72. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
  73. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +1034 -0
  74. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
  75. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +730 -0
  76. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  77. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +78 -49
  78. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +33 -25
  80. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  81. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +13 -0
  82. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  83. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  84. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +13 -0
  85. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  86. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  87. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +62 -41
  88. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  89. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +25 -21
  90. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  91. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +66 -37
  92. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  93. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +27 -19
  94. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  95. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +106 -69
  96. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  97. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +47 -35
  98. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  99. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +13 -0
  100. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  101. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +13 -0
  102. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  103. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +13 -0
  104. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  105. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +13 -0
  106. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  107. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
  108. package/artifacts/contracts/product/IProductService.sol/IProductService.json +13 -0
  109. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  110. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +84 -47
  111. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +36 -24
  113. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  114. package/artifacts/contracts/product/PricingService.sol/PricingService.json +92 -63
  115. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  116. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +40 -32
  117. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  118. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
  119. package/artifacts/contracts/product/ProductService.sol/ProductService.json +54 -25
  120. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +21 -13
  122. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  123. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  124. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  125. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +13 -0
  126. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  127. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  128. package/artifacts/contracts/registry/Registry.sol/Registry.json +19 -19
  129. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  130. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1678 -153
  131. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  132. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +51 -14
  133. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  134. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +20 -8
  135. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  136. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +99 -154
  137. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
  138. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +195 -0
  139. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  140. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  141. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +1 -1
  142. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +1 -1
  143. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +42 -10
  144. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +1 -1
  145. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +42 -10
  146. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +1 -1
  147. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +52 -20
  148. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +1 -1
  149. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +52 -20
  150. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  151. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  152. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +107 -71
  153. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  154. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +44 -36
  155. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  156. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +13 -0
  157. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  158. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +1 -1
  159. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +1 -1
  160. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  161. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  162. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +20 -0
  163. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  164. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  165. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  166. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  167. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  168. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  169. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  170. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  171. package/artifacts/contracts/shared/IService.sol/IService.json +13 -0
  172. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  173. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  174. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  175. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  176. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +8 -8
  177. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  178. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +6 -6
  179. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +1 -1
  180. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +2 -2
  181. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  182. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  183. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  184. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  185. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  186. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  187. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  188. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  189. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  190. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  191. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  192. package/artifacts/contracts/shared/Service.sol/Service.json +13 -0
  193. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  194. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  195. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  196. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  197. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  198. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +49 -7
  199. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  200. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +44 -28
  201. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  202. package/artifacts/contracts/staking/Staking.sol/Staking.json +44 -84
  203. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  204. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +23 -39
  205. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  206. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -6
  207. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  208. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +92 -73
  209. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  210. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +33 -41
  211. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  212. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +186 -114
  213. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  214. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +18 -18
  215. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  216. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  217. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  218. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  219. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  220. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  221. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  222. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  223. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  224. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  225. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  226. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  227. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  228. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  229. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +125 -2
  231. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  232. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  233. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
  235. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
  236. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
  237. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  239. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  240. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +114 -4
  241. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
  243. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
  244. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
  245. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
  246. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  247. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  248. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
  249. package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
  250. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +17 -4
  252. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  253. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  255. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  256. package/contracts/authorization/AccessAdmin.sol +749 -0
  257. package/contracts/authorization/IAccess.sol +43 -0
  258. package/contracts/authorization/IAccessAdmin.sol +130 -0
  259. package/contracts/authorization/IModuleAuthorization.sol +27 -0
  260. package/contracts/authorization/IServiceAuthorization.sol +35 -0
  261. package/contracts/authorization/InstanceAdmin.sol +108 -0
  262. package/contracts/authorization/ModuleAuthorization.sol +116 -0
  263. package/contracts/authorization/ServiceAuthorization.sol +86 -0
  264. package/contracts/distribution/DistributionService.sol +3 -4
  265. package/contracts/instance/IInstance.sol +14 -6
  266. package/contracts/instance/IInstanceService.sol +24 -8
  267. package/contracts/instance/Instance.sol +63 -39
  268. package/contracts/instance/InstanceAdminNew.sol +74 -0
  269. package/contracts/instance/InstanceAuthorizationV3.sol +176 -0
  270. package/contracts/instance/InstanceAuthorizationsLib.sol +31 -3
  271. package/contracts/instance/InstanceReader.sol +29 -2
  272. package/contracts/instance/InstanceService.sol +85 -8
  273. package/contracts/instance/InstanceStore.sol +29 -20
  274. package/contracts/instance/base/BalanceStore.sol +11 -6
  275. package/contracts/instance/base/Cloneable.sol +2 -25
  276. package/contracts/instance/base/ObjectCounter.sol +21 -0
  277. package/contracts/instance/base/ObjectManager.sol +1 -3
  278. package/contracts/oracle/IOracle.sol +20 -0
  279. package/contracts/oracle/IOracleComponent.sol +32 -0
  280. package/contracts/oracle/IOracleService.sol +65 -0
  281. package/contracts/oracle/Oracle.sol +145 -0
  282. package/contracts/oracle/OracleService.sol +278 -0
  283. package/contracts/oracle/OracleServiceManager.sol +42 -0
  284. package/contracts/pool/BundleService.sol +19 -19
  285. package/contracts/pool/PoolService.sol +6 -7
  286. package/contracts/product/ApplicationService.sol +5 -5
  287. package/contracts/product/ClaimService.sol +5 -5
  288. package/contracts/product/IClaimService.sol +6 -0
  289. package/contracts/product/PolicyService.sol +5 -5
  290. package/contracts/product/PricingService.sol +5 -6
  291. package/contracts/product/ProductService.sol +5 -5
  292. package/contracts/registry/IRegistry.sol +1 -1
  293. package/contracts/registry/Registry.sol +7 -1
  294. package/contracts/registry/RegistryAdmin.sol +236 -148
  295. package/contracts/registry/RegistryService.sol +5 -5
  296. package/contracts/registry/RegistryServiceManager.sol +0 -5
  297. package/contracts/registry/ReleaseManager.sol +102 -172
  298. package/contracts/registry/ServiceAuthorizationV3.sol +200 -0
  299. package/contracts/shared/AccessManagerCustom.sol +6 -1
  300. package/contracts/shared/AccessManagerExtended.sol +12 -1
  301. package/contracts/shared/Component.sol +3 -0
  302. package/contracts/shared/ComponentService.sol +30 -9
  303. package/contracts/shared/ComponentVerifyingService.sol +13 -7
  304. package/contracts/shared/IComponentService.sol +11 -0
  305. package/contracts/shared/IService.sol +7 -0
  306. package/contracts/shared/Lifecycle.sol +11 -2
  307. package/contracts/shared/Service.sol +27 -21
  308. package/contracts/staking/IStakingService.sol +11 -7
  309. package/contracts/staking/StakeManagerLib.sol +52 -0
  310. package/contracts/staking/Staking.sol +58 -96
  311. package/contracts/staking/StakingService.sol +61 -56
  312. package/contracts/staking/StakingServiceManager.sol +0 -1
  313. package/contracts/staking/StakingStore.sol +79 -38
  314. package/contracts/type/ObjectType.sol +162 -67
  315. package/contracts/type/RequestId.sol +75 -0
  316. package/contracts/type/RoleId.sol +77 -19
  317. package/contracts/type/Selector.sol +102 -0
  318. package/contracts/type/StateId.sol +12 -0
  319. package/contracts/type/String.sol +53 -0
  320. package/contracts/type/Timestamp.sol +6 -2
  321. package/package.json +3 -3
  322. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +0 -4
  323. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +0 -137
  324. package/contracts/registry/ServiceAuthorizationsLib.sol +0 -173
@@ -0,0 +1,749 @@
1
+ // SPDX-License-Identifier: UNLICENSED
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
5
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
6
+ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
7
+
8
+ import {IAccessAdmin} from "./IAccessAdmin.sol";
9
+ import {RoleId, RoleIdLib} from "../type/RoleId.sol";
10
+ import {Selector, SelectorLib, SelectorSetLib} from "../type/Selector.sol";
11
+ import {Str, StrLib} from "../type/String.sol";
12
+ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
13
+
14
+
15
+ /**
16
+ * @dev A generic access amin contract that implements role based access control based on OpenZeppelin's AccessManager contract.
17
+ * The contract provides read functions to query all available roles, targets and access rights.
18
+ * This contract works for both a constructor based deployment or a deployment based on cloning and initialization.
19
+ */
20
+ contract AccessAdmin is
21
+ AccessManagedUpgradeable,
22
+ IAccessAdmin
23
+ {
24
+ using EnumerableSet for EnumerableSet.AddressSet;
25
+
26
+ string public constant ADMIN_ROLE_NAME = "AdminRole";
27
+ string public constant PUBLIC_ROLE_NAME = "PublicRole";
28
+
29
+ uint64 public constant MANAGER_ROLE = type(uint64).min + 1;
30
+ string public constant MANAGER_ROLE_NAME = "ManagerRole";
31
+
32
+ /// @dev the OpenZeppelin access manager driving the access admin contract
33
+ AccessManager internal _authority;
34
+
35
+ /// @dev stores the deployer address and allows to create initializers
36
+ /// that are restricted to the deployer address.
37
+ address internal _deployer;
38
+
39
+ /// @dev required role for state changes to this contract
40
+ RoleId internal _managerRoleId;
41
+
42
+ /// @dev store role info per role id
43
+ mapping(RoleId roleId => RoleInfo info) internal _roleInfo;
44
+
45
+ /// @dev store role name info per role name
46
+ mapping(Str roleName => RoleNameInfo nameInfo) internal _roleForName;
47
+
48
+ /// @dev store array with all created roles
49
+ RoleId [] internal _roleIds;
50
+
51
+ /// @dev store set of current role members for given role
52
+ mapping(RoleId roleId => EnumerableSet.AddressSet roleMembers) internal _roleMembers;
53
+
54
+ /// @dev store target info per target address
55
+ mapping(address target => TargetInfo info) internal _targetInfo;
56
+
57
+ /// @dev store role name info per role name
58
+ mapping(Str targetName => address target) internal _targetForName;
59
+
60
+ /// @dev store array with all created targets
61
+ address [] internal _targets;
62
+
63
+ /// @dev store all managed functions per target
64
+ mapping(address target => SelectorSetLib.Set selectors) internal _targetFunctions;
65
+
66
+ /// @dev function infos array
67
+ mapping(address target => mapping(Selector selector => FunctionInfo)) internal _functionInfo;
68
+
69
+ /// @dev temporary dynamic functions array
70
+ bytes4[] private _functions;
71
+
72
+ modifier onlyDeployer() {
73
+ // special case for cloned AccessAdmin contracts
74
+ // IMPORTANT cloning and _initializeAuthority needs to be done in a single transaction
75
+ if (_deployer == address(0)) {
76
+ _deployer = msg.sender;
77
+ }
78
+
79
+ if (msg.sender != _deployer) {
80
+ revert ErrorNotDeployer();
81
+ }
82
+ _;
83
+ }
84
+
85
+ modifier onlyRoleAdmin(RoleId roleId) {
86
+ if (!roleExists(roleId)) {
87
+ revert ErrorRoleUnknown(roleId);
88
+ }
89
+
90
+ if (!hasRole(msg.sender, _roleInfo[roleId].adminRoleId)) {
91
+ revert ErrorNotAdminOfRole(_roleInfo[roleId].adminRoleId);
92
+ }
93
+ _;
94
+ }
95
+
96
+ modifier onlyRoleMember(RoleId roleId) {
97
+ if (!hasRole(msg.sender, roleId)) {
98
+ revert ErrorNotRoleOwner(roleId);
99
+ }
100
+ _;
101
+ }
102
+
103
+ modifier onlyExistingRole(RoleId roleId) {
104
+ _checkRoleId(roleId);
105
+ _;
106
+ }
107
+
108
+ modifier onlyExistingTarget(address target) {
109
+ _checkTarget(target);
110
+ _;
111
+ }
112
+
113
+ constructor() {
114
+ _deployer = msg.sender;
115
+ _authority = new AccessManager(address(this));
116
+
117
+ _setAuthority(address(_authority));
118
+ _createInitialRoleSetup();
119
+
120
+ _disableInitializers();
121
+ }
122
+
123
+ //--- role management functions -----------------------------------------//
124
+
125
+ function setRoleDisabled(
126
+ RoleId roleId,
127
+ bool disabled
128
+ )
129
+ external
130
+ virtual
131
+ restricted()
132
+ {
133
+ _setRoleDisabled(roleId, disabled);
134
+ }
135
+
136
+ function grantRole(
137
+ address account,
138
+ RoleId roleId
139
+ )
140
+ external
141
+ virtual
142
+ onlyRoleAdmin(roleId)
143
+ restricted()
144
+ {
145
+ _grantRoleToAccount(roleId, account);
146
+ }
147
+
148
+ function revokeRole(
149
+ address account,
150
+ RoleId roleId
151
+ )
152
+ external
153
+ virtual
154
+ onlyRoleAdmin(roleId)
155
+ restricted()
156
+ {
157
+ _revokeRoleFromAccount(roleId, account);
158
+ }
159
+
160
+ function renounceRole(
161
+ RoleId roleId
162
+ )
163
+ external
164
+ virtual
165
+ onlyRoleMember(roleId)
166
+ restricted()
167
+ {
168
+ _revokeRoleFromAccount(roleId, msg.sender);
169
+ }
170
+
171
+ //--- target management functions ---------------------------------------//
172
+
173
+ function setTargetLocked(
174
+ address target,
175
+ bool locked
176
+ )
177
+ external
178
+ virtual
179
+ onlyExistingTarget(target)
180
+ restricted()
181
+ {
182
+ _authority.setTargetClosed(target, locked);
183
+
184
+ // implizit logging: rely on OpenZeppelin log TargetClosed
185
+ }
186
+
187
+ function authorizeFunctions(
188
+ address target,
189
+ RoleId roleId,
190
+ FunctionInfo[] memory functions
191
+ )
192
+ external
193
+ virtual
194
+ onlyExistingTarget(target)
195
+ onlyExistingRole(roleId)
196
+ restricted()
197
+ {
198
+ _authorizeTargetFunctions(target, roleId, functions);
199
+ }
200
+
201
+ function unauthorizeFunctions(
202
+ address target,
203
+ FunctionInfo[] memory functions
204
+ )
205
+ external
206
+ virtual
207
+ restricted()
208
+ {
209
+ _unauthorizeTargetFunctions(target, functions);
210
+ }
211
+
212
+
213
+ function authorizedFunctions(address target) external view returns (uint256 numberOfFunctions) {
214
+ return SelectorSetLib.size(_targetFunctions[target]);
215
+ }
216
+
217
+ function getAuthorizedFunction(
218
+ address target,
219
+ uint256 idx
220
+ )
221
+ external
222
+ view
223
+ returns (
224
+ FunctionInfo memory func,
225
+ RoleId roleId
226
+ )
227
+ {
228
+ Selector selector = SelectorSetLib.at(_targetFunctions[target], idx);
229
+ func = _functionInfo[target][selector];
230
+ roleId = RoleIdLib.toRoleId(
231
+ _authority.getTargetFunctionRole(
232
+ target,
233
+ selector.toBytes4()));
234
+ }
235
+
236
+ //--- view functions ----------------------------------------------------//
237
+
238
+ function roles() external view returns (uint256 numberOfRoles) {
239
+ return _roleIds.length;
240
+ }
241
+
242
+ function getRoleId(uint256 idx) external view returns (RoleId roleId) {
243
+ return _roleIds[idx];
244
+ }
245
+
246
+ function getAdminRole() public view returns (RoleId roleId) {
247
+ return RoleId.wrap(_authority.ADMIN_ROLE());
248
+ }
249
+
250
+ function getPublicRole() public view returns (RoleId roleId) {
251
+ return RoleId.wrap(_authority.PUBLIC_ROLE());
252
+ }
253
+
254
+ function getManagerRole() public view returns (RoleId roleId) {
255
+ return _managerRoleId;
256
+ }
257
+
258
+ function roleExists(RoleId roleId) public view returns (bool exists) {
259
+ return _roleInfo[roleId].createdAt.gtz();
260
+ }
261
+
262
+ function isRoleDisabled(RoleId roleId) public view returns (bool isActive) {
263
+ return _roleInfo[roleId].disabledAt <= TimestampLib.blockTimestamp();
264
+ }
265
+
266
+ function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory) {
267
+ return _roleInfo[roleId];
268
+ }
269
+
270
+ function getRoleForName(Str name) external view returns (RoleNameInfo memory) {
271
+ return _roleForName[name];
272
+ }
273
+
274
+ function hasRole(address account, RoleId roleId) public view returns (bool) {
275
+ (bool isMember, ) = _authority.hasRole(
276
+ RoleId.unwrap(roleId),
277
+ account);
278
+ return isMember;
279
+ }
280
+
281
+ function roleMembers(RoleId roleId) external view returns (uint256 numberOfMembers) {
282
+ return _roleMembers[roleId].length();
283
+ }
284
+
285
+ function getRoleMember(RoleId roleId, uint256 idx) external view returns (address account) {
286
+ return _roleMembers[roleId].at(idx);
287
+ }
288
+
289
+ function targetExists(address target) public view returns (bool exists) {
290
+ return _targetInfo[target].createdAt.gtz();
291
+ }
292
+
293
+ function isTargetLocked(address target) public view returns (bool locked) {
294
+ return _authority.isTargetClosed(target);
295
+ }
296
+
297
+ function targets() external view returns (uint256 numberOfTargets) {
298
+ return _targets.length;
299
+ }
300
+
301
+ function getTargetAddress(uint256 idx) external view returns (address target) {
302
+ return _targets[idx];
303
+ }
304
+
305
+ function getTargetInfo(address target) external view returns (TargetInfo memory targetInfo) {
306
+ return _targetInfo[target];
307
+ }
308
+
309
+ function getTargetForName(Str name) external view returns (address target) {
310
+ return _targetForName[name];
311
+ }
312
+
313
+ function isAccessManaged(address target) public view returns (bool) {
314
+ if (!_isContract(target)) {
315
+ return false;
316
+ }
317
+
318
+ (bool success, ) = target.staticcall(
319
+ abi.encodeWithSelector(
320
+ AccessManagedUpgradeable.authority.selector));
321
+
322
+ return success;
323
+ }
324
+
325
+ function canCall(address caller, address target, Selector selector) external virtual view returns (bool can) {
326
+ (can, ) = _authority.canCall(caller, target, selector.toBytes4());
327
+ }
328
+
329
+ function deployer() public view returns (address) {
330
+ return _deployer;
331
+ }
332
+
333
+ function toFunction(bytes4 selector, string memory name) public view returns (FunctionInfo memory) {
334
+ return FunctionInfo({
335
+ selector: SelectorLib.toSelector(selector),
336
+ name: StrLib.toStr(name),
337
+ createdAt: TimestampLib.blockTimestamp()});
338
+ }
339
+
340
+ //--- internal/private functions -------------------------------------------------//
341
+
342
+ function _authorizeTargetFunctions(
343
+ address target,
344
+ RoleId roleId,
345
+ FunctionInfo[] memory functions
346
+ )
347
+ internal
348
+ {
349
+ if (roleId == getAdminRole()) {
350
+ revert ErrorAuthorizeForAdminRoleInvalid(target);
351
+ }
352
+
353
+ bool addFunctions = true;
354
+ bytes4[] memory functionSelectors = _processFunctionSelectors(target, functions, addFunctions);
355
+
356
+ // apply authz via access manager
357
+ _grantRoleAccessToFunctions(target, roleId, functionSelectors);
358
+ }
359
+
360
+ function _unauthorizeTargetFunctions(
361
+ address target,
362
+ FunctionInfo[] memory functions
363
+ )
364
+ internal
365
+ {
366
+ bool addFunctions = false;
367
+ bytes4[] memory functionSelectors = _processFunctionSelectors(target, functions, addFunctions);
368
+ _grantRoleAccessToFunctions(target, getAdminRole(), functionSelectors);
369
+ }
370
+
371
+ function _processFunctionSelectors(
372
+ address target,
373
+ FunctionInfo[] memory functions,
374
+ bool addFunctions
375
+ )
376
+ internal
377
+ returns (
378
+ bytes4[] memory functionSelectors
379
+ )
380
+ {
381
+ uint256 n = functions.length;
382
+ functionSelectors = new bytes4[](n);
383
+ FunctionInfo memory func;
384
+ Selector selector;
385
+
386
+ for (uint256 i = 0; i < n; i++) {
387
+ func = functions[i];
388
+ selector = func.selector;
389
+
390
+ // add function selector to target selector set if not in set
391
+ if (addFunctions) { SelectorSetLib.add(_targetFunctions[target], selector); }
392
+ else { SelectorSetLib.remove(_targetFunctions[target], selector); }
393
+
394
+ // set function name
395
+ _functionInfo[target][selector] = func;
396
+
397
+ // add bytes4 selector to function selector array
398
+ functionSelectors[i] = selector.toBytes4();
399
+ }
400
+ }
401
+
402
+ function _initializeAuthority(
403
+ address authorityAddress
404
+ )
405
+ internal
406
+ virtual
407
+ onlyInitializing()
408
+ onlyDeployer()
409
+ {
410
+ if (authority() != address(0)) {
411
+ revert ErrorAuthorityAlreadySet();
412
+ }
413
+
414
+ _authority = AccessManager(authorityAddress);
415
+
416
+ if(!hasRole(address(this), RoleId.wrap(_authority.ADMIN_ROLE()))) {
417
+ revert ErrorAdminRoleMissing();
418
+ }
419
+
420
+ __AccessManaged_init(address(_authority));
421
+ }
422
+
423
+
424
+ function _initializeRoleSetup()
425
+ internal
426
+ virtual
427
+ onlyInitializing()
428
+ {
429
+ _createInitialRoleSetup();
430
+ }
431
+
432
+
433
+ /// @dev internal setup function that can be used in both constructor and initializer.
434
+ function _createInitialRoleSetup()
435
+ internal
436
+ {
437
+ bool isCustom = false;
438
+ RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
439
+ FunctionInfo[] memory functions;
440
+
441
+ // setup admin role
442
+ _createRoleUnchecked(
443
+ adminRoleId,
444
+ adminRoleId,
445
+ StrLib.toStr(ADMIN_ROLE_NAME),
446
+ isCustom,
447
+ 1,
448
+ true);
449
+
450
+ // add this contract as admin role member
451
+ _roleMembers[adminRoleId].add(address(this));
452
+
453
+ // setup public role
454
+ _createRoleUnchecked(
455
+ RoleIdLib.toRoleId(_authority.PUBLIC_ROLE()),
456
+ adminRoleId,
457
+ StrLib.toStr(PUBLIC_ROLE_NAME),
458
+ isCustom,
459
+ type(uint256).max,
460
+ true);
461
+
462
+ // setup manager role
463
+ _managerRoleId = RoleIdLib.toRoleId(MANAGER_ROLE);
464
+ _createRole(
465
+ _managerRoleId,
466
+ adminRoleId,
467
+ MANAGER_ROLE_NAME,
468
+ isCustom,
469
+ 3, // TODO think about max member count
470
+ false);
471
+
472
+ // grant public role access to grant and revoke, renounce
473
+ functions = new FunctionInfo[](3);
474
+ functions[0] = toFunction(IAccessAdmin.grantRole.selector, "grantRole");
475
+ functions[1] = toFunction(IAccessAdmin.revokeRole.selector, "revokeRole");
476
+ functions[2] = toFunction(IAccessAdmin.renounceRole.selector, "renounceRole");
477
+ _authorizeTargetFunctions(address(this), getPublicRole(), functions);
478
+
479
+ // grant manager role access to the specified functions
480
+ functions = new FunctionInfo[](4);
481
+ // TODO cleanup
482
+ // functions[0] = toFunction(IAccessAdmin.createRole.selector, "createRole");
483
+ functions[0] = toFunction(IAccessAdmin.setRoleDisabled.selector, "setRoleDisabled");
484
+ // functions[1] = toFunction(IAccessAdmin.createTarget.selector, "createTarget");
485
+ functions[1] = toFunction(IAccessAdmin.setTargetLocked.selector, "setTargetLocked");
486
+ functions[2] = toFunction(IAccessAdmin.authorizeFunctions.selector, "authorizeFunctions");
487
+ functions[3] = toFunction(IAccessAdmin.unauthorizeFunctions.selector, "unauthorizeFunctions");
488
+ _authorizeTargetFunctions(address(this), getManagerRole(), functions);
489
+ }
490
+
491
+ /// @dev check if target exists and reverts if it doesn't
492
+ function _checkTarget(address target)
493
+ internal
494
+ {
495
+ if (_targetInfo[target].createdAt.eqz()) {
496
+ revert ErrorTargetUnknown(target);
497
+ }
498
+ }
499
+
500
+ /// @dev grant the specified role access to all functions in the provided selector list
501
+ function _grantRoleAccessToFunctions(
502
+ address target,
503
+ RoleId roleId,
504
+ bytes4[] memory functionSelectors
505
+ )
506
+ internal
507
+ {
508
+ _authority.setTargetFunctionRole(
509
+ target,
510
+ functionSelectors,
511
+ RoleId.unwrap(roleId));
512
+
513
+ // implizit logging: rely on OpenZeppelin log TargetFunctionRoleUpdated
514
+ }
515
+
516
+ /// @dev grant the specified role to the provided account
517
+ function _grantRoleToAccount(RoleId roleId, address account)
518
+ internal
519
+ {
520
+ _checkRoleId(roleId);
521
+ _checkRoleIsActive(roleId);
522
+
523
+ // check max role members will not be exceeded
524
+ if (_roleMembers[roleId].length() >= _roleInfo[roleId].maxMemberCount) {
525
+ revert ErrorRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
526
+ }
527
+
528
+ _roleMembers[roleId].add(account);
529
+ _authority.grantRole(
530
+ RoleId.unwrap(roleId),
531
+ account,
532
+ 0);
533
+
534
+ // indirect logging: rely on OpenZeppelin log RoleGranted
535
+ }
536
+
537
+ /// @dev revoke the specified role from the provided account
538
+ function _revokeRoleFromAccount(RoleId roleId, address account)
539
+ internal
540
+ {
541
+ _checkRoleId(roleId);
542
+
543
+ // check role removal is permitted
544
+ if (_roleInfo[roleId].memberRemovalDisabled) {
545
+ revert ErrorRoleRemovalDisabled(roleId);
546
+ }
547
+
548
+ _roleMembers[roleId].remove(account);
549
+ _authority.revokeRole(
550
+ RoleId.unwrap(roleId),
551
+ account);
552
+
553
+ // indirect logging: rely on OpenZeppelin log RoleGranted
554
+ }
555
+
556
+
557
+ function _checkRoleId(RoleId roleId)
558
+ internal
559
+ {
560
+ if (_roleInfo[roleId].createdAt.eqz()) {
561
+ revert ErrorRoleUnknown(roleId);
562
+ }
563
+
564
+ uint64 roleIdInt = RoleId.unwrap(roleId);
565
+ if (roleIdInt == _authority.ADMIN_ROLE()
566
+ || roleIdInt == _authority.PUBLIC_ROLE())
567
+ {
568
+ revert ErrorRoleIsLocked(roleId);
569
+ }
570
+ }
571
+
572
+
573
+ function _checkRoleIsActive(RoleId roleId)
574
+ internal
575
+ {
576
+ if (isRoleDisabled(roleId)) {
577
+ revert ErrorRoleIsDisabled(roleId);
578
+ }
579
+ }
580
+
581
+
582
+ function _createRole(
583
+ RoleId roleId,
584
+ RoleId adminRoleId,
585
+ string memory roleName,
586
+ bool isCustom,
587
+ uint256 maxMemberCount,
588
+ bool memberRemovalDisabled
589
+ )
590
+ internal
591
+ {
592
+ // check role does not yet exist
593
+ if(roleExists(roleId)) {
594
+ revert ErrorRoleAlreadyCreated(
595
+ roleId,
596
+ _roleInfo[roleId].name.toString());
597
+ }
598
+
599
+ // check admin role exists
600
+ if(!roleExists(adminRoleId)) {
601
+ revert ErrorRoleAdminNotExisting(adminRoleId);
602
+ }
603
+
604
+ // check role name is not empty
605
+ Str name = StrLib.toStr(roleName);
606
+ if(name.length() == 0) {
607
+ revert ErrorRoleNameEmpty(roleId);
608
+ }
609
+
610
+ // check role name is not used for another role
611
+ if(_roleForName[name].exists) {
612
+ revert ErrorRoleNameAlreadyExists(
613
+ roleId,
614
+ roleName,
615
+ _roleForName[name].roleId);
616
+ }
617
+
618
+ _createRoleUnchecked(
619
+ roleId, adminRoleId,
620
+ name,
621
+ isCustom,
622
+ maxMemberCount,
623
+ memberRemovalDisabled);
624
+ }
625
+
626
+
627
+ function _setRoleDisabled(
628
+ RoleId roleId,
629
+ bool disabled
630
+ )
631
+ internal
632
+ {
633
+
634
+ _checkRoleId(roleId);
635
+ Timestamp disabledAtOld = _roleInfo[roleId].disabledAt;
636
+
637
+ if (disabled) {
638
+ _roleInfo[roleId].disabledAt = TimestampLib.blockTimestamp();
639
+ } else {
640
+ _roleInfo[roleId].disabledAt = TimestampLib.max();
641
+ }
642
+
643
+ emit LogRoleDisabled(roleId, disabled, disabledAtOld);
644
+ }
645
+
646
+
647
+ function _createRoleUnchecked(
648
+ RoleId roleId,
649
+ RoleId adminRoleId,
650
+ Str name,
651
+ bool custom,
652
+ uint256 maxMemberCount,
653
+ bool memberRemovalDisabled
654
+ )
655
+ private
656
+ {
657
+ // create role info
658
+ _roleInfo[roleId] = RoleInfo({
659
+ adminRoleId: adminRoleId,
660
+ name: name,
661
+ isCustom: custom,
662
+ maxMemberCount: maxMemberCount,
663
+ memberRemovalDisabled: memberRemovalDisabled,
664
+ createdAt: TimestampLib.blockTimestamp(),
665
+ disabledAt: TimestampLib.max()});
666
+
667
+ // create role name info
668
+ _roleForName[name] = RoleNameInfo({
669
+ roleId: roleId,
670
+ exists: true});
671
+
672
+ // add role to list of roles
673
+ _roleIds.push(roleId);
674
+
675
+ emit LogRoleCreated(roleId, adminRoleId, name.toString());
676
+ }
677
+
678
+
679
+ function _createTarget(address target, string memory targetName)
680
+ internal
681
+ {
682
+ _createTarget(target, targetName, false);
683
+ }
684
+
685
+
686
+ function _createTarget(address target, string memory targetName, bool custom)
687
+ internal
688
+ {
689
+ // check target does not yet exist
690
+ if(targetExists(target)) {
691
+ revert ErrorTargetAlreadyCreated(
692
+ target,
693
+ _targetInfo[target].name.toString());
694
+ }
695
+
696
+ // check target name is not empty
697
+ Str name = StrLib.toStr(targetName);
698
+ if(name.length() == 0) {
699
+ revert ErrorTargetNameEmpty(target);
700
+ }
701
+
702
+ // check target name is not used for another role
703
+ if( _targetForName[name] != address(0)) {
704
+ revert ErrorTargetNameAlreadyExists(
705
+ target,
706
+ targetName,
707
+ _targetForName[name]);
708
+ }
709
+
710
+ // check target is an access managed contract
711
+ if (!isAccessManaged(target)) {
712
+ revert ErrorTargetNotAccessManaged(target);
713
+ }
714
+
715
+ // check target shares authority with this contract
716
+ address targetAuthority = AccessManagedUpgradeable(target).authority();
717
+ if (targetAuthority != authority()) {
718
+ revert ErrorTargetAuthorityMismatch(authority(), targetAuthority);
719
+ }
720
+
721
+ // create target info
722
+ _targetInfo[target] = TargetInfo({
723
+ name: name,
724
+ isCustom: custom,
725
+ createdAt: TimestampLib.blockTimestamp()
726
+ });
727
+
728
+ // create name to target mapping
729
+ _targetForName[name] = target;
730
+
731
+ // add role to list of roles
732
+ _targets.push(target);
733
+
734
+ emit LogTargetCreated(target, targetName);
735
+ }
736
+
737
+ function _isContract(address target)
738
+ internal
739
+ view
740
+ returns (bool)
741
+ {
742
+ uint256 size;
743
+ assembly {
744
+ size := extcodesize(target)
745
+ }
746
+ return size > 0;
747
+ }
748
+
749
+ }