@etherisc/gif-next 0.0.2-f15b559-661 → 0.0.2-f1b01e0-214

Sign up to get free protection for your applications and to get access to all the features.
Files changed (396) hide show
  1. package/README.md +43 -0
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +38 -38
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +26 -26
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  7. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +6 -6
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +366 -251
  10. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
  12. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  14. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +8 -39
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +101 -28
  17. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +283 -189
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +37 -5
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +32 -145
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +101 -46
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -87
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +160 -89
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +56 -52
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +1 -87
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  38. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +68 -5
  39. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  41. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +44 -74
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  43. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +101 -46
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  45. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +94 -124
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  47. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +101 -46
  48. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +82 -173
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  52. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +101 -46
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  54. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +20 -63
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  56. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +69 -112
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  58. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +101 -46
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +95 -138
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  62. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +101 -46
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  64. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  66. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +104 -8
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  68. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +62 -13
  69. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  70. package/artifacts/contracts/instance/Instance.sol/Instance.json +119 -26
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  72. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +520 -413
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  74. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +101 -46
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  76. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +225 -196
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +94 -65
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  80. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -36
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  82. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +356 -346
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  84. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  87. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  89. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  91. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  93. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  95. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +20 -20
  96. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  100. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  101. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  103. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -35
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +98 -35
  106. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -21
  109. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  111. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -21
  112. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  113. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +42 -42
  114. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  115. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +31 -31
  116. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +22 -43
  118. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +101 -46
  120. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +64 -64
  122. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  123. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +39 -39
  124. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  125. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +6 -6
  126. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  127. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +10 -31
  128. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  129. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +18 -18
  130. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  131. package/artifacts/contracts/pool/Pool.sol/Pool.json +10 -31
  132. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  133. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +34 -34
  134. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  135. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +80 -80
  136. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  137. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +41 -41
  138. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  139. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +90 -24
  140. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  141. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +34 -22
  142. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  143. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +27 -48
  144. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  145. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +101 -46
  146. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  147. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +78 -78
  148. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  149. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +50 -50
  150. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  151. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +42 -0
  152. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  153. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  154. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  155. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +21 -0
  156. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  157. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +21 -42
  158. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  159. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +21 -0
  160. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  161. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +62 -62
  162. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  163. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +32 -32
  164. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  165. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +41 -41
  166. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  167. package/artifacts/contracts/product/PricingService.sol/PricingService.json +63 -82
  168. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  169. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +31 -51
  170. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  171. package/artifacts/contracts/product/Product.sol/Product.json +21 -42
  172. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  173. package/artifacts/contracts/product/RiskService.sol/RiskService.json +55 -26
  174. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +27 -23
  176. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  177. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  178. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  179. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  181. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  183. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  184. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +445 -355
  185. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
  186. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
  187. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  188. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  189. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  190. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +19 -19
  191. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  192. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +481 -376
  193. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  194. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  195. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  196. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +128 -124
  197. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  198. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  199. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  200. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  201. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  202. package/artifacts/contracts/shared/Component.sol/Component.json +0 -21
  203. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  204. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +114 -129
  205. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  206. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +45 -49
  207. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  208. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  209. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +60 -4
  210. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  211. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  212. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  213. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  214. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -21
  215. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  216. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +44 -51
  217. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  218. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -21
  219. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  220. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  221. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  222. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  223. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  224. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  225. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  226. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  227. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
  228. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  229. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -21
  230. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  231. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  232. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  233. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  234. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  235. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  236. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  237. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  238. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  239. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  240. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  241. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  242. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  243. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  244. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  245. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  246. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  247. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  248. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  249. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +83 -39
  250. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  251. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +75 -4
  252. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  253. package/artifacts/contracts/staking/Staking.sol/Staking.json +133 -94
  254. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
  255. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
  256. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  257. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  258. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  259. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +41 -37
  260. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  261. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +34 -61
  262. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  263. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +109 -30
  264. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  265. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +27 -23
  266. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  267. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +148 -134
  268. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  269. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +47 -37
  270. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  271. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Amount.sol/AmountLib.json +10 -10
  273. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  276. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  278. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/Fee.sol/FeeLib.json +93 -37
  280. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  281. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  282. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  283. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  284. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  286. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  287. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  288. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +33 -31
  290. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  291. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  292. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  294. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  295. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  296. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  297. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  298. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  299. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  300. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  301. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  302. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  303. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  304. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  305. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  306. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  307. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +60 -36
  308. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  309. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  310. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  311. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +56 -2
  312. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  313. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  314. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +4 -4
  315. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  316. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  317. package/contracts/accounting/IAccountingService.sol +2 -2
  318. package/contracts/authorization/AccessAdmin.sol +201 -186
  319. package/contracts/authorization/AccessAdminLib.sol +183 -0
  320. package/contracts/authorization/AccessManagerCloneable.sol +40 -31
  321. package/contracts/authorization/Authorization.sol +61 -33
  322. package/contracts/authorization/IAccess.sol +13 -5
  323. package/contracts/authorization/IAccessAdmin.sol +63 -36
  324. package/contracts/authorization/IAuthorization.sol +6 -0
  325. package/contracts/distribution/BasicDistribution.sol +6 -6
  326. package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
  327. package/contracts/distribution/Distribution.sol +3 -48
  328. package/contracts/distribution/DistributionService.sol +57 -30
  329. package/contracts/distribution/IDistributionComponent.sol +0 -9
  330. package/contracts/distribution/IDistributionService.sol +4 -2
  331. package/contracts/examples/fire/FirePool.sol +0 -4
  332. package/contracts/examples/fire/FireProduct.sol +0 -4
  333. package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
  334. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
  335. package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
  336. package/contracts/examples/unpermissioned/SimpleProduct.sol +0 -4
  337. package/contracts/instance/IInstance.sol +45 -9
  338. package/contracts/instance/IInstanceService.sol +19 -3
  339. package/contracts/instance/Instance.sol +73 -16
  340. package/contracts/instance/InstanceAdmin.sol +120 -107
  341. package/contracts/instance/InstanceAuthorizationV3.sol +43 -21
  342. package/contracts/instance/InstanceReader.sol +13 -0
  343. package/contracts/instance/InstanceService.sol +128 -73
  344. package/contracts/instance/module/IBundle.sol +6 -5
  345. package/contracts/instance/module/IComponents.sol +16 -5
  346. package/contracts/instance/module/IDistribution.sol +19 -7
  347. package/contracts/instance/module/IPolicy.sol +28 -8
  348. package/contracts/instance/module/IRisk.sol +2 -0
  349. package/contracts/oracle/BasicOracle.sol +1 -3
  350. package/contracts/oracle/BasicOracleAuthorization.sol +1 -1
  351. package/contracts/oracle/IOracle.sol +9 -4
  352. package/contracts/oracle/Oracle.sol +0 -2
  353. package/contracts/pool/BasicPool.sol +0 -2
  354. package/contracts/pool/BasicPoolAuthorization.sol +1 -1
  355. package/contracts/pool/Pool.sol +0 -2
  356. package/contracts/pool/PoolService.sol +1 -3
  357. package/contracts/product/ApplicationService.sol +21 -6
  358. package/contracts/product/BasicProduct.sol +0 -2
  359. package/contracts/product/BasicProductAuthorization.sol +1 -1
  360. package/contracts/product/IApplicationService.sol +3 -0
  361. package/contracts/product/IPricingService.sol +1 -0
  362. package/contracts/product/IRiskService.sol +3 -0
  363. package/contracts/product/PolicyService.sol +0 -18
  364. package/contracts/product/PricingService.sol +11 -6
  365. package/contracts/product/Product.sol +0 -2
  366. package/contracts/product/RiskService.sol +10 -0
  367. package/contracts/registry/IRegistry.sol +4 -0
  368. package/contracts/registry/RegistryAdmin.sol +133 -229
  369. package/contracts/registry/RegistryAuthorization.sol +267 -0
  370. package/contracts/registry/ReleaseAdmin.sol +30 -22
  371. package/contracts/registry/ReleaseRegistry.sol +39 -33
  372. package/contracts/registry/ServiceAuthorizationV3.sol +87 -3
  373. package/contracts/shared/Component.sol +13 -30
  374. package/contracts/shared/ComponentService.sol +58 -42
  375. package/contracts/shared/ContractLib.sol +28 -0
  376. package/contracts/shared/IComponent.sol +0 -3
  377. package/contracts/shared/IComponentService.sol +9 -9
  378. package/contracts/shared/InitializableERC165.sol +9 -1
  379. package/contracts/shared/InstanceLinkedComponent.sol +0 -2
  380. package/contracts/shared/NftOwnable.sol +1 -1
  381. package/contracts/shared/Registerable.sol +1 -4
  382. package/contracts/shared/TokenHandler.sol +5 -4
  383. package/contracts/staking/IStaking.sol +12 -2
  384. package/contracts/staking/IStakingService.sol +8 -1
  385. package/contracts/staking/Staking.sol +35 -15
  386. package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +79 -22
  387. package/contracts/staking/StakingReader.sol +5 -15
  388. package/contracts/staking/StakingService.sol +36 -2
  389. package/contracts/staking/StakingStore.sol +2 -1
  390. package/contracts/type/Fee.sol +8 -8
  391. package/contracts/type/ObjectType.sol +5 -14
  392. package/contracts/type/UFixed.sol +27 -10
  393. package/contracts/type/Version.sol +39 -0
  394. package/package.json +2 -2
  395. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
  396. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
