@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
@@ -0,0 +1,183 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
+
6
+ import {IAccess} from "./IAccess.sol";
7
+ import {IAccessAdmin} from "./IAccessAdmin.sol";
8
+ import {IAuthorization} from "./IAuthorization.sol";
9
+ import {IRegistry} from "../registry/IRegistry.sol";
10
+
11
+ import {ContractLib} from "../shared/ContractLib.sol";
12
+ import {ObjectType} from "../type/ObjectType.sol";
13
+ import {RoleId} from "../type/RoleId.sol";
14
+ import {SelectorLib} from "../type/Selector.sol";
15
+ import {Str, StrLib} from "../type/String.sol";
16
+ import {TimestampLib} from "../type/Timestamp.sol";
17
+ import {VersionPart} from "../type/Version.sol";
18
+
19
+
20
+ library AccessAdminLib { // ACCESS_ADMIN_LIB
21
+
22
+ function checkRoleCreation(
23
+ IAccessAdmin accessAdmin,
24
+ RoleId roleId,
25
+ IAccess.RoleInfo memory info
26
+ )
27
+ public
28
+ view
29
+ {
30
+ // check role does not yet exist // ACCESS_ADMIN_LIB role creation checks
31
+ if(accessAdmin.roleExists(roleId)) {
32
+ revert IAccessAdmin.ErrorAccessAdminRoleAlreadyCreated(
33
+ roleId,
34
+ accessAdmin.getRoleInfo(roleId).name.toString());
35
+ }
36
+
37
+ // check admin role exists
38
+ if(!accessAdmin.roleExists(info.adminRoleId)) {
39
+ revert IAccessAdmin.ErrorAccessAdminRoleAdminNotExisting(info.adminRoleId);
40
+ }
41
+
42
+ // check role name is not empty
43
+ if(info.name.length() == 0) {
44
+ revert IAccessAdmin.ErrorAccessAdminRoleNameEmpty(roleId);
45
+ }
46
+
47
+ // check role name is not used for another role
48
+ RoleId roleIdForName = accessAdmin.getRoleForName(StrLib.toString(info.name));
49
+ if(roleIdForName.gtz()) {
50
+ revert IAccessAdmin.ErrorAccessAdminRoleNameAlreadyExists(
51
+ roleId,
52
+ info.name.toString(),
53
+ roleIdForName);
54
+ }
55
+ }
56
+
57
+ function checkTargetCreation(
58
+ IAccessAdmin accessAdmin,
59
+ address target,
60
+ string memory targetName,
61
+ bool checkAuthority
62
+ )
63
+ public
64
+ view
65
+ {
66
+ // check target does not yet exist
67
+ if(accessAdmin.targetExists(target)) {
68
+ revert IAccessAdmin.ErrorAccessAdminTargetAlreadyCreated(
69
+ target,
70
+ accessAdmin.getTargetInfo(target).name.toString());
71
+ }
72
+
73
+ // check target name is not empty
74
+ Str name = StrLib.toStr(targetName);
75
+ if(name.length() == 0) {
76
+ revert IAccessAdmin.ErrorAccessAdminTargetNameEmpty(target);
77
+ }
78
+
79
+ // check target name is not used for another target
80
+ address targetForName = accessAdmin.getTargetForName(name);
81
+ if(targetForName != address(0)) {
82
+ revert IAccessAdmin.ErrorAccessAdminTargetNameAlreadyExists(
83
+ target,
84
+ targetName,
85
+ targetForName);
86
+ }
87
+
88
+ // check target is an access managed contract
89
+ if (!ContractLib.isAccessManaged(target)) {
90
+ revert IAccessAdmin.ErrorAccessAdminTargetNotAccessManaged(target);
91
+ }
92
+
93
+ // check target shares authority with this contract
94
+ if (checkAuthority) {
95
+ address targetAuthority = AccessManagedUpgradeable(target).authority();
96
+ if (targetAuthority != accessAdmin.authority()) {
97
+ revert IAccessAdmin.ErrorAccessAdminTargetAuthorityMismatch(accessAdmin.authority(), targetAuthority);
98
+ }
99
+ }
100
+
101
+ }
102
+
103
+
104
+ function checkAuthorization(
105
+ address authorizationOld,
106
+ address authorization,
107
+ ObjectType expectedDomain,
108
+ VersionPart expectedRelease,
109
+ bool checkAlreadyInitialized
110
+ )
111
+ public
112
+ view
113
+ {
114
+ // checks
115
+ // check not yet initialized
116
+ if (checkAlreadyInitialized && authorizationOld != address(0)) {
117
+ revert IAccessAdmin.ErrorAccessAdminAlreadyInitialized(authorizationOld);
118
+ }
119
+
120
+ // check contract type matches
121
+ if (!ContractLib.supportsInterface(authorization, type(IAuthorization).interfaceId)) {
122
+ revert IAccessAdmin.ErrorAccessAdminNotAuthorization(authorization);
123
+ }
124
+
125
+ // check domain matches
126
+ ObjectType domain = IAuthorization(authorization).getDomain();
127
+ if (domain != expectedDomain) {
128
+ revert IAccessAdmin.ErrorAccessAdminDomainMismatch(authorization, expectedDomain, domain);
129
+ }
130
+
131
+ // check release matches
132
+ VersionPart authorizationRelease = IAuthorization(authorization).getRelease();
133
+ if (authorizationRelease != expectedRelease) {
134
+ revert IAccessAdmin.ErrorAccessAdminReleaseMismatch(authorization, expectedRelease, authorizationRelease);
135
+ }
136
+ }
137
+
138
+
139
+ function checkIsRegistered(
140
+ address registry,
141
+ address target,
142
+ ObjectType expectedType
143
+ )
144
+ public
145
+ view
146
+ {
147
+ ObjectType tagetType = IRegistry(registry).getObjectInfo(target).objectType;
148
+ if (tagetType.eqz()) {
149
+ revert IAccessAdmin.ErrorAccessAdminNotRegistered(target);
150
+ }
151
+
152
+ if (tagetType != expectedType) {
153
+ revert IAccessAdmin.ErrorAccessAdminTargetTypeMismatch(target, expectedType, tagetType);
154
+ }
155
+ }
156
+
157
+ function toRole(RoleId adminRoleId, IAccessAdmin.RoleType roleType, uint32 maxMemberCount, string memory name)
158
+ public
159
+ view
160
+ returns (IAccess.RoleInfo memory)
161
+ {
162
+ return IAccess.RoleInfo({
163
+ name: StrLib.toStr(name),
164
+ adminRoleId: adminRoleId,
165
+ roleType: roleType,
166
+ maxMemberCount: maxMemberCount,
167
+ createdAt: TimestampLib.blockTimestamp(),
168
+ pausedAt: TimestampLib.max()
169
+ });
170
+ }
171
+
172
+ function toFunction(bytes4 selector, string memory name)
173
+ public
174
+ view
175
+ returns (IAccess.FunctionInfo memory)
176
+ {
177
+ return IAccess.FunctionInfo({
178
+ name: StrLib.toStr(name),
179
+ selector: SelectorLib.toSelector(selector),
180
+ createdAt: TimestampLib.blockTimestamp()});
181
+ }
182
+
183
+ }
@@ -2,12 +2,11 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
5
- import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
6
5
  import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
