@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,267 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IAccess} from "../authorization/IAccess.sol";
5
+ import {IRegistry} from "../registry/IRegistry.sol";
6
+ import {IStaking} from "../staking/IStaking.sol";
7
+
8
+ import {Authorization} from "../authorization/Authorization.sol";
9
+ import {POOL, REGISTRY, STAKING} from "../../contracts/type/ObjectType.sol";
10
+ import {PUBLIC_ROLE} from "../type/RoleId.sol";
11
+ import {ReleaseRegistry} from "./ReleaseRegistry.sol";
12
+ import {RegistryAdmin} from "./RegistryAdmin.sol";
13
+ import {RoleIdLib, ADMIN_ROLE, GIF_ADMIN_ROLE, GIF_MANAGER_ROLE} from "../type/RoleId.sol";
14
+ import {StakingStore} from "../staking/StakingStore.sol";
15
+ import {TokenHandler} from "../shared/TokenHandler.sol";
16
+ import {TokenRegistry} from "../registry/TokenRegistry.sol";
17
+
18
+
19
+ contract RegistryAuthorization
20
+ is Authorization
21
+ {
22
+
23
+ /// @dev gif core roles
24
+ string public constant GIF_ADMIN_ROLE_NAME = "GifAdminRole";
25
+ string public constant GIF_MANAGER_ROLE_NAME = "GifManagerRole";
26
+ string public constant RELEASE_REGISTRY_ROLE_NAME = "ReleaseRegistryRole";
27
+ string public constant STAKING_ROLE_NAME = "StakingRole";
28
+
29
+ /// @dev gif roles for external contracts
30
+ string public constant REGISTRY_SERVICE_ROLE_NAME = "RegistryServiceRole";
31
+ string public constant COMPONENT_SERVICE_ROLE_NAME = "ComponentServiceRole";
32
+ string public constant POOL_SERVICE_ROLE_NAME = "PoolServiceRole";
33
+ string public constant STAKING_SERVICE_ROLE_NAME = "StakingServiceRole";
34
+
35
+ /// @dev gif core targets
36
+ string public constant REGISTRY_ADMIN_TARGET_NAME = "RegistryAdmin";
37
+ string public constant REGISTRY_TARGET_NAME = "Registry";
38
+ string public constant RELEASE_REGISTRY_TARGET_NAME = "ReleaseRegistry";
39
+ string public constant TOKEN_REGISTRY_TARGET_NAME = "TokenRegistry";
40
+
41
+ string public constant STAKING_TARGET_NAME = "Staking";
42
+ string public constant STAKING_TH_TARGET_NAME = "StakingTH";
43
+ string public constant STAKING_STORE_TARGET_NAME = "StakingStore";
44
+
45
+ constructor()
46
+ Authorization(REGISTRY_TARGET_NAME, REGISTRY(), false, false)
47
+ { }
48
+
49
+ /// @dev Sets up the GIF admin and manager roles.
50
+ function _setupRoles() internal override {
51
+
52
+ // service roles (for all versions)
53
+ _addRole(
54
+ RoleIdLib.roleForTypeAndAllVersions(REGISTRY()),
55
+ _toRoleInfo({
56
+ adminRoleId: ADMIN_ROLE(),
57
+ roleType: RoleType.Gif,
58
+ maxMemberCount: 999, // max member count = max
59
+ name: REGISTRY_SERVICE_ROLE_NAME}));
60
+
61
+ _addRole(
62
+ RoleIdLib.roleForTypeAndAllVersions(STAKING()),
63
+ _toRoleInfo({
64
+ adminRoleId: ADMIN_ROLE(),
65
+ roleType: RoleType.Gif,
66
+ maxMemberCount: 999, // max member count = max
67
+ name: STAKING_SERVICE_ROLE_NAME}));
68
+
69
+ _addRole(
70
+ RoleIdLib.roleForTypeAndAllVersions(POOL()),
71
+ _toRoleInfo({
72
+ adminRoleId: ADMIN_ROLE(),
73
+ roleType: RoleType.Gif,
74
+ maxMemberCount: 999, // max member count = max
75
+ name: POOL_SERVICE_ROLE_NAME}));
76
+
77
+ // gif admin role
78
+ _addRole(
79
+ GIF_ADMIN_ROLE(),
80
+ _toRoleInfo({
81
+ adminRoleId: ADMIN_ROLE(),
82
+ roleType: RoleType.Gif,
83
+ maxMemberCount: 2, // TODO decide on max member count
84
+ name: GIF_ADMIN_ROLE_NAME}));
85
+
86
+ // gif manager role
87
+ _addRole(
88
+ GIF_MANAGER_ROLE(),
89
+ _toRoleInfo({
90
+ adminRoleId: ADMIN_ROLE(),
91
+ roleType: RoleType.Gif,
92
+ maxMemberCount: 1, // TODO decide on max member count
93
+ name: GIF_MANAGER_ROLE_NAME}));
94
+
95
+ }
96
+
97
+ /// @dev Sets up the relevant (non-service) targets for the registry.
98
+ function _setupTargets() internal override {
99
+ _addGifContractTarget(REGISTRY_ADMIN_TARGET_NAME);
100
+ _addGifContractTarget(RELEASE_REGISTRY_TARGET_NAME);
101
+ _addGifContractTarget(TOKEN_REGISTRY_TARGET_NAME);
102
+
103
+ _addGifContractTarget(STAKING_TARGET_NAME);
104
+ _addGifContractTarget(STAKING_TH_TARGET_NAME);
105
+ _addTarget(STAKING_STORE_TARGET_NAME);
106
+ }
107
+
108
+
109
+ function _setupTargetAuthorizations()
110
+ internal
111
+ override
112
+ {
113
+ // registry
114
+ _setupRegistryAuthorization();
115
+ _setupRegistryAdminAuthorization();
116
+ _setupReleaseRegistryAuthorization();
117
+ _setupTokenRegistryAuthorization();
118
+
119
+ // staking
120
+ _setupStakingAuthorization();
121
+ _setupStakingThAuthorization();
122
+ _setupStakingStoreAuthorization();
123
+ }
124
+
125
+ event LogAccessAdminDebug(string message, string custom, uint256 value);
126
+
127
+ function _setupRegistryAuthorization() internal {
128
+ IAccess.FunctionInfo[] storage functions;
129
+
130
+ // gif admin role
131
+ functions = _authorizeForTarget(REGISTRY_TARGET_NAME, GIF_ADMIN_ROLE());
132
+ _authorize(functions, IRegistry.registerRegistry.selector, "registerRegistry");
133
+
134
+ // registry service role
135
+ functions = _authorizeForTarget(
136
+ REGISTRY_TARGET_NAME,
137
+ RoleIdLib.roleForTypeAndAllVersions(REGISTRY()));
138
+
139
+ _authorize(functions, IRegistry.register.selector, "register");
140
+ _authorize(functions, IRegistry.registerWithCustomType.selector, "registerWithCustomType");
141
+
142
+ // release registry role
143
+ functions = _authorizeForTarget(
144
+ REGISTRY_TARGET_NAME,
145
+ getTargetRole(getTarget(RELEASE_REGISTRY_TARGET_NAME)));
146
+
147
+ _authorize(functions, IRegistry.registerService.selector, "registerService");
148
+ }
149
+
150
+
151
+ function _setupRegistryAdminAuthorization() internal {
152
+ IAccess.FunctionInfo[] storage functions;
153
+
154
+ // release registry role
155
+ functions = _authorizeForTarget(
156
+ REGISTRY_ADMIN_TARGET_NAME,
157
+ getTargetRole(getTarget(RELEASE_REGISTRY_TARGET_NAME)));
158
+
159
+ _authorize(functions, RegistryAdmin.grantServiceRoleForAllVersions.selector, "grantServiceRoleForAllVersions");
160
+ }
161
+
162
+
163
+ function _setupReleaseRegistryAuthorization() internal {
164
+ IAccess.FunctionInfo[] storage functions;
165
+
166
+ functions = _authorizeForTarget(RELEASE_REGISTRY_TARGET_NAME, GIF_ADMIN_ROLE());
167
+ _authorize(functions, ReleaseRegistry.createNextRelease.selector, "createNextRelease");
168
+ _authorize(functions, ReleaseRegistry.activateNextRelease.selector, "activateNextRelease");
169
+ _authorize(functions, ReleaseRegistry.setActive.selector, "setActive");
170
+
171
+ functions = _authorizeForTarget(RELEASE_REGISTRY_TARGET_NAME, GIF_MANAGER_ROLE());
172
+ _authorize(functions, ReleaseRegistry.prepareNextRelease.selector, "prepareNextRelease");
173
+ _authorize(functions, ReleaseRegistry.registerService.selector, "registerService");
174
+ }
175
+
176
+
177
+ function _setupTokenRegistryAuthorization() internal {
178
+ IAccess.FunctionInfo[] storage functions;
179
+
180
+ // gif manager role
181
+ functions = _authorizeForTarget(TOKEN_REGISTRY_TARGET_NAME, GIF_MANAGER_ROLE());
182
+ _authorize(functions, TokenRegistry.registerToken.selector, "registerToken");
183
+ _authorize(functions, TokenRegistry.registerRemoteToken.selector, "registerRemoteToken");
184
+ _authorize(functions, TokenRegistry.setActive.selector, "setActive");
185
+ _authorize(functions, TokenRegistry.setActiveForVersion.selector, "setActiveForVersion");
186
+ // TODO find a better way (only needed for testing)
187
+ _authorize(functions, TokenRegistry.setActiveWithVersionCheck.selector, "setActiveWithVersionCheck");
188
+ }
189
+
190
+
191
+ function _setupStakingAuthorization() internal {
192
+ IAccess.FunctionInfo[] storage functions;
193
+
194
+ // staking public role
195
+ functions = _authorizeForTarget(
196
+ STAKING_TARGET_NAME,
197
+ PUBLIC_ROLE());
198
+
199
+ _authorize(functions, IStaking.approveTokenHandler.selector, "approveTokenHandler");
200
+
201
+ // staking service role
202
+ functions = _authorizeForTarget(
203
+ STAKING_TARGET_NAME,
204
+ RoleIdLib.roleForTypeAndAllVersions(STAKING()));
205
+
206
+ _authorize(functions, IStaking.registerTarget.selector, "registerTarget");
207
+ _authorize(functions, IStaking.setLockingPeriod.selector, "setLockingPeriod");
208
+ _authorize(functions, IStaking.setRewardRate.selector, "setRewardRate");
209
+ _authorize(functions, IStaking.setMaxStakedAmount.selector, "setMaxStakedAmount");
210
+ _authorize(functions, IStaking.refillRewardReserves.selector, "refillRewardReserves");
211
+ _authorize(functions, IStaking.withdrawRewardReserves.selector, "withdrawRewardReserves");
212
+ _authorize(functions, IStaking.createStake.selector, "createStake");
213
+ _authorize(functions, IStaking.stake.selector, "stake");
214
+ _authorize(functions, IStaking.unstake.selector, "unstake");
215
+ _authorize(functions, IStaking.restake.selector, "restake");
216
+ _authorize(functions, IStaking.updateRewards.selector, "updateRewards");
217
+ _authorize(functions, IStaking.claimRewards.selector, "claimRewards");
218
+
219
+ // pool service role
220
+ functions = _authorizeForTarget(
221
+ STAKING_TARGET_NAME,
222
+ RoleIdLib.roleForTypeAndAllVersions(POOL()));
223
+
224
+ _authorize(functions, IStaking.increaseTotalValueLocked.selector, "increaseTotalValueLocked");
225
+ _authorize(functions, IStaking.decreaseTotalValueLocked.selector, "decreaseTotalValueLocked");
226
+ }
227
+
228
+
229
+ function _setupStakingThAuthorization() internal {
230
+ IAccess.FunctionInfo[] storage functions;
231
+
232
+ // staking service role
233
+ functions = _authorizeForTarget(
234
+ STAKING_TH_TARGET_NAME,
235
+ RoleIdLib.roleForTypeAndAllVersions(STAKING()));
236
+
237
+ _authorize(functions, TokenHandler.approve.selector, "approve");
238
+ _authorize(functions, TokenHandler.pullToken.selector, "pullToken");
239
+ _authorize(functions, TokenHandler.pushToken.selector, "pushToken");
240
+ }
241
+
242
+
243
+ function _setupStakingStoreAuthorization() internal {
244
+ IAccess.FunctionInfo[] storage functions;
245
+
246
+ // release registry role
247
+ functions = _authorizeForTarget(
248
+ STAKING_STORE_TARGET_NAME,
249
+ getTargetRole(getTarget(STAKING_TARGET_NAME)));
250
+
251
+ _authorize(functions, StakingStore.setStakingRate.selector, "setStakingRate");
252
+ _authorize(functions, StakingStore.createTarget.selector, "createTarget");
253
+ _authorize(functions, StakingStore.updateTarget.selector, "updateTarget");
254
+ _authorize(functions, StakingStore.increaseReserves.selector, "increaseReserves");
255
+ _authorize(functions, StakingStore.decreaseReserves.selector, "decreaseReserves");
256
+ _authorize(functions, StakingStore.increaseTotalValueLocked.selector, "increaseTotalValueLocked");
257
+ _authorize(functions, StakingStore.decreaseTotalValueLocked.selector, "decreaseTotalValueLocked");
258
+ _authorize(functions, StakingStore.create.selector, "create");
259
+ _authorize(functions, StakingStore.update.selector, "update");
260
+ _authorize(functions, StakingStore.increaseStake.selector, "increaseStake");
261
+ _authorize(functions, StakingStore.restakeRewards.selector, "restakeRewards");
262
+ _authorize(functions, StakingStore.updateRewards.selector, "updateRewards");
263
+ _authorize(functions, StakingStore.claimUpTo.selector, "claimUpTo");
264
+ _authorize(functions, StakingStore.unstakeUpTo.selector, "unstakeUpTo");
265
+ }
266
+ }
267
+
@@ -2,6 +2,7 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessAdmin} from "../authorization/AccessAdmin.sol";
5
+ import {AccessAdminLib} from "../authorization/AccessAdminLib.sol";
5
6
  import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
