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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +2 -2
  3. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +2 -2
  5. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  6. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +97 -267
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
  10. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +36 -652
  12. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +2 -2
  14. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +47 -222
  16. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  17. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +27 -175
  19. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +12 -85
  21. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +16 -246
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +27 -420
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +3 -3
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +60 -221
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +114 -167
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +60 -72
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +0 -29
  38. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  39. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +2 -2
  41. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +59 -220
  43. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +2 -2
  45. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +59 -220
  47. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +3 -3
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +59 -220
  52. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +2 -2
  54. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +2 -2
  56. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +59 -220
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +2 -2
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +59 -220
  62. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  64. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +32 -310
  66. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +0 -182
  68. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  69. package/artifacts/contracts/instance/Instance.sol/Instance.json +72 -322
  70. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +292 -605
  72. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +56 -242
  74. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +290 -478
  76. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +26 -208
  78. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +14 -14
  80. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2 -2
  82. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  84. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  86. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  87. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  89. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  91. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  93. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
  95. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  100. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +2 -2
  103. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +56 -234
  105. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
  111. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
  113. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  114. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +59 -220
  116. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +108 -92
  118. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  119. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +55 -31
  120. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  122. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  123. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  124. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  125. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +26 -92
  126. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  127. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +2 -2
  128. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  129. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +2 -2
  130. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  131. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +36 -60
  132. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  133. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +19 -15
  134. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  135. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  136. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +59 -220
  137. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  138. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +78 -78
  139. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  140. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +40 -40
  141. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  143. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  145. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  146. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  147. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  148. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +2 -2
  149. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  150. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +26 -82
  151. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +2 -2
  153. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.json +2 -2
  155. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
  157. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  158. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskService.sol/RiskService.json +2 -2
  160. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  161. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +2 -2
  162. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  163. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  164. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  166. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  167. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  168. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  169. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +249 -378
  171. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +1 -1
  172. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +68 -243
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  174. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  176. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +10 -10
  177. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  178. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +186 -384
  179. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  181. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +76 -128
  183. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  184. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +26 -437
  185. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  186. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  187. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  189. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +54 -54
  190. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  191. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +28 -28
  192. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  194. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +45 -16
  195. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  196. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  197. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  200. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  202. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  203. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  204. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  205. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  206. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  208. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  209. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  210. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  211. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  212. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  213. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  214. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  215. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  216. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  217. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  218. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  219. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  220. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  221. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  222. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  223. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  224. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  225. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  226. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  227. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  228. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  229. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  230. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  231. package/artifacts/contracts/staking/Staking.sol/Staking.json +8 -8
  232. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +1 -1
  233. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +2 -2
  234. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  235. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  236. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  237. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +5 -5
  238. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  239. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
  240. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  241. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +2 -2
  242. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  243. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +2 -2
  244. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  245. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2 -2
  246. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  247. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +3 -3
  248. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  249. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  250. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  252. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  253. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  255. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  256. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  257. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  258. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  259. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  260. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  261. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  262. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  263. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  264. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  265. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +6 -6
  266. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  267. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  268. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  269. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  270. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  271. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  272. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  273. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  274. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  275. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +218 -39
  276. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/String.sol/StrLib.json +2 -50
  282. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  286. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  287. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  288. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
  289. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  290. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  291. package/contracts/authorization/AccessAdmin.sol +185 -261
  292. package/contracts/authorization/AccessAdminLib.sol +7 -220
  293. package/contracts/authorization/Authorization.sol +229 -38
  294. package/contracts/authorization/IAccess.sol +4 -14
  295. package/contracts/authorization/IAccessAdmin.sol +45 -19
  296. package/contracts/authorization/IAuthorization.sol +56 -3
  297. package/contracts/authorization/IServiceAuthorization.sol +17 -55
  298. package/contracts/authorization/ServiceAuthorization.sol +33 -247
  299. package/contracts/distribution/BasicDistributionAuthorization.sol +4 -11
  300. package/contracts/distribution/Distribution.sol +1 -2
  301. package/contracts/distribution/DistributionService.sol +33 -75
  302. package/contracts/distribution/IDistributionComponent.sol +1 -3
  303. package/contracts/distribution/IDistributionService.sol +4 -10
  304. package/contracts/instance/IInstance.sol +4 -43
  305. package/contracts/instance/IInstanceService.sol +3 -28
  306. package/contracts/instance/Instance.sol +39 -80
  307. package/contracts/instance/InstanceAdmin.sol +229 -162
  308. package/contracts/instance/InstanceAuthorizationV3.sol +28 -58
  309. package/contracts/instance/InstanceReader.sol +389 -371
  310. package/contracts/instance/InstanceService.sol +53 -105
  311. package/contracts/oracle/BasicOracleAuthorization.sol +2 -18
  312. package/contracts/pool/BasicPoolAuthorization.sol +3 -9
  313. package/contracts/pool/BundleService.sol +9 -8
  314. package/contracts/pool/PoolLib.sol +0 -44
  315. package/contracts/product/ApplicationService.sol +26 -4
  316. package/contracts/product/BasicProductAuthorization.sol +4 -9
  317. package/contracts/product/ClaimService.sol +20 -11
  318. package/contracts/product/PolicyService.sol +2 -2
  319. package/contracts/product/PolicyServiceLib.sol +0 -20
  320. package/contracts/registry/RegistryAdmin.sol +97 -27
  321. package/contracts/registry/RegistryAuthorization.sol +25 -35
  322. package/contracts/registry/ReleaseAdmin.sol +100 -42
  323. package/contracts/registry/ReleaseRegistry.sol +9 -12
  324. package/contracts/registry/ServiceAuthorizationV3.sol +20 -32
  325. package/contracts/registry/TokenRegistry.sol +4 -2
  326. package/contracts/shared/ComponentService.sol +5 -22
  327. package/contracts/shared/ContractLib.sol +45 -9
  328. package/contracts/shared/IRegisterable.sol +1 -0
  329. package/contracts/shared/Service.sol +4 -6
  330. package/contracts/staking/Staking.sol +5 -4
  331. package/contracts/staking/TargetManagerLib.sol +1 -1
  332. package/contracts/type/ObjectType.sol +3 -16
  333. package/contracts/type/RoleId.sol +59 -57
  334. package/contracts/type/String.sol +0 -12
  335. package/contracts/upgradeability/ProxyManager.sol +2 -2
  336. package/contracts/upgradeability/Versionable.sol +1 -4
  337. package/package.json +1 -1