7
6
 
8
7
  import {InitializableERC165} from "../shared/InitializableERC165.sol";
9
8
  import {RegistryLinked} from "../shared/RegistryLinked.sol";
10
- import {VersionPart, VersionLib} from "../type/Version.sol";
9
+ import {VersionPart} from "../type/Version.sol";
11
10
 
12
11
 
13
12
  /// @dev An AccessManager based on OpenZeppelin that is cloneable and has a central lock property.
@@ -28,6 +27,7 @@ contract AccessManagerCloneable is
28
27
  VersionPart private _release;
29
28
  bool private _isLocked;
30
29
 
30
+
31
31
  modifier onlyAdminRole() {
32
32
  (bool isMember, ) = hasRole(ADMIN_ROLE, msg.sender);
33
33
  if(!isMember) {
@@ -36,12 +36,14 @@ contract AccessManagerCloneable is
36
36
  _;
37
37
  }
38
38
 
39
+
39
40
  function initialize(address admin)
40
- external
41
+ public
41
42
  initializer()
42
43
  {
44
+ __ERC165_init();
43
45
  __AccessManager_init(admin);
44
- _initializeERC165();
46
+
45
47
  _registerInterface(type(IAccessManager).interfaceId);
46
48
  }
47
49
 
@@ -56,22 +58,27 @@ contract AccessManagerCloneable is
56
58
  onlyAdminRole
57
59
  reinitializer(uint64(release.toInt()))
58
60
  {
59
- _completeSetup(registry, release, true);
61
+ _checkAndSetRegistry(registry);
62
+ _checkAndSetRelease(release);
60
63
  }
61
64
 
62
- /// @dev Completes the setup of the access manager.
63
- /// Links the access manager to the registry and sets the release version.
64
- function completeSetup(
65
- address registry,
66
- VersionPart release,
67
- bool verifyRelease
68
- )
69
- public
70
- onlyAdminRole
71
- reinitializer(uint64(release.toInt()))
72
- {
73
- _completeSetup(registry, release, verifyRelease);
74
- }
65
+ // /// @dev Completes the setup of the access manager.
66
+ // /// Links the access manager to the registry and sets the release version.
67
+ // function completeSetup(
68
+ // address registry,
69
+ // VersionPart release,
70
+ // bool verifyRelease
71
+ // )
72
+ // public
73
+ // onlyAdminRole
74
+ // reinitializer(uint64(release.toInt()))
75
+ // {
76
+ // _checkAndSetRegistry(registry);
77
+
78
+ // if (verifyRelease) {
79
+ // _checkAndSetRelease(release);
80
+ // }
81
+ // }
75
82
 
76
83
  /// @dev Returns true if the caller is authorized to call the target with the given selector and the manager lock is not set to locked.
77
84
  /// Feturn values as in OpenZeppelin AccessManager.
@@ -89,12 +96,12 @@ contract AccessManagerCloneable is
89
96
  uint32 delay
90
97
  )