@@ -5,10 +5,15 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
5
5
  import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
6
6
  import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
7
7
 
8
- import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
9
- import {ContractLib} from "../shared/ContractLib.sol";
10
8
  import {IAccessAdmin} from "./IAccessAdmin.sol";
9
+ import {IAuthorization} from "./IAuthorization.sol";
11
10
  import {IRegistry} from "../registry/IRegistry.sol";
11
+
12
+ import {AccessAdminLib} from "./AccessAdminLib.sol";
13
+ import {AccessManagerCloneable} from "./AccessManagerCloneable.sol";
14
+ import {ContractLib} from "../shared/ContractLib.sol";
15
+ import {NftId, NftIdLib} from "../type/NftId.sol";
16
+ import {ObjectType} from "../type/ObjectType.sol";
12
17
  import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
13
18
  import {Selector, SelectorLib, SelectorSetLib} from "../type/Selector.sol";
14
19
  import {Str, StrLib} from "../type/String.sol";
@@ -34,13 +39,23 @@ contract AccessAdmin is
34
39
  string public constant ADMIN_ROLE_NAME = "AdminRole";
35
40
  string public constant PUBLIC_ROLE_NAME = "PublicRole";
36
41
 
37
- /// @dev the OpenZeppelin access manager driving the access admin contract
42
+ /// @dev admin name used for logging only
43
+ string internal _adminName;
44
+
45
+ /// @dev the access manager driving the access admin contract
46
+ /// hold link to registry and release version
38
47
  AccessManagerCloneable internal _authority;