@@ -6,57 +6,19 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
6
6
  import {IAccess} from "./IAccess.sol";
7
7
  import {IAccessAdmin} from "./IAccessAdmin.sol";
8
8
  import {IAuthorization} from "./IAuthorization.sol";
9
- import {IComponent} from "../shared/IComponent.sol";
10
9
  import {IRegistry} from "../registry/IRegistry.sol";
11
- import {IService} from "../shared/IService.sol";
12
- import {IServiceAuthorization} from "./IServiceAuthorization.sol";
13
10
 
14
11
  import {ContractLib} from "../shared/ContractLib.sol";
15
12
  import {ObjectType} from "../type/ObjectType.sol";
16
- import {RoleId, RoleIdLib} from "../type/RoleId.sol";
13
+ import {RoleId} from "../type/RoleId.sol";
17
14
  import {SelectorLib} from "../type/Selector.sol";
18
15
  import {Str, StrLib} from "../type/String.sol";
19
16
  import {TimestampLib} from "../type/Timestamp.sol";
20
- import {VersionPart, VersionPartLib} from "../type/Version.sol";
17
+ import {VersionPart} from "../type/Version.sol";
21
18
 
22
19
 
23
20
  library AccessAdminLib { // ACCESS_ADMIN_LIB
24
21
 
25
- string public constant TOKEN_HANDLER_SUFFIX = "Th";
26
- string public constant ROLE_SUFFIX = "_Role";
27
-
28
- uint64 public constant SERVICE_DOMAIN_ROLE_FACTOR = 100;
29
- uint64 public constant COMPONENT_ROLE_FACTOR = 1000;
30
- uint64 public constant COMPONENT_ROLE_MAX = 19000;
31
-
32
- uint64 public constant CORE_ROLE_MIN = 100;
33
- uint64 public constant SERVICE_ROLE_MIN = 1000; // + service domain * SERVICE_ROLE_FACTOR + release
34
- uint64 public constant SERVICE_ROLE_FACTOR = 1000;
35
- uint64 public constant INSTANCE_ROLE_MIN = 100000;
36
-
37
- // MUST match with Authorization.COMPONENT_ROLE_MIN
38
- uint64 public constant COMPONENT_ROLE_MIN = 110000;
39
-
40
- uint64 public constant CUSTOM_ROLE_MIN = 1000000;
41
-
42
-
43
- function getSelectors(
44
- IAccess.FunctionInfo[] memory functions
45
- )
46
- public
47
- pure
48
- returns (
49
- bytes4[] memory selectors
50
- )
51
- {
52
- uint256 n = functions.length;
53
- selectors = new bytes4[](n);
54
- for (uint256 i = 0; i < n; i++) {
55
- selectors[i] = functions[i].selector.toBytes4();
56
- }
57
- }
58
-
59
-
60
22
  function checkRoleCreation(
61
23
  IAccessAdmin accessAdmin,
62
24
  RoleId roleId,
@@ -92,7 +54,6 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
92
54
  }
93
55
  }