6
7
  import {IAccess} from "../authorization/IAccess.sol";
7
8
  import {IService} from "../shared/IService.sol";
@@ -38,13 +39,14 @@ contract ReleaseAdmin is
38
39
  _;
39
40
  }
40
41
 
41
- /// @dev Only used for master release admin.
42
- /// Contracts created via constructor come with disabled initializers.
43
- constructor() {
44
- initialize(new AccessManagerCloneable());
45
- _disableInitializers();
42
+ // @dev Only used for master release admin
43
+ constructor(address accessManager) {
44
+ initialize(
45
+ accessManager,
46
+ "MasterReleaseAdmin");
46
47
  }
47
48
 
49
+
48
50
  function completeSetup(
49
51
  address registry,
50
52
  address releaseRegistry,
@@ -53,11 +55,18 @@ contract ReleaseAdmin is
53
55
  external
54
56
  reinitializer(uint64(release.toInt()))
55
57
  {
58
+
59
+ // checks
60
+ _checkRegistry(registry);
61
+
56
62
  AccessManagerCloneable(
57
63
  authority()).completeSetup(
58
64
  registry,
59
65
  release);
60
66
 
67
+ // link nft ownability to registry
68
+ _linkToNftOwnable(registry);
69
+
61
70
  _setupReleaseRegistry(releaseRegistry);
62
71
  }
63
72
 
@@ -68,13 +77,13 @@ contract ReleaseAdmin is
68
77
  IServiceAuthorization serviceAuthorization,
69
78
  IService service,
70
79
  ObjectType serviceDomain,
71
- VersionPart releaseVersion
80
+ VersionPart release
72
81
  )
73
82
  external
74
83
  restricted()
75
84
  {
76
- _createServiceTargetAndRole(service, serviceDomain, releaseVersion);
77
- _authorizeServiceFunctions(serviceAuthorization, service, serviceDomain, releaseVersion);
85
+ _createServiceTargetAndRole(service, serviceDomain, release);
86
+ _authorizeServiceFunctions(serviceAuthorization, service, serviceDomain, release);
78
87
  }
79
88
 
80
89
  /// @dev Locks/unlocks all release targets.
@@ -109,7 +118,7 @@ contract ReleaseAdmin is
109
118
  revert ErrorReleaseAdminNotService(address(service));
110
119
  }