39
48
 
49
+ /// @dev the authorization contract used for initial access control
50
+ IAuthorization internal _authorization;
51
+
40
52
  /// @dev stores the deployer address and allows to create initializers
41
53
  /// that are restricted to the deployer address.
42
54
  address internal _deployer;
43
55
 
56
+ /// @dev the linked NFT ID
57
+ NftId internal _linkedNftId;
58
+
44
59
  /// @dev store role info per role id
45
60
  mapping(RoleId roleId => RoleInfo info) internal _roleInfo;
46
61
 
@@ -79,23 +94,25 @@ contract AccessAdmin is
79
94
  }
80
95
 
81
96
  if (msg.sender != _deployer) {
82
- revert ErrorNotDeployer();
97
+ revert ErrorAccessAdminNotDeployer();
83
98
  }
84
99
  _;
85
100
  }
86
101
 
87
- modifier onlyRoleAdmin(RoleId roleId) {
102
+ modifier onlyRoleMember(RoleId roleId, address account) {
88
103
  _checkRoleExists(roleId, false);
89
104
 
90
- if (!hasAdminRole(msg.sender, roleId)) {
91
- revert ErrorNotAdminOfRole(_roleInfo[roleId].adminRoleId);
105
+ if (!hasRole(account, roleId)) {
106
+ revert ErrorAccessAdminNotRoleOwner(roleId, account);
92
107
  }
93
108
  _;
94
109
  }
95
110
 
96
- modifier onlyRoleMember(RoleId roleId) {
97
- if (!hasRole(msg.sender, roleId)) {
98
- revert ErrorNotRoleOwner(roleId);
111
+ modifier onlyRoleAdmin(RoleId roleId, address account) {
112
+ _checkRoleExists(roleId, false);
113
+
114
+ if (!hasAdminRole(account, roleId)) {
115
+ revert ErrorAccessAdminNotAdminOfRole(_roleInfo[roleId].adminRoleId, account);
99
116
  }
100
117
  _;
101
118
  }
@@ -113,7 +130,7 @@ contract AccessAdmin is
113
130
  }
114
131
 
115
132
  modifier onlyExistingTarget(address target) {
116
- _checkTarget(target);
133
+ _checkTargetExists(target);
117
134
  _;
118
135
  }
119
136
 
@@ -124,34 +141,61 @@ contract AccessAdmin is
124
141
  /// @dev Initializes this admin with the provided accessManager (and authorization specification).
125
142
  /// Internally initializes access manager with this admin and creates basic role setup.
126
143
  function initialize(
127
- AccessManagerCloneable authority
144
+ address authority,
145
+ string memory adminName
128
146
  )
129
147
  public
130
148
  initializer()
131
149
  {
132
- __AccessAdmin_init(authority);
150
+ __AccessAdmin_init(authority, adminName);
133
151
  }
134
152
 
135
153
 
136
154
  function __AccessAdmin_init(
137
- AccessManagerCloneable authority
155
+ address authority,
156
+ string memory adminName
138
157
  )
139
158
  internal
140
159
  onlyInitializing()
141
- onlyDeployer() // initializes deployer if not initialized yet
160
+ onlyDeployer()
142
161
  {
143
- authority.initialize(address(this));
162
+ // checks
163
+ // check authority is contract
164
+ if (!ContractLib.isContract(authority)) {
165
+ revert ErrorAccessAdminAuthorityNotContract(authority);
166
+ }
144
167
 
168
+ // check name not empty
169
+ if (bytes(adminName).length == 0) {
170
+ revert ErrorAccessAdminAccessManagerEmptyName();
171
+ }
172
+
173
+ _authority = AccessManagerCloneable(authority);
174
+ _authority.initialize(address(this));
175
+
176
+ // delayed additional check for authority after its initialization
177
+ if (!ContractLib.isAuthority(authority)) {
178
+ revert ErrorAccessAdminAccessManagerNotAccessManager(authority);
179
+ }
180
+
181
+ // effects
145
182
  // set and initialize this access manager contract as
146
183
  // the admin (ADMIN_ROLE) of the provided authority
147
- __AccessManaged_init(address(authority));
148
- _authority = authority;
184
+ __AccessManaged_init(authority);
185
+
186
+ // set name for logging
187
+ _adminName = adminName;
188
+
189
+ // set initial linked NFT ID to zero
190
+ _linkedNftId = NftIdLib.zero();
149
191
 
150
192
  // create admin and public roles
151
193
  _initializeAdminAndPublicRoles();
194
+ }
152
195
 
153
- // additional use case specific initialization
154
- _initializeCustom();
196
+
197
+ function getRelease() public view virtual returns (VersionPart release) {
198
+ return _authority.getRelease();
155
199
  }
156
200
 
157
201
 
@@ -160,46 +204,24 @@ contract AccessAdmin is
160
204
  }
161
205
 
162
206
 
163
- function getRelease() public view returns (VersionPart release) {
164
- return _authority.getRelease();
207
+ function getLinkedNftId() external view returns (NftId linkedNftId) {
208
+ return _linkedNftId;
165
209
  }
166
210
 
167
211
 
168
- function _initializeAdminAndPublicRoles()
169
- internal
170
- virtual
171
- onlyInitializing()
172
- {
173
- RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
174
-
175
- // setup admin role
176
- _createRoleUnchecked(
177
- ADMIN_ROLE(),
178
- toRole({
179
- adminRoleId: ADMIN_ROLE(),
180
- roleType: RoleType.Contract,
181
- maxMemberCount: 1,
182
- name: ADMIN_ROLE_NAME}));
212
+ function getLinkedOwner() external view returns (address linkedOwner) {
213
+ return getRegistry().ownerOf(_linkedNftId);
214
+ }
183
215
 
184
- // add this contract as admin role member
185
- _roleMembers[adminRoleId].add(address(this));
186
216
 
187
- // setup public role
188
- _createRoleUnchecked(
189
- PUBLIC_ROLE(),
190
- toRole({
191
- adminRoleId: ADMIN_ROLE(),
192
- roleType: RoleType.Gif,
193
- maxMemberCount: type(uint32).max,
194
- name: PUBLIC_ROLE_NAME}));
217
+ function getAuthorization() public view returns (IAuthorization authorization) {
218
+ return _authorization;
195
219
  }
196
220
 
197
221
 
198
- function _initializeCustom()
199
- internal
200
- virtual
201
- onlyInitializing()
202
- { }
222
+ function isLocked() public view returns (bool locked) {
223
+ return _authority.isLocked();
224
+ }
203
225
 
204
226
  //--- view functions for roles ------------------------------------------//
205
227
 
@@ -223,12 +245,12 @@ contract AccessAdmin is
223
245
  return _roleInfo[roleId].createdAt.gtz();
224
246
  }
225
247
 
226
- function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory) {
227
- return _roleInfo[roleId];
248
+ function getRoleForName(string memory name) external view returns (RoleId roleId) {
249
+ return _roleForName[StrLib.toStr(name)].roleId;
228
250
  }
229
251
 
230
- function getRoleForName(Str name) external view returns (RoleNameInfo memory) {
231
- return _roleForName[name];
252
+ function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory) {
253
+ return _roleInfo[roleId];
232
254
  }
233
255
 
234
256
  function roleMembers(RoleId roleId) external view returns (uint256 numberOfMembers) {
@@ -305,33 +327,59 @@ contract AccessAdmin is
305
327
  selector.toBytes4()));
306
328
  }
307
329
 
308
- function canCall(address caller, address target, Selector selector) external virtual view returns (bool can) {
309
- (can, ) = _authority.canCall(caller, target, selector.toBytes4());
330
+ function deployer() public view returns (address) {
331
+ return _deployer;
310
332
  }
311
333
 
312
- function toRole(RoleId adminRoleId, RoleType roleType, uint32 maxMemberCount, string memory name) public view returns (RoleInfo memory) {
313
- return RoleInfo({
314
- name: StrLib.toStr(name),
315
- adminRoleId: adminRoleId,
316
- roleType: roleType,
317
- maxMemberCount: maxMemberCount,
318
- createdAt: TimestampLib.blockTimestamp(),
319
- pausedAt: TimestampLib.max()
320
- });
321
- }
334
+ //--- internal/private functions -------------------------------------------------//
322
335
 
323
- function toFunction(bytes4 selector, string memory name) public view returns (FunctionInfo memory) {
324
- return FunctionInfo({
325
- name: StrLib.toStr(name),
326
- selector: SelectorLib.toSelector(selector),
327
- createdAt: TimestampLib.blockTimestamp()});
336
+ function _linkToNftOwnable(address registerable) internal {
337
+ if (!getRegistry().isRegistered(registerable)) {
338
+ revert ErrorAccessAdminNotRegistered(registerable);
339
+ }
340
+
341
+ _linkedNftId = getRegistry().getNftIdForAddress(registerable);
328
342
  }
329
343
 
330
- function deployer() public view returns (address) {
331
- return _deployer;
344
+ function _initializeAdminAndPublicRoles()
345
+ internal
346
+ virtual
347
+ onlyInitializing()
348
+ {
349
+ RoleId adminRoleId = RoleIdLib.toRoleId(_authority.ADMIN_ROLE());
350
+
351
+ // setup admin role
352
+ _createRoleUnchecked(
353
+ ADMIN_ROLE(),
354
+ AccessAdminLib.toRole({
355
+ adminRoleId: ADMIN_ROLE(),
356
+ roleType: RoleType.Contract,
357
+ maxMemberCount: 1,
358
+ name: ADMIN_ROLE_NAME}));
359
+
360
+ // add this contract as admin role member
361
+ _roleMembers[adminRoleId].add(address(this));
362
+
363
+ // setup public role
364
+ _createRoleUnchecked(
365
+ PUBLIC_ROLE(),
366
+ AccessAdminLib.toRole({
367
+ adminRoleId: ADMIN_ROLE(),
368
+ roleType: RoleType.Gif,
369
+ maxMemberCount: type(uint32).max,
370
+ name: PUBLIC_ROLE_NAME}));
332
371
  }
333
372
 
334
- //--- internal/private functions -------------------------------------------------//
373
+ function _createTargetWithRole(
374
+ address target,
375
+ string memory targetName,
376
+ RoleId targetRoleId
377
+ )
378
+ internal
379
+ {
380
+ _createTarget(target, targetName, true, false);
381
+ _grantRoleToAccount(targetRoleId, target);
382
+ }
335
383
 
336
384
  function _authorizeTargetFunctions(
337
385
  address target,
@@ -341,7 +389,7 @@ contract AccessAdmin is
341
389
  internal
342
390
  {
343
391
  if (roleId == getAdminRole()) {
344
- revert ErrorAuthorizeForAdminRoleInvalid(target);
392
+ revert ErrorAccessAdminAuthorizeForAdminRoleInvalid(target);
345
393
  }
346
394
 
347
395
  (
@@ -430,13 +478,15 @@ contract AccessAdmin is
430
478
  functionSelectors,
431
479
  RoleId.unwrap(roleId));
432
480
 
481
+ // log function grantings
433
482
  for (uint256 i = 0; i < functionSelectors.length; i++) {
434
483
  emit LogAccessAdminFunctionGranted(
484
+ _adminName,
435
485
  target,
436
- // _getAccountName(target),
437
- // string(abi.encodePacked("", functionSelectors[i])),
438
- functionNames[i],
439
- _getRoleName(roleId));
486
+ string(abi.encodePacked(
487
+ functionNames[i],
488
+ "(): ",
489
+ _getRoleName(roleId))));
440
490
  }
441
491
  }
442
492
 
@@ -448,7 +498,7 @@ contract AccessAdmin is
448
498
  {
449
499
  // check max role members will not be exceeded
450
500
  if (_roleMembers[roleId].length() >= _roleInfo[roleId].maxMemberCount) {
451
- revert ErrorRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
501
+ revert ErrorAccessAdminRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
452
502
  }
453
503
 
454
504
  // check account is contract for contract role
@@ -456,7 +506,7 @@ contract AccessAdmin is
456
506
  _roleInfo[roleId].roleType == RoleType.Contract &&
457
507
  !ContractLib.isContract(account) // will fail in account's constructor
458
508
  ) {
459
- revert ErrorRoleMemberNotContract(roleId, account);
509
+ revert ErrorAccessAdminRoleMemberNotContract(roleId, account);
460
510
  }
461
511
 
462
512
  // TODO check account already have roleId
@@ -466,7 +516,7 @@ contract AccessAdmin is
466
516
  account,
467
517
  0);
468
518
 
469
- emit LogAccessAdminRoleGranted(account, _getRoleName(roleId));
519
+ emit LogAccessAdminRoleGranted(_adminName, account, _getRoleName(roleId));
470
520
  }
471
521
 
472
522
  /// @dev revoke the specified role from the provided account
@@ -477,7 +527,7 @@ contract AccessAdmin is
477
527
 
478
528
  // check role removal is permitted
479
529
  if (_roleInfo[roleId].roleType == RoleType.Contract) {
480
- revert ErrorRoleMemberRemovalDisabled(roleId, account);
530
+ revert ErrorAccessAdminRoleMemberRemovalDisabled(roleId, account);
481
531
  }
482
532
 
483
533
  // TODO check account have roleId?
@@ -486,7 +536,7 @@ contract AccessAdmin is
486
536
  RoleId.unwrap(roleId),
487
537
  account);
488
538
 
489
- emit LogAccessAdminRoleRevoked(account, _roleInfo[roleId].name.toString());
539
+ emit LogAccessAdminRoleRevoked(_adminName, account, _roleInfo[roleId].name.toString());
490
540
  }
