@etherisc/gif-next 0.0.2-9a680f3-735 → 0.0.2-9aa0884-641

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 (356) hide show
  1. package/README.md +53 -0
  2. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
  3. package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +8 -8
  4. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
  5. package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +40 -40
  6. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
  7. package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +6 -6
  8. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
  9. package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +33 -33
  10. package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
  11. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +1 -1
  12. package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +18 -18
  13. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
  14. package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +2 -2
  15. package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
  16. package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +19 -19
  17. package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
  18. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
  19. package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +5 -5
  20. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
  21. package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +5 -5
  22. package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
  23. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
  24. package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
  25. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
  26. package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +32 -145
  27. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
  28. package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +20 -20
  29. package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
  30. package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +1 -87
  31. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
  32. package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +160 -89
  33. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
  34. package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +70 -66
  35. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
  36. package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +1 -87
  37. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
  38. package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +68 -5
  39. package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
  40. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
  41. package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +44 -74
  42. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
  43. package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +20 -20
  44. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
  45. package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +89 -119
  46. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
  47. package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +20 -20
  48. package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
  49. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
  50. package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +82 -173
  51. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
  52. package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +20 -20
  53. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
  54. package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +18 -61
  55. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
  56. package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +69 -112
  57. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
  58. package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +20 -20
  59. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
  60. package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +93 -136
  61. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
  62. package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +20 -20
  63. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
  64. package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
  65. package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
  66. package/artifacts/contracts/instance/IInstance.sol/IInstance.json +33 -2
  67. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
  68. package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +21 -2
  69. package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
  70. package/artifacts/contracts/instance/Instance.sol/Instance.json +50 -14
  71. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
  72. package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +81 -81
  73. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
  74. package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +26 -26
  75. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
  76. package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +225 -196
  77. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
  78. package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +47 -28
  79. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
  80. package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -37
  81. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
  82. package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +356 -346
  83. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
  84. package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
  85. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
  86. package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
  87. package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
  88. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
  89. package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
  90. package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
  91. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
  92. package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
  93. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
  94. package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +20 -20
  95. package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
  96. package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
  97. package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
  98. package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
  99. package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
  100. package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
  101. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
  102. package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +10 -31
  103. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
  104. package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +20 -20
  105. package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
  106. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
  107. package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +0 -21
  108. package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
  109. package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
  110. package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +0 -21
  111. package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
  112. package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +32 -32
  113. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
  114. package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +45 -45
  115. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
  116. package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +22 -43
  117. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
  118. package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +20 -20
  119. package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
  120. package/artifacts/contracts/pool/BundleService.sol/BundleService.json +60 -60
  121. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
  122. package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +53 -53
  123. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
  124. package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +6 -6
  125. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
  126. package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +10 -31
  127. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
  128. package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +18 -18
  129. package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
  130. package/artifacts/contracts/pool/Pool.sol/Pool.json +10 -31
  131. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
  132. package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +34 -34
  133. package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
  134. package/artifacts/contracts/pool/PoolService.sol/PoolService.json +42 -42
  135. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
  136. package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +55 -55
  137. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
  138. package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +78 -12
  139. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
  140. package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +48 -36
  141. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
  142. package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +27 -48
  143. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
  144. package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +20 -20
  145. package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
  146. package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +64 -64
  147. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
  148. package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +63 -63
  149. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
  150. package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +42 -0
  151. package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
  152. package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
  153. package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
  154. package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +21 -0
  155. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
  156. package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +21 -42
  157. package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
  158. package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +21 -0
  159. package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
  160. package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +60 -60
  161. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
  162. package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +32 -32
  163. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
  164. package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +55 -55
  165. package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
  166. package/artifacts/contracts/product/PricingService.sol/PricingService.json +53 -72
  167. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
  168. package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +45 -65
  169. package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
  170. package/artifacts/contracts/product/Product.sol/Product.json +21 -42
  171. package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
  172. package/artifacts/contracts/product/RiskService.sol/RiskService.json +47 -18
  173. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
  174. package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +41 -37
  175. package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
  176. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
  177. package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +15 -15
  178. package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
  179. package/artifacts/contracts/registry/IRelease.sol/IRelease.dbg.json +1 -1
  180. package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
  181. package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
  182. package/artifacts/contracts/registry/Registry.sol/Registry.json +17 -17
  183. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
  184. package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +83 -83
  185. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +1 -1
  186. package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +31 -31
  187. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
  188. package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
  189. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
  190. package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +33 -33
  191. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
  192. package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +91 -91
  193. package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
  194. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
  195. package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +88 -88
  196. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
  197. package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
  198. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
  199. package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -14
  200. package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
  201. package/artifacts/contracts/shared/Component.sol/Component.json +0 -21
  202. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
  203. package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +105 -81
  204. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
  205. package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +59 -55
  206. package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
  207. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
  208. package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +2 -2
  209. package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
  210. package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
  211. package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
  212. package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
  213. package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -21
  214. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
  215. package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +43 -27
  216. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
  217. package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -21
  218. package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
  219. package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
  220. package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
  221. package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
  222. package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
  223. package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
  224. package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
  225. package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
  226. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
  227. package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -21
  228. package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
  229. package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
  230. package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
  231. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
  232. package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
  233. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
  234. package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
  235. package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
  236. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
  237. package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
  238. package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
  239. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
  240. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
  241. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
  242. package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
  243. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
  244. package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
  245. package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
  246. package/artifacts/contracts/staking/IStaking.sol/IStaking.json +67 -30
  247. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
  248. package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +22 -4
  249. package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
  250. package/artifacts/contracts/staking/Staking.sol/Staking.json +131 -89
  251. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +1 -1
  252. package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +70 -41
  253. package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
  254. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
  255. package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +50 -50
  256. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
  257. package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +40 -16
  258. package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
  259. package/artifacts/contracts/staking/StakingService.sol/StakingService.json +50 -32
  260. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
  261. package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +38 -38
  262. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
  263. package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +162 -148
  264. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
  265. package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +59 -49
  266. package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
  267. package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
  268. package/artifacts/contracts/type/Amount.sol/AmountLib.json +10 -10
  269. package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
  270. package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
  271. package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
  272. package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
  273. package/artifacts/contracts/type/Fee.sol/FeeLib.json +93 -37
  274. package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
  275. package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
  276. package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
  277. package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
  278. package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
  279. package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
  280. package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
  281. package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
  282. package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
  283. package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
  284. package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
  285. package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
  286. package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
  287. package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
  288. package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
  289. package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
  290. package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
  291. package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +60 -36
  292. package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
  293. package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
  294. package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
  295. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
  296. package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +18 -18
  297. package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
  298. package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
  299. package/contracts/accounting/IAccountingService.sol +2 -2
  300. package/contracts/authorization/IAccess.sol +13 -5
  301. package/contracts/distribution/BasicDistribution.sol +6 -6
  302. package/contracts/distribution/Distribution.sol +3 -48
  303. package/contracts/distribution/DistributionService.sol +57 -30
  304. package/contracts/distribution/IDistributionComponent.sol +0 -9
  305. package/contracts/distribution/IDistributionService.sol +4 -2
  306. package/contracts/examples/fire/FirePool.sol +0 -4
  307. package/contracts/examples/fire/FireProduct.sol +0 -4
  308. package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
  309. package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
  310. package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
  311. package/contracts/examples/unpermissioned/SimpleProduct.sol +0 -4
  312. package/contracts/instance/IInstance.sol +6 -3
  313. package/contracts/instance/IInstanceService.sol +6 -1
  314. package/contracts/instance/Instance.sol +18 -3
  315. package/contracts/instance/InstanceReader.sol +13 -0
  316. package/contracts/instance/InstanceService.sol +23 -14
  317. package/contracts/instance/module/IBundle.sol +6 -5
  318. package/contracts/instance/module/IComponents.sol +16 -5
  319. package/contracts/instance/module/IDistribution.sol +19 -7
  320. package/contracts/instance/module/IPolicy.sol +28 -8
  321. package/contracts/instance/module/IRisk.sol +2 -0
  322. package/contracts/oracle/BasicOracle.sol +1 -3
  323. package/contracts/oracle/IOracle.sol +9 -4
  324. package/contracts/oracle/Oracle.sol +0 -2
  325. package/contracts/pool/BasicPool.sol +0 -2
  326. package/contracts/pool/Pool.sol +0 -2
  327. package/contracts/pool/PoolService.sol +1 -3
  328. package/contracts/product/ApplicationService.sol +21 -6
  329. package/contracts/product/BasicProduct.sol +0 -2
  330. package/contracts/product/IApplicationService.sol +3 -0
  331. package/contracts/product/IPricingService.sol +1 -0
  332. package/contracts/product/IRiskService.sol +3 -0
  333. package/contracts/product/PricingService.sol +11 -6
  334. package/contracts/product/Product.sol +0 -2
  335. package/contracts/product/RiskService.sol +10 -0
  336. package/contracts/registry/IRegistry.sol +4 -0
  337. package/contracts/registry/IRelease.sol +6 -3
  338. package/contracts/registry/RegistryAuthorization.sol +1 -0
  339. package/contracts/registry/ServiceAuthorizationV3.sol +2 -0
  340. package/contracts/registry/TokenRegistry.sol +4 -1
  341. package/contracts/shared/Component.sol +8 -25
  342. package/contracts/shared/ComponentService.sol +34 -15
  343. package/contracts/shared/IComponent.sol +0 -3
  344. package/contracts/shared/IComponentService.sol +5 -3
  345. package/contracts/shared/InstanceLinkedComponent.sol +0 -2
  346. package/contracts/staking/IStaking.sol +13 -2
  347. package/contracts/staking/IStakingService.sol +4 -0
  348. package/contracts/staking/Staking.sol +19 -3
  349. package/contracts/staking/StakingLib.sol +10 -2
  350. package/contracts/staking/StakingReader.sol +5 -0
  351. package/contracts/staking/StakingService.sol +11 -0
  352. package/contracts/staking/StakingStore.sol +2 -1
  353. package/contracts/type/Fee.sol +8 -8
  354. package/contracts/type/UFixed.sol +27 -10
  355. package/contracts/upgradeability/ProxyManager.sol +11 -9
  356. package/package.json +1 -1