111
120
 
112
- _setTargetClosed(address(service), locked);
121
+ _setTargetLocked(address(service), locked);
113
122
 
114
123
  emit LogReleaseAdminServiceLockChanged(service.getRelease(), address(service), locked);
115
124
  }
@@ -126,16 +135,15 @@ contract ReleaseAdmin is
126
135
  function _createServiceTargetAndRole(
127
136
  IService service,
128
137
  ObjectType serviceDomain,
129
- VersionPart releaseVersion
138
+ VersionPart release
130
139
  )
131
140
  private
132
141
  {
133
142
  string memory baseName = ObjectTypeLib.toName(serviceDomain);
134
- uint256 versionInt = releaseVersion.toInt();
135
143
 
136
144
  // create service target
137
145
  string memory serviceTargetName = ObjectTypeLib.toVersionedName(
138
- baseName, "Service", versionInt);
146
+ baseName, "Service", release);
139
147
 
140
148
  _createTarget(
141
149
  address(service),
@@ -146,19 +154,19 @@ contract ReleaseAdmin is
146
154
  // create service role
147
155
  RoleId serviceRoleId = RoleIdLib.roleForTypeAndVersion(
148
156
  serviceDomain,
149
- releaseVersion);
157
+ release);
150
158
 
151
159
  if(!roleExists(serviceRoleId)) {
152
160
  _createRole(
153
161
  serviceRoleId,
154
- toRole({
162
+ AccessAdminLib.toRole({
155
163
  adminRoleId: ADMIN_ROLE(),
156
164
  roleType: RoleType.Contract,
157
165
  maxMemberCount: 1,
158
166
  name: ObjectTypeLib.toVersionedName(
159
167
  baseName,
160
168
  "ServiceRole",
161
- versionInt)}));
169
+ release)}));
162
170
  }