491
541
 
492
542
 
@@ -498,32 +548,21 @@ contract AccessAdmin is
498
548
  )
499
549
  internal
500
550
  {
501
- // check role does not yet exist
502
- if(roleExists(roleId)) {
503
- revert ErrorRoleAlreadyCreated(
504
- roleId,
505
- _roleInfo[roleId].name.toString());
506
- }
507
-
508
- // check admin role exists
509
- if(!roleExists(info.adminRoleId)) {
510
- revert ErrorRoleAdminNotExisting(info.adminRoleId);
511
- }
512
-
513
- // check role name is not empty
514
- if(info.name.length() == 0) {
515
- revert ErrorRoleNameEmpty(roleId);
516
- }
551
+ AccessAdminLib.checkRoleCreation(this, roleId, info);
552
+ _createRoleUnchecked(roleId, info);
553
+ }
517
554
 
518
- // check role name is not used for another role
519
- if(_roleForName[info.name].exists) {
520
- revert ErrorRoleNameAlreadyExists(
521
- roleId,
522
- info.name.toString(),
523
- _roleForName[info.name].roleId);
524
- }
525
555
 
526
- _createRoleUnchecked(roleId, info);
556
+ function _createTarget(
557
+ address target,
558
+ string memory targetName,
559
+ bool checkAuthority,
560
+ bool custom
561
+ )
562
+ internal
563
+ {
564
+ AccessAdminLib.checkTargetCreation(this, target, targetName, checkAuthority);
565
+ _createTargetUnchecked(target, targetName, custom);
527
566
  }