94
56
 
95
-
96
57
  function checkTargetCreation(
97
58
  IAccessAdmin accessAdmin,
98
59
  address target,
@@ -136,6 +97,7 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
136
97
  revert IAccessAdmin.ErrorAccessAdminTargetAuthorityMismatch(accessAdmin.authority(), targetAuthority);
137
98
  }
138
99
  }
100
+
139
101
  }
140
102
 
141
103
 
@@ -144,7 +106,6 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
144
106
  address authorization,
145
107
  ObjectType expectedDomain,
146
108
  VersionPart expectedRelease,
147
- bool expectServiceAuthorization,
148
109
  bool checkAlreadyInitialized
149
110
  )
150
111
  public
@@ -157,14 +118,8 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
157
118
  }
158
119
 
159
120
  // check contract type matches
160
- if (expectServiceAuthorization) {
161
- if (!ContractLib.supportsInterface(authorization, type(IServiceAuthorization).interfaceId)) {
162
- revert IAccessAdmin.ErrorAccessAdminNotServiceAuthorization(authorization);
163
- }
164
- } else {
165
- if (!ContractLib.supportsInterface(authorization, type(IAuthorization).interfaceId)) {
166
- revert IAccessAdmin.ErrorAccessAdminNotAuthorization(authorization);
167
- }
121
+ if (!ContractLib.supportsInterface(authorization, type(IAuthorization).interfaceId)) {
122
+ revert IAccessAdmin.ErrorAccessAdminNotAuthorization(authorization);
168
123
  }
169
124
 
170
125
  // check domain matches
@@ -189,8 +144,6 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
189
144
  public
190
145
  view
191
146
  {
192
- checkRegistry(registry);
193
-
194
147
  ObjectType tagetType = IRegistry(registry).getObjectInfo(target).objectType;
195
148
  if (tagetType.eqz()) {
196
149
  revert IAccessAdmin.ErrorAccessAdminNotRegistered(target);
@@ -201,161 +154,7 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
201
154
  }
202
155
  }
203
156
 
204
-
205
- function checkRegistry(
206
- address registry
207
- )
208
- public
209
- view
210
- {
211
- if (!ContractLib.isRegistry(registry)) {
212
- revert IAccessAdmin.ErrorAccessAdminNotRegistry(registry);
213
- }
214
- }
215
-
216
-
217
- function getServiceRoleId(
218
- address serviceAddress,
219
- IAccess.TargetType serviceTargetType
220
- )
221
- public
222
- view
223
- returns (RoleId serviceRoleId)
224
- {
225
- IService service = IService(serviceAddress);
226
-
227
- if (serviceTargetType == IAccess.TargetType.Service) {
228
- return RoleIdLib.toServiceRoleId(service.getDomain(), service.getRelease());
229
- } else if (serviceTargetType == IAccess.TargetType.GenericService) {
230
- return RoleIdLib.toGenericServiceRoleId(service.getDomain());
231
- }
232
-
233
- revert IAccessAdmin.ErrorAccessAdminInvalidServiceType(serviceAddress, serviceTargetType);
234
- }
235
-
236
-
237
- function getVersionedServiceRoleId(
238
- ObjectType serviceDomain,
239
- VersionPart release
240
- )
241
- public
242
- pure
243
- returns (RoleId serviceRoleId)
244
- {
245
- return RoleIdLib.toRoleId(
246
- SERVICE_ROLE_MIN + SERVICE_ROLE_FACTOR * serviceDomain.toInt() + release.toInt());
247
- }
248
-
249
-
250
- function getGenericServiceRoleId(
251
- ObjectType serviceDomain
252
- )
253
- public
254
- pure
255
- returns (RoleId serviceRoleId)
256
- {
257
- return RoleIdLib.toRoleId(
258
- SERVICE_ROLE_MIN + SERVICE_ROLE_FACTOR * serviceDomain.toInt() + VersionPartLib.releaseMax().toInt());
259
- }
260
-
261
-
262
- function getCustomRoleId(uint64 index)
263
- public
264
- pure
265
- returns (RoleId customRoleId)
266
- {
267
- return RoleIdLib.toRoleId(CUSTOM_ROLE_MIN + index);
268
- }
269
-
270
-
271
- function isCustomRole(RoleId roleId)
272
- public
273
- pure
274
- returns (bool)
275
- {
276
- return roleId.toInt() >= CUSTOM_ROLE_MIN;
277
- }
278
-
279
-
280
- function getTargetRoleId(
281
- address target,
282
- IAccess.TargetType targetType,
283
- uint64 index
284
- )
285
- public
286
- view
287
- returns (RoleId targetRoleId)
288
- {
289
- if (targetType == IAccess.TargetType.Core) {
290
- return RoleIdLib.toRoleId(CORE_ROLE_MIN + index);
291
- }
292
-
293
- if (targetType == IAccess.TargetType.Service || targetType == IAccess.TargetType.GenericService ) {
294
- return getServiceRoleId(target, targetType);
295
- }
296
-
297
- if (targetType == IAccess.TargetType.Instance) {
298
- return RoleIdLib.toRoleId(INSTANCE_ROLE_MIN + index);
299
- }
300
-
301
- if (targetType == IAccess.TargetType.Component) {
302
- return RoleIdLib.toRoleId(COMPONENT_ROLE_MIN + index);
303
- }
304
-
305
- if (targetType == IAccess.TargetType.Custom) {
306
- return RoleIdLib.toRoleId(CUSTOM_ROLE_MIN + index);
307
- }
308
-
309
- revert IAccessAdmin.ErrorAccessAdminInvalidTargetType(target, targetType);
310
- }
311
-
312
-
313
- function getTokenHandler(
314
- address target,
315
- string memory targetName,
316
- IAccess.TargetType targetType
317
- )
318
- public
319
- view
320
- returns (
321
- address tokenHandler,
322
- string memory tokenHandlerName
323
- )
324
- {
325
- // not component or core (we need to check core because of staking)
326
- if (targetType != IAccess.TargetType.Component && targetType != IAccess.TargetType.Core) {
327
- return (address(0), "");
328
- }
329
-
330
- // not contract
331
- if (!ContractLib.isContract(target)) {
332
- return (address(0), "");
333
- }
334
-
335
- // not component
336
- if (!ContractLib.supportsInterface(target, type(IComponent).interfaceId)) {
337
- return (address(0), "");
338
- }
339
-
340
- tokenHandler = address(IComponent(target).getTokenHandler());
341
- tokenHandlerName = string(abi.encodePacked(targetName, TOKEN_HANDLER_SUFFIX));
342
- }
343
-
344
-
345
- function toRoleName(string memory name) public pure returns (string memory) {
346
- return string(
347
- abi.encodePacked(
348
- name,
349
- ROLE_SUFFIX));
350
- }
351
-
352
-
353
- function toRole(
354
- RoleId adminRoleId,
355
- IAccessAdmin.RoleType roleType,
356
- uint32 maxMemberCount,
357
- string memory name
358
- )
157
+ function toRole(RoleId adminRoleId, IAccessAdmin.RoleType roleType, uint32 maxMemberCount, string memory name)
359
158
  public
360
159
  view
361
160
  returns (IAccess.RoleInfo memory)
@@ -370,23 +169,11 @@ library AccessAdminLib { // ACCESS_ADMIN_LIB
370
169
  });