163
171
 
164
172
  _grantRoleToAccount(
@@ -171,7 +179,7 @@ contract ReleaseAdmin is
171
179
  IServiceAuthorization serviceAuthorization,
172
180
  IService service,
173
181
  ObjectType serviceDomain,
174
- VersionPart releaseVersion
182
+ VersionPart release
175
183
  )
176
184
  private
177
185
  {
@@ -189,21 +197,21 @@ contract ReleaseAdmin is
189
197
  } else {
190
198
  authorizedRoleId = RoleIdLib.roleForTypeAndVersion(
191
199
  authorizedDomain,
192
- releaseVersion);
200
+ release);
193
201
  }
194
202
 
195
203
  if(!roleExists(authorizedRoleId)) {
196
204
  // create role for authorized domain
197
205
  _createRole(
198
206
  authorizedRoleId,
199
- toRole({
207
+ AccessAdminLib.toRole({
200
208
  adminRoleId: ADMIN_ROLE(),
201
209
  roleType: RoleType.Contract,
202
210
  maxMemberCount: 1,
203
211
  name: ObjectTypeLib.toVersionedName(
204
212
  ObjectTypeLib.toName(authorizedDomain),
205
213
  "Role",
206
- releaseVersion.toInt())}));
214
+ release)}));
207
215
  }
208
216
 
209
217
  // get authorized functions for authorized domain
@@ -228,7 +236,7 @@ contract ReleaseAdmin is
228
236
 
229
237
  _createRole(
230
238
  RELEASE_REGISTRY_ROLE(),
231
- toRole({
239
+ AccessAdminLib.toRole({
232
240
  adminRoleId: ADMIN_ROLE(),
233
241
  roleType: RoleType.Contract,
234
242
  maxMemberCount: 1,
@@ -236,8 +244,8 @@ contract ReleaseAdmin is
236
244
 
237
245
  FunctionInfo[] memory functions;
238
246
  functions = new FunctionInfo[](2);
239
- functions[0] = toFunction(ReleaseAdmin.authorizeService.selector, "authorizeService");
240
- functions[1] = toFunction(ReleaseAdmin.setServiceLocked.selector, "setServiceLocked");
247
+ functions[0] = AccessAdminLib.toFunction(ReleaseAdmin.authorizeService.selector, "authorizeService");
248
+ functions[1] = AccessAdminLib.toFunction(ReleaseAdmin.setServiceLocked.selector, "setServiceLocked");
241
249
  _authorizeTargetFunctions(address(this), RELEASE_REGISTRY_ROLE(), functions);
242
250
 
243
251
  _grantRoleToAccount(RELEASE_REGISTRY_ROLE(), releaseRegistry);
@@ -4,27 +4,25 @@ pragma solidity ^0.8.20;
4
4
  import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
5
5
  import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManaged.sol";
6
6
 
7
- import {ContractLib} from "../shared/ContractLib.sol";
8
- import {NftId} from "../type/NftId.sol";
9
- import {ObjectType, ObjectTypeLib, POOL, RELEASE, REGISTRY, SERVICE, STAKING} from "../type/ObjectType.sol";
10
- import {TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
11
- import {Seconds} from "../type/Seconds.sol";
12
- import {StateId, SCHEDULED, DEPLOYING, DEPLOYED, SKIPPED, ACTIVE, PAUSED} from "../type/StateId.sol";
13
- import {VersionPart, VersionPartLib} from "../type/Version.sol";
14
-
15
- import {IService} from "../shared/IService.sol";
16
-
17
7
  import {IAccessAdmin} from "../authorization/IAccessAdmin.sol";
18
8
  import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
19
-
20
9
  import {IRegistry} from "./IRegistry.sol";
21
10
  import {IRelease} from "./IRelease.sol";
22
11
  import {IRegistryLinked} from "../shared/IRegistryLinked.sol";
12
+ import {IService} from "../shared/IService.sol";
23
13
  import {IServiceAuthorization} from "../authorization/IServiceAuthorization.sol";
14
+
15
+ import {ContractLib} from "../shared/ContractLib.sol";
16
+ import {NftId} from "../type/NftId.sol";
17
+ import {ObjectType, ObjectTypeLib, POOL, RELEASE, REGISTRY, SERVICE, STAKING} from "../type/ObjectType.sol";
24
18
  import {RegistryAdmin} from "./RegistryAdmin.sol";
25
19
  import {Registry} from "./Registry.sol";
26
- import {ReleaseLifecycle} from "./ReleaseLifecycle.sol";
27
20
  import {ReleaseAdmin} from "./ReleaseAdmin.sol";
21
+ import {ReleaseLifecycle} from "./ReleaseLifecycle.sol";
22
+ import {Seconds} from "../type/Seconds.sol";
23
+ import {StateId, SCHEDULED, DEPLOYING, DEPLOYED, SKIPPED, ACTIVE, PAUSED} from "../type/StateId.sol";
24
+ import {TimestampLib, zeroTimestamp} from "../type/Timestamp.sol";
25
+ import {VersionPart, VersionPartLib} from "../type/Version.sol";
28
26
 
29
27
  /// @dev The ReleaseRegistry manages the lifecycle of major GIF releases and their services.
30
28
  /// The creation of a new GIF release is a multi-step process:
@@ -73,7 +71,7 @@ contract ReleaseRegistry is
73
71
  error ErrorReleaseRegistryServiceSelfRegistration(IService service);
74
72
  error ErrorReleaseRegistryServiceOwnerRegistered(IService service, address owner);
75
73
 
76
- RegistryAdmin public immutable _admin;
74
+ RegistryAdmin public immutable _registryAdmin;
77
75
  Registry public immutable _registry;
78
76
 
79
77
  mapping(VersionPart release => IRelease.ReleaseInfo info) internal _releaseInfo;
@@ -87,6 +85,7 @@ contract ReleaseRegistry is
87
85
  uint256 internal _registeredServices = 0;
88
86
  uint256 internal _servicesToRegister = 0;
89
87
 
88
+ // TODO move master relase admin outside constructor (same construction as for registry admin)
90
89
  constructor(Registry registry)
91
90
  AccessManaged(msg.sender)
92
91
  {
@@ -97,9 +96,9 @@ contract ReleaseRegistry is
97
96
  setAuthority(registry.getAuthority());
98
97
 
99
98
  _registry = registry;
100
- _admin = RegistryAdmin(_registry.getRegistryAdminAddress());
101
-
102
- _masterReleaseAdmin = new ReleaseAdmin();
99
+ _registryAdmin = RegistryAdmin(_registry.getRegistryAdminAddress());
100
+ _masterReleaseAdmin = new ReleaseAdmin(
101
+ _cloneNewAccessManager());
103
102
 
104
103
  _next = VersionPartLib.toVersionPart(INITIAL_GIF_VERSION - 1);
105
104
  }
@@ -253,16 +252,16 @@ contract ReleaseRegistry is
253
252
  revert ErrorReleaseRegistryRegistryServiceMissing(release);
254
253
  }
255
254
 
256
- _admin.grantServiceRoleForAllVersions(IService(service), REGISTRY());
255
+ _registryAdmin.grantServiceRoleForAllVersions(IService(service), REGISTRY());
257
256
 
258
257
  service = _registry.getServiceAddress(STAKING(), release);
259
258
  if(service != address(0)) {
260
- _admin.grantServiceRoleForAllVersions(IService(service), STAKING());
259
+ _registryAdmin.grantServiceRoleForAllVersions(IService(service), STAKING());
261
260
  }
262
261
 
263
262
  service = _registry.getServiceAddress(POOL(), release);
264
263
  if(service != address(0)) {
265
- _admin.grantServiceRoleForAllVersions(IService(service), POOL());
264
+ _registryAdmin.grantServiceRoleForAllVersions(IService(service), POOL());
266
265
  }
267
266
 
268
267
  _setReleaseLocked(release, false);
@@ -350,7 +349,7 @@ contract ReleaseRegistry is
350
349
  }
351
350
 
352
351
  function getRegistryAdmin() external view returns (address) {
353
- return address(_admin);
352
+ return address(_registryAdmin);
354
353
  }
355
354
 
356
355
  //--- IRegistryLinked ------------------------------------------------------//
@@ -368,24 +367,23 @@ contract ReleaseRegistry is
368
367
  _releaseInfo[release].releaseAdmin).setReleaseLocked(locked);
369
368
  }
370
369
 
371
-
372
370
  function _cloneNewReleaseAdmin(VersionPart release)
373
371
  private
374
372
  returns (ReleaseAdmin clonedAdmin)
375
373
  {
376
- AccessManagerCloneable clonedAccessManager = AccessManagerCloneable(
377
- Clones.clone(
378
- _masterReleaseAdmin.authority()
379
- )
380
- );
381
-
374
+ // clone and setup release specific release admin
382
375
  clonedAdmin = ReleaseAdmin(
383
- Clones.clone(
384
- address(_masterReleaseAdmin)
385
- )
386
- );
376
+ Clones.clone(address(_masterReleaseAdmin)));
377
+
378
+ string memory releaseAdminName = string(
379
+ abi.encodePacked(
380
+ "ReleaseAdmin_v",
381
+ release.toString()));
382
+
383
+ clonedAdmin.initialize(
384
+ address(_cloneNewAccessManager()),
385
+ releaseAdminName);
387
386
 
388
- clonedAdmin.initialize(clonedAccessManager);
389
387
  clonedAdmin.completeSetup(
390
388
  address(_registry),
391
389
  address(this), // release registry (this contract)
@@ -396,6 +394,14 @@ contract ReleaseRegistry is
396
394
  }
397
395
 
398
396
 
397
+ function _cloneNewAccessManager()
398
+ private
399
+ returns (address accessManager)
400
+ {
401
+ return Clones.clone(address(_registryAdmin.authority()));
402
+ }
403
+
404
+
399
405
  function _verifyServiceAuthorization(
400
406
  IServiceAuthorization serviceAuthorization,
401
407
  VersionPart releaseVersion,
@@ -407,7 +413,7 @@ contract ReleaseRegistry is
407
413
  {
408
414
  // authorization contract supports IServiceAuthorization interface
409
415
  if(!serviceAuthorization.supportsInterface(type(IServiceAuthorization).interfaceId)) {
410
- revert ErrorReleaseRegistryNotServiceAuth(address(serviceAuthorization));
416
+ revert ErrorReleaseRegistryNotServiceAuth(address(serviceAuthorization));
411
417
  }
412
418
 
413
419
  // authorizaions contract version matches with release version