@etherisc/gif-next 0.0.2-7c8d286-020 → 0.0.2-7d488b3-675

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 (358) hide show
  1. package/README.md +1 -1
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +32 -48
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +26 -34
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  7. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +246 -361
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
  10. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +39 -8
  12. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  13. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +23 -96
  14. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  15. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +184 -278
  17. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +0 -32
  19. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  20. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  22. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  23. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +109 -33
  24. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  25. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +41 -96
  26. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  27. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +65 -0
  28. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  29. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +106 -142
  30. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  31. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +53 -61
  32. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  33. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +65 -0
  34. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  35. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +20 -40
  36. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  37. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  38. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +17 -33
  39. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +41 -96
  41. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  42. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +59 -75
  43. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  44. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +41 -96
  45. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  46. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  47. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +118 -42
  48. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +41 -96
  50. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  51. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +23 -23
  52. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  53. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +27 -43
  54. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  55. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +41 -96
  56. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  57. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +29 -45
  58. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +41 -96
  60. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  61. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  62. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  63. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +7 -85
  64. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  65. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +11 -54
  66. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  67. package/artifacts/contracts/instance/Instance.sol/Instance.json +25 -95
  68. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  69. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +405 -512
  70. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  71. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +41 -96
  72. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  73. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
  74. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  75. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +63 -86
  76. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  77. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +36 -26
  78. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  79. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2 -2
  80. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  81. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  82. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  83. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  84. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  85. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  87. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
  89. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  90. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  91. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
  93. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  94. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  95. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  98. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  99. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  100. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -14
  101. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +30 -93
  103. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  105. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  108. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +42 -58
  109. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +31 -39
  111. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  112. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  113. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +41 -96
  114. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  115. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +58 -74
  116. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  117. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +39 -47
  118. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  119. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  120. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  121. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  122. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  123. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +22 -38
  124. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  125. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +74 -106
  126. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  127. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +47 -63
  128. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  129. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +26 -71
  130. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  131. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +23 -35
  132. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  133. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  134. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +41 -96
  135. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  136. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +80 -96
  137. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  138. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +50 -58
  139. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  140. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +0 -21
  141. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  142. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  143. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  144. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +0 -21
  145. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  146. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  147. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +0 -21
  148. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  149. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +86 -94
  150. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  151. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +18 -452
  152. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  153. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +53 -57
  154. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  155. package/artifacts/contracts/product/PricingService.sol/PricingService.json +52 -89
  156. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  157. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +36 -44
  158. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  159. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  160. package/artifacts/contracts/product/RiskService.sol/RiskService.json +26 -55
  161. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  162. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +23 -27
  163. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  164. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  165. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  166. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  167. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  168. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  169. package/artifacts/contracts/registry/Registry.sol/Registry.json +2 -2
  170. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  171. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +350 -440
  172. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  173. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
  174. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  175. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +19 -19
  176. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  177. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +368 -473
  178. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  179. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
  180. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  181. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +124 -128
  182. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  183. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  184. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  185. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
  186. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  187. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  188. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +102 -63
  189. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  190. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +49 -41
  191. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  192. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  193. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +4 -60
  194. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  195. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  196. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  197. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  198. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  199. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +24 -1
  200. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  201. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  202. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  203. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  204. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  205. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  206. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  207. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  208. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  209. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
  210. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  211. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  212. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  213. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  214. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
  215. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  216. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  217. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  218. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  219. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  220. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  221. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  222. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  223. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  224. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  225. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  226. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  227. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  228. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  229. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  230. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +9 -74
  231. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  232. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +3 -74
  233. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
  234. package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +440 -0
  235. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  236. package/artifacts/contracts/staking/Staking.sol/Staking.json +57 -141
  237. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  238. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
  239. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  240. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +34 -50
  241. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  242. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +57 -30
  243. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  244. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +29 -124
  245. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  246. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +23 -35
  247. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  248. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +128 -142
  249. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  250. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +14 -24
  251. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  252. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  253. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  254. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  255. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
  256. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  257. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
  258. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  259. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  260. package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
  261. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  262. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
  263. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  264. package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
  265. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  266. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
  267. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +31 -33
  269. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
  271. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
  273. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  274. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
  275. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  276. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
  277. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  278. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
  279. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
  288. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/Version.sol/VersionPartLib.json +2 -56
  290. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  291. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  292. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +4 -4
  293. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  294. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  295. package/contracts/accounting/AccountingService.sol +3 -2
  296. package/contracts/authorization/AccessAdmin.sol +186 -201
  297. package/contracts/authorization/AccessManagerCloneable.sol +31 -40
  298. package/contracts/authorization/Authorization.sol +33 -61
  299. package/contracts/authorization/IAccessAdmin.sol +36 -63
  300. package/contracts/authorization/IAuthorization.sol +0 -6
  301. package/contracts/distribution/BasicDistribution.sol +3 -5
  302. package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
  303. package/contracts/distribution/Distribution.sol +47 -4
  304. package/contracts/distribution/DistributionService.sol +6 -10
  305. package/contracts/distribution/IDistributionComponent.sol +9 -0
  306. package/contracts/distribution/IDistributionService.sol +5 -3
  307. package/contracts/instance/IInstance.sol +8 -43
  308. package/contracts/instance/IInstanceService.sol +2 -14
  309. package/contracts/instance/Instance.sol +13 -62
  310. package/contracts/instance/InstanceAdmin.sol +107 -120
  311. package/contracts/instance/InstanceAuthorizationV3.sol +21 -43
  312. package/contracts/instance/InstanceReader.sol +1 -1
  313. package/contracts/instance/InstanceService.sol +60 -118
  314. package/contracts/oracle/BasicOracleAuthorization.sol +1 -1
  315. package/contracts/oracle/OracleService.sol +4 -4
  316. package/contracts/pool/BasicPoolAuthorization.sol +1 -1
  317. package/contracts/pool/PoolLib.sol +1 -94
  318. package/contracts/pool/PoolService.sol +89 -91
  319. package/contracts/product/ApplicationService.sol +1 -10
  320. package/contracts/product/BasicProductAuthorization.sol +1 -1
  321. package/contracts/product/ClaimService.sol +0 -8
  322. package/contracts/product/IApplicationService.sol +0 -2
  323. package/contracts/product/IPricingService.sol +0 -1
  324. package/contracts/product/IRiskService.sol +0 -3
  325. package/contracts/product/PolicyService.sol +53 -35
  326. package/contracts/product/PolicyServiceLib.sol +1 -55
  327. package/contracts/product/PricingService.sol +0 -5
  328. package/contracts/product/RiskService.sol +0 -10
  329. package/contracts/registry/RegistryAdmin.sol +229 -133
  330. package/contracts/registry/ReleaseAdmin.sol +22 -30
  331. package/contracts/registry/ReleaseRegistry.sol +33 -39
  332. package/contracts/registry/ServiceAuthorizationV3.sol +3 -88
  333. package/contracts/shared/Component.sol +6 -6
  334. package/contracts/shared/ComponentService.sol +29 -33
  335. package/contracts/shared/ContractLib.sol +0 -28
  336. package/contracts/shared/IComponentService.sol +6 -4
  337. package/contracts/shared/InitializableERC165.sol +1 -9
  338. package/contracts/shared/NftOwnable.sol +1 -2
  339. package/contracts/shared/Registerable.sol +4 -1
  340. package/contracts/shared/TokenHandler.sol +4 -5
  341. package/contracts/staking/IStaking.sol +2 -12
  342. package/contracts/staking/IStakingService.sol +1 -11
  343. package/contracts/staking/{StakingLib.sol → StakeManagerLib.sol} +22 -79
  344. package/contracts/staking/Staking.sol +13 -33
  345. package/contracts/staking/StakingReader.sol +15 -5
  346. package/contracts/staking/StakingService.sol +2 -39
  347. package/contracts/staking/StakingStore.sol +1 -2
  348. package/contracts/type/ObjectType.sol +14 -5
  349. package/contracts/type/Version.sol +0 -39
  350. package/package.json +1 -1
  351. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +0 -4
  352. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +0 -673
  353. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +0 -4
  354. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +0 -878
  355. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +0 -4
  356. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +0 -469
  357. package/contracts/authorization/AccessAdminLib.sol +0 -183
  358. package/contracts/registry/RegistryAuthorization.sol +0 -267
@@ -94,7 +94,6 @@ contract ComponentService is
94
94
  function registerComponent(address component)
95
95
  external
96
96
  virtual
97
- restricted()
98
97
  onlyComponent(component)
99
98
  returns (NftId componentNftId)
100
99
  {
@@ -120,7 +119,6 @@ contract ComponentService is
120
119
  )
121
120
  external
122
121
  virtual
123
- restricted()
124
122
  {
125
123
  // checks
126
124
  (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
@@ -135,7 +133,6 @@ contract ComponentService is
135
133
  function setWallet(address newWallet)
136
134
  external
137
135
  virtual
138
- restricted()
139
136
  {
140
137
  // checks
141
138
  (NftId componentNftId, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
@@ -147,24 +144,31 @@ contract ComponentService is
147
144
  }
148
145
 
149
146
  /// @inheritdoc IComponentService
150
- function setLocked(bool locked)
147
+ function setLockedFromInstance(address componentAddress, bool locked)
151
148
  external
152
149
  virtual
153
- restricted()
150
+ onlyInstance()
154
151
  {
155
- (, IInstance instance) = _getAndVerifyComponent(COMPONENT(), false);
152
+ address instanceAddress = msg.sender;
153
+ // NftId instanceNftId = getRegistry().getNftIdForAddress(msg.sender);
154
+ IInstance instance = IInstance(instanceAddress);
155
+ _setLocked(instance.getInstanceAdmin(), componentAddress, locked);
156
+ }
156
157
 
157
- address component = msg.sender;
158
- instance.getInstanceAdmin().setComponentLocked(
159
- component,
160
- locked);
158
+ /// @inheritdoc IComponentService
159
+ function setLockedFromComponent(address componentAddress, bool locked)
160
+ external
161
+ virtual
162
+ onlyComponent(msg.sender)
163
+ {
164
+ (, IInstance instance) = _getAndVerifyComponent(COMPONENT(), false);
165
+ _setLocked(instance.getInstanceAdmin(), componentAddress, locked);
161
166
  }
162
167
 
163
168
  /// @inheritdoc IComponentService
164
169
  function withdrawFees(Amount amount)
165
170
  external
166
171
  virtual
167
- restricted()
168
172
  returns (Amount withdrawnAmount)
169
173
  {
170
174
  // checks
@@ -194,7 +198,6 @@ contract ComponentService is
194
198
  componentNftId,
195
199
  withdrawnAmount);
196
200
 
197
- // transfer amount to component owner
198
201
  address componentOwner = getRegistry().ownerOf(componentNftId);
199
202
  TokenHandler tokenHandler = instanceReader.getTokenHandler(componentNftId);
200
203
  emit LogComponentServiceComponentFeesWithdrawn(
@@ -216,7 +219,6 @@ contract ComponentService is
216
219
  function registerProduct(address productAddress)
217
220
  external
218
221
  virtual
219
- restricted()
220
222
  nonReentrant()
221
223
  onlyComponent(productAddress)
222
224
  returns (NftId productNftId)
@@ -255,7 +257,6 @@ contract ComponentService is
255
257
  )
256
258
  external
257
259
  virtual
258
- restricted()
259
260
  nonReentrant()
260
261
  {
261
262
  (NftId productNftId, IInstance instance) = _getAndVerifyActiveComponent(PRODUCT());
@@ -321,7 +322,6 @@ contract ComponentService is
321
322
  )
322
323
  external
323
324
  virtual
324
- restricted()
325
325
  {
326
326
  (NftId distributionNftId, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
327
327
  (NftId productNftId, IComponents.FeeInfo memory feeInfo) = _getLinkedFeeInfo(
@@ -422,7 +422,6 @@ contract ComponentService is
422
422
  )
423
423
  external
424
424
  virtual
425
- restricted()
426
425
  {
427
426
  (NftId poolNftId, IInstance instance) = _getAndVerifyActiveComponent(POOL());
428
427
 
@@ -503,29 +502,26 @@ contract ComponentService is
503
502
  }
504
503
 
505
504
  // deploy and wire token handler
506
- address token;
507
- {
508
- IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
509
- token = address(componentInfo.token);
510
- componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
511
- address(getRegistry()),
512
- componentAddress, // initially, component is its own wallet
513
- token,
514
- address(instanceAdmin.authority()));
515
-
516
- // register component with instance
517
- instanceStore.createComponent(
518
- componentNftId,
519
- componentInfo);
520
- }
505
+ IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
506
+ IERC20Metadata token = componentInfo.token;
507
+ componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
508
+ address(getRegistry()),
509
+ address(component), // initially, component is its own wallet
510
+ address(token),
511
+ address(instanceAdmin.authority()));
512
+
513
+ // register component with instance
514
+ instanceStore.createComponent(
515
+ componentNftId,
516
+ componentInfo);
521
517
 
522
518
  // link component contract to nft id
523
519
  component.linkToRegisteredNftId();
524
520
 
525
521
  // authorize
526
- instanceAdmin.initializeComponentAuthorization(componentAddress, requiredType);
522
+ instanceAdmin.initializeComponentAuthorization(component);
527
523
 
528
- emit LogComponentServiceRegistered(instanceNftId, componentNftId, requiredType, componentAddress, token, initialOwner);
524
+ emit LogComponentServiceRegistered(instanceNftId, componentNftId, requiredType, address(component), address(token), initialOwner);
529
525
  }
530
526
 
531
527
 
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
3
3
 
4
4
  import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
5
5
  import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
6
- import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
7
6
 
8
7
  // import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
9
8
  import {IRegistry} from "../registry/IRegistry.sol";
@@ -171,33 +170,6 @@ library ContractLib {
171
170
  }
172
171
 
173
172
 
174
- function isAccessManaged(address target)
175
- public
176
- view
177
- returns (bool)
178
- {
179
- if (!isContract(target)) {
180
- return false;
181
- }
182
-
183
- (bool success, ) = target.staticcall(
184
- abi.encodeWithSelector(
185
- IAccessManaged.authority.selector));
186
-
187
- return success;
188
- }
189
-
190
-
191
- function isRegistered(address registry, address caller, ObjectType expectedType) public view returns (bool) {
192
- NftId nftId = IRegistry(registry).getNftIdForAddress(caller);
193
- if (nftId.eqz()) {
194
- return false;
195
- }
196
-
197
- return IRegistry(registry).getObjectInfo(nftId).objectType == expectedType;
198
- }
199
-
200
-
201
173
  function isRegistry(address registry) public view returns (bool) {
202
174
  if (!isContract(registry)) {
203
175
  return false;
@@ -67,12 +67,14 @@ interface IComponentService is
67
67
  /// Reverts if the component's token handler wallet is not the token handler itself.
68
68
  function approveTokenHandler(IERC20Metadata token, Amount amount) external;
69
69
 
70
- /// @dev Sets the components associated wallet address.
71
- /// To set the wallet to the token handler contract, use address(0) as the new wallet adress.
70
+ /// @dev Sets the components associated wallet address
72
71
  function setWallet(address newWallet) external;
73
72
 
74
- /// @dev Locks/Unlocks the calling component.
75
- function setLocked(bool locked) external;
73
+ /// @dev Locks/Unlocks the given component - call from instanceService
74
+ function setLockedFromInstance(address componentAddress, bool locked) external;
75
+
76
+ /// @dev Locks/Unlocks the given component - call from component
77
+ function setLockedFromComponent(address componentAddress, bool locked) external;
76
78
 
77
79
  /// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
78
80
  /// @param withdrawAmount the amount to withdraw
@@ -11,21 +11,13 @@ contract InitializableERC165 is
11
11
  mapping(bytes4 => bool) private _isSupported;
12
12
 
13
13
  // @dev initializes with support for ERC165
14
- function __ERC165_init() internal onlyInitializing() {
15
- _initializeERC165();
16
- }
17
-
18
- function _initializeERC165() internal {
14
+ function _initializeERC165() internal onlyInitializing() {
19
15
  _isSupported[type(IERC165).interfaceId] = true;
20
16
  }
21
17
 
22
18
  // @dev register support for provided interfaceId
23
19
  // includes initialization for ERC165_ID if not yet done
24
20
  function _registerInterface(bytes4 interfaceId) internal onlyInitializing() {
25
- _registerInterfaceNotInitializing(interfaceId);
26
- }
27
-
28
- function _registerInterfaceNotInitializing(bytes4 interfaceId) internal{
29
21
  _isSupported[interfaceId] = true;
30
22
  }
31
23
 
@@ -41,7 +41,6 @@ contract NftOwnable is
41
41
  }
42
42
 
43
43
  function _checkNftType(NftId nftId, ObjectType expectedObjectType) internal view {
44
- assert(expectedObjectType.gtz());
45
44
  if(!getRegistry().isObjectType(nftId, expectedObjectType)) {
46
45
  revert ErrorNftOwnableInvalidType(nftId, expectedObjectType);
47
46
  }
@@ -58,8 +57,8 @@ contract NftOwnable is
58
57
  virtual
59
58
  onlyInitializing()
60
59
  {
61
- __ERC165_init();
62
60
  __RegistryLinked_init(registry);
61
+ _initializeERC165();
63
62
 
64
63
  if(initialOwner == address(0)) {
65
64
  revert ErrorNftOwnableInitialOwnerZero();
@@ -26,6 +26,7 @@ abstract contract Registerable is
26
26
  struct RegisterableStorage {
27
27
  NftId _parentNftId;
28
28
  ObjectType _objectType;
29
+ VersionPart _release;
29
30
  bool _isInterceptor;
30
31
  bytes _data;
31
32
  }
@@ -60,6 +61,7 @@ abstract contract Registerable is
60
61
  RegisterableStorage storage $ = _getRegisterableStorage();
61
62
  $._parentNftId = parentNftId;
62
63
  $._objectType = objectType;
64
+ $._release = AccessManagerCloneable(authority).getRelease();
63
65
  $._isInterceptor = isInterceptor;
64
66
  $._data = data;
65
67
 
@@ -75,7 +77,8 @@ abstract contract Registerable is
75
77
 
76
78
  /// @inheritdoc IRelease
77
79
  function getRelease() public virtual view returns (VersionPart release) {
78
- return AccessManagerCloneable(authority()).getRelease();
80
+ RegisterableStorage storage $ = _getRegisterableStorage();
81
+ return $._release;
79
82
  }
80
83
 
81
84
 
@@ -270,12 +270,11 @@ contract TokenHandler is
270
270
  AccessManaged(authority)
271
271
  { }
272
272
 
273
- /// @dev Sets the wallet address for the component.
274
- /// Seeting the new wallet address to address(0) will set the wallet to the tokenHandler contract itself.
275
- /// If the current wallet has tokens, these will be transferred.
276
- /// If the new wallet address is externally owned, an approval from the
273
+ /// @dev sets the wallet address for the component.
274
+ /// if the current wallet has tokens, these will be transferred.
275
+ /// if the new wallet address is externally owned, an approval from the
277
276
  /// owner of the external wallet to the tokenhandler of the component that
278
- /// covers the current component balance must exist.
277
+ /// covers the current component balance must exist
279
278
  function setWallet(address newWallet)
280
279
  external
281
280
  restricted()
@@ -1,8 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
- import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
-
6
4
  import {Amount} from "../type/Amount.sol";
7
5
  import {IComponent} from "../shared/IComponent.sol";
8
6
  import {IVersionable} from "../upgradeability/IVersionable.sol";
@@ -24,7 +22,6 @@ interface IStaking is
24
22
  // target parameters
25
23
  event LogStakingLockingPeriodSet(NftId targetNftId, Seconds oldLockingPeriod, Seconds lockingPeriod);
26
24
  event LogStakingRewardRateSet(NftId targetNftId, UFixed oldRewardRate, UFixed rewardRate);
27
- event LogStakingMaxStakedAmountSet(NftId targetNftId, Amount maxStakedAmount);
28
25
 
29
26
  // modifiers
30
27
  error ErrorStakingNotStake(NftId stakeNftId);
@@ -54,8 +51,8 @@ interface IStaking is
54
51
  error ErrorStakingRewardRateTooHigh(NftId targetNftId, UFixed maxRewardRate, UFixed rewardRate);
55
52
  error ErrorStakingTargetNotFound(NftId targetNftId);
56
53
  error ErrorStakingTargetTokenNotFound(NftId targetNftId, uint256 chainId, address token);
57
- error ErrorStakingTargetMaxStakedAmountExceeded(NftId targetNftId, Amount maxStakedAmount, Amount stakedAmount);
58
54
 
55
+ error ErrorStakingTargetNotActive(NftId targetNftId);
59
56
  error ErrorStakingStakeAmountZero(NftId targetNftId);
60
57
 
61
58
  // info for individual stake
@@ -68,13 +65,10 @@ interface IStaking is
68
65
  uint256 chainId;
69
66
  Seconds lockingPeriod;
70
67
  UFixed rewardRate;
71
- Amount maxStakedAmount;
72
68
  }
73
69
 
74
70
  function initializeTokenHandler() external;
75
71
 
76
- function approveTokenHandler(IERC20Metadata token, Amount amount) external;
77
-
78
72
  // staking rate management
79
73
 
80
74
  /// @dev sets the rate that converts 1 token of total value locked into the
@@ -101,10 +95,6 @@ interface IStaking is
101
95
  /// permissioned: only the staking service may call this function
102
96
  function setRewardRate(NftId targetNftId, UFixed rewardRate) external;
103
97
 
104
- /// @dev set the maximum staked amount for the specified target.
105
- /// permissioned: only the staking service may call this function
106
- function setMaxStakedAmount(NftId targetNftId, Amount maxStakedAmount) external;
107
-
108
98
  /// @dev (re)fills the staking reward reserves for the specified target
109
99
  /// unpermissioned: anybody may fill up staking reward reserves
110
100
  function refillRewardReserves(NftId targetNftId, Amount dipAmount) external returns (Amount newBalance);
@@ -142,7 +132,7 @@ interface IStaking is
142
132
  /// @dev restakes the dips to a new target.
143
133
  /// the sum of the staked dips and the accumulated rewards will be restaked.
144
134
  /// permissioned: only staking service may call this function.
145
- function restake(NftId stakeNftId, NftId newStakeNftId) external returns (Amount newStakeBalance);
135
+ function restake(NftId stakeNftId, NftId newTargetNftId) external returns (NftId newStakeNftId);
146
136
 
147
137
  /// @dev retuns the specified amount of dips to the holder of the specified stake nft.
148
138
  /// if dipAmount is set to Amount.max() all staked dips and all rewards are transferred to
@@ -26,7 +26,6 @@ interface IStakingService is IService
26
26
  event LogStakingServiceStakeCreated(NftId stakeNftId, NftId targetNftId, address owner, Amount stakedAmount);
27
27
  event LogStakingServiceStakeIncreased(NftId stakeNftId, address owner, Amount stakedAmount, Amount stakeBalance);
28
28
  event LogStakingServiceUnstaked(NftId stakeNftId, address stakeOwner, Amount totalAmount);
29
- event LogStakingServiceStakeRestaked(address stakeOwner, NftId indexed stakeNftId, NftId newStakeNftId, NftId indexed newTargetNftId, Amount indexed newStakeBalance);
30
29
 
31
30
  event LogStakingServiceRewardsUpdated(NftId stakeNftId);
32
31
  event LogStakingServiceRewardsClaimed(NftId stakeNftId, address stakeOwner, Amount rewardsClaimedAmount);
@@ -37,7 +36,6 @@ interface IStakingService is IService
37
36
  error ErrorStakingServiceNotSupportingIStaking(address stakingAddress);
38
37
 
39
38
  // create
40
- error ErrorStakingServiceTargetUnknown(NftId targetNftId);
41
39
  error ErrorStakingServiceZeroTargetNftId();
42
40
  error ErrorStakingServiceNotTargetNftId(NftId targetNftId);
43
41
  error ErrorStakingServiceNotActiveTargetNftId(NftId targetNftId);
@@ -74,10 +72,6 @@ interface IStakingService is IService
74
72
  /// Permissioned: Only owner of the specified target.
75
73
  function setInstanceRewardRate(NftId instanceNftId, UFixed rewardRate) external;
76
74
 
77
- /// @dev Set the instance max staked amount to the specified value.
78
- /// Permissioned: Only owner of the specified target.
79
- function setInstanceMaxStakedAmount(NftId instanceNftId, Amount maxStakingAmount) external;
80
-
81
75
  /// @dev (Re)fills the staking reward reserves for the specified target using the dips provided by the reward provider.
82
76
  /// unpermissioned: anybody may fill up staking reward reserves
83
77
  function refillInstanceRewardReserves(NftId instanceNftId, address rewardProvider, Amount dipAmount) external returns (Amount newBalance);
@@ -122,8 +116,7 @@ interface IStakingService is IService
122
116
  )
123
117
  external
124
118
  returns (
125
- NftId newStakeNftId,
126
- Amount newStakeBalance
119
+ NftId newStakeNftId
127
120
  );
128
121
 
129
122
 
@@ -160,16 +153,13 @@ interface IStakingService is IService
160
153
 
161
154
  function getDipToken()
162
155
  external
163
- view
164
156
  returns (IERC20Metadata dip);
165
157
 
166
158
  function getTokenHandler()
167
159
  external
168
- view
169
160
  returns (TokenHandler tokenHandler);
170
161
 
171
162
  function getStaking()
172
163
  external
173
- view
174
164
  returns (IStaking staking);
175
165
  }
@@ -1,10 +1,16 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.20;
3
3
 
4
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
+
4
6
  import {Amount, AmountLib} from "../type/Amount.sol";
7
+ import {Component} from "../shared/Component.sol";
5
8
  import {IRegistry} from "../registry/IRegistry.sol";
9
+ import {IRegistryService} from "../registry/IRegistryService.sol";
6
10
  import {IStaking} from "./IStaking.sol";
11
+ import {Key32} from "../type/Key32.sol";
7
12
  import {NftId} from "../type/NftId.sol";
13
+ import {ObjectType, INSTANCE, PROTOCOL, TARGET} from "../type/ObjectType.sol";
8
14
  import {Seconds, SecondsLib} from "../type/Seconds.sol";
9
15
  import {StakingReader} from "./StakingReader.sol";
10
16
  import {StakingStore} from "./StakingStore.sol";
@@ -12,7 +18,7 @@ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
12
18
  import {UFixed, UFixedLib} from "../type/UFixed.sol";
13
19
 
14
20
 
15
- library StakingLib {
21
+ library StakeManagerLib {
16
22
 
17
23
  function stake(
18
24
  IRegistry registry,
@@ -46,11 +52,6 @@ library StakingLib {
46
52
  // TODO check that additional dip, rewards and rewards increment
47
53
  // are still ok with max target staking amount
48
54
  NftId targetNftId = registry.getParentNftId(stakeNftId);
49
- Amount maxStakedAmount = stakingReader.getTargetMaxStakedAmount(targetNftId);
50
-
51
- if (stakeBalance > maxStakedAmount) {
52
- revert IStaking.ErrorStakingTargetMaxStakedAmountExceeded(targetNftId, maxStakedAmount, stakeBalance);
53
- }
54
55
 
55
56
  stakingStore.restakeRewards(
56
57
  stakeNftId,
@@ -71,55 +72,6 @@ library StakingLib {
71
72
 
72
73
  }
73
74
 
74
- function restake(
75
- StakingReader stakingReader,
76
- StakingStore stakingStore,
77
- NftId oldStakeNftId,
78
- NftId newStakeNftId
79
- )
80
- external
81
- returns (Amount newStakeBalance)
82
- {
83
- checkUnstakeParameters(stakingReader, oldStakeNftId);
84
- (NftId oldTargetNftId, UFixed oldRewardRate) = stakingReader.getTargetRewardRate(oldStakeNftId);
85
-
86
- // calculate new rewards update and unstake full amount
87
- (
88
- Amount rewardIncrementAmount,
89
- ) = calculateRewardIncrease(
90
- stakingReader,
91
- oldStakeNftId,
92
- oldRewardRate);
93
- stakingStore.updateRewards(
94
- oldStakeNftId,
95
- oldTargetNftId,
96
- rewardIncrementAmount);
97
- (
98
- Amount unstakedAmount,
99
- Amount rewardsAmount
100
- ) = stakingStore.unstakeUpTo(
101
- oldStakeNftId,
102
- oldTargetNftId,
103
- AmountLib.max(), // unstake all stakes
104
- AmountLib.max()); // claim all rewards
105
-
106
- // calculate full restake amount
107
- newStakeBalance = unstakedAmount + rewardsAmount;
108
- NftId newTargetNftId = stakingReader.getTargetNftId(newStakeNftId);
109
-
110
- // create new staking target and increase stake
111
- Timestamp newLockedUntil = _checkCreateParameters(stakingReader, newTargetNftId, newStakeBalance);
112
- stakingStore.create(
113
- newStakeNftId,
114
- IStaking.StakeInfo({
115
- lockedUntil: newLockedUntil
116
- }));
117
- stakingStore.increaseStake(
118
- newStakeNftId,
119
- newTargetNftId,
120
- newStakeBalance);
121
- }
122
-
123
75
  function checkCreateParameters(
124
76
  StakingReader stakingReader,
125
77
  NftId targetNftId,
@@ -130,19 +82,6 @@ library StakingLib {
130
82
  returns (
131
83
  Timestamp lockedUntil
132
84
  )
133
- {
134
- return _checkCreateParameters(stakingReader, targetNftId, dipAmount);
135
- }
136
-
137
- function _checkCreateParameters(
138
- StakingReader stakingReader,
139
- NftId targetNftId,
140
- Amount dipAmount
141
- )
142
- internal view
143
- returns (
144
- Timestamp lockedUntil
145
- )
146
85
  {
147
86
  Seconds lockingPeriod = checkTarget(stakingReader, targetNftId);
148
87
  checkDipAmount(stakingReader, targetNftId, dipAmount);
@@ -165,11 +104,11 @@ library StakingLib {
165
104
  {
166
105
  NftId targetNftId = stakingReader.getTargetNftId(stakeNftId);
167
106
 
168
- // target nft id must be registered
169
- if (!stakingReader.isTarget(targetNftId)) {
170
- revert IStaking.ErrorStakingNotTarget(targetNftId);
107
+ // only accept stakes for active targets
108
+ if (!stakingReader.isActive(targetNftId)) {
109
+ revert IStaking.ErrorStakingTargetNotActive(targetNftId);
171
110
  }
172
-
111
+
173
112
  IStaking.TargetInfo memory info = stakingReader.getTargetInfo(targetNftId);
174
113
  rewardRate = info.rewardRate;
175
114
  lockingPeriod = info.lockingPeriod;
@@ -182,11 +121,12 @@ library StakingLib {
182
121
  public
183
122
  view
184
123
  returns (
124
+ UFixed rewardRate,
185
125
  Seconds lockingPeriod
186
126
  )
187
127
  {
188
128
  IStaking.StakeInfo memory stakeInfo = stakingReader.getStakeInfo(stakeNftId);
189
-
129
+
190
130
  if (stakeInfo.lockedUntil > TimestampLib.blockTimestamp()) {
191
131
  revert IStaking.ErrorStakingStakeLocked(stakeNftId, stakeInfo.lockedUntil);
192
132
  }
@@ -206,6 +146,11 @@ library StakingLib {
206
146
  revert IStaking.ErrorStakingNotTarget(targetNftId);
207
147
  }
208
148
 
149
+ // only accept stakes for active targets
150
+ if (!stakingReader.isActive(targetNftId)) {
151
+ revert IStaking.ErrorStakingTargetNotActive(targetNftId);
152
+ }
153
+
209
154
  lockingPeriod = stakingReader.getTargetInfo(targetNftId).lockingPeriod;
210
155
  }
211
156
 
@@ -216,17 +161,14 @@ library StakingLib {
216
161
  Amount dipAmount
217
162
  )
218
163
  public
219
- view
164
+ pure
220
165
  {
221
166
  // check stake amount > 0
222
167
  if (dipAmount.eqz()) {
223
168
  revert IStaking.ErrorStakingStakeAmountZero(targetNftId);
224
169
  }
225
170
 
226
- Amount maxStakedAmount = stakingReader.getTargetMaxStakedAmount(targetNftId);
227
- if (dipAmount > maxStakedAmount) {
228
- revert IStaking.ErrorStakingTargetMaxStakedAmountExceeded(targetNftId, maxStakedAmount, dipAmount);
229
- }
171
+ // TODO add check for target specific max dip amount (min stake + tvl * stake rate + buffer)
230
172
  }
231
173
 
232
174
  function calculateRewardIncrease(
@@ -254,10 +196,11 @@ library StakingLib {
254
196
  rewardRate,
255
197
  duration,
256
198
  stakeAmount);
257
-
199
+
258
200
  totalDipAmount = stakeAmount + rewardAmount + rewardIncreaseAmount;
259
201
  }
260
202
 
203
+
261
204
  function calculateRewardAmount(
262
205
  UFixed rewardRate,
263
206
  Seconds duration,