@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
@@ -10,7 +10,7 @@ import {IInstance} from "./IInstance.sol";
10
10
  import {AccessAdmin} from "../authorization/AccessAdmin.sol";
11
11
  import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
12
12
  import {NftId} from "../type/NftId.sol";
13
- import {ObjectType} from "../type/ObjectType.sol";
13
+ import {ObjectType, INSTANCE, ORACLE} from "../type/ObjectType.sol";
14
14
  import {RoleId, RoleIdLib} from "../type/RoleId.sol";
15
15
  import {Str, StrLib} from "../type/String.sol";
16
16
  import {TokenHandler} from "../shared/TokenHandler.sol";
@@ -21,18 +21,19 @@ contract InstanceAdmin is
21
21
  AccessAdmin
22
22
  {
23
23
  string public constant INSTANCE_TARGET_NAME = "Instance";
24
- string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
25
24
  string public constant INSTANCE_ADMIN_TARGET_NAME = "InstanceAdmin";
25
+ string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
26
26
  string public constant BUNDLE_SET_TARGET_NAME = "BundleSet";
27
- string public constant RISK_SET_TAGET_NAME = "RiskSet";
27
+ string public constant RISK_SET_TARGET_NAME = "RiskSet";
28
28
 
29
29
  uint64 public constant CUSTOM_ROLE_ID_MIN = 10000; // MUST be even
30
30
 
31
- error ErrorInstanceAdminCallerNotInstanceOwner(address caller);
32
- error ErrorInstanceAdminInstanceAlreadyLocked();
33
- error ErrorInstanceAdminNotRegistered(address target);
31
+ error ErrorInstanceAdminNotInstanceService(address caller);
32
+
33
+ error ErrorInstanceAdminNotRegistered(address instance);
34
+ error ErrorInstanceAdminNotInstance(address instance);
35
+ error ErrorInstanceAdminAlreadyAuthorized(address instance);
34
36
 
35
- error ErrorInstanceAdminAlreadyAuthorized(address target);
36
37
  error ErrorInstanceAdminNotComponentRole(RoleId roleId);
37
38
  error ErrorInstanceAdminRoleAlreadyExists(RoleId roleId);
38
39
  error ErrorInstanceAdminRoleTypeNotContract(RoleId roleId, IAccess.RoleType roleType);
@@ -42,119 +43,134 @@ contract InstanceAdmin is
42
43
 
43
44
  IInstance internal _instance;
44
45
  IRegistry internal _registry;
46
+ VersionPart internal _release;
45
47
  uint64 internal _customIdNext;
46
48
 
47
49
  mapping(address target => RoleId roleId) internal _targetRoleId;
48
50
  uint64 internal _components;
49
51
 
50
- IAuthorization internal _instanceAuthorization;
51
-
52
-
53
- modifier onlyInstanceOwner() {
54
- if(msg.sender != _registry.ownerOf(address(_instance))) {
55
- revert ErrorInstanceAdminCallerNotInstanceOwner(msg.sender);
52
+ modifier onlyInstanceService() {
53
+ if (msg.sender != _registry.getServiceAddress(INSTANCE(), getRelease())) {
54
+ revert ErrorInstanceAdminNotInstanceService(msg.sender);
56
55
  }
57
56
  _;
58
57
  }
59
58
 
60
59
  /// @dev Only used for master instance admin.
61
- /// Contracts created via constructor come with disabled initializers.
62
- constructor(
63
- address instanceAuthorization
64
- ) {
65
- initialize(new AccessManagerCloneable());
66
-
67
- _instanceAuthorization = IAuthorization(instanceAuthorization);
68
-
69
- _disableInitializers();
60
+ constructor(address accessManager) {
61
+ initialize(
62
+ accessManager,
63
+ "MasterInstanceAdmin");
70
64
  }
71
65
 
72
66
 
73
- function initialize(
74
- AccessManagerCloneable clonedAccessManager,
75
- IRegistry registry,
76
- VersionPart release
77
- )
78
- external
79
- initializer()
80
- {
81
- __AccessAdmin_init(clonedAccessManager);
82
-
83
- clonedAccessManager.completeSetup(
84
- address(registry),
85
- release);
86
-
87
- _registry = registry;
88
- }
89
-
90
67
  /// @dev Completes the initialization of this instance admin using the provided instance, registry and version.
91
68
  /// Important: Initialization of instance admin is only complete after calling this function.
92
69
  /// Important: The instance MUST be registered and all instance supporting contracts must be wired to this instance.
93
70
  function completeSetup(
71
+ address registry,
94
72
  address instance,
95
- address authorization
73
+ address authorization,
74
+ VersionPart release
96
75
  )
97
76
  external
98
- reinitializer(uint64(getRelease().toInt()))
77
+ reinitializer(uint64(release.toInt()))
99
78
  onlyDeployer()
100
79
  {
80
+ // checks
81
+ _checkRegistry(registry);
82
+ _checkIsRegistered(registry, instance, INSTANCE());
83
+
84
+ AccessManagerCloneable(
85
+ authority()).completeSetup(
86
+ registry,
87
+ release);
88
+
89
+ _checkAuthorization(authorization, INSTANCE(), release, true);
90
+
91
+ // effects
92
+ _registry = IRegistry(registry);
93
+ _release = release;
94
+
95
+ _instance = IInstance(instance);
96
+ _authorization = IAuthorization(authorization);
101
97
  _components = 0;
102
98
  _customIdNext = CUSTOM_ROLE_ID_MIN;
103
- _instance = IInstance(instance);
104
- _instanceAuthorization = IAuthorization(authorization);
105
-
106
- _checkTargetIsReadyForAuthorization(instance);
107
99
 
108
- // check matching releases
109
- if (_instanceAuthorization.getRelease() != getRelease()) {
110
- revert ErrorInstanceAdminReleaseMismatch();
111
- }
100
+ // link nft ownability to instance
101
+ _linkToNftOwnable(instance);
112
102
 
113
103
  // create instance role and target
114
104
  _setupInstance(instance);
115
105
 
116
106
  // add instance authorization
117
- _createRoles(_instanceAuthorization);
118
-
107
+ _createRoles(_authorization);
108
+ // _createTargets(_authorization);
119
109
  _setupInstanceHelperTargetsWithRoles();
120
- _createTargetAuthorizations(_instanceAuthorization);
110
+ _createTargetAuthorizations(_authorization);
111
+ }
112
+
113
+
114
+ function _createTargets(IAuthorization authorization)
115
+ internal
116
+ {
117
+ _createTargetWithRole(address(this), INSTANCE_ADMIN_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(INSTANCE_ADMIN_TARGET_NAME)));
118
+ _createTargetWithRole(address(_instance.getInstanceStore()), INSTANCE_STORE_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(INSTANCE_STORE_TARGET_NAME)));
119
+ _createTargetWithRole(address(_instance.getBundleSet()), BUNDLE_SET_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(BUNDLE_SET_TARGET_NAME)));
120
+ _createTargetWithRole(address(_instance.getRiskSet()), RISK_SET_TARGET_NAME, authorization.getTargetRole(StrLib.toStr(RISK_SET_TARGET_NAME)));
121
121
  }
122
122
 
123
123
 
124
124
  /// @dev Initializes the authorization for the specified component.
125
125
  /// Important: The component MUST be registered.
126
126
  function initializeComponentAuthorization(
127
- IInstanceLinkedComponent component
127
+ address componentAddress,
128
+ ObjectType expectedType
128
129
  )
129
130
  external
130
131
  restricted()
131
132
  {
132
133
  // checks
133
- _checkTargetIsReadyForAuthorization(address(component));
134
-
135
- // setup target and role for component (including token handler)
136
- _setupComponentAndTokenHandler(component);
134
+ _checkIsRegistered(address(getRegistry()), componentAddress, expectedType);
137
135
 
138
- // create other roles
136
+ IInstanceLinkedComponent component = IInstanceLinkedComponent(componentAddress);
139
137
  IAuthorization authorization = component.getAuthorization();
140
- _createRoles(authorization);
138
+ _checkAuthorization(address(authorization), expectedType, getRelease(), false);
139
+
140
+ // effects
141
+ // setup target and role for component (including token handler if applicable)
142
+ _setupComponentAndTokenHandler(component, expectedType);
143
+
144
+ // create other roles and function authorizations
145
+ _createRoles(authorization);
141
146
  _createTargetAuthorizations(authorization);
142
147
  }
143
148
 
149
+ function getRelease()
150
+ public
151
+ view
152
+ override
153
+ returns (VersionPart release)
154
+ {
155
+ return _release;
156
+ }
157
+
158
+
144
159
  // create instance role and target
145
160
  function _setupInstance(address instance) internal {
161
+
146
162
  // create instance role
147
- RoleId instanceRoleId = _instanceAuthorization.getTargetRole(
148
- _instanceAuthorization.getMainTarget());
163
+ RoleId instanceRoleId = _authorization.getTargetRole(
164
+ _authorization.getMainTarget());
149
165
 
150
166
  _createRole(
151
167
  instanceRoleId,
152
- _instanceAuthorization.getRoleInfo(instanceRoleId));
168
+ _authorization.getRoleInfo(instanceRoleId));
153
169
 
154
170
  // create instance target
155
171
  _createTarget(
156
172
  instance,
157
- _instanceAuthorization.getMainTargetName(),
173
+ _authorization.getMainTargetName(),
158
174
  true, // checkAuthority
159
175
  false); // custom
160
176
 
@@ -186,21 +202,28 @@ contract InstanceAdmin is
186
202
 
187
203
  function setInstanceLocked(bool locked)
188
204
  external
189
- onlyInstanceOwner()
205
+ // not restricted(): need to operate on locked instances to unlock instance
206
+ onlyInstanceService()
190
207
  {
191
208
  AccessManagerCloneable accessManager = AccessManagerCloneable(authority());
192
-
193
- if(accessManager.isLocked() == locked) {
194
- revert ErrorInstanceAdminInstanceAlreadyLocked();
195
- }
196
209
  accessManager.setLocked(locked);
197
210
  }
198
211
 
212
+
199
213
  function setTargetLocked(address target, bool locked)
214
+ external
215
+ // not restricted(): might need to operate on targets while instance is locked
216
+ onlyInstanceService()
217
+ {
218
+ _setTargetLocked(target, locked);
219
+ }
220
+
221
+
222
+ function setComponentLocked(address target, bool locked)
200
223
  external
201
224
  restricted()
202
225
  {
203
- _setTargetClosed(target, locked);
226
+ _setTargetLocked(target, locked);
204
227
  }
205
228
 
206
229
  /// @dev Returns the number of components that have been registered with this instance.
@@ -218,12 +241,15 @@ contract InstanceAdmin is
218
241
  view
219
242
  returns (IAuthorization instanceAuthorizaion)
220
243
  {
221
- return _instanceAuthorization;
244
+ return _authorization;
222
245
  }
223
246
 
224
247
  // ------------------- Internal functions ------------------- //
225
248
 
226
- function _setupComponentAndTokenHandler(IInstanceLinkedComponent component)
249
+ function _setupComponentAndTokenHandler(
250
+ IInstanceLinkedComponent component,
251
+ ObjectType componentType
252
+ )
227
253
  internal
228
254
  {
229
255
 
@@ -240,25 +266,27 @@ contract InstanceAdmin is
240
266
  true, // checkAuthority
241
267
  false); // custom
242
268
 
243
- // create component's token handler target
244
- NftId componentNftId = _registry.getNftIdForAddress(address(component));
245
- address tokenHandler = address(
246
- _instance.getInstanceReader().getComponentInfo(
247
- componentNftId).tokenHandler);
248
-
249
- _createTarget(
250
- tokenHandler,
251
- authorization.getTokenHandlerName(),
252
- true,
253
- false);
269
+ // create component's token handler target if app
270
+ if (componentType != ORACLE()) {
271
+ NftId componentNftId = _registry.getNftIdForAddress(address(component));
272
+ address tokenHandler = address(
273
+ _instance.getInstanceReader().getComponentInfo(
274
+ componentNftId).tokenHandler);
275
+
276
+ _createTarget(
277
+ tokenHandler,
278
+ authorization.getTokenHandlerName(),
279
+ true,
280
+ false);
281
+
282
+ // token handler does not require its own role
283
+ // token handler is not calling other components
284
+ }
254
285
 
255
286
  // assign component role to component
256
287
  _grantRoleToAccount(
257
288
  componentRoleId,
258
289
  address(component));
259
-
260
- // token handler does not require its own role
261
- // token handler is not calling other components
262
290
  }