91
98
  {
92
- (immediate, delay) = super.canCall(caller, target, selector);
93
-
94
99
  // locking of all contracts under control of this access manager
95
- if (isLocked()) {
100
+ if (_isLocked) {
96
101
  revert ErrorAccessManagerTargetAdminLocked(target);
97
102
  }
103
+
104
+ (immediate, delay) = super.canCall(caller, target, selector);
98
105
  }
99
106
 
100
107
 
@@ -126,11 +133,18 @@ contract AccessManagerCloneable is
126
133
  }
127
134
 
128
135
 
129
- function _completeSetup(
130
- address registry,
131
- VersionPart release,
132
- bool verifyRelease
133
- )
136
+ function _checkAndSetRelease(VersionPart release)
137
+ internal
138
+ {
139
+ if (!release.isValidRelease()) {
140
+ revert ErrorAccessManagerInvalidRelease(release);
141
+ }
142
+
143
+ _release = release;
144
+ }
145
+
146
+
147
+ function _checkAndSetRegistry(address registry)
134
148
  internal
135
149
  {
136
150
  // checks
@@ -138,12 +152,7 @@ contract AccessManagerCloneable is
138
152
  revert ErrorAccessManagerRegistryAlreadySet(address(getRegistry()) );
139
153
  }
140
154
 
141
- if (verifyRelease && !release.isValidRelease()) {
142
- revert ErrorAccessManagerInvalidRelease(release);
143
- }
144
-
145
155
  // effects
146
156
  __RegistryLinked_init(registry);
147
- _release = release;
148
157
  }
149
158
  }
@@ -3,27 +3,32 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {IAccess} from "./IAccess.sol";
5
5
  import {IAuthorization} from "./IAuthorization.sol";
6
- import {ObjectType, ObjectTypeLib, PRODUCT, ORACLE, DISTRIBUTION, POOL} from "../type/ObjectType.sol";
6
+
7
+ import {InitializableERC165} from "../shared/InitializableERC165.sol";
8
+ import {ObjectType, ObjectTypeLib} from "../type/ObjectType.sol";
7
9
  import {RoleId, RoleIdLib, ADMIN_ROLE} from "../type/RoleId.sol";