@@ -11,13 +11,16 @@ import {VersionPart} from "../type/Version.sol";
11
11
  interface IRelease {
12
12
 
13
13
  struct ReleaseInfo {
14
+ // slot 0
15
+ address releaseAdmin;
14
16
  StateId state;
15
17
  VersionPart version;
16
- bytes32 salt;
17
- IServiceAuthorization auth;
18
- address releaseAdmin;
19
18
  Timestamp activatedAt;
20
19
  Timestamp disabledAt;
20
+ // slot 1
21
+ IServiceAuthorization auth;
22
+ // slot 2
23
+ bytes32 salt;
21
24
  }
22
25
 
23
26
  /// @dev Registers a registry contract for a specified chain.
@@ -206,6 +206,7 @@ contract RegistryAuthorization
206
206
  _authorize(functions, IStaking.registerTarget.selector, "registerTarget");
207
207
  _authorize(functions, IStaking.setLockingPeriod.selector, "setLockingPeriod");
208
208
  _authorize(functions, IStaking.setRewardRate.selector, "setRewardRate");
209
+ _authorize(functions, IStaking.setMaxStakedAmount.selector, "setMaxStakedAmount");
209
210
  _authorize(functions, IStaking.refillRewardReserves.selector, "refillRewardReserves");
210
211
  _authorize(functions, IStaking.withdrawRewardReserves.selector, "withdrawRewardReserves");
211
212
  _authorize(functions, IStaking.createStake.selector, "createStake");
@@ -111,6 +111,7 @@ contract ServiceAuthorizationV3
111
111
  _authorize(functions, IStakingService.createInstanceTarget.selector, "createInstanceTarget");
112
112
  _authorize(functions, IStakingService.setInstanceLockingPeriod.selector, "setInstanceLockingPeriod");
113
113
  _authorize(functions, IStakingService.setInstanceRewardRate.selector, "setInstanceRewardRate");
114
+ _authorize(functions, IStakingService.setInstanceMaxStakedAmount.selector, "setInstanceMaxStakedAmount");
114
115
  _authorize(functions, IStakingService.refillInstanceRewardReserves.selector, "refillInstanceRewardReserves");
115
116
  _authorize(functions, IStakingService.withdrawInstanceRewardReserves.selector, "withdrawInstanceRewardReserves");
116
117
 
@@ -139,6 +140,7 @@ contract ServiceAuthorizationV3
139
140
 
140
141
  _authorize(functions, IInstanceService.setStakingLockingPeriod.selector, "setStakingLockingPeriod");
141
142
  _authorize(functions, IInstanceService.setStakingRewardRate.selector, "setStakingRewardRate");
143
+ _authorize(functions, IInstanceService.setStakingMaxAmount.selector, "setStakingMaxAmount");
142
144
  _authorize(functions, IInstanceService.refillStakingRewardReserves.selector, "refillStakingRewardReserves");
143
145
  _authorize(functions, IInstanceService.withdrawStakingRewardReserves.selector, "withdrawStakingRewardReserves");
144
146
  }