371
170
  }
372
171
 
373
-
374
- function toFunction(
375
- bytes4 selector,
376
- string memory name
377
- )
172
+ function toFunction(bytes4 selector, string memory name)
378
173
  public
379
174
  view
380
175
  returns (IAccess.FunctionInfo memory)
381
176
  {
382
- if(selector == bytes4(0)) {
383
- revert IAccessAdmin.ErrorAccessAdminSelectorZero();
384
- }
385
-
386
- if(bytes(name).length == 0) {
387
- revert IAccessAdmin.ErrorAccessAdminFunctionNameEmpty();
388
- }
389
-
390
177
  return IAccess.FunctionInfo({
391
178
  name: StrLib.toStr(name),
392
179
  selector: SelectorLib.toSelector(selector),
@@ -4,49 +4,75 @@ pragma solidity ^0.8.20;
4
4
  import {IAccess} from "./IAccess.sol";
5
5
  import {IAuthorization} from "./IAuthorization.sol";
6
6
 
7
- import {ADMIN_ROLE_NAME, PUBLIC_ROLE_NAME} from "./AccessAdmin.sol";
7
+ import {InitializableERC165} from "../shared/InitializableERC165.sol";
8
8
  import {ObjectType, ObjectTypeLib} from "../type/ObjectType.sol";
9
- import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
9
+ import {RoleId, RoleIdLib, ADMIN_ROLE} from "../type/RoleId.sol";
10
10
  import {SelectorLib} from "../type/Selector.sol";
11
- import {ServiceAuthorization} from "../authorization/ServiceAuthorization.sol";
12
11
  import {Str, StrLib} from "../type/String.sol";
13
12
  import {TimestampLib} from "../type/Timestamp.sol";
14
13
  import {VersionPart, VersionPartLib} from "../type/Version.sol";
15
14
 
16
-
17
15
  contract Authorization is
18
- ServiceAuthorization,
16
+ InitializableERC165,
19
17
  IAuthorization
20
18
  {
19
+ uint256 public constant GIF_RELEASE = 3;
21
20
 
22
- // MUST match with AccessAdminLib.COMPONENT_ROLE_MIN
23
- uint64 public constant COMPONENT_ROLE_MIN = 110000;
21
+ string public constant ROLE_NAME_SUFFIX = "Role";
22
+ string public constant SERVICE_ROLE_NAME_SUFFIX = "ServiceRole";
24
23
 
25
24
  uint64 internal _nextGifContractRoleId;
25
+ ObjectType[] internal _serviceDomains;
26
+ mapping(ObjectType domain => Str target) internal _serviceTarget;
27
+
28
+ string internal _mainTargetName = "Component";
29
+ string internal _tokenHandlerName = "ComponentTH";
26
30
 
27
- string internal _tokenHandlerName = "ComponentTh";
31
+ ObjectType internal _domain;
32
+ Str internal _mainTarget;
28
33
  Str internal _tokenHandlerTarget;
34
+ Str[] internal _targets;
35
+
36
+ mapping(Str target => RoleId roleid) internal _targetRole;
37
+ mapping(Str target => bool exists) internal _targetExists;
38
+
39
+ RoleId[] internal _roles;
40
+ mapping(RoleId role => RoleInfo info) internal _roleInfo;
41
+
42
+ mapping(Str target => RoleId[] authorizedRoles) internal _authorizedRoles;
43
+ mapping(Str target => mapping(RoleId authorizedRole => IAccess.FunctionInfo[] functions)) internal _authorizedFunctions;
29
44
 
30
45
 
31
46
  constructor(
32
47
  string memory mainTargetName,
33
- ObjectType domain,
34
- uint8 release,
35
- string memory commitHash,
48
+ ObjectType targetDomain,
36
49
  bool isComponent,
37
50
  bool includeTokenHandler
38
51
  )
39
- ServiceAuthorization(mainTargetName, domain, release, commitHash)
40
52
  {
53
+ // checks
54
+ if (bytes(mainTargetName).length == 0) {
55
+ revert ErrorAuthorizationMainTargetNameEmpty();
56
+ }
57
+
58
+ if (targetDomain == ObjectTypeLib.zero()) {
59
+ revert ErrorAuthorizationTargetDomainZero();
60
+ }
61
+
62
+ // effects
63
+ _initializeERC165();
64
+
65
+ _domain = targetDomain;
66
+ _mainTargetName = mainTargetName;
67
+ _mainTarget = StrLib.toStr(mainTargetName);
41
68
  _nextGifContractRoleId = 10;
42
69
 
43
- // setup main target
44
70
  if (isComponent) {
45
- if (domain.eqz()) {
71
+ if (targetDomain.eqz()) {
46
72
  revert ErrorAuthorizationTargetDomainZero();
47
73
  }
48
74
 
49
- RoleId mainRoleId = RoleIdLib.toRoleId(COMPONENT_ROLE_MIN);
75
+ RoleId mainRoleId = RoleIdLib.toComponentRoleId(targetDomain, 0);
50
76
  string memory mainRolName = _toTargetRoleName(_mainTargetName);
51
77
 
52
78
  _addTargetWithRole(
@@ -54,9 +80,8 @@ contract Authorization is
54
80
  mainRoleId,
55
81
  mainRolName);
56
82
  } else {
57
- _addGifTarget(_mainTargetName);
83
+ _addGifContractTarget(_mainTargetName);
58
84
  }
59
-
60
85
  // setup use case specific parts
61
86
  _setupServiceTargets();
62
87
  _setupRoles(); // not including main target role
@@ -65,7 +90,7 @@ contract Authorization is
65
90
 
66
91
  // setup component token handler
67
92
  if (includeTokenHandler) {
68
- _tokenHandlerName = string(abi.encodePacked(mainTargetName, "Th"));
93
+ _tokenHandlerName = string(abi.encodePacked(mainTargetName, "TH"));
69
94
  _tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
70
95
  _addTarget(_tokenHandlerName);
71
96
  _setupTokenHandlerAuthorizations();
@@ -74,6 +99,47 @@ contract Authorization is
74
99
  _registerInterfaceNotInitializing(type(IAuthorization).interfaceId);
75
100
  }
76
101
 
102
+ function getDomain() external view returns(ObjectType targetDomain) {
103
+ return _domain;
104
+ }
105
+
106
+ function getServiceDomains() external view returns(ObjectType[] memory serviceDomains) {
107
+ return _serviceDomains;
108
+ }
109
+
110
+ function getComponentRole(ObjectType componentDomain) public view returns(RoleId roleId) {
111
+ return RoleIdLib.toComponentRoleId(componentDomain, 0);
112
+ }
113
+
114
+ function getServiceRole(ObjectType serviceDomain) public virtual pure returns (RoleId serviceRoleId) {
115
+ return RoleIdLib.roleForTypeAndVersion(
116
+ serviceDomain,
117
+ getRelease());
118
+ }
119
+
120
+ function getServiceTarget(ObjectType serviceDomain) external view returns(Str serviceTarget) {
121
+ return _serviceTarget[serviceDomain];
122
+ }
123
+
124
+ function getRoles() external view returns(RoleId[] memory roles) {
125
+ return _roles;
126
+ }
127
+
128
+ function roleExists(RoleId roleId) public view returns(bool exists) {
129
+ return _roleInfo[roleId].roleType != RoleType.Undefined;
130
+ }
131
+
132
+ function getRoleInfo(RoleId roleId) external view returns (RoleInfo memory info) {
133
+ return _roleInfo[roleId];
134
+ }
135
+
136
+ function getMainTargetName() public virtual view returns (string memory name) {
137
+ return _mainTargetName;
138
+ }
139
+
140
+ function getMainTarget() public view returns(Str) {
141
+ return _mainTarget;
142
+ }
77
143
 
78
144
  function getTokenHandlerName() public view returns(string memory) {
79
145
  return _tokenHandlerName;
@@ -83,7 +149,7 @@ contract Authorization is
83
149
  return _tokenHandlerTarget;
84
150
  }
85
151
 
86
- function getTarget(string memory targetName) public pure returns(Str target) {
152
+ function getTarget(string memory targetName) public view returns(Str target) {
87
153
  return StrLib.toStr(targetName);
88
154
  }
89
155
 
@@ -95,31 +161,111 @@ contract Authorization is
95
161
  return target == _mainTarget || _targetExists[target];
96
162
  }
97
163
 
164
+ function getTargetRole(Str target) public view returns(RoleId roleId) {
165
+ return _targetRole[target];
166
+ }
167
+
168
+ function getAuthorizedRoles(Str target) external view returns(RoleId[] memory roleIds) {
169
+ return _authorizedRoles[target];
170
+ }
171
+
172
+ function getAuthorizedFunctions(Str target, RoleId roleId) external view returns(IAccess.FunctionInfo[] memory authorizatedFunctions) {
173
+ return _authorizedFunctions[target][roleId];
174
+ }
175
+
176
+ function getRelease() public virtual pure returns(VersionPart release) {
177
+ return VersionPartLib.toVersionPart(GIF_RELEASE);
178
+ }
179
+
98
180
  /// @dev Sets up the relevant service targets for the component.
99
181
  /// Overwrite this function for use case specific authorizations.
100
- // solhint-disable-next-line no-empty-blocks
101
182
  function _setupServiceTargets() internal virtual { }
102
183
 
103
184
  /// @dev Sets up the relevant (non-service) targets for the component.
104
185
  /// Overwrite this function for use case specific authorizations.
105
- // solhint-disable-next-line no-empty-blocks
106
186
  function _setupTargets() internal virtual { }
107
187
 
108
188
  /// @dev Sets up the relevant roles for the component.
109
189
  /// Overwrite this function for use case specific authorizations.
110
- // solhint-disable-next-line no-empty-blocks
111
190
  function _setupRoles() internal virtual {}
112
191
 
113
192
  /// @dev Sets up the relevant component's token handler authorizations.
114
193
  /// Overwrite this function for use case specific authorizations.
115
- // solhint-disable-next-line no-empty-blocks
116
194
  function _setupTokenHandlerAuthorizations() internal virtual {}
117
195
 
118
196
  /// @dev Sets up the relevant target authorizations for the component.
119
197
  /// Overwrite this function for use case specific authorizations.
120
- // solhint-disable-next-line no-empty-blocks
121
198
  function _setupTargetAuthorizations() internal virtual {}
122
199
 
200
+ function _addGifContractTarget(string memory contractName) internal {
201
+
202
+ RoleId contractRoleId = RoleIdLib.toRoleId(_nextGifContractRoleId++);
203
+ string memory contractRoleName = string(
204
+ abi.encodePacked(
205
+ contractName,
206
+ ROLE_NAME_SUFFIX));
207
+
208
+ _addTargetWithRole(
209
+ contractName,
210
+ contractRoleId,
211
+ contractRoleName);
212
+ }
213
+
214
+ /// @dev Add the service target role for the specified service domain
215
+ function _addServiceTargetWithRole(ObjectType serviceDomain) internal {
216
+ // add service domain
217
+ _serviceDomains.push(serviceDomain);
218
+
219
+ // get versioned target name
220
+ string memory serviceTargetName = ObjectTypeLib.toVersionedName(
221
+ ObjectTypeLib.toName(serviceDomain),
222
+ "Service",
223
+ getRelease());
224
+
225
+ _serviceTarget[serviceDomain] = StrLib.toStr(serviceTargetName);
226
+
227
+ RoleId serviceRoleId = getServiceRole(serviceDomain);
228
+ string memory serviceRoleName = ObjectTypeLib.toVersionedName(
229
+ ObjectTypeLib.toName(serviceDomain),
230
+ "ServiceRole",
231
+ getRelease());
232
+
233
+ _addTargetWithRole(
234
+ serviceTargetName,
235
+ serviceRoleId,
236
+ serviceRoleName);
237
+ }
238
+
239
+
240
+ /// @dev Use this method to to add an authorized role.
241
+ function _addRole(RoleId roleId, RoleInfo memory info) internal {
242
+ _roles.push(roleId);
243
+ _roleInfo[roleId] = info;
244
+ }
245
+
246
+
247
+ /// @dev Add a contract role for the provided role id and name.
248
+ function _addContractRole(RoleId roleId, string memory name) internal {
249
+ _addRole(
250
+ roleId,
251
+ _toRoleInfo(
252
+ ADMIN_ROLE(),
253
+ RoleType.Contract,
254
+ 1,
255
+ name));
256
+ }
257
+
258
+
259
+ /// @dev Add the versioned service role for the specified service domain
260
+ function _addServiceRole(ObjectType serviceDomain) internal {
261
+ _addContractRole(
262
+ getServiceRole(serviceDomain),
263
+ ObjectTypeLib.toVersionedName(
264
+ ObjectTypeLib.toName(serviceDomain),
265
+ SERVICE_ROLE_NAME_SUFFIX,
266
+ getRelease()));
267
+ }
268
+
123
269
 
124
270
  /// @dev Add a contract role for the provided role id and name.
125
271
  function _addCustomRole(RoleId roleId, RoleId adminRoleId, uint32 maxMemberCount, string memory name) internal {
@@ -132,18 +278,31 @@ contract Authorization is
132
278
  name));
133
279
  }
134
280
 
135
- /// @dev Add a gif target with its corresponding contract role
136
- function _addGifTarget(string memory contractName) internal {
137
- RoleId contractRoleId = RoleIdLib.toRoleId(_nextGifContractRoleId++);
138
- string memory contractRoleName = string(
139
- abi.encodePacked(
140
- contractName,
141
- ROLE_NAME_SUFFIX));
142
281
 
143
- _addTargetWithRole(
144
- contractName,
145
- contractRoleId,
146
- contractRoleName);
282
+ /// @dev Use this method to to add an authorized target together with its target role.
283
+ function _addTargetWithRole(
284
+ string memory targetName,
285
+ RoleId roleId,
286
+ string memory roleName
287
+ )
288
+ internal
289
+ {
290
+ // add target
291
+ Str target = StrLib.toStr(targetName);
292
+ _targets.push(target);
293
+
294
+ _targetExists[target] = true;
295
+
296
+ // link role to target if defined
297
+ if (roleId != RoleIdLib.zero()) {
298
+ // add role if new
299
+ if (!roleExists(roleId)) {
300
+ _addContractRole(roleId, roleName);
301
+ }
302
+
303
+ // link target to role
304
+ _targetRole[target] = roleId;
305
+ }
147
306
  }
148
307
 
149
308
 
@@ -153,22 +312,54 @@ contract Authorization is
153
312
  }
154
313
 
155
314
 
156
- /// @dev Role id for targets registry, staking and instance
315
+ /// @dev Use this method to authorize the specified role to access the target.
316
+ function _authorizeForTarget(string memory target, RoleId authorizedRoleId)
317
+ internal
318
+ returns (IAccess.FunctionInfo[] storage authorizatedFunctions)
319
+ {
320
+ Str targetStr = StrLib.toStr(target);
321
+ _authorizedRoles[targetStr].push(authorizedRoleId);
322
+ return _authorizedFunctions[targetStr][authorizedRoleId];
323
+ }
324
+
325
+
326
+ /// @dev Use this method to authorize a specific function authorization
327
+ function _authorize(IAccess.FunctionInfo[] storage functions, bytes4 selector, string memory name) internal {
328
+ functions.push(
329
+ IAccess.FunctionInfo({
330
+ selector: SelectorLib.toSelector(selector),
331
+ name: StrLib.toStr(name),
332
+ createdAt: TimestampLib.blockTimestamp()}));
333
+ }
334
+
335
+
336
+ /// @dev role id for targets registry, staking and instance
157
337
  function _toTargetRoleId(ObjectType targetDomain)
158
338
  internal
159
339
  pure
160
340
  returns (RoleId targetRoleId)
161
341
  {
162
- return RoleIdLib.toRoleId(100 * targetDomain.toInt());
342
+ return RoleIdLib.roleForType(targetDomain);
163
343
  }
164
344
 
165
345
 
166
- /// @dev Returns the role name for the specified target name
167
346
  function _toTargetRoleName(string memory targetName) internal pure returns (string memory) {
168
347
  return string(
169
348
  abi.encodePacked(
170
349
  targetName,
171
350
  ROLE_NAME_SUFFIX));
172
351
  }
352
+
353
+
354
+ /// @dev creates a role info object from the provided parameters
355
+ function _toRoleInfo(RoleId adminRoleId, RoleType roleType, uint32 maxMemberCount, string memory name) internal view returns (RoleInfo memory info) {
356
+ return RoleInfo({
357
+ name: StrLib.toStr(name),
358
+ adminRoleId: adminRoleId,
359
+ roleType: roleType,
360
+ maxMemberCount: maxMemberCount,
361
+ createdAt: TimestampLib.blockTimestamp(),
362
+ pausedAt: TimestampLib.max()});
363
+ }
173
364
  }
174
365