263
291
 
264
292
 
@@ -312,20 +340,6 @@ contract InstanceAdmin is
312
340
  }
313
341
 
314
342
 
315
- function _checkTargetIsReadyForAuthorization(address target)
316
- internal
317
- view
318
- {
319
- if (!_registry.isRegistered(target)) {
320
- revert ErrorInstanceAdminNotRegistered(target);
321
- }
322
-
323
- if (targetExists(target)) {
324
- revert ErrorInstanceAdminAlreadyAuthorized(target);
325
- }
326
- }
327
-
328
-
329
343
  function _createRoles(IAuthorization authorization)
330
344
  internal
331
345
  {
@@ -392,7 +406,7 @@ contract InstanceAdmin is
392
406
  {
393
407
  // check that target name is defined in authorization specification
394
408
  Str name = StrLib.toStr(targetName);
395
- if (!_instanceAuthorization.targetExists(name)) {
409
+ if (!_authorization.targetExists(name)) {
396
410
  revert ErrorInstanceAdminExpectedTargetMissing(targetName);
397
411
  }
398
412
 
@@ -404,7 +418,7 @@ contract InstanceAdmin is
404
418
  false);
405
419
 
406
420
  // assign target role if defined
407
- RoleId targetRoleId = _instanceAuthorization.getTargetRole(name);
421
+ RoleId targetRoleId = _authorization.getTargetRole(name);
408
422
  if (targetRoleId != RoleIdLib.zero()) {
409
423
  _grantRoleToAccount(targetRoleId, target);
410
424
  }
@@ -413,17 +427,16 @@ contract InstanceAdmin is
413
427
  function _setupInstanceHelperTargetsWithRoles()
414
428
  internal
415
429
  {
416
- // _checkAndCreateTargetWithRole(address(_instance), INSTANCE_TARGET_NAME);
417
430
 
418
431
  // create module targets
419
432
  _checkAndCreateTargetWithRole(address(_instance.getInstanceStore()), INSTANCE_STORE_TARGET_NAME);
420
433
  _checkAndCreateTargetWithRole(address(_instance.getInstanceAdmin()), INSTANCE_ADMIN_TARGET_NAME);
421
434
  _checkAndCreateTargetWithRole(address(_instance.getBundleSet()), BUNDLE_SET_TARGET_NAME);
422
- _checkAndCreateTargetWithRole(address(_instance.getRiskSet()), RISK_SET_TAGET_NAME);
435
+ _checkAndCreateTargetWithRole(address(_instance.getRiskSet()), RISK_SET_TARGET_NAME);
423
436
 
424
- // create targets for services that need to access the module targets
425
- ObjectType[] memory serviceDomains = _instanceAuthorization.getServiceDomains();
426
- VersionPart release = _instanceAuthorization.getRelease();
437
+ // create targets for services that need to access the instance targets
438
+ ObjectType[] memory serviceDomains = _authorization.getServiceDomains();
439
+ VersionPart release = _authorization.getRelease();
427
440
  ObjectType serviceDomain;
428
441
 
429
442
  for (uint256 i = 0; i < serviceDomains.length; i++) {
@@ -431,7 +444,7 @@ contract InstanceAdmin is
431
444
 
432
445
  _checkAndCreateTargetWithRole(
433
446
  _registry.getServiceAddress(serviceDomain, release),
434
- _instanceAuthorization.getServiceTarget(serviceDomain).toString());
447
+ _authorization.getServiceTarget(serviceDomain).toString());
435
448
  }
436
449
  }
437
450
  }
@@ -1,17 +1,16 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {
5
- ACCOUNTING, ORACLE, POOL, INSTANCE, COMPONENT, DISTRIBUTION, APPLICATION, POLICY, CLAIM, BUNDLE, RISK
6
- } from "../../contracts/type/ObjectType.sol";
4
+ import {IAccess} from "../authorization/IAccess.sol";
7
5
 
6
+ import {Authorization} from "../authorization/Authorization.sol";
7
+ import {ACCOUNTING, ORACLE, POOL, INSTANCE, COMPONENT, DISTRIBUTION, APPLICATION, POLICY, CLAIM, BUNDLE, RISK} from "../../contracts/type/ObjectType.sol";
8
8
  import {BundleSet} from "../instance/BundleSet.sol";
9
- import {RiskSet} from "../instance/RiskSet.sol";
10
- import {IAccess} from "../authorization/IAccess.sol";
11
9
  import {Instance} from "../instance/Instance.sol";
12
10
  import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
13
11
  import {InstanceStore} from "../instance/InstanceStore.sol";
14
- import {Authorization} from "../authorization/Authorization.sol";
12
+ import {PUBLIC_ROLE} from "../type/RoleId.sol";
13
+ import {RiskSet} from "../instance/RiskSet.sol";
15
14
 
16
15
 