8
10
  import {SelectorLib} from "../type/Selector.sol";
9
11
  import {Str, StrLib} from "../type/String.sol";
10
12
  import {TimestampLib} from "../type/Timestamp.sol";
11
13
  import {VersionPart, VersionPartLib} from "../type/Version.sol";
12
14
 
13
- contract Authorization
14
- is IAuthorization
15
+ contract Authorization is
16
+ InitializableERC165,
17
+ IAuthorization
15
18
  {
16
19
  uint256 public constant GIF_RELEASE = 3;
17
20
 
18
21
  string public constant ROLE_NAME_SUFFIX = "Role";
19
22
  string public constant SERVICE_ROLE_NAME_SUFFIX = "ServiceRole";
20
23
 
24
+ uint64 internal _nextGifContractRoleId;
21
25
  ObjectType[] internal _serviceDomains;
22
26
  mapping(ObjectType domain => Str target) internal _serviceTarget;
23
27
 
24
28
  string internal _mainTargetName = "Component";
25
29
  string internal _tokenHandlerName = "ComponentTH";
26
30
 
31
+ ObjectType internal _domain;
27
32
  Str internal _mainTarget;
28
33
  Str internal _tokenHandlerTarget;
29
34
  Str[] internal _targets;
@@ -40,7 +45,9 @@ contract Authorization
40
45
 
41
46
  constructor(
42
47
  string memory mainTargetName,
43
- ObjectType targetDomain
48
+ ObjectType targetDomain,
49
+ bool isComponent,
50
+ bool includeTokenHandler
44
51
  )
45
52
  {
46
53
  // checks
@@ -48,45 +55,52 @@ contract Authorization
48
55
  revert ErrorAuthorizationMainTargetNameEmpty();
49
56
  }
50
57
 
51
- if (targetDomain.eqz()) {
58
+ if (targetDomain == ObjectTypeLib.zero()) {
52
59
  revert ErrorAuthorizationTargetDomainZero();
53
60
  }
54
61
 
55
62
  // effects
56
- // setup main target, main role id and main role info
63
+ _initializeERC165();
64
+
65
+ _domain = targetDomain;
57
66
  _mainTargetName = mainTargetName;
58
- _tokenHandlerName = string(abi.encodePacked(mainTargetName, "TH"));
67
+ _mainTarget = StrLib.toStr(mainTargetName);
68
+ _nextGifContractRoleId = 10;
59
69
 
60
- RoleId mainRoleId = RoleIdLib.toComponentRoleId(targetDomain, 0);
61
- string memory mainRolName = _toTargetRoleName(mainTargetName);
70
+ if (isComponent) {
71
+ if (targetDomain.eqz()) {
72
+ revert ErrorAuthorizationTargetDomainZero();
73
+ }
62
74
 
63
- _addTargetWithRole(
64
- _mainTargetName,
65
- mainRoleId,
66
- mainRolName);
75
+ RoleId mainRoleId = RoleIdLib.toComponentRoleId(targetDomain, 0);
76
+ string memory mainRolName = _toTargetRoleName(_mainTargetName);
67
77
 
68
- _mainTarget = StrLib.toStr(mainTargetName);
69
- _targetRole[_mainTarget] = mainRoleId;
70
-
71
- // add token handler target for components
72
- if (targetDomain == PRODUCT()
73
- || targetDomain == DISTRIBUTION()
74
- || targetDomain == ORACLE()
75
- || targetDomain == POOL()
76
- ) {
77
- _addTarget(_tokenHandlerName);
78
+ _addTargetWithRole(
79
+ _mainTargetName,
80
+ mainRoleId,
81
+ mainRolName);
82
+ } else {
83
+ _addGifContractTarget(_mainTargetName);
78
84
  }
79
-
80
- // setup token handler target
81
- _tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
82
-
83
85
  // setup use case specific parts
84
86
  _setupServiceTargets();
85
87
  _setupRoles(); // not including main target role
86
88
  _setupTargets(); // not including main target (and token handler target)
87
-
88
- _setupTokenHandlerAuthorizations();
89
89
  _setupTargetAuthorizations(); // not including token handler target
90
+
91
+ // setup component token handler
92
+ if (includeTokenHandler) {
93
+ _tokenHandlerName = string(abi.encodePacked(mainTargetName, "TH"));
94
+ _tokenHandlerTarget = StrLib.toStr(_tokenHandlerName);
95
+ _addTarget(_tokenHandlerName);
96
+ _setupTokenHandlerAuthorizations();
97
+ }
98
+
99
+ _registerInterfaceNotInitializing(type(IAuthorization).interfaceId);
100
+ }
101
+
102
+ function getDomain() external view returns(ObjectType targetDomain) {
103
+ return _domain;
90
104
  }
91
105
 
92
106
  function getServiceDomains() external view returns(ObjectType[] memory serviceDomains) {
@@ -147,7 +161,7 @@ contract Authorization
147
161
  return target == _mainTarget || _targetExists[target];
148
162
  }
149
163
 
150
- function getTargetRole(Str target) external view returns(RoleId roleId) {
164
+ function getTargetRole(Str target) public view returns(RoleId roleId) {
151
165
  return _targetRole[target];
152
166
  }
153
167
 
@@ -183,6 +197,20 @@ contract Authorization
183
197
  /// Overwrite this function for use case specific authorizations.
184
198
  function _setupTargetAuthorizations() internal virtual {}
185
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
+
186
214
  /// @dev Add the service target role for the specified service domain
187
215
  function _addServiceTargetWithRole(ObjectType serviceDomain) internal {
188
216
  // add service domain
@@ -192,7 +220,7 @@ contract Authorization
192
220
  string memory serviceTargetName = ObjectTypeLib.toVersionedName(
193
221
  ObjectTypeLib.toName(serviceDomain),
194
222
  "Service",
195
- getRelease().toInt());
223
+ getRelease());
196
224
 
197
225
  _serviceTarget[serviceDomain] = StrLib.toStr(serviceTargetName);
198
226
 
@@ -200,7 +228,7 @@ contract Authorization
200
228
  string memory serviceRoleName = ObjectTypeLib.toVersionedName(
201
229
  ObjectTypeLib.toName(serviceDomain),
202
230
  "ServiceRole",
203
- getRelease().toInt());
231
+ getRelease());
204
232
 
205
233
  _addTargetWithRole(
206
234
  serviceTargetName,
@@ -235,7 +263,7 @@ contract Authorization
235
263
  ObjectTypeLib.toVersionedName(
236
264
  ObjectTypeLib.toName(serviceDomain),
237
265
  SERVICE_ROLE_NAME_SUFFIX,
238
- getRelease().toInt()));
266
+ getRelease()));
239
267
  }