528
567
 
529
568
 
@@ -545,53 +584,19 @@ contract AccessAdmin is
545
584
  // add role to list of roles
546
585
  _roleIds.push(roleId);
547
586
 
548
- emit LogAccessAdminRoleCreated(roleId, info.roleType, info.adminRoleId, info.name.toString());
587
+ emit LogAccessAdminRoleCreated(_adminName, roleId, info.roleType, info.adminRoleId, info.name.toString());
549
588
  }
550
589
 
551
590
 
552
- function _createTarget(
591
+ function _createTargetUnchecked(
553
592
  address target,
554
593
  string memory targetName,
555
- bool checkAuthority,
556
594
  bool custom
557
595
  )
558
596
  internal
559
597
  {
560
- // check target does not yet exist
561
- if(targetExists(target)) {
562
- revert ErrorTargetAlreadyCreated(
563
- target,
564
- _targetInfo[target].name.toString());
565
- }
566
-
567
- // check target name is not empty
568
- Str name = StrLib.toStr(targetName);
569
- if(name.length() == 0) {
570
- revert ErrorTargetNameEmpty(target);
571
- }
572
-
573
- // check target name is not used for another target
574
- if( _targetForName[name] != address(0)) {
575
- revert ErrorTargetNameAlreadyExists(
576
- target,
577
- targetName,
578
- _targetForName[name]);
579
- }
580
-
581
- // check target is an access managed contract
582
- if (!_isAccessManaged(target)) {
583
- revert ErrorTargetNotAccessManaged(target);
584
- }
585
-
586
- // check target shares authority with this contract
587
- if (checkAuthority) {
588
- address targetAuthority = AccessManagedUpgradeable(target).authority();
589
- if (targetAuthority != authority()) {
590
- revert ErrorTargetAuthorityMismatch(authority(), targetAuthority);
591
- }
592
- }
593
-
594
598
  // create target info
599
+ Str name = StrLib.toStr(targetName);
595
600
  _targetInfo[target] = TargetInfo({
596
601
  name: name,
597
602
  isCustom: custom,
@@ -604,47 +609,17 @@ contract AccessAdmin is
604
609
  // add role to list of roles
605
610
  _targets.push(target);
606
611
 
607
- emit LogAccessAdminTargetCreated(target, targetName);
612
+ emit LogAccessAdminTargetCreated(_adminName, target, targetName);
608
613
  }
609
614
 
610
615
 
611
- function _isAccessManaged(address target)
612
- internal
613
- view
614
- returns (bool)
615
- {
616
- if (!ContractLib.isContract(target)) {
617
- return false;
618
- }
619
-
620
- (bool success, ) = target.staticcall(
621
- abi.encodeWithSelector(
622
- IAccessManagedChecker.authority.selector));
623
-
624
- return success;
625
- }
626
-
627
-
628
- function _setTargetClosed(address target, bool locked)
616
+ function _setTargetLocked(address target, bool locked)
629
617
  internal
618
+ onlyExistingTarget(target)
630
619
  {
631
- _checkTarget(target);
632
-
633
- // target locked/unlocked already
634
- if(_authority.isTargetClosed(target) == locked) {
635
- revert ErrorTargetAlreadyLocked(target, locked);
636
- }
637
-
638
620
  _authority.setTargetClosed(target, locked);
639
621
  }
640
622
 
641
- function _getAccountName(address account) internal view returns (string memory) {
642
- if (targetExists(account)) {
643
- return _targetInfo[account].name.toString();
644
- }
645
- return "<unknown-account>";
646
- }
647
-
648
623
 
649
624
  function _getRoleName(RoleId roleId) internal view returns (string memory) {
650
625
  if (roleExists(roleId)) {
@@ -654,7 +629,25 @@ contract AccessAdmin is
654
629
  }
655
630
 
656
631
 
657
- function _checkRoleExists(
632
+ function _checkAuthorization(
633
+ address authorization,
634
+ ObjectType expectedDomain,
635
+ VersionPart expectedRelease,
636
+ bool checkAlreadyInitialized
637
+ )
638
+ internal
639
+ view
640
+ {
641
+ AccessAdminLib.checkAuthorization(
642
+ address(_authorization),
643
+ authorization,
644
+ expectedDomain,
645
+ expectedRelease,
646
+ checkAlreadyInitialized);
647
+ }
648
+
649
+
650
+ function _checkRoleExists(
658
651
  RoleId roleId,
659
652
  bool onlyActiveRole
660
653
  )
@@ -662,28 +655,50 @@ contract AccessAdmin is
662
655
  view
663
656
  {
664
657
  if (!roleExists(roleId)) {
665
- revert ErrorRoleUnknown(roleId);
658
+ revert ErrorAccessAdminRoleUnknown(roleId);
666
659
  }
667
660
 
668
661
  uint64 roleIdInt = RoleId.unwrap(roleId);
669
662
  if (roleIdInt == _authority.ADMIN_ROLE()) {
670
- revert ErrorRoleIsLocked(roleId);
663
+ revert ErrorAccessAdminRoleIsLocked(roleId);
671
664
  }
672
665
 
673
666
  // check if role is disabled
674
667
  if (onlyActiveRole && _roleInfo[roleId].pausedAt <= TimestampLib.blockTimestamp()) {
675
- revert ErrorRoleIsPaused(roleId);
668
+ revert ErrorAccessAdminRoleIsPaused(roleId);
676
669
  }
677
670
  }
678
671
 
679
672
 
673
+
680
674
  /// @dev check if target exists and reverts if it doesn't
681
- function _checkTarget(address target)
675
+ function _checkTargetExists(
676
+ address target
677
+ )
682
678
  internal
683
679
  view
684
680
  {
681
+ // check not yet created
685
682
  if (!targetExists(target)) {
686
- revert ErrorTargetUnknown(target);
683
+ revert ErrorAccessAdminTargetNotCreated(target);
684
+ }
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);
687
702
  }
688
703
  }
689
704
  }