@@ -35,10 +35,13 @@ contract TokenRegistry is
35
35
  error ErrorTokenRegistryMajorVersionInvalid(VersionPart majorVersion);
36
36
 
37
37
  struct TokenInfo {
38
+ // slot 0
38
39
  uint256 chainId;
40
+ // slot 1
41
+ string symbol;
42
+ // slot 2
39
43
  address token;
40
44
  uint8 decimals;
41
- string symbol;
42
45
  bool active;
43
46
  }
44
47
 
@@ -5,17 +5,14 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
5
5
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
6
 
7
7
  import {Amount} from "../type/Amount.sol";
8
- import {ContractLib} from "./ContractLib.sol";
9
8
  import {IComponent} from "./IComponent.sol";
10
9
  import {IComponents} from "../instance/module/IComponents.sol";
11
10
  import {IComponentService} from "./IComponentService.sol";
12
- import {IRegistry} from "../registry/IRegistry.sol";
13
- import {IRelease} from "../registry/IRelease.sol";
14
11
  import {NftId} from "../type/NftId.sol";
15
- import {ObjectType, COMPONENT, STAKING} from "../type/ObjectType.sol";
12
+ import {ObjectType, COMPONENT} from "../type/ObjectType.sol";
16
13
  import {Registerable} from "../shared/Registerable.sol";
17
14
  import {TokenHandler} from "../shared/TokenHandler.sol";
18
- import {Version, VersionLib, VersionPart} from "../type/Version.sol";
15
+ import {Version, VersionLib} from "../type/Version.sol";
19
16
 
20
17
 
21
18
  abstract contract Component is
@@ -27,7 +24,6 @@ abstract contract Component is
27
24
 
28
25
  struct ComponentStorage {
29
26
  string _name; // unique (per instance) component name
30
- IERC20Metadata _token; // token for this component
31
27
  bool _isInterceptor;
32
28
  bytes _data;
33
29
  IComponentService _componentService;
@@ -43,6 +39,7 @@ abstract contract Component is
43
39
 
44
40
 
45
41
  function _getComponentStorage() private pure returns (ComponentStorage storage $) {
42
+ // solhint-disable-next-line no-inline-assembly
46
43
  assembly {
47
44
  $.slot := COMPONENT_LOCATION_V1
48
45
  }
@@ -54,7 +51,6 @@ abstract contract Component is
54
51
  address registry,
55
52
  NftId parentNftId,
56
53
  string memory name,
57
- address token,
58
54
  ObjectType componentType,
59
55
  bool isInterceptor,
60
56
  address initialOwner,
@@ -65,20 +61,6 @@ abstract contract Component is
65
61
  virtual
66
62
  onlyInitializing()
67
63
  {
68
- address tokenRegistry = IRegistry(registry).getTokenRegistryAddress();
69
- VersionPart release = IRelease(authority).getRelease();
70
-
71
- // special case for staking: component intitialization happens before
72
- // GIF core contract setup is complete. at that time token registry
73
- // is not yet available. therefore we skip the check for staking.
74
- if (componentType != STAKING()) {
75
-
76
- // check if provided token is whitelisted and active
77
- if (!ContractLib.isActiveToken(tokenRegistry, token, block.chainid, release)) {
78
- revert ErrorComponentTokenInvalid(token);
79
- }
80
- }
81
-
82
64
  if (bytes(name).length == 0) {
83
65
  revert ErrorComponentNameLengthZero();
84
66
  }
@@ -95,7 +77,6 @@ abstract contract Component is
95
77
  // set component state
96
78
  ComponentStorage storage $ = _getComponentStorage();
97
79
  $._name = name;
98
- $._token = IERC20Metadata(token);
99
80
  $._isInterceptor = isInterceptor;
100
81
  $._data = componentData;
101
82
  $._componentService = IComponentService(_getServiceAddress(COMPONENT()));
@@ -125,7 +106,7 @@ abstract contract Component is
125
106
  }
126
107
 
127
108
  function getToken() public view virtual returns (IERC20Metadata token) {
128
- return getComponentInfo().token;
109
+ return getTokenHandler().TOKEN();
129
110
  }
130
111
 
131
112
  function getName() public view override returns(string memory name) {
@@ -183,7 +164,10 @@ abstract contract Component is
183
164
  function _nftTransferFrom(address from, address to, uint256 tokenId, address operator)
184
165
  internal
185
166
  virtual
186
- { }
167
+ // solhint-disable-next-line no-empty-blocks
168
+ {
169
+ // empty default implementation
170
+ }
187
171
 
188
172
 
189
173
  /// @dev Sets the components wallet to the specified address.
@@ -213,7 +197,6 @@ abstract contract Component is
213
197
 
214
198
  return IComponents.ComponentInfo({
215
199
  name: $._name,
216
- token: $._token,
217
200
  tokenHandler: TokenHandler(address(0)),
218
201
  data: $._data // user specific component data
219
202
  });
@@ -19,6 +19,7 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
19
19
  import {IRegistry} from "../registry/IRegistry.sol";
20
20
  import {IRegistryService} from "../registry/IRegistryService.sol";
21
21
 
22
+ import {AccessManagerCloneable} from "../authorization/AccessManagerCloneable.sol";
22
23
  import {Amount, AmountLib} from "../type/Amount.sol";
23
24
  import {ContractLib} from "../shared/ContractLib.sol";
24
25
  import {Fee, FeeLib} from "../type/Fee.sol";
@@ -98,15 +99,18 @@ contract ComponentService is
98
99
  returns (NftId componentNftId)
99
100
  {
100
101
  // type specific registration
101
- ObjectType componentType = IInstanceLinkedComponent(component).getInitialInfo().objectType;
102
+ IRegistry.ObjectInfo memory componentObjectInfo = IInstanceLinkedComponent(component).getInitialInfo();
103
+ ObjectType componentType = componentObjectInfo.objectType;
104
+ IComponent productComponent = IComponent(getRegistry().getObjectAddress(componentObjectInfo.parentNftId));
105
+
102
106
  if (componentType == POOL()) {
103
- return _registerPool(component);
107
+ return _registerPool(component, address(productComponent.getToken()));
104
108
  }
105
109
  if (componentType == DISTRIBUTION()) {
106
- return _registerDistribution(component);
110
+ return _registerDistribution(component, address(productComponent.getToken()));
107
111
  }
108
112
  if (componentType == ORACLE()) {
109
- return _registerOracle(component);
113
+ return _registerOracle(component, address(productComponent.getToken()));
110
114
  }
111
115
 
112
116
  // fail
@@ -210,7 +214,7 @@ contract ComponentService is
210
214
 
211
215
  //-------- product ------------------------------------------------------//
212
216
 
213
- function registerProduct(address productAddress)
217
+ function registerProduct(address productAddress, address token)
214
218
  external
215
219
  virtual
216
220
  nonReentrant()
@@ -222,7 +226,8 @@ contract ComponentService is
222
226
  InstanceStore instanceStore;
223
227
  (, instanceAdmin, instanceStore,, productNftId) = _register(
224
228
  productAddress,
225
- PRODUCT());
229
+ PRODUCT(),
230
+ token);
226
231
 
227
232
  // get product
228
233
  IProductComponent product = IProductComponent(productAddress);
@@ -280,7 +285,7 @@ contract ComponentService is
280
285
  //-------- distribution -------------------------------------------------//
281
286
 
282
287
  /// @dev registers the sending component as a distribution component
283
- function _registerDistribution(address distributioAddress)
288
+ function _registerDistribution(address distributioAddress, address token)
284
289
  internal
285
290
  virtual
286
291
  nonReentrant()
@@ -293,7 +298,8 @@ contract ComponentService is
293
298
  NftId productNftId;
294
299
  (instanceReader, instanceAdmin, instanceStore, productNftId, distributionNftId) = _register(
295
300
  distributioAddress,
296
- DISTRIBUTION());
301
+ DISTRIBUTION(),
302
+ token);
297
303
 
298
304
  // check product is still expecting a distribution registration
299
305
  IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
@@ -344,7 +350,7 @@ contract ComponentService is
344
350
 
345
351
  //-------- oracle -------------------------------------------------------//
346
352
 
347
- function _registerOracle(address oracleAddress)
353
+ function _registerOracle(address oracleAddress, address token)
348
354
  internal
349
355
  virtual
350
356
  returns (NftId oracleNftId)
@@ -357,7 +363,8 @@ contract ComponentService is
357
363
 
358
364
  (instanceReader, instanceAdmin, instanceStore, productNftId, oracleNftId) = _register(
359
365
  oracleAddress,
360
- ORACLE());
366
+ ORACLE(),
367
+ token);
361
368
 
362
369
  // check product is still expecting an oracle registration
363
370
  IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
@@ -376,7 +383,7 @@ contract ComponentService is
376
383
 
377
384
  //-------- pool ---------------------------------------------------------//
378
385
 
379
- function _registerPool(address poolAddress)
386
+ function _registerPool(address poolAddress, address token)
380
387
  internal
381
388
  virtual
382
389
  returns (NftId poolNftId)
@@ -389,7 +396,8 @@ contract ComponentService is
389
396
 
390
397
  (instanceReader, instanceAdmin, instanceStore, productNftId, poolNftId) = _register(
391
398
  poolAddress,
392
- POOL());
399
+ POOL(),
400
+ token);
393
401
 
394
402
  // check product is still expecting a pool registration
395
403
  IComponents.ProductInfo memory productInfo = instanceReader.getProductInfo(productNftId);
@@ -453,7 +461,8 @@ contract ComponentService is
453
461
  /// @dev Registers the component represented by the provided address.
454
462
  function _register(
455
463
  address componentAddress, // address of component to register
456
- ObjectType requiredType // required type for component for registration
464
+ ObjectType requiredType, // required type for component for registration
465
+ address token
457
466
  )
458
467
  internal
459
468
  virtual
@@ -481,6 +490,18 @@ contract ComponentService is
481
490
  componentAddress,
482
491
  requiredType);
483
492
 
493
+ if (! instance.isTokenRegistryDisabled()) {
494
+ // check if provided token is whitelisted and active
495
+ if (!ContractLib.isActiveToken(
496
+ getRegistry().getTokenRegistryAddress(),
497
+ token,
498
+ block.chainid,
499
+ AccessManagerCloneable(authority()).getRelease())
500
+ ) {
501
+ revert ErrorComponentServiceTokenInvalid(token);
502
+ }
503
+ }
504
+
484
505
  // get instance supporting contracts (as function return values)
485
506
  instanceReader = instance.getInstanceReader();
486
507
  instanceAdmin = instance.getInstanceAdmin();
@@ -496,10 +517,8 @@ contract ComponentService is
496
517
  }
497
518
 
498
519
  // deploy and wire token handler
499
- address token;
500
520
  {
501
521
  IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
502
- token = address(componentInfo.token);
503
522
  componentInfo.tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
504
523
  address(getRegistry()),
505
524
  componentAddress, // initially, component is its own wallet
@@ -15,9 +15,6 @@ interface IComponent is
15
15
  IRegisterable,
16
16
  ITransferInterceptor
17
17
  {
18
-
19
- error ErrorComponentTokenInvalid(address token);
20
-
21
18
  error ErrorComponentProductNftIdZero();
22
19
  error ErrorComponentProductNftIdNonzero();
23
20
  error ErrorComponentNameLengthZero();
@@ -16,6 +16,8 @@ import {VersionPart} from "../type/Version.sol";
16
16
  interface IComponentService is
17
17
  IService
18
18
  {
19
+ error ErrorComponentServiceTokenInvalid(address token);
20
+
19
21
  error ErrorComponentServiceNotInstanceLinkedComponent(address component);
20
22
  error ErrorComponentServiceSenderNotRegistered(address sender);
21
23
  error ErrorComponentServiceNotComponent(address component);
@@ -56,9 +58,9 @@ interface IComponentService is
56
58
  NftId nftId,
57
59
  string feeName,
58
60
  UFixed previousFractionalFee,
59
- uint256 previousFixedFee,
61
+ Amount previousFixedFee,
60
62
  UFixed newFractionalFee,
61
- uint256 newFixedFee
63
+ Amount newFixedFee
62
64
  );
63
65
 
64
66
  //-------- component ----------------------------------------------------//
@@ -85,7 +87,7 @@ interface IComponentService is
85
87
  //-------- product ------------------------------------------------------//
86
88
 
87
89
  /// @dev Registers the specified product component for the instance (sender)
88
- function registerProduct(address product) external returns (NftId productNftId);
90
+ function registerProduct(address product, address token) external returns (NftId productNftId);
89
91
 
90
92
  function setProductFees(
91
93
  Fee memory productFee, // product fee on net premium
@@ -71,7 +71,6 @@ abstract contract InstanceLinkedComponent is
71
71
  address registry,
72
72
  NftId parentNftId,
73
73
  string memory name,
74
- address token,
75
74
  ObjectType componentType,
76
75
  IAuthorization authorization,
77
76
  bool isInterceptor,
@@ -99,7 +98,6 @@ abstract contract InstanceLinkedComponent is
99
98
  registry,
100
99
  parentNftId,
101
100
  name,
102
- token,
103
101
  componentType,
104
102
  isInterceptor,
105
103
  initialOwner,
@@ -24,6 +24,7 @@ interface IStaking is
24
24
  // target parameters
25
25
  event LogStakingLockingPeriodSet(NftId targetNftId, Seconds oldLockingPeriod, Seconds lockingPeriod);
26
26
  event LogStakingRewardRateSet(NftId targetNftId, UFixed oldRewardRate, UFixed rewardRate);
27
+ event LogStakingMaxStakedAmountSet(NftId targetNftId, Amount maxStakedAmount);
27
28
 
28
29
  // modifiers
29
30
  error ErrorStakingNotStake(NftId stakeNftId);
@@ -53,19 +54,25 @@ interface IStaking is
53
54
  error ErrorStakingRewardRateTooHigh(NftId targetNftId, UFixed maxRewardRate, UFixed rewardRate);
54
55
  error ErrorStakingTargetNotFound(NftId targetNftId);
55
56
  error ErrorStakingTargetTokenNotFound(NftId targetNftId, uint256 chainId, address token);
57
+ error ErrorStakingTargetMaxStakedAmountExceeded(NftId targetNftId, Amount maxStakedAmount, Amount stakedAmount);
56
58
 
57
59
  error ErrorStakingStakeAmountZero(NftId targetNftId);
58
60
 
59
61
  // info for individual stake
60
62
  struct StakeInfo {
63
+ // slot 0
61
64
  Timestamp lockedUntil;
62
65
  }
63
66
 
64
67
  struct TargetInfo {
68
+ // Slot 0
69
+ UFixed rewardRate;
70
+ Amount maxStakedAmount;
71
+ // Slot 1
65
72
  ObjectType objectType;
66
- uint256 chainId;
67
73
  Seconds lockingPeriod;
68
- UFixed rewardRate;
74
+ // Slot 2
75
+ uint256 chainId;
69
76
  }
70
77
 
71
78
  function initializeTokenHandler() external;
@@ -98,6 +105,10 @@ interface IStaking is
98
105
  /// permissioned: only the staking service may call this function
99
106
  function setRewardRate(NftId targetNftId, UFixed rewardRate) external;
100
107
 
108
+ /// @dev set the maximum staked amount for the specified target.
109
+ /// permissioned: only the staking service may call this function
110
+ function setMaxStakedAmount(NftId targetNftId, Amount maxStakedAmount) external;
111
+
101
112
  /// @dev (re)fills the staking reward reserves for the specified target
102
113
  /// unpermissioned: anybody may fill up staking reward reserves
103
114
  function refillRewardReserves(NftId targetNftId, Amount dipAmount) external returns (Amount newBalance);
@@ -74,6 +74,10 @@ interface IStakingService is IService
74
74
  /// Permissioned: Only owner of the specified target.
75
75
  function setInstanceRewardRate(NftId instanceNftId, UFixed rewardRate) external;
76
76
 
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
+
77
81
  /// @dev (Re)fills the staking reward reserves for the specified target using the dips provided by the reward provider.
78
82
  /// unpermissioned: anybody may fill up staking reward reserves
79
83
  function refillInstanceRewardReserves(NftId instanceNftId, address rewardProvider, Amount dipAmount) external returns (Amount newBalance);
@@ -70,10 +70,11 @@ contract Staking is
70
70
  }
71
71
 
72
72
  StakingStorage storage $ = _getStakingStorage();
73
+ address dipToken = _getStakingStorage()._tokenRegistry.getDipTokenAddress();
73
74
  $._tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
74
75
  address(getRegistry()),
75
76
  address(this),
76
- address(getToken()),
77
+ dipToken,
77
78
  getRegistry().getAuthority());
78
79
  }
79
80
 
@@ -146,7 +147,8 @@ contract Staking is
146
147
  objectType: expectedObjectType,
147
148
  chainId: chainId,
148
149
  lockingPeriod: initialLockingPeriod,
149
- rewardRate: initialRewardRate}));
150
+ rewardRate: initialRewardRate,
151
+ maxStakedAmount: AmountLib.max()}));
150
152
  }
151
153
 
152
154
 
@@ -194,6 +196,21 @@ contract Staking is
194
196
  emit LogStakingRewardRateSet(targetNftId, oldRewardRate, rewardRate);
195
197
  }
196
198
 
199
+ function setMaxStakedAmount(NftId targetNftId, Amount maxStakedAmount)
200
+ external
201
+ virtual
202
+ restricted()
203
+ onlyTarget(targetNftId)
204
+ {
205
+ IStaking.TargetInfo memory targetInfo = getStakingReader().getTargetInfo(targetNftId);
206
+
207
+ targetInfo.maxStakedAmount = maxStakedAmount;
208
+
209
+ _getStakingStorage()._store.updateTarget(targetNftId, targetInfo);
210
+
211
+ emit LogStakingMaxStakedAmountSet(targetNftId, maxStakedAmount);
212
+ }
213
+
197
214
 
198
215
  function refillRewardReserves(NftId targetNftId, Amount dipAmount)
199
216
  external
@@ -511,7 +528,6 @@ contract Staking is
511
528
  registryAddress,
512
529
  registry.getNftId(), // parent nft id
513
530
  CONTRACT_NAME,
514
- dipTokenAddress,
515
531
  STAKING(),
516
532
  false, // is interceptor
517
533
  stakingOwner,
@@ -46,6 +46,11 @@ library StakingLib {
46
46
  // TODO check that additional dip, rewards and rewards increment
47
47
  // are still ok with max target staking amount
48
48
  NftId targetNftId = registry.getParentNftId(stakeNftId);
49
+ Amount maxStakedAmount = stakingReader.getTargetMaxStakedAmount(targetNftId);
50
+
51
+ if (stakeBalance > maxStakedAmount) {
52
+ revert IStaking.ErrorStakingTargetMaxStakedAmountExceeded(targetNftId, maxStakedAmount, stakeBalance);
53
+ }
49
54
 
50
55
  stakingStore.restakeRewards(
51
56
  stakeNftId,
@@ -211,14 +216,17 @@ library StakingLib {
211
216
  Amount dipAmount
212
217
  )
213
218
  public
214
- pure
219
+ view
215
220
  {
216
221
  // check stake amount > 0
217
222
  if (dipAmount.eqz()) {
218
223
  revert IStaking.ErrorStakingStakeAmountZero(targetNftId);
219
224
  }
220
225
 
221
- // TODO add check for target specific max dip amount (min stake + tvl * stake rate + buffer)
226
+ Amount maxStakedAmount = stakingReader.getTargetMaxStakedAmount(targetNftId);
227
+ if (dipAmount > maxStakedAmount) {
228
+ revert IStaking.ErrorStakingTargetMaxStakedAmountExceeded(targetNftId, maxStakedAmount, dipAmount);
229
+ }
222
230
  }
223
231
 
224
232
  function calculateRewardIncrease(
@@ -104,6 +104,11 @@ contract StakingReader is
104
104
  rewardRate = getTargetInfo(targetNftId).rewardRate;
105
105
  }
106
106
 
107
+ /// @dev get the max staked amount allowed for the specified target nft id.
108
+ function getTargetMaxStakedAmount(NftId targetNftId) external view returns (Amount maxStakedAmount) {
109
+ return getTargetInfo(targetNftId).maxStakedAmount;
110
+ }
111
+
107
112
 
108
113
  /// @dev get the reward rate for the specified target nft id.
109
114
  function getRewardRate(NftId targetNftId) external view returns (UFixed rewardRate) {
@@ -98,6 +98,17 @@ contract StakingService is
98
98
  rewardRate);
99
99
  }
100
100
 
101
+ function setInstanceMaxStakedAmount(NftId instanceNftId, Amount maxStakingAmount)
102
+ external
103
+ virtual
104
+ restricted()
105
+ {
106
+ _checkNftType(instanceNftId, INSTANCE());
107
+ _getStakingServiceStorage()._staking.setMaxStakedAmount(
108
+ instanceNftId,
109
+ maxStakingAmount);
110
+ }
111
+
101
112
 
102
113
  function refillInstanceRewardReserves(NftId instanceNftId, address rewardProvider, Amount dipAmount)
103
114
  external
@@ -91,7 +91,8 @@ contract StakingStore is
91
91
  objectType: PROTOCOL(),
92
92
  chainId: 1,
93
93
  lockingPeriod: TargetManagerLib.getDefaultLockingPeriod(),
94
- rewardRate: TargetManagerLib.getDefaultRewardRate()}));
94
+ rewardRate: TargetManagerLib.getDefaultRewardRate(),
95
+ maxStakedAmount: AmountLib.max()}));
95
96
  }
96
97
 
97
98
 
@@ -5,16 +5,16 @@ import {Amount, AmountLib} from "./Amount.sol";
5
5
  import {UFixed, UFixedLib} from "./UFixed.sol";
6
6
 
7
7
  struct Fee {
8
+ // slot 0
8
9
  UFixed fractionalFee;
9
- // TODO migrate fixed fee to Amount
10
- uint256 fixedFee;
10
+ Amount fixedFee;
11
11
  }
12
12
 
13
13
  library FeeLib {
14
14
 
15
15
  /// @dev Return a zero fee struct (0, 0)
16
16
  function zero() public pure returns (Fee memory fee) {
17
- return Fee(UFixed.wrap(0), 0);
17
+ return Fee(UFixed.wrap(0), AmountLib.zero());
18
18
  }
19
19
 
20
20
  /// @dev Converts the uint256 to a fee struct.
@@ -22,7 +22,7 @@ library FeeLib {
22
22
  UFixed fractionalFee,
23
23
  uint256 fixedFee
24
24
  ) public pure returns (Fee memory fee) {
25
- return Fee(fractionalFee, fixedFee);
25
+ return Fee(fractionalFee, AmountLib.toAmount(fixedFee));
26
26
  }
27
27
 
28
28
  /// @dev Calculates fee and net amounts for the provided parameters
@@ -41,14 +41,14 @@ library FeeLib {
41
41
  if(gtz(fee)) {
42
42
  UFixed fractionalAmount =
43
43
  amount.toUFixed() * fee.fractionalFee;
44
- feeAmount = AmountLib.toAmount(fractionalAmount.toInt() + fee.fixedFee);
44
+ feeAmount = AmountLib.toAmount(fractionalAmount.toInt()) + fee.fixedFee;
45
45
  netAmount = netAmount - feeAmount;
46
46
  }
47
47
  }
48
48
 
49
49
  /// @dev Return the percent fee struct (x%, 0)
50
50
  function percentageFee(uint8 percent) public pure returns (Fee memory fee) {
51
- return Fee(UFixedLib.toUFixed(percent, -2), 0);
51
+ return Fee(UFixedLib.toUFixed(percent, -2), AmountLib.zero());
52
52
  }
53
53
 
54
54
  // pure free functions for operators
@@ -57,10 +57,10 @@ library FeeLib {
57
57
  }
58
58
 
59
59
  function gtz(Fee memory fee) public pure returns (bool) {
60
- return UFixed.unwrap(fee.fractionalFee) > 0 || fee.fixedFee > 0;
60
+ return UFixed.unwrap(fee.fractionalFee) > 0 || fee.fixedFee.gtz();
61
61
  }
62
62
 
63
63
  function eqz(Fee memory fee) public pure returns (bool) {
64
- return fee.fixedFee == 0 && UFixed.unwrap(fee.fractionalFee) == 0;
64
+ return fee.fixedFee.eqz() && UFixed.unwrap(fee.fractionalFee) == 0;
65
65
  }
66
66
  }