@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
@@ -4,14 +4,15 @@ pragma solidity ^0.8.20;
4
4
  import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
5
5
  import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
6
6
 
7
+ import {Amount} from "../type/Amount.sol";
7
8
  import {BundleManager} from "./BundleManager.sol";
8
9
  import {ChainNft} from "../registry/ChainNft.sol";
9
10
  import {NftId} from "../type/NftId.sol";
10
11
  import {RoleId} from "../type/RoleId.sol";
11
12
  import {SecondsLib} from "../type/Seconds.sol";
12
- import {UFixedLib} from "../type/UFixed.sol";
13
+ import {UFixed, UFixedLib} from "../type/UFixed.sol";
13
14
  import {ADMIN_ROLE, INSTANCE_OWNER_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, INSTANCE_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";
14
- import {ObjectType, INSTANCE, BUNDLE, APPLICATION, CLAIM, DISTRIBUTION, POLICY, POOL, PRODUCT, REGISTRY, STAKING} from "../type/ObjectType.sol";
15
+ import {ObjectType, INSTANCE, BUNDLE, APPLICATION, CLAIM, DISTRIBUTION, INSTANCE, POLICY, POOL, PRODUCT, REGISTRY, STAKING} from "../type/ObjectType.sol";
15
16
 
16
17
  import {Service} from "../shared/Service.sol";
17
18
  import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
@@ -34,6 +35,9 @@ import {IInstanceService} from "./IInstanceService.sol";
34
35
  import {InstanceReader} from "./InstanceReader.sol";
35
36
  import {InstanceStore} from "./InstanceStore.sol";
36
37
  import {InstanceAuthorizationsLib} from "./InstanceAuthorizationsLib.sol";
38
+ import {Seconds} from "../type/Seconds.sol";
39
+ import {VersionPart, VersionPartLib} from "../type/Version.sol";
40
+
37
41
 
38
42
  contract InstanceService is
39
43
  Service,
@@ -53,6 +57,28 @@ contract InstanceService is
53
57
  address internal _masterInstanceBundleManager;
54
58
  address internal _masterInstanceStore;
55
59
 
60
+
61
+ modifier onlyInstance() {
62
+ address instanceAddress = msg.sender;
63
+ NftId instanceNftId = getRegistry().getNftId(msg.sender);
64
+ if (instanceNftId.eqz()) {
65
+ revert ErrorInstanceServiceNotRegistered(instanceAddress);
66
+ }
67
+
68
+ ObjectType objectType = getRegistry().getObjectInfo(instanceNftId).objectType;
69
+ if (objectType != INSTANCE()) {
70
+ revert ErrorInstanceServiceNotInstance(instanceAddress, objectType);
71
+ }
72
+
73
+ VersionPart instanceVersion = IInstance(instanceAddress).getMajorVersion();
74
+ if (instanceVersion != getVersion().toMajorPart()) {
75
+ revert ErrorInstanceServiceInstanceVersionMismatch(instanceAddress, instanceVersion);
76
+ }
77
+
78
+ _;
79
+ }
80
+
81
+
56
82
  modifier onlyInstanceOwner(NftId instanceNftId) {
57
83
  if(msg.sender != getRegistry().ownerOf(instanceNftId)) {
58
84
  revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
@@ -142,6 +168,57 @@ contract InstanceService is
142
168
  clonedInstanceNftId);
143
169
  }
144
170
 
171
+
172
+ function setStakingLockingPeriod(Seconds stakeLockingPeriod)
173
+ external
174
+ virtual
175
+ onlyInstance()
176
+ {
177
+ NftId instanceNftId = getRegistry().getNftId(msg.sender);
178
+ _stakingService.setInstanceLockingPeriod(
179
+ instanceNftId,
180
+ stakeLockingPeriod);
181
+ }
182
+
183
+
184
+ function setStakingRewardRate(UFixed rewardRate)
185
+ external
186
+ virtual
187
+ onlyInstance()
188
+ {
189
+ NftId instanceNftId = getRegistry().getNftId(msg.sender);
190
+ _stakingService.setInstanceRewardRate(
191
+ instanceNftId,
192
+ rewardRate);
193
+ }
194
+
195
+
196
+ function refillStakingRewardReserves(address rewardProvider, Amount dipAmount)
197
+ external
198
+ virtual
199
+ onlyInstance()
200
+ {
201
+ NftId instanceNftId = getRegistry().getNftId(msg.sender);
202
+ _stakingService.refillInstanceRewardReserves(
203
+ instanceNftId,
204
+ rewardProvider,
205
+ dipAmount);
206
+ }
207
+
208
+
209
+ function withdrawStakingRewardReserves(Amount dipAmount)
210
+ external
211
+ virtual
212
+ onlyInstance()
213
+ returns (Amount newBalance)
214
+ {
215
+ NftId instanceNftId = getRegistry().getNftId(msg.sender);
216
+ _stakingService.withdrawInstanceRewardReserves(
217
+ instanceNftId,
218
+ dipAmount);
219
+ }
220
+
221
+
145
222
  function setComponentLocked(bool locked)
146
223
  external
147
224
  virtual
@@ -172,11 +249,6 @@ contract InstanceService is
172
249
  return _masterInstanceReader;
173
250
  }
174
251
 
175
- // From IService
176
- function getDomain() public pure override returns(ObjectType) {
177
- return INSTANCE();
178
- }
179
-
180
252
  function setAndRegisterMasterInstance(address instanceAddress)
181
253
  external
182
254
  onlyOwner
@@ -348,7 +420,7 @@ contract InstanceService is
348
420
  IRegistry registry = getRegistry();
349
421
  IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
350
422
  if(instanceInfo.objectType != INSTANCE()) {
351
- revert ErrorInstanceServiceNotInstance(instanceNftId);
423
+ revert ErrorInstanceServiceNotInstanceNftId(instanceNftId);
352
424
  }
353
425
 
354
426
  IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
@@ -359,4 +431,9 @@ contract InstanceService is
359
431
  instance = Instance(instanceInfo.objectAddress);
360
432
  componentNftId = componentInfo.nftId;
361
433
  }
434
+
435
+ // From IService
436
+ function _getDomain() internal pure override returns(ObjectType) {
437
+ return INSTANCE();
438
+ }
362
439
  }
@@ -4,15 +4,13 @@ pragma solidity ^0.8.20;
4
4
  import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
5
 
6
6
  import {Amount} from "../type/Amount.sol";
7
- import {Key32, KeyId, Key32Lib} from "../type/Key32.sol";
7
+ import {Key32} from "../type/Key32.sol";
8
8
  import {NftId} from "../type/NftId.sol";
9
9
  import {ClaimId} from "../type/ClaimId.sol";
10
- import {ObjectType, BUNDLE, DISTRIBUTION, FEE, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../type/ObjectType.sol";
11
- import {RiskId, RiskIdLib} from "../type/RiskId.sol";
12
- import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../type/RoleId.sol";
13
- import {StateId, ACTIVE} from "../type/StateId.sol";
14
- import {TimestampLib} from "../type/Timestamp.sol";
15
- import {VersionPart, VersionPartLib} from "../type/Version.sol";
10
+ import {ObjectType, BUNDLE, POLICY, POOL, PRODUCT, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../type/ObjectType.sol";
11
+ import {RequestId} from "../type/RequestId.sol";
12
+ import {RiskId} from "../type/RiskId.sol";
13
+ import {StateId} from "../type/StateId.sol";
16
14
  import {ReferralId} from "../type/Referral.sol";
17
15
  import {DistributorType} from "../type/DistributorType.sol";
18
16
  import {PayoutId} from "../type/PayoutId.sol";
@@ -20,19 +18,21 @@ import {PayoutId} from "../type/PayoutId.sol";
20
18
  import {BalanceStore} from "./base/BalanceStore.sol";
21
19
  import {IInstance} from "./IInstance.sol";
22
20
  import {KeyValueStore} from "../shared/KeyValueStore.sol";
23
- import {IKeyValueStore} from "../shared/KeyValueStore.sol";
21
+ import {ObjectCounter} from "./base/ObjectCounter.sol";
24
22
 
25
23
  import {IBundle} from "./module/IBundle.sol";
26
24
  import {IComponents} from "./module/IComponents.sol";
27
25
  import {IDistribution} from "./module/IDistribution.sol";
28
26
  import {IPolicy} from "./module/IPolicy.sol";
27
+ import {IOracle} from "../oracle/IOracle.sol";
29
28
  import {IRisk} from "./module/IRisk.sol";
30
29
 
31
30
 
32
31
  contract InstanceStore is
33
32
  AccessManagedUpgradeable,
33
+ BalanceStore,
34
34
  KeyValueStore,
35
- BalanceStore
35
+ ObjectCounter
36
36
  {
37
37
  function initialize(address instance)
38
38
  public
@@ -40,10 +40,12 @@ contract InstanceStore is
40
40
  {
41
41
  address authority = IInstance(instance).authority();
42
42
  __AccessManaged_init(authority);
43
+
43
44
  initializeLifecycle();
44
45
  }
45
46
 
46
47
  //--- Component ---------------------------------------------------------//
48
+
47
49
  function createComponent(
48
50
  NftId componentNftId,
49
51
  IComponents.ComponentInfo memory componentInfo
@@ -66,7 +68,7 @@ contract InstanceStore is
66
68
  _update(_toNftKey32(componentNftId, COMPONENT()), abi.encode(componentInfo), newState);
67
69
  }
68
70
 
69
- //--- ProductSetup ------------------------------------------------------//
71
+ //--- Product -----------------------------------------------------------//
70
72
 
71
73
  function createProduct(NftId productNftId, IComponents.ProductInfo memory info) external restricted() {
72
74
  _create(_toNftKey32(productNftId, PRODUCT()), abi.encode(info));
@@ -76,11 +78,7 @@ contract InstanceStore is
76
78
  _update(_toNftKey32(productNftId, PRODUCT()), abi.encode(info), newState);
77
79
  }
78
80
 
79
- function updateProductSetupState(NftId productNftId, StateId newState) external restricted() {
80
- _updateState(_toNftKey32(productNftId, PRODUCT()), newState);
81
- }
82
-
83
- //--- PoolSetup ------------------------------------------------------//
81
+ //--- Pool --------------------------------------------------------------//
84
82
 
85
83
  function createPool(
86
84
  NftId poolNftId,
@@ -96,11 +94,7 @@ contract InstanceStore is
96
94
  _update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
97
95
  }
98
96
 
99
- function updatePoolState(NftId poolNftId, StateId newState) external restricted() {
100
- _updateState(_toNftKey32(poolNftId, POOL()), newState);
101
- }
102
-
103
- //--- DistributorType -------------------------------------------------------//
97
+ //--- DistributorType ---------------------------------------------------//
104
98
  function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
105
99
  _create(distributorType.toKey32(), abi.encode(info));
106
100
  }
@@ -219,6 +213,21 @@ contract InstanceStore is
219
213
  _updateState(_toPayoutKey32(policyNftId, payoutId), newState);
220
214
  }
221
215
 
216
+ //--- Request -----------------------------------------------------------//
217
+
218
+ function createRequest(IOracle.RequestInfo memory request) external restricted() returns (RequestId requestId) {
219
+ requestId = _createNextRequestId();
220
+ _create(requestId.toKey32(), abi.encode(request));
221
+ }
222
+
223
+ function updateRequest(RequestId requestId, IOracle.RequestInfo memory request, StateId newState) external restricted() {
224
+ _update(requestId.toKey32(), abi.encode(request), newState);
225
+ }
226
+
227
+ function updateRequestState(RequestId requestId, StateId newState) external restricted() {
228
+ _updateState(requestId.toKey32(), newState);
229
+ }
230
+
222
231
  //--- balance and fee management functions ------------------------------//
223
232
 
224
233
  function increaseBalance(NftId targetNftId, Amount amount) external restricted() returns (Amount newBalance) {
@@ -60,7 +60,7 @@ contract BalanceStore {
60
60
  }
61
61
 
62
62
  _isRegistered[targetNftId] = true;
63
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
63
+ _setLastUpdatedIn(targetNftId);
64
64
 
65
65
  emit LogBalanceStoreTargetRegistered(targetNftId);
66
66
  }
@@ -71,7 +71,7 @@ contract BalanceStore {
71
71
  _feeAmount[targetNftId] = newBalance;
72
72
 
73
73
  emit LogBalanceStoreFeesIncreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
74
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
74
+ _setLastUpdatedIn(targetNftId);
75
75
  }
76
76
 
77
77
  function _decreaseFees(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
@@ -79,7 +79,7 @@ contract BalanceStore {
79
79
  _feeAmount[targetNftId] = newBalance;
80
80
 
81
81
  emit LogBalanceStoreFeesDecreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
82
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
82
+ _setLastUpdatedIn(targetNftId);
83
83
  }
84
84
 
85
85
  //--- locked management -------------------------------------------------//
@@ -88,7 +88,7 @@ contract BalanceStore {
88
88
  _lockedAmount[targetNftId] = newBalance;
89
89
 
90
90
  emit LogBalanceStoreLockedIncreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
91
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
91
+ _setLastUpdatedIn(targetNftId);
92
92
  }
93
93
 
94
94
  function _decreaseLocked(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
@@ -96,7 +96,7 @@ contract BalanceStore {
96
96
  _lockedAmount[targetNftId] = newBalance;
97
97
 
98
98
  emit LogBalanceStoreLockedDecreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
99
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
99
+ _setLastUpdatedIn(targetNftId);
100
100
  }
101
101
 
102
102
  //--- balance management ------------------------------------------------//
@@ -105,7 +105,7 @@ contract BalanceStore {
105
105
  _balanceAmount[targetNftId] = newBalance;
106
106
 
107
107
  emit LogBalanceStoreBalanceIncreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
108
- _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
108
+ _setLastUpdatedIn(targetNftId);
109
109
  }
110
110
 
111
111
  function _decreaseBalance(NftId targetNftId, Amount amount) internal onlyRegisteredTarget(targetNftId) returns (Amount newBalance) {
@@ -113,6 +113,11 @@ contract BalanceStore {
113
113
  _balanceAmount[targetNftId] = newBalance;
114
114
 
115
115
  emit LogBalanceStoreBalanceDecreased(targetNftId, amount, newBalance, _lastUpdatedIn[targetNftId]);
116
+ _setLastUpdatedIn(targetNftId);
117
+ }
118
+
119
+ //--- internal/private functions ----------------------------------------//
120
+ function _setLastUpdatedIn(NftId targetNftId) internal {
116
121
  _lastUpdatedIn[targetNftId] = BlocknumberLib.currentBlocknumber();
117
122
  }
118
123
  }
@@ -2,47 +2,24 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
5
- import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
5
 
7
6
  import {IRegistry} from "../../registry/IRegistry.sol";
8
7
 
9
8
  abstract contract Cloneable is
10
9
  AccessManagedUpgradeable
11
10
  {
12
- event CloneableInitialized(address authority, address registry);
13
-
14
- error CloneableAuthorityZero();
15
- error CloneableRegistryInvalid(address registry);
16
-
17
11
  IRegistry internal _registry;
18
12
 
19
- constructor() {
20
- _registry = IRegistry(address(0));
21
- }
22
-
23
13
  /// @dev call to initialize MUST be made in the same transaction as cloning of the contract
24
- function initialize(
14
+ function __Cloneable_init(
25
15
  address authority,
26
16
  address registry
27
17
  )
28
- public
18
+ internal
29
19
  onlyInitializing
30
20
  {
31
- // check/handle access managed
32
- if(authority == address(0)) {
33
- revert CloneableAuthorityZero();
34
- }
35
-
36
21
  __AccessManaged_init(authority);
37
-
38
- // check/handle registry
39
- if (registry.code.length == 0) {
40
- revert CloneableRegistryInvalid(registry);
41
- }
42
-
43
22
  _registry = IRegistry(registry);
44
-
45
- emit CloneableInitialized(authority, registry);
46
23
  }
47
24
 
48
25
  function getRegistry() external view returns (IRegistry) {
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Blocknumber, BlocknumberLib} from "../../type/Blocknumber.sol";
5
+ import {NftId} from "../../type/NftId.sol";
6
+ import {Amount} from "../../type/Amount.sol";
7
+ import {RequestId, RequestIdLib} from "../../type/RequestId.sol";
8
+
9
+ contract ObjectCounter {
10
+
11
+ // TODO refactor risk id
12
+ // mapping(NftId productNftId => uint64 risks) private _riskCounter;
13
+
14
+ uint256 private _requestCounter;
15
+
16
+ // TODO introduce RequestId (uint64)
17
+ function _createNextRequestId() internal returns (RequestId requestId) {
18
+ _requestCounter++;
19
+ requestId = RequestIdLib.toRequestId(_requestCounter);
20
+ }
21
+ }
@@ -17,7 +17,6 @@ contract ObjectManager is
17
17
  event LogObjectManagerInitialized(address instance);
18
18
 
19
19
  error ErrorObjectManagerNftIdInvalid(NftId instanceNftId);
20
- error ErrorObjectManagerAlreadyAdded(NftId componentNftId, NftId objectNftId);
21
20
 
22
21
  mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _activeObjects;
23
22
  mapping(NftId compnentNftId => LibNftIdSet.Set objects) internal _allObjects;
@@ -29,8 +28,7 @@ contract ObjectManager is
29
28
  external
30
29
  {
31
30
  IInstance instance = IInstance(instanceAddress);
32
- initialize(instance.authority(), address(instance.getRegistry()));
33
-
31
+ __Cloneable_init(instance.authority(), address(instance.getRegistry()));
34
32
  _instance = instance;
35
33
 
36
34
  emit LogObjectManagerInitialized(instanceAddress);
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {NftId} from "../type/NftId.sol";
5
+ import {Timestamp} from "../type/Timestamp.sol";
6
+
7
+
8
+ interface IOracle {
9
+
10
+ struct RequestInfo {
11
+ NftId requesterNftId; // originator of the request
12
+ string callbackMethodName; // callback function of the requestor to call to provide response data
13
+ NftId oracleNftId; // responsible oracle component
14
+ bytes requestData;
15
+ bytes responseData;
16
+ Timestamp respondedAt; // response timestamp
17
+ Timestamp expiredAt; // expiry timestamp
18
+ bool isCancelled;
19
+ }
20
+ }
@@ -0,0 +1,32 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {Fee} from "../type/Fee.sol";
5
+ import {IInstanceLinkedComponent} from "../shared/IInstanceLinkedComponent.sol";
6
+ import {ReferralId, ReferralStatus} from "../type/Referral.sol";
7
+ import {NftId} from "../type/NftId.sol";
8
+ import {DistributorType} from "../type/DistributorType.sol";
9
+ import {RequestId} from "../type/RequestId.sol";
10
+ import {UFixed} from "../type/UFixed.sol";
11
+ import {Timestamp} from "../type/Timestamp.sol";
12
+
13
+ interface IOracleComponent is IInstanceLinkedComponent {
14
+
15
+ /// @dev callback method for requesting some data from the oracle
16
+ function request(
17
+ RequestId requestId,
18
+ NftId requesterNftId,
19
+ bytes calldata requestData,
20
+ Timestamp expiryAt
21
+ ) external;
22
+
23
+
24
+ /// @dev callback method for cancelling the specified oracle request
25
+ function cancel(
26
+ RequestId requestId
27
+ ) external;
28
+
29
+
30
+ /// @dev returns true iff the component needs to be called when selling/renewing policis
31
+ function isVerifying() external view returns (bool verifying);
32
+ }
@@ -0,0 +1,65 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {IService} from "../shared/IService.sol";
5
+ import {NftId} from "../type/NftId.sol";
6
+ import {RequestId} from "../type/RequestId.sol";
7
+ import {StateId} from "../type/StateId.sol";
8
+ import {Timestamp} from "../type/Timestamp.sol";
9
+
10
+
11
+ interface IOracleService is IService {
12
+
13
+ event LogOracleServiceRequestCreated(RequestId requestId, NftId requesterNftId, NftId oracleNftId, Timestamp expiryAt);
14
+ event LogOracleServiceResponseProcessed(RequestId requestId, NftId oracleNftId);
15
+ event LogOracleServiceDeliveryFailed(RequestId requestId, address requesterAddress, string functionSignature);
16
+ event LogOracleServiceResponseResent(RequestId requestId, NftId requesterNftId);
17
+ event LogOracleServiceRequestCancelled(RequestId requestId, NftId requesterNftId);
18
+
19
+ // create request
20
+ error ErrorOracleServiceInstanceMismatch(NftId expectedInstanceNftId, NftId oracleInstanceNftId);
21
+ error ErrorOracleServiceExpiryInThePast(Timestamp blockTimestamp, Timestamp expiryAt);
22
+ error ErrorOracleServiceCallbackMethodNameEmpty();
23
+
24
+ // respond
25
+ error ErrorOracleServiceNotResponsibleOracle(RequestId requestId, NftId expectedOracleNftId, NftId oracleNftId);
26
+
27
+ // get request info
28
+ error ErrorOracleServiceRequestStateNotActive(RequestId requestId, StateId state);
29
+ error ErrorOracleServiceCallerNotResponsibleOracle(RequestId requestId, NftId oracleNftId, NftId callerNftId);
30
+ error ErrorOracleServiceCallerNotRequester(RequestId requestId, NftId requesterNftId, NftId callerNftId);
31
+ error ErrorOracleServiceRequestExpired(RequestId requestId, Timestamp expiredAt);
32
+
33
+ /// @dev send an oracle request to the specified oracle component.
34
+ /// the function returns the id of the newly created request.
35
+ /// permissioned: only registered components may send requests to oracles.
36
+ function request(
37
+ NftId oracleNftId,
38
+ bytes calldata requestData,
39
+ Timestamp expiryAt,
40
+ string calldata callbackMethodName
41
+ ) external returns (RequestId requestId);
42
+
43
+ /// @dev respond to oracle request by oracle compnent.
44
+ /// the response data is amende in the request info stored with the instance.
45
+ /// the request state changes to FULFILLED (when calling the callback method of the requester is successful)
46
+ /// or to FAILED when calling the requester is not succesful.
47
+ /// the function returns true iff the state changes to FULFILLED.
48
+ /// permissioned: only the oracle component linked to the request id may call this method
49
+ function respond(
50
+ RequestId requestId,
51
+ bytes calldata responseData
52
+ ) external returns (bool success);
53
+
54
+ /// @dev re send a failed response to the requester.
55
+ /// only requests in state FAILED may be re sent.
56
+ /// the request state changes to FULFILLED when calling the callback method of the requester is successful.
57
+ /// permissioned: only the requester may resend a request
58
+ function resend(RequestId requestId) external;
59
+
60
+ /// @dev notify the oracle component that the specified request has become invalid.
61
+ /// only requests in state ACTIVE may be cancelled.
62
+ /// permissioned: only the requester may cancel a request
63
+ function cancel(RequestId requestId) external;
64
+
65
+ }
@@ -0,0 +1,145 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.20;
3
+
4
+ import {COMPONENT, ORACLE} from "../type/ObjectType.sol";
5
+ import {IOracleService} from "./IOracleService.sol";
6
+ import {NftId, NftIdLib} from "../type/NftId.sol";
7
+ import {InstanceLinkedComponent} from "../shared/InstanceLinkedComponent.sol";
8
+ import {IComponentService} from "../shared/IComponentService.sol";
9
+ import {IOracleComponent} from "./IOracleComponent.sol";
10
+ import {IRegistry} from "../registry/IRegistry.sol";
11
+ import {InstanceReader} from "../instance/InstanceReader.sol";
12
+ import {RequestId} from "../type/RequestId.sol";
13
+ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
14
+ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
15
+ import {UFixed} from "../type/UFixed.sol";
16
+
17
+
18
+ abstract contract Oracle is
19
+ InstanceLinkedComponent,
20
+ IOracleComponent
21
+ {
22
+ // keccak256(abi.encode(uint256(keccak256("etherisc.storage.Oracle")) - 1)) & ~bytes32(uint256(0xff));
23
+ bytes32 public constant ORACLE_STORAGE_LOCATION_V1 = 0xaab7c0ea03d290e56d6c060e0733d3ebcbe647f7694616a2ec52738a64b2f900;
24
+
25
+ struct OracleStorage {
26
+ IComponentService _componentService;
27
+ IOracleService _oracleService;
28
+ }
29
+
30
+
31
+ function initializeOracle(
32
+ address registry,
33
+ NftId instanceNftId,
34
+ address initialOwner,
35
+ string memory name,
36
+ address token,
37
+ bytes memory registryData, // writeonly data that will saved in the object info record of the registry
38
+ bytes memory componentData // component specifidc data
39
+ )
40
+ public
41
+ virtual
42
+ onlyInitializing()
43
+ {
44
+ initializeInstanceLinkedComponent(registry, instanceNftId, name, token, ORACLE(), true, initialOwner, registryData, componentData);
45
+
46
+ OracleStorage storage $ = _getOracleStorage();
47
+ $._oracleService = IOracleService(_getServiceAddress(ORACLE()));
48
+ $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
49
+
50
+ registerInterface(type(IOracleComponent).interfaceId);
51
+ }
52
+
53
+
54
+ function register()
55
+ external
56
+ virtual
57
+ onlyOwner()
58
+ {
59
+ _getOracleStorage()._componentService.registerOracle();
60
+ }
61
+
62
+
63
+ function isVerifying()
64
+ external
65
+ virtual
66
+ view
67
+ returns (bool verifying)
68
+ {
69
+ return false;
70
+ }
71
+
72
+
73
+ function request(
74
+ RequestId requestId,
75
+ NftId requesterId,
76
+ bytes calldata requestData,
77
+ Timestamp expiryAt
78
+ )
79
+ external
80
+ virtual
81
+ // restricted() // TODO enable: only oracle service
82
+ {
83
+ _request(requestId, requesterId, requestData, expiryAt);
84
+ }
85
+
86
+
87
+ function cancel(
88
+ RequestId requestId
89
+ )
90
+ external
91
+ virtual
92
+ // restricted() // TODO enable: only oracle service
93
+ {
94
+ _cancel(requestId);
95
+ }
96
+
97
+
98
+ /// @dev internal function for handling requests.
99
+ /// empty implementation.
100
+ /// overwrite this function to implement use case specific handling
101
+ /// for oracle calls.
102
+ function _request(
103
+ RequestId requestId,
104
+ NftId requesterId,
105
+ bytes calldata requestData,
106
+ Timestamp expiryAt
107
+ )
108
+ internal
109
+ virtual
110
+ {
111
+ }
112
+
113
+
114
+ /// @dev internal function for cancelling requests.
115
+ /// empty implementation.
116
+ /// overwrite this function to implement use case specific cancelling
117
+ function _cancel(
118
+ RequestId requestId
119
+ )
120
+ internal
121
+ virtual
122
+ {
123
+ }
124
+
125
+
126
+ /// @dev internal function for handling oracle responses.
127
+ /// use this function in use case specific external/public functions
128
+ /// to handle use case specific response handling.
129
+ function _respond(
130
+ RequestId requestId,
131
+ bytes memory responseData
132
+ )
133
+ internal
134
+ virtual
135
+ {
136
+ _getOracleStorage()._oracleService.respond(
137
+ requestId, responseData);
138
+ }
139
+
140
+ function _getOracleStorage() private pure returns (OracleStorage storage $) {
141
+ assembly {
142
+ $.slot := ORACLE_STORAGE_LOCATION_V1
143
+ }
144
+ }
145
+ }