240
268
 
241
269
 
@@ -16,32 +16,40 @@ interface IAccess {
16
16
  }
17
17
 
18
18
  struct RoleInfo {
19
- RoleId adminRoleId;
20
- RoleType roleType;
21
- uint32 maxMemberCount;
19
+ // slot 0
20
+ RoleId adminRoleId;
21
+ RoleType roleType;
22
+ uint32 maxMemberCount;
23
+ Timestamp createdAt;
24
+ Timestamp pausedAt;
25
+ // slot 1
22
26
  Str name;
23
- Timestamp createdAt;
24
- Timestamp pausedAt;
25
27
  }
26
28
 
27
29
  struct TargetInfo {
30
+ // slot 0
28
31
  Str name;
32
+ // slot 1
29
33
  bool isCustom;
30
34
  Timestamp createdAt;
31
35
  }
32
36
 
33
37
  struct FunctionInfo {
38
+ // slot 0
34
39
  Str name; // function name
40
+ // slot 1
35
41
  Selector selector; // function selector
36
42
  Timestamp createdAt;
37
43
  }
38
44
 
39
45
  struct RoleNameInfo {
46
+ // slot 0
40
47
  RoleId roleId;
41
48
  bool exists;
42
49
  }
43
50
 
44
51
  struct TargeNameInfo {
52
+ // slot 0
45
53
  address target;
46
54
  bool exists;
47
55
  }