@etherisc/gif-next 0.0.2-8bdd2eb-413 → 0.0.2-8d9d4d6-542

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
  2. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +1502 -0
  3. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +4 -0
  4. package/artifacts/contracts/authorization/IAccess.sol/IAccess.json +10 -0
  5. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
  6. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +1168 -0
  7. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +4 -0
  8. package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +110 -0
  9. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
  10. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +129 -0
  11. package/artifacts/contracts/authorization/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
  12. package/artifacts/contracts/authorization/InstanceAdmin.sol/InstanceAdmin.json +1639 -0
  13. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +4 -0
  14. package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +134 -0
  15. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
  16. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +171 -0
  17. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  18. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  19. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +108 -79
  20. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  21. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +48 -40
  22. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  24. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +13 -0
  25. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
  26. package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +32 -101
  27. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  28. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +58 -65
  29. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  30. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +120 -1
  31. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  32. package/artifacts/contracts/instance/Instance.sol/Instance.json +72 -79
  33. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  34. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +22 -22
  35. package/artifacts/contracts/instance/InstanceAdminNew.sol/InstanceAdminNew.dbg.json +4 -0
  36. package/artifacts/contracts/instance/InstanceAdminNew.sol/InstanceAdminNew.json +1676 -0
  37. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +4 -0
  38. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +289 -0
  39. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +1 -1
  40. package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +70 -46
  41. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  42. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +192 -56
  43. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  44. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +201 -34
  45. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  46. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +41 -17
  47. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  48. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +248 -108
  49. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  50. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  51. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  52. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.json +0 -53
  53. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
  54. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
  55. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +1 -1
  56. package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +2 -71
  57. package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
  58. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  59. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  60. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  61. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  62. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  63. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  64. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
  65. package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +10 -0
  66. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
  67. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +759 -0
  68. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
  69. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +675 -0
  70. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
  71. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +1146 -0
  72. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
  73. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +1034 -0
  74. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
  75. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +730 -0
  76. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  77. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +78 -49
  78. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  79. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +33 -25
  80. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  81. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +13 -0
  82. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  83. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  84. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +13 -0
  85. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  86. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  87. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +62 -41
  88. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  89. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +25 -21
  90. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  91. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +66 -37
  92. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  93. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +27 -19
  94. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  95. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +106 -69
  96. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  97. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +47 -35
  98. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  99. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +13 -0
  100. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  101. package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +13 -0
  102. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  103. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +13 -0
  104. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  105. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +13 -0
  106. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  107. package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
  108. package/artifacts/contracts/product/IProductService.sol/IProductService.json +13 -0
  109. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  110. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +84 -47
  111. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  112. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +36 -24
  113. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  114. package/artifacts/contracts/product/PricingService.sol/PricingService.json +92 -63
  115. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  116. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +40 -32
  117. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  118. package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
  119. package/artifacts/contracts/product/ProductService.sol/ProductService.json +54 -25
  120. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
  121. package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +21 -13
  122. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  123. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  124. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  125. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +13 -0
  126. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  127. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  128. package/artifacts/contracts/registry/Registry.sol/Registry.json +19 -19
  129. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  130. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1678 -153
  131. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  132. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +51 -14
  133. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  134. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +20 -8
  135. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
  136. package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +99 -154
  137. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
  138. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +195 -0
  139. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  140. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  141. package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +1 -1
  142. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +1 -1
  143. package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +42 -10
  144. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +1 -1
  145. package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +42 -10
  146. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +1 -1
  147. package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +52 -20
  148. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +1 -1
  149. package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +52 -20
  150. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  151. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  152. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +107 -71
  153. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  154. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +44 -36
  155. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  156. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +13 -0
  157. package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
  158. package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +1 -1
  159. package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +1 -1
  160. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  161. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  162. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +20 -0
  163. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  164. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  165. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  166. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  167. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  168. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  169. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  170. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  171. package/artifacts/contracts/shared/IService.sol/IService.json +13 -0
  172. package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
  173. package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
  174. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  175. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  176. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +8 -8
  177. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  178. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +6 -6
  179. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +1 -1
  180. package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +2 -2
  181. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  182. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  183. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  184. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  185. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  186. package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
  187. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  188. package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
  189. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  190. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  191. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  192. package/artifacts/contracts/shared/Service.sol/Service.json +13 -0
  193. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  194. package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  195. package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
  196. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  197. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  198. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +49 -7
  199. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
  200. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +44 -28
  201. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  202. package/artifacts/contracts/staking/Staking.sol/Staking.json +44 -84
  203. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  204. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +23 -39
  205. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  206. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -6
  207. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  208. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +92 -73
  209. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  210. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +33 -41
  211. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  212. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +186 -114
  213. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  214. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +18 -18
  215. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  216. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  217. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  218. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  219. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  220. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  221. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  222. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  223. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  224. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  225. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  226. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  227. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  228. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  229. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  230. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +125 -2
  231. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  232. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  233. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  234. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +4 -4
  235. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
  236. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
  237. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  238. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  239. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  240. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +114 -4
  241. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  242. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +4 -0
  243. package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
  244. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
  245. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
  246. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  247. package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
  248. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +4 -0
  249. package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
  250. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  251. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +17 -4
  252. package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
  253. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  255. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  256. package/contracts/authorization/AccessAdmin.sol +749 -0
  257. package/contracts/authorization/IAccess.sol +43 -0
  258. package/contracts/authorization/IAccessAdmin.sol +130 -0
  259. package/contracts/authorization/IModuleAuthorization.sol +27 -0
  260. package/contracts/authorization/IServiceAuthorization.sol +35 -0
  261. package/contracts/authorization/InstanceAdmin.sol +108 -0
  262. package/contracts/authorization/ModuleAuthorization.sol +116 -0
  263. package/contracts/authorization/ServiceAuthorization.sol +86 -0
  264. package/contracts/distribution/DistributionService.sol +3 -4
  265. package/contracts/instance/IInstance.sol +14 -6
  266. package/contracts/instance/IInstanceService.sol +24 -8
  267. package/contracts/instance/Instance.sol +63 -39
  268. package/contracts/instance/InstanceAdminNew.sol +74 -0
  269. package/contracts/instance/InstanceAuthorizationV3.sol +176 -0
  270. package/contracts/instance/InstanceAuthorizationsLib.sol +31 -3
  271. package/contracts/instance/InstanceReader.sol +29 -2
  272. package/contracts/instance/InstanceService.sol +85 -8
  273. package/contracts/instance/InstanceStore.sol +29 -20
  274. package/contracts/instance/base/BalanceStore.sol +11 -6
  275. package/contracts/instance/base/Cloneable.sol +2 -25
  276. package/contracts/instance/base/ObjectCounter.sol +21 -0
  277. package/contracts/instance/base/ObjectManager.sol +1 -3
  278. package/contracts/oracle/IOracle.sol +20 -0
  279. package/contracts/oracle/IOracleComponent.sol +32 -0
  280. package/contracts/oracle/IOracleService.sol +65 -0
  281. package/contracts/oracle/Oracle.sol +145 -0
  282. package/contracts/oracle/OracleService.sol +278 -0
  283. package/contracts/oracle/OracleServiceManager.sol +42 -0
  284. package/contracts/pool/BundleService.sol +19 -19
  285. package/contracts/pool/PoolService.sol +6 -7
  286. package/contracts/product/ApplicationService.sol +5 -5
  287. package/contracts/product/ClaimService.sol +5 -5
  288. package/contracts/product/IClaimService.sol +6 -0
  289. package/contracts/product/PolicyService.sol +5 -5
  290. package/contracts/product/PricingService.sol +5 -6
  291. package/contracts/product/ProductService.sol +5 -5
  292. package/contracts/registry/IRegistry.sol +1 -1
  293. package/contracts/registry/Registry.sol +7 -1
  294. package/contracts/registry/RegistryAdmin.sol +236 -148
  295. package/contracts/registry/RegistryService.sol +5 -5
  296. package/contracts/registry/RegistryServiceManager.sol +0 -5
  297. package/contracts/registry/ReleaseManager.sol +102 -172
  298. package/contracts/registry/ServiceAuthorizationV3.sol +200 -0
  299. package/contracts/shared/AccessManagerCustom.sol +6 -1
  300. package/contracts/shared/AccessManagerExtended.sol +12 -1
  301. package/contracts/shared/Component.sol +3 -0
  302. package/contracts/shared/ComponentService.sol +30 -9
  303. package/contracts/shared/ComponentVerifyingService.sol +13 -7
  304. package/contracts/shared/IComponentService.sol +11 -0
  305. package/contracts/shared/IService.sol +7 -0
  306. package/contracts/shared/Lifecycle.sol +11 -2
  307. package/contracts/shared/Service.sol +27 -21
  308. package/contracts/staking/IStakingService.sol +11 -7
  309. package/contracts/staking/StakeManagerLib.sol +52 -0
  310. package/contracts/staking/Staking.sol +58 -96
  311. package/contracts/staking/StakingService.sol +61 -56
  312. package/contracts/staking/StakingServiceManager.sol +0 -1
  313. package/contracts/staking/StakingStore.sol +79 -38
  314. package/contracts/type/ObjectType.sol +162 -67
  315. package/contracts/type/RequestId.sol +75 -0
  316. package/contracts/type/RoleId.sol +77 -19
  317. package/contracts/type/Selector.sol +102 -0
  318. package/contracts/type/StateId.sol +12 -0
  319. package/contracts/type/String.sol +53 -0
  320. package/contracts/type/Timestamp.sol +6 -2
  321. package/package.json +3 -3
  322. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +0 -4
  323. package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +0 -137
  324. package/contracts/registry/ServiceAuthorizationsLib.sol +0 -173
@@ -1,19 +1,24 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {Amount} from "../type/Amount.sol";
5
+ import {BundleManager} from "./BundleManager.sol";
6
+ import {Instance} from "./Instance.sol";
7
+ import {IService} from "../shared/IService.sol";
4
8
  import {NftId} from "../type/NftId.sol";
5
9
  import {ObjectType} from "../type/ObjectType.sol";
6
10
  import {RoleId} from "../type/RoleId.sol";
7
- import {IService} from "../shared/IService.sol";
8
-
9
- import {InstanceAdmin} from "./InstanceAdmin.sol";
10
- import {Instance} from "./Instance.sol";
11
- import {InstanceReader} from "./InstanceReader.sol";
12
- import {BundleManager} from "./BundleManager.sol";
13
- import {InstanceStore} from "./InstanceStore.sol";
11
+ import {Seconds} from "../type/Seconds.sol";
12
+ import {UFixed} from "../type/UFixed.sol";
13
+ import {VersionPart} from "../type/Version.sol";
14
14
 
15
15
  interface IInstanceService is IService {
16
16
 
17
+ // onlyInstance
18
+ error ErrorInstanceServiceNotRegistered(address instance);
19
+ error ErrorInstanceServiceNotInstance(address instance, ObjectType objectType);
20
+ error ErrorInstanceServiceInstanceVersionMismatch(address instance, VersionPart instanceVersion);
21
+
17
22
  error ErrorInstanceServiceComponentNotInstanceLinked(address component);
18
23
 
19
24
  error ErrorInstanceServiceMasterInstanceAlreadySet();
@@ -39,7 +44,7 @@ interface IInstanceService is IService {
39
44
  error ErrorInstanceServiceInstanceStoreAuthorityMismatch();
40
45
 
41
46
  error ErrorInstanceServiceRequestUnauhorized(address caller);
42
- error ErrorInstanceServiceNotInstance(NftId nftId);
47
+ error ErrorInstanceServiceNotInstanceNftId(NftId nftId);
43
48
  error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
44
49
  error ErrorInstanceServiceInstanceComponentMismatch(NftId instanceNftId, NftId componentNftId);
45
50
  error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
@@ -57,10 +62,21 @@ interface IInstanceService is IService {
57
62
  function createInstanceClone()
58
63
  external
59
64
  returns (
65
+ // TODO check if Instance can be changed to IInstance
60
66
  Instance clonedInstance,
61
67
  NftId instanceNftId
62
68
  );
63
69
 
70
+
71
+ function setStakingLockingPeriod(Seconds stakeLockingPeriod) external;
72
+ function setStakingRewardRate(UFixed rewardRate) external;
73
+ function refillStakingRewardReserves(address rewardProvider, Amount dipAmount) external;
74
+
75
+ /// @dev defunds the staking reward reserves for the specified target
76
+ /// permissioned: only the target owner may call this function
77
+ function withdrawStakingRewardReserves(Amount dipAmount) external returns (Amount newBalance);
78
+
79
+
64
80
  function createComponentTarget(
65
81
  NftId instanceNftId,
66
82
  address targetAddress,
@@ -3,16 +3,19 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
5
 
6
+ import {Amount} from "../type/Amount.sol";
6
7
  import {Key32} from "../type/Key32.sol";
7
8
  import {NftId} from "../type/NftId.sol";
8
9
  import {RiskId} from "../type/RiskId.sol";
9
10
  import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../type/ObjectType.sol";
10
11
  import {RoleId, RoleIdLib, eqRoleId, ADMIN_ROLE, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../type/RoleId.sol";
11
- import {VersionPart, VersionPartLib} from "../type/Version.sol";
12
12
  import {ClaimId} from "../type/ClaimId.sol";
13
13
  import {ReferralId} from "../type/Referral.sol";
14
14
  import {PayoutId} from "../type/PayoutId.sol";
15
15
  import {DistributorType} from "../type/DistributorType.sol";
16
+ import {Seconds} from "../type/Seconds.sol";
17
+ import {UFixed} from "../type/UFixed.sol";
18
+ import {VersionPart, VersionPartLib} from "../type/Version.sol";
16
19
 
17
20
  import {Registerable} from "../shared/Registerable.sol";
18
21
  import {TokenHandler} from "../shared/TokenHandler.sol";
@@ -21,6 +24,7 @@ import {AccessManagerExtendedInitializeable} from "../shared/AccessManagerExtend
21
24
  import {IRegistry} from "../registry/IRegistry.sol";
22
25
 
23
26
  import {IInstance} from "./IInstance.sol";
27
+ import {IInstanceService} from "./IInstanceService.sol";
24
28
  import {InstanceReader} from "./InstanceReader.sol";
25
29
  import {InstanceAdmin} from "./InstanceAdmin.sol";
26
30
  import {BundleManager} from "./BundleManager.sol";
@@ -49,6 +53,7 @@ contract Instance is
49
53
 
50
54
  bool private _initialized;
51
55
 
56
+ IInstanceService internal _instanceService;
52
57
  InstanceAdmin internal _instanceAdmin;
53
58
  InstanceReader internal _instanceReader;
54
59
  BundleManager internal _bundleManager;
@@ -74,14 +79,52 @@ contract Instance is
74
79
  IRegistry registry = IRegistry(registryAddress);
75
80
  initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
76
81
 
82
+ _instanceService = IInstanceService(
83
+ getRegistry().getServiceAddress(
84
+ INSTANCE(),
85
+ getMajorVersion()));
86
+
77
87
  registerInterface(type(IInstance).interfaceId);
78
88
  }
79
89
 
90
+ //--- Staking ----------------------------------------------------------//
91
+
92
+ function setStakingLockingPeriod(Seconds stakeLockingPeriod)
93
+ external
94
+ // TODO decide if onlyOwner or restricted to instance owner role is better
95
+ onlyOwner()
96
+ {
97
+ _instanceService.setStakingLockingPeriod(stakeLockingPeriod);
98
+ }
99
+
100
+ function setStakingRewardRate(UFixed rewardRate)
101
+ external
102
+ onlyOwner()
103
+ {
104
+ _instanceService.setStakingRewardRate(rewardRate);
105
+ }
106
+
107
+ function refillStakingRewardReserves(Amount dipAmount)
108
+ external
109
+ onlyOwner()
110
+ {
111
+ address instanceOwner = msg.sender;
112
+ _instanceService.refillStakingRewardReserves(instanceOwner, dipAmount);
113
+ }
114
+
115
+ function withdrawStakingRewardReserves(Amount dipAmount)
116
+ external
117
+ onlyOwner()
118
+ returns (Amount newBalance)
119
+ {
120
+ return _instanceService.withdrawStakingRewardReserves(dipAmount);
121
+ }
122
+
80
123
  //--- Roles ------------------------------------------------------------//
81
124
 
82
125
  function createRole(string memory roleName, string memory adminName)
83
126
  external
84
- restricted // INSTANCE_OWNER_ROLE
127
+ onlyOwner()
85
128
  returns (RoleId roleId, RoleId admin)
86
129
  {
87
130
  (roleId, admin) = _instanceAdmin.createRole(roleName, adminName);
@@ -89,14 +132,14 @@ contract Instance is
89
132
 
90
133
  function grantRole(RoleId roleId, address account)
91
134
  external
92
- restricted // INSTANCE_OWNER_ROLE
135
+ onlyOwner()
93
136
  {
94
137
  AccessManagerExtendedInitializeable(authority()).grantRole(roleId.toInt(), account, 0);
95
138
  }
96
139
 
97
140
  function revokeRole(RoleId roleId, address account)
98
141
  external
99
- restricted // INSTANCE_OWNER_ROLE
142
+ onlyOwner()
100
143
  {
101
144
  AccessManagerExtendedInitializeable(authority()).revokeRole(roleId.toInt(), account);
102
145
  }
@@ -105,7 +148,7 @@ contract Instance is
105
148
 
106
149
  function createTarget(address target, string memory name)
107
150
  external
108
- restricted // INSTANCE_OWNER_ROLE
151
+ onlyOwner()
109
152
  {
110
153
  _instanceAdmin.createTarget(target, name);
111
154
  }
@@ -116,19 +159,20 @@ contract Instance is
116
159
  RoleId roleId
117
160
  )
118
161
  external
119
- restricted // INSTANCE_OWNER_ROLE
162
+ onlyOwner()
120
163
  {
121
164
  _instanceAdmin.setTargetFunctionRoleByInstance(targetName, selectors, roleId);
122
165
  }
123
166
 
124
167
  function setTargetLocked(address target, bool locked)
125
168
  external
126
- restricted // INSTANCE_OWNER_ROLE
169
+ onlyOwner()
127
170
  {
128
171
  _instanceAdmin.setTargetLockedByInstance(target, locked);
129
172
  }
130
173
 
131
- //--- ITransferInterceptor ------------------------------------------------------------//
174
+ //--- ITransferInterceptor ----------------------------------------------//
175
+
132
176
  // TODO interception of child components nfts
133
177
  function nftMint(address to, uint256 tokenId) external onlyChainNft {
134
178
  _instanceAdmin.transferInstanceOwnerRole(address(0), to);
@@ -167,6 +211,16 @@ contract Instance is
167
211
  _bundleManager = bundleManager;
168
212
  }
169
213
 
214
+ function setInstanceStore(InstanceStore instanceStore) external restricted {
215
+ if(address(_instanceStore) != address(0)) {
216
+ revert ErrorInstanceInstanceStoreAlreadySet(address(_instanceStore));
217
+ }
218
+ if(instanceStore.authority() != authority()) {
219
+ revert ErrorInstanceInstanceStoreAuthorityMismatch(authority());
220
+ }
221
+ _instanceStore = instanceStore;
222
+ }
223
+
170
224
  function setInstanceReader(InstanceReader instanceReader) external restricted() {
171
225
  if(instanceReader.getInstance() != Instance(this)) {
172
226
  revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
@@ -193,43 +247,13 @@ contract Instance is
193
247
  return AccessManagerExtendedInitializeable(authority());
194
248
  }
195
249
 
196
- function setInstanceStore(InstanceStore instanceStore) external restricted {
197
- if(address(_instanceStore) != address(0)) {
198
- revert ErrorInstanceInstanceStoreAlreadySet(address(_instanceStore));
199
- }
200
- if(instanceStore.authority() != authority()) {
201
- revert ErrorInstanceInstanceStoreAuthorityMismatch(authority());
202
- }
203
- _instanceStore = instanceStore;
204
- }
205
-
206
250
  function getInstanceStore() external view returns (InstanceStore) {
207
251
  return _instanceStore;
208
252
  }
209
253
 
210
- function getMajorVersion() external pure returns (VersionPart majorVersion) {
254
+ function getMajorVersion() public pure returns (VersionPart majorVersion) {
211
255
  return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
212
256
  }
213
257
 
214
- function getDistributionService() external view returns (IDistributionService) {
215
- return IDistributionService(getRegistry().getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
216
- }
217
-
218
- function getProductService() external view returns (IProductService) {
219
- return IProductService(getRegistry().getServiceAddress(PRODUCT(), VersionPart.wrap(3)));
220
- }
221
-
222
- function getPoolService() external view returns (IPoolService) {
223
- return IPoolService(getRegistry().getServiceAddress(POOL(), VersionPart.wrap(3)));
224
- }
225
-
226
- function getPolicyService() external view returns (IPolicyService) {
227
- return IPolicyService(getRegistry().getServiceAddress(POLICY(), VersionPart.wrap(3)));
228
- }
229
-
230
- function getBundleService() external view returns (IBundleService) {
231
- return IBundleService(getRegistry().getServiceAddress(BUNDLE(), VersionPart.wrap(3)));
232
- }
233
-
234
258
  //--- internal view/pure functions --------------------------------------//
235
259
  }
@@ -0,0 +1,74 @@
1
+ // SPDX-License-Identifier: UNLICENSED
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {AccessAdmin} from "../authorization/AccessAdmin.sol";
5
+ import {IAccessAdmin} from "../authorization/IAccessAdmin.sol";
6
+ import {IRegistry} from "../registry/IRegistry.sol";
7
+ import {IInstance} from "./IInstance.sol";
8
+ import {IService} from "../shared/IService.sol";
9
+ import {ObjectType, ObjectTypeLib, ALL, POOL, RELEASE} from "../type/ObjectType.sol";
10
+ import {RoleId, RoleIdLib, ADMIN_ROLE, PUBLIC_ROLE, INSTANCE_ROLE} from "../type/RoleId.sol";
11
+ import {VersionPart} from "../type/Version.sol";
12
+
13
+
14
+ contract InstanceAdminNew is
15
+ AccessAdmin
16
+ {
17
+ string public constant INSTANCE_ROLE_NAME = "InstanceRole";
18
+ string public constant INSTANCE_OWNER_ROLE_NAME = "InstanceOwnerRole";
19
+
20
+ string public constant INSTANCE_ADMIN_TARGET_NAME = "InstanceAdmin";
21
+ string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
22
+ string public constant INSTANCE_TARGET_NAME = "Instance";
23
+
24
+ uint64 public constant CUSTOM_ROLE_ID_MIN = 10000; // MUST be even
25
+
26
+ address _instance;
27
+ IRegistry internal _registry;
28
+ uint64 _idNext;
29
+
30
+ bool private _setupCompleted;
31
+
32
+
33
+ // instance owner role is granted upon instance nft minting in callback function
34
+ function initialize(address instanceAddress)
35
+ external
36
+ initializer()
37
+ {
38
+ _instance = instanceAddress;
39
+ IInstance instance = IInstance(instanceAddress);
40
+
41
+ _initializeAuthority(
42
+ instance.authority());
43
+
44
+ _registry = instance.getRegistry();
45
+ _idNext = CUSTOM_ROLE_ID_MIN;
46
+
47
+ _createInitialRoleSetup();
48
+ _setupInstanceAdmin();
49
+ _setupInstance();
50
+ }
51
+
52
+
53
+ function _setupInstanceAdmin()
54
+ internal
55
+ {
56
+ // _createTarget(address(this), INSTANCE_ADMIN_TARGET_NAME, IAccess.Type.Core);
57
+ }
58
+
59
+
60
+ function _setupInstance()
61
+ internal
62
+ {
63
+ // _createTarget(_instance, INSTANCE_TARGET_NAME, IAccess.Type.Core);
64
+
65
+ // minimum configuration required for nft interception
66
+ // _createRole(INSTANCE_ROLE(), INSTANCE_ROLE_NAME, IAccess.Type.Core);
67
+ // _createRole(INSTANCE_OWNER_ROLE(), INSTANCE_OWNER_ROLE_NAME, IAccess.Type.Core);
68
+ // _grantRole(INSTANCE_ROLE(), _instance);
69
+
70
+ // bytes4[] memory instanceAdminInstanceSelectors = new bytes4[](1);
71
+ // instanceAdminInstanceSelectors[0] = this.transferInstanceOwnerRole.selector;
72
+ // _setTargetFunctionRole(address(this), instanceAdminInstanceSelectors, INSTANCE_ROLE());
73
+ }
74
+ }
@@ -0,0 +1,176 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {
5
+ ALL, REGISTRY, SERVICE, PRODUCT, ORACLE, POOL, INSTANCE, COMPONENT, DISTRIBUTION, DISTRIBUTOR, APPLICATION, POLICY, CLAIM, BUNDLE, STAKE, STAKING, PRICE
6
+ } from "../../contracts/type/ObjectType.sol";
7
+
8
+ import {IAccess} from "../authorization/IAccess.sol";
9
+ import {Instance} from "../instance/Instance.sol";
10
+ import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
11
+ import {InstanceStore} from "../instance/InstanceStore.sol";
12
+ import {ModuleAuthorization} from "../authorization/ModuleAuthorization.sol";
13
+ import {VersionPart, VersionPartLib} from "../type/Version.sol";
14
+
15
+
16
+ contract InstanceAuthorizationV3
17
+ is ModuleAuthorization
18
+ {
19
+ uint256 public constant GIF_VERSION = 3;
20
+
21
+ string public constant INSTANCE_TARGET_NAME = "Instance";
22
+ string public constant INSTANCE_STORE_TARGET_NAME = "InstanceStore";
23
+ string public constant INSTANCE_ADMIN_TARGET_NAME = "InstanceAdmin";
24
+ string public constant BUNDLE_MANAGER_TARGET_NAME = "BundleManager";
25
+
26
+ string public constant INSTANCE_ROLE_NAME = "InstanceRole";
27
+
28
+ function getRelease() public override view returns(VersionPart release) {
29
+ return VersionPartLib.toVersionPart(GIF_VERSION);
30
+ }
31
+
32
+ function _setupTargets()
33
+ internal
34
+ override
35
+ {
36
+ _addTarget(INSTANCE_TARGET_NAME);
37
+ _addTarget(INSTANCE_STORE_TARGET_NAME);
38
+ _addTarget(INSTANCE_ADMIN_TARGET_NAME);
39
+ _addTarget(BUNDLE_MANAGER_TARGET_NAME);
40
+ }
41
+
42
+ function _setupRoles()
43
+ internal
44
+ override
45
+ {
46
+ _addRole(_getTargetRoleId(INSTANCE()), INSTANCE_ROLE_NAME);
47
+
48
+ _addServiceRole(INSTANCE());
49
+ _addServiceRole(COMPONENT());
50
+ _addServiceRole(DISTRIBUTION());
51
+ _addServiceRole(ORACLE());
52
+ _addServiceRole(POOL());
53
+ _addServiceRole(BUNDLE());
54
+ _addServiceRole(PRODUCT());
55
+ _addServiceRole(APPLICATION());
56
+ _addServiceRole(POLICY());
57
+ _addServiceRole(CLAIM());
58
+ }
59
+
60
+
61
+ function _setupTargetAuthorizations()
62
+ internal
63
+ override
64
+ {
65
+ _setupInstanceAuthorization();
66
+ _setupInstanceAdminAuthorization();
67
+ _setupInstanceStoreAuthorization();
68
+ }
69
+
70
+
71
+ function _setupInstanceAuthorization()
72
+ internal
73
+ {
74
+ IAccess.FunctionInfo[] storage functions;
75
+
76
+ // authorize instance service role
77
+ functions = _authorizeForTarget( INSTANCE_TARGET_NAME, _getServiceRoleId(INSTANCE()));
78
+ _authorize(functions, Instance.setInstanceAdmin.selector, "setInstanceAdmin");
79
+ _authorize(functions, Instance.setInstanceStore.selector, "setInstanceStore");
80
+ _authorize(functions, Instance.setBundleManager.selector, "setBundleManager");
81
+ _authorize(functions, Instance.setInstanceReader.selector, "setInstanceReader");
82
+ }
83
+
84
+
85
+ function _setupInstanceAdminAuthorization()
86
+ internal
87
+ {
88
+ IAccess.FunctionInfo[] storage functions;
89
+
90
+ // authorize instance role
91
+ functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, _getTargetRoleId(INSTANCE()));
92
+ _authorize(functions, InstanceAdmin.createRole.selector, "createRole");
93
+ _authorize(functions, InstanceAdmin.createTarget.selector, "createTarget");
94
+ _authorize(functions, InstanceAdmin.setTargetFunctionRoleByInstance.selector, "setTargetFunctionRoleByInstance");
95
+ _authorize(functions, InstanceAdmin.setTargetLockedByInstance.selector, "setTargetLockedByInstance");
96
+
97
+ // authorize instance service role
98
+ functions = _authorizeForTarget(INSTANCE_ADMIN_TARGET_NAME, _getServiceRoleId(INSTANCE()));
99
+ _authorize(functions, InstanceAdmin.createGifTarget.selector, "createGifTarget");
100
+ _authorize(functions, InstanceAdmin.setTargetLockedByService.selector, "setTargetLockedByService");
101
+ _authorize(functions, InstanceAdmin.setTargetFunctionRoleByService.selector, "setTargetFunctionRoleByService");
102
+ }
103
+
104
+
105
+ function _setupInstanceStoreAuthorization()
106
+ internal
107
+ {
108
+ IAccess.FunctionInfo[] storage functions;
109
+
110
+ // authorize component service role
111
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(COMPONENT()));
112
+ _authorize(functions, InstanceStore.createComponent.selector, "createComponent");
113
+ _authorize(functions, InstanceStore.updateComponent.selector, "updateComponent");
114
+ _authorize(functions, InstanceStore.createPool.selector, "createPool");
115
+ _authorize(functions, InstanceStore.createProduct.selector, "createProduct");
116
+ _authorize(functions, InstanceStore.updateProduct.selector, "updateProduct");
117
+ _authorize(functions, InstanceStore.increaseBalance.selector, "increaseBalance");
118
+ _authorize(functions, InstanceStore.increaseFees.selector, "increaseFees");
119
+
120
+ // authorize distribution service role
121
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(DISTRIBUTION()));
122
+ _authorize(functions, InstanceStore.createDistributorType.selector, "createDistributorType");
123
+ _authorize(functions, InstanceStore.updateDistributorType.selector, "updateDistributorType");
124
+ _authorize(functions, InstanceStore.updateDistributorTypeState.selector, "updateDistributorTypeState");
125
+ _authorize(functions, InstanceStore.createDistributor.selector, "createDistributor");
126
+ _authorize(functions, InstanceStore.updateDistributor.selector, "updateDistributor");
127
+ _authorize(functions, InstanceStore.updateDistributorState.selector, "updateDistributorState");
128
+ _authorize(functions, InstanceStore.createReferral.selector, "createReferral");
129
+ _authorize(functions, InstanceStore.updateReferral.selector, "updateReferral");
130
+ _authorize(functions, InstanceStore.updateReferralState.selector, "updateReferralState");
131
+
132
+ // authorize oracle service role
133
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(ORACLE()));
134
+ _authorize(functions, InstanceStore.createRequest.selector, "createRequest");
135
+ _authorize(functions, InstanceStore.updateRequest.selector, "updateRequest");
136
+ _authorize(functions, InstanceStore.updateRequestState.selector, "updateRequestState");
137
+
138
+ // authorize pool service role
139
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(POOL()));
140
+ _authorize(functions, InstanceStore.updatePool.selector, "updatePool");
141
+
142
+ // authorize bundle service role
143
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(BUNDLE()));
144
+ _authorize(functions, InstanceStore.createBundle.selector, "createBundle");
145
+ _authorize(functions, InstanceStore.updateBundle.selector, "updateBundle");
146
+ _authorize(functions, InstanceStore.updateBundleState.selector, "updateBundleState");
147
+ _authorize(functions, InstanceStore.increaseLocked.selector, "increaseLocked");
148
+ _authorize(functions, InstanceStore.decreaseLocked.selector, "decreaseLocked");
149
+
150
+ // authorize product service role
151
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(PRODUCT()));
152
+ _authorize(functions, InstanceStore.createRisk.selector, "createRisk");
153
+ _authorize(functions, InstanceStore.updateRisk.selector, "updateRisk");
154
+ _authorize(functions, InstanceStore.updateRiskState.selector, "updateRiskState");
155
+
156
+ // authorize application service role
157
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(APPLICATION()));
158
+ _authorize(functions, InstanceStore.createApplication.selector, "createApplication");
159
+ _authorize(functions, InstanceStore.updateApplication.selector, "updateApplication");
160
+ _authorize(functions, InstanceStore.updateApplicationState.selector, "updateApplicationState");
161
+
162
+ // authorize policy service role
163
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(POLICY()));
164
+ _authorize(functions, InstanceStore.updatePolicy.selector, "updatePolicy");
165
+ _authorize(functions, InstanceStore.updatePolicyState.selector, "updatePolicyState");
166
+
167
+ // authorize claim service role
168
+ functions = _authorizeForTarget(INSTANCE_STORE_TARGET_NAME, _getServiceRoleId(CLAIM()));
169
+ _authorize(functions, InstanceStore.updatePolicyClaims.selector, "updatePolicyClaims");
170
+ _authorize(functions, InstanceStore.createClaim.selector, "createClaim");
171
+ _authorize(functions, InstanceStore.updateClaim.selector, "updateClaim");
172
+ _authorize(functions, InstanceStore.createPayout.selector, "createPayout");
173
+ _authorize(functions, InstanceStore.updatePayout.selector, "updatePayout");
174
+ }
175
+ }
176
+
@@ -1,8 +1,8 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {ADMIN_ROLE, INSTANCE_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, INSTANCE_SERVICE_ROLE, COMPONENT_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE, INSTANCE_ROLE} from "../type/RoleId.sol";
5
- import {APPLICATION, BUNDLE, CLAIM, COMPONENT, DISTRIBUTION, INSTANCE, POLICY, POOL, PRODUCT, REGISTRY} from "../type/ObjectType.sol";
4
+ import {ADMIN_ROLE, INSTANCE_OWNER_ROLE, ORACLE_SERVICE_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, ORACLE_OWNER_ROLE, INSTANCE_SERVICE_ROLE, COMPONENT_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE, INSTANCE_ROLE} from "../type/RoleId.sol";
5
+ import {APPLICATION, BUNDLE, CLAIM, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POLICY, POOL, PRODUCT, REGISTRY} from "../type/ObjectType.sol";
6
6
  import {VersionPart} from "../type/Version.sol";
7
7
 
8
8
  import {IRegistry} from "../registry/IRegistry.sol";
@@ -31,6 +31,7 @@ library InstanceAuthorizationsLib
31
31
  _createRoles(instanceAdmin);
32
32
  _createTargets(instanceAdmin, instance, bundleManager, instanceStore);
33
33
  _grantComponentServiceAuthorizations(accessManager, instanceAdmin, instanceStore, registry, majorVersion);
34
+ _grantOracleServiceAuthorizations(accessManager, instanceAdmin, instanceStore, registry, majorVersion);
34
35
  _grantDistributionServiceAuthorizations(accessManager, instanceAdmin, instanceStore, registry, majorVersion);
35
36
  _grantPoolServiceAuthorizations(accessManager, instanceAdmin, instanceStore, registry, majorVersion);
36
37
  _grantProductServiceAuthorizations(accessManager, instanceAdmin, instanceStore, registry, majorVersion);
@@ -49,6 +50,7 @@ library InstanceAuthorizationsLib
49
50
  instanceAdmin.createCoreRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole");
50
51
  instanceAdmin.createCoreRole(COMPONENT_SERVICE_ROLE(), "ComponentServiceRole");
51
52
  instanceAdmin.createCoreRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole");
53
+ instanceAdmin.createCoreRole(ORACLE_SERVICE_ROLE(), "OracleServiceRole");
52
54
  instanceAdmin.createCoreRole(POOL_SERVICE_ROLE(), "PoolServiceRole");
53
55
  instanceAdmin.createCoreRole(APPLICATION_SERVICE_ROLE(), "ApplicationServiceRole");
54
56
  instanceAdmin.createCoreRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole");
@@ -58,6 +60,7 @@ library InstanceAuthorizationsLib
58
60
 
59
61
  // default roles controlled by INSTANCE_OWNER_ROLE -> gif roles
60
62
  instanceAdmin.createGifRole(DISTRIBUTION_OWNER_ROLE(), "DistributionOwnerRole", INSTANCE_OWNER_ROLE());
63
+ instanceAdmin.createGifRole(ORACLE_OWNER_ROLE(), "OracleOwnerRole", INSTANCE_OWNER_ROLE());
61
64
  instanceAdmin.createGifRole(POOL_OWNER_ROLE(), "PoolOwnerRole", INSTANCE_OWNER_ROLE());
62
65
  instanceAdmin.createGifRole(PRODUCT_OWNER_ROLE(), "ProductOwnerRole", INSTANCE_OWNER_ROLE());
63
66
  }
@@ -102,12 +105,37 @@ library InstanceAuthorizationsLib
102
105
  COMPONENT_SERVICE_ROLE());
103
106
  }
104
107
 
108
+ function _grantOracleServiceAuthorizations(
109
+ AccessManagerExtendedInitializeable accessManager,
110
+ InstanceAdmin instanceAdmin,
111
+ InstanceStore instanceStore,
112
+ IRegistry registry,
113
+ VersionPart majorVersion
114
+ )
115
+ private
116
+ {
117
+ // configure authorization for distribution service on instance
118
+ address oracleServiceAddress = registry.getServiceAddress(ORACLE(), majorVersion);
119
+ accessManager.grantRole(ORACLE_SERVICE_ROLE().toInt(), oracleServiceAddress, 0);
120
+
121
+ bytes4[] memory instanceOracleServiceSelectors = new bytes4[](3);
122
+ instanceOracleServiceSelectors[0] = instanceStore.createRequest.selector;
123
+ instanceOracleServiceSelectors[1] = instanceStore.updateRequest.selector;
124
+ instanceOracleServiceSelectors[2] = instanceStore.updateRequestState.selector;
125
+
126
+ instanceAdmin.setTargetFunctionRoleByService(
127
+ "InstanceStore",
128
+ instanceOracleServiceSelectors,
129
+ ORACLE_SERVICE_ROLE());
130
+ }
131
+
105
132
  function _grantDistributionServiceAuthorizations(
106
133
  AccessManagerExtendedInitializeable accessManager,
107
134
  InstanceAdmin instanceAdmin,
108
135
  InstanceStore instanceStore,
109
136
  IRegistry registry,
110
- VersionPart majorVersion)
137
+ VersionPart majorVersion
138
+ )
111
139
  private
112
140
  {
113
141
  // configure authorization for distribution service on instance
@@ -9,13 +9,15 @@ import {DistributorType} from "../type/DistributorType.sol";
9
9
  import {Fee, FeeLib} from "../type/Fee.sol";
10
10
  import {Key32} from "../type/Key32.sol";
11
11
  import {NftId} from "../type/NftId.sol";
12
- import {ObjectType, COMPONENT, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, FEE, BUNDLE} from "../type/ObjectType.sol";
12
+ import {ObjectType, COMPONENT, DISTRIBUTOR, DISTRIBUTION, INSTANCE, PRODUCT, POLICY, POOL, BUNDLE} from "../type/ObjectType.sol";
13
13
  import {PayoutId} from "../type/PayoutId.sol";
14
14
  import {ReferralId, ReferralStatus, ReferralLib, REFERRAL_OK, REFERRAL_ERROR_UNKNOWN, REFERRAL_ERROR_EXPIRED, REFERRAL_ERROR_EXHAUSTED} from "../type/Referral.sol";
15
+ import {RequestId} from "../type/RequestId.sol";
15
16
  import {RiskId} from "../type/RiskId.sol";
17
+ import {RoleId} from "../type/RoleId.sol";
18
+ import {StateId} from "../type/StateId.sol";
16
19
  import {UFixed, MathLib, UFixedLib} from "../type/UFixed.sol";
17
20
  import {Version} from "../type/Version.sol";
18
- import {StateId} from "../type/StateId.sol";
19
21
 
20
22
  import {IRegistry} from "../registry/IRegistry.sol";
21
23
  import {IBundle} from "../instance/module/IBundle.sol";
@@ -23,6 +25,7 @@ import {IComponents} from "../instance/module/IComponents.sol";
23
25
  import {IDistribution} from "../instance/module/IDistribution.sol";
24
26
  import {IInstance} from "./IInstance.sol";
25
27
  import {IKeyValueStore} from "../shared/IKeyValueStore.sol";
28
+ import {IOracle} from "../oracle/IOracle.sol";
26
29
  import {IPolicy} from "../instance/module/IPolicy.sol";
27
30
  import {IRisk} from "../instance/module/IRisk.sol";
28
31
  import {TimestampLib} from "../type/Timestamp.sol";
@@ -257,6 +260,16 @@ contract InstanceReader {
257
260
  }
258
261
  }
259
262
 
263
+ function getRequestInfo(RequestId requestId)
264
+ public
265
+ view
266
+ returns (IOracle.RequestInfo memory requestInfo)
267
+ {
268
+ bytes memory data = _store.getData(requestId.toKey32());
269
+ if (data.length > 0) {
270
+ return abi.decode(data, (IOracle.RequestInfo));
271
+ }
272
+ }
260
273
 
261
274
  function getMetadata(Key32 key)
262
275
  public
@@ -266,6 +279,14 @@ contract InstanceReader {
266
279
  return _store.getMetadata(key);
267
280
  }
268
281
 
282
+ function getState(Key32 key)
283
+ public
284
+ view
285
+ returns (StateId state)
286
+ {
287
+ return _store.getMetadata(key).state;
288
+ }
289
+
269
290
 
270
291
  function toReferralId(
271
292
  NftId distributionNftId,
@@ -317,6 +338,12 @@ contract InstanceReader {
317
338
  }
318
339
 
319
340
 
341
+ function hasRole(address account, RoleId roleId) public view returns (bool isMember) {
342
+ (isMember, ) = _instance.getInstanceAccessManager().hasRole(
343
+ roleId.toInt(), account);
344
+ }
345
+
346
+
320
347
  function toPolicyKey(NftId policyNftId) public pure returns (Key32) {
321
348
  return policyNftId.toKey32(POLICY());
322
349
  }