17
16
  contract InstanceAuthorizationV3
@@ -27,19 +26,10 @@ contract InstanceAuthorizationV3
27
26
  string public constant RISK_SET_TARGET_NAME = "RiskSet";
28
27
 
29
28
  constructor()
30
- Authorization(INSTANCE_TARGET_NAME, INSTANCE())
29
+ Authorization(INSTANCE_TARGET_NAME, INSTANCE(), false, false)
31
30
  { }
32
31
 
33
- function _setupTargets()
34
- internal
35
- override
36
- {
37
- // instance supporting targets
38
- _addTarget(INSTANCE_STORE_TARGET_NAME);
39
- _addTarget(INSTANCE_ADMIN_TARGET_NAME);
40
- _addTarget(BUNDLE_SET_TARGET_NAME);
41
- _addTarget(RISK_SET_TARGET_NAME);
42
-
32
+ function _setupServiceTargets() internal virtual override {
43
33
  // service targets relevant to instance
44
34
  _addServiceTargetWithRole(INSTANCE());
45
35
  _addServiceTargetWithRole(ACCOUNTING());
@@ -54,6 +44,19 @@ contract InstanceAuthorizationV3
54
44
  _addServiceTargetWithRole(CLAIM());
55
45
  }
56
46
 
47
+ function _setupTargets()
48
+ internal
49
+ override
50
+ {
51
+ // instance supporting targets
52
+ // _addGifContractTarget(INSTANCE_ADMIN_TARGET_NAME);
53
+ _addTarget(INSTANCE_ADMIN_TARGET_NAME);
54
+ _addTarget(INSTANCE_STORE_TARGET_NAME);
55
+ _addTarget(BUNDLE_SET_TARGET_NAME);
56
+ _addTarget(RISK_SET_TARGET_NAME);
57
+
58
+ }
59
+
57
60
 
58
61
  function _setupTargetAuthorizations()
59
62
  internal
@@ -107,6 +110,24 @@ contract InstanceAuthorizationV3
107
110
  {
108
111
  IAccess.FunctionInfo[] storage functions;
109
112
 
113
+ // authorize instance service role
114
+ functions = _authorizeForTarget(INSTANCE_TARGET_NAME, PUBLIC_ROLE());
115
+ _authorize(functions, Instance.registerProduct.selector, "registerProduct");
116
+ _authorize(functions, Instance.upgradeInstanceReader.selector, "upgradeInstanceReader");
117
+
118
+ // staking
119
+ _authorize(functions, Instance.setStakingLockingPeriod.selector, "setStakingLockingPeriod");
120
+ _authorize(functions, Instance.setStakingRewardRate.selector, "setStakingRewardRate");
121
+ _authorize(functions, Instance.refillStakingRewardReserves.selector, "refillStakingRewardReserves");
122
+ _authorize(functions, Instance.withdrawStakingRewardReserves.selector, "withdrawStakingRewardReserves");
123
+
124
+ // custom authz
125
+ _authorize(functions, Instance.createRole.selector, "createRole");
126
+ _authorize(functions, Instance.grantRole.selector, "grantRole");
127
+ _authorize(functions, Instance.revokeRole.selector, "revokeRole");
128
+ _authorize(functions, Instance.createTarget.selector, "createTarget");
129
+ _authorize(functions, Instance.setTargetFunctionRole.selector, "setTargetFunctionRole");
130
+
110
131
  // authorize instance service role
111
132
  functions = _authorizeForTarget(INSTANCE_TARGET_NAME, getServiceRole(INSTANCE()));
112
133
  _authorize(functions, Instance.setInstanceReader.selector, "setInstanceReader");
@@ -118,14 +139,15 @@ contract InstanceAuthorizationV3
118
139
  {
119
140
  IAccess.FunctionInfo[] storage functions;
120
141
 
121
- // authorize instance role
122
- functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, getComponentRole(INSTANCE()));
123
- _authorize(functions, InstanceAdmin.grantRole.selector, "grantRole");
142
+ // authorize component service role
143
+ functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, getServiceRole(INSTANCE()));
144
+ _authorize(functions, InstanceAdmin.setInstanceLocked.selector, "setInstanceLocked");
145
+ _authorize(functions, InstanceAdmin.setTargetLocked.selector, "setTargetLocked");
124
146
 
125
147
  // authorize component service role
126
148
  functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, getServiceRole(COMPONENT()));
127
149
  _authorize(functions, InstanceAdmin.initializeComponentAuthorization.selector, "initializeComponentAuthoriz");
128
- _authorize(functions, InstanceAdmin.setTargetLocked.selector, "setTargetLocked");
150
+ _authorize(functions, InstanceAdmin.setComponentLocked.selector, "setComponentLocked");
129
151
  }
130
152
 
131
153
 
@@ -6,6 +6,7 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
6
6
  import {IBundle} from "../instance/module/IBundle.sol";
7
7
  import {IComponents} from "../instance/module/IComponents.sol";
8
8
  import {IDistribution} from "../instance/module/IDistribution.sol";
9
+ import {IDistributionService} from "../distribution/IDistributionService.sol";
9
10
  import {IInstance} from "./IInstance.sol";
10
11
  import {IKeyValueStore} from "../shared/IKeyValueStore.sol";
11
12
  import {IOracle} from "../oracle/IOracle.sol";
@@ -47,6 +48,7 @@ contract InstanceReader {
47
48
  InstanceStore internal _store;
48
49
  BundleSet internal _bundleSet;
49
50
  RiskSet internal _riskSet;
51
+ IDistributionService internal _distributionService;
50
52
 
51
53
  /// @dev This initializer needs to be called from the instance itself.
52
54
  function initialize() public {
@@ -71,6 +73,7 @@ contract InstanceReader {
71
73
  _store = _instance.getInstanceStore();
72
74
  _bundleSet = _instance.getBundleSet();
73
75
  _riskSet = _instance.getRiskSet();
76
+ _distributionService = IDistributionService(_registry.getServiceAddress(DISTRIBUTION(), _instance.getRelease()));
74
77
  }
75
78
 
76
79
 
@@ -485,6 +488,16 @@ contract InstanceReader {
485
488
  }
486
489
  }
487
490
 
491
+ function isReferralValid(NftId distributionNftId, ReferralId referralId)
492
+ external
493
+ view
494
+ returns (bool isValid)
495
+ {
496
+ return _distributionService.referralIsValid(
497
+ distributionNftId,
498
+ referralId);
499
+ }
500
+
488
501
  function getRequestInfo(RequestId requestId)
489
502
  public
490
503
  view