@harvest-finance/harvest-strategy-polygon 0.0.1-security → 1.0.0

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.

Potentially problematic release.


This version of @harvest-finance/harvest-strategy-polygon might be problematic. Click here for more details.

Files changed (485) hide show
  1. package/README.md +110 -5
  2. package/contracts/base/Controller.sol +125 -0
  3. package/contracts/base/ControllerV2.sol +363 -0
  4. package/contracts/base/FeeRewardForwarder.sol +163 -0
  5. package/contracts/base/PotPool.sol +360 -0
  6. package/contracts/base/ProfitSharingReceiver.sol +39 -0
  7. package/contracts/base/RewardForwarderV2.sol +109 -0
  8. package/contracts/base/Vault.sol +344 -0
  9. package/contracts/base/VaultERC4626.sol +113 -0
  10. package/contracts/base/VaultProxy.sol +35 -0
  11. package/contracts/base/VaultStorage.sol +199 -0
  12. package/contracts/base/VaultStorageV2.sol +196 -0
  13. package/contracts/base/VaultV2.sol +369 -0
  14. package/contracts/base/ape-base/MiniApeV2Strategy.sol +322 -0
  15. package/contracts/base/ape-base/interface/IMiniChefV2.sol +31 -0
  16. package/contracts/base/ape-base/interface/IRewarder.sol +10 -0
  17. package/contracts/base/factory/MegaFactory.sol +120 -0
  18. package/contracts/base/factory/interface/IPoolFactory.sol +6 -0
  19. package/contracts/base/factory/interface/IStrategyFactory.sol +6 -0
  20. package/contracts/base/factory/interface/IVaultFactory.sol +7 -0
  21. package/contracts/base/factory/pool/PotPoolFactory.sol +43 -0
  22. package/contracts/base/factory/strategy/UpgradableStrategyFactory.sol +19 -0
  23. package/contracts/base/factory/vault/RegularVaultFactory.sol +34 -0
  24. package/contracts/base/incentives/GlobalIncentivesHelper.sol +167 -0
  25. package/contracts/base/incentives/NotifyHelperGeneric.sol +61 -0
  26. package/contracts/base/incentives/NotifyHelperStateful.sol +290 -0
  27. package/contracts/base/inheritance/Controllable.sol +26 -0
  28. package/contracts/base/inheritance/ControllableInit.sol +31 -0
  29. package/contracts/base/inheritance/Governable.sol +29 -0
  30. package/contracts/base/inheritance/GovernableInit.sol +51 -0
  31. package/contracts/base/inheritance/IUpgradeSource.sol +8 -0
  32. package/contracts/base/inheritance/OwnableWhitelist.sol +17 -0
  33. package/contracts/base/inheritance/RewardTokenProfitNotifier.sol +48 -0
  34. package/contracts/base/inheritance/Storage.sol +36 -0
  35. package/contracts/base/interface/IController.sol +30 -0
  36. package/contracts/base/interface/IControllerV2.sol +135 -0
  37. package/contracts/base/interface/IERC4626.sol +263 -0
  38. package/contracts/base/interface/IFeeRewardForwarder.sol +9 -0
  39. package/contracts/base/interface/IProfitSharingReceiver.sol +10 -0
  40. package/contracts/base/interface/IRewardForwarder.sol +58 -0
  41. package/contracts/base/interface/IRewardPool.sol +34 -0
  42. package/contracts/base/interface/IStrategy.sol +25 -0
  43. package/contracts/base/interface/IUniversalLiquidator.sol +21 -0
  44. package/contracts/base/interface/IUniversalLiquidatorRegistry.sol +20 -0
  45. package/contracts/base/interface/IUpgradeSource.sol +8 -0
  46. package/contracts/base/interface/IVault.sol +35 -0
  47. package/contracts/base/interface/aave/DataTypes.sol +266 -0
  48. package/contracts/base/interface/aave/IAToken.sol +37 -0
  49. package/contracts/base/interface/aave/IPool.sol +13 -0
  50. package/contracts/base/interface/balancer/Gauge.sol +22 -0
  51. package/contracts/base/interface/balancer/IBVault.sol +557 -0
  52. package/contracts/base/interface/balancer/IBalancerMinter.sol +114 -0
  53. package/contracts/base/interface/balancer/linearPool/ILinearPool.sol +185 -0
  54. package/contracts/base/interface/balancer/linearPool/ILinearPoolFactory.sol +16 -0
  55. package/contracts/base/interface/balancer/linearPool/ILinearPoolRebalancer.sol +8 -0
  56. package/contracts/base/interface/balancer/linearPool/IPoolSwapStructs.sol +57 -0
  57. package/contracts/base/interface/caviar/ICaviarChef.sol +16 -0
  58. package/contracts/base/interface/compound/IComet.sol +114 -0
  59. package/contracts/base/interface/compound/ICometRewards.sol +17 -0
  60. package/contracts/base/interface/curve/Gauge.sol +25 -0
  61. package/contracts/base/interface/curve/ICurveDeposit_2token.sol +25 -0
  62. package/contracts/base/interface/curve/ICurveDeposit_2token_underlying.sol +31 -0
  63. package/contracts/base/interface/curve/ICurveDeposit_3token.sol +25 -0
  64. package/contracts/base/interface/curve/ICurveDeposit_3token_meta.sol +20 -0
  65. package/contracts/base/interface/curve/ICurveDeposit_3token_underlying.sol +31 -0
  66. package/contracts/base/interface/curve/ICurveDeposit_4token.sol +25 -0
  67. package/contracts/base/interface/curve/ICurveDeposit_4token_meta.sol +20 -0
  68. package/contracts/base/interface/curve/ICurveDeposit_4token_underlying.sol +31 -0
  69. package/contracts/base/interface/curve/ICurveDeposit_5token.sol +25 -0
  70. package/contracts/base/interface/curve/ICurveDeposit_5token_meta.sol +20 -0
  71. package/contracts/base/interface/curve/ICurveDeposit_5token_underlying.sol +31 -0
  72. package/contracts/base/interface/curve/ICurveDeposit_6token.sol +25 -0
  73. package/contracts/base/interface/curve/ICurveDeposit_6token_meta.sol +20 -0
  74. package/contracts/base/interface/gamma/IClearing.sol +8 -0
  75. package/contracts/base/interface/gamma/IHypervisor.sol +17 -0
  76. package/contracts/base/interface/gamma/IStakingRewards.sol +35 -0
  77. package/contracts/base/interface/gamma/IUniProxy.sol +15 -0
  78. package/contracts/base/interface/kyber/IDMMExchangeRouter.sol +69 -0
  79. package/contracts/base/interface/kyber/IDMMFactory.sol +35 -0
  80. package/contracts/base/interface/kyber/IDMMLiquidityRouter.sol +204 -0
  81. package/contracts/base/interface/kyber/IDMMPool.sol +42 -0
  82. package/contracts/base/interface/kyber/IDMMRouter01.sol +12 -0
  83. package/contracts/base/interface/kyber/IDMMRouter02.sol +55 -0
  84. package/contracts/base/interface/kyber/IKyberZap.sol +7 -0
  85. package/contracts/base/interface/merkl/IDistributor.sol +6 -0
  86. package/contracts/base/interface/morpho/IMetaMorpho.sol +7 -0
  87. package/contracts/base/interface/pearl/IGauge.sol +13 -0
  88. package/contracts/base/interface/pearl/IPair.sol +44 -0
  89. package/contracts/base/interface/pearl/IRouter.sol +305 -0
  90. package/contracts/base/interface/quickswap/IDragonLair.sol +25 -0
  91. package/contracts/base/interface/quickswap/IMasterChef.sol +13 -0
  92. package/contracts/base/interface/uniswap/IUniswapV2Factory.sol +15 -0
  93. package/contracts/base/interface/uniswap/IUniswapV2Migrator.sol +6 -0
  94. package/contracts/base/interface/uniswap/IUniswapV2Pair.sol +59 -0
  95. package/contracts/base/interface/uniswap/IUniswapV2Router01.sol +96 -0
  96. package/contracts/base/interface/uniswap/IUniswapV2Router02.sol +137 -0
  97. package/contracts/base/interface/uniswap/IUniswapV3Pool.sol +24 -0
  98. package/contracts/base/interface/uniswap/IUniswapV3Router.sol +64 -0
  99. package/contracts/base/interface/uniswap/IWETH.sol +8 -0
  100. package/contracts/base/interface/uniswap/pool/IUniswapV3PoolActions.sol +103 -0
  101. package/contracts/base/interface/uniswap/pool/IUniswapV3PoolDerivedState.sol +40 -0
  102. package/contracts/base/interface/uniswap/pool/IUniswapV3PoolEvents.sol +121 -0
  103. package/contracts/base/interface/uniswap/pool/IUniswapV3PoolImmutables.sol +35 -0
  104. package/contracts/base/interface/uniswap/pool/IUniswapV3PoolOwnerActions.sol +23 -0
  105. package/contracts/base/interface/uniswap/pool/IUniswapV3PoolState.sol +116 -0
  106. package/contracts/base/masterchef-base/MasterChefHodlStrategy.sol +240 -0
  107. package/contracts/base/masterchef-base/MasterChefStrategy.sol +364 -0
  108. package/contracts/base/masterchef-base/interfaces/IMasterChef.sol +12 -0
  109. package/contracts/base/migration/vaultMigratable_2JPYv2.sol +87 -0
  110. package/contracts/base/migration/vaultMigratable_bal2EUR_PAR.sol +121 -0
  111. package/contracts/base/migration/vaultMigratable_bal2EUR_agEUR.sol +121 -0
  112. package/contracts/base/migration/vaultMigratable_balMaticX.sol +153 -0
  113. package/contracts/base/migration/vaultMigratable_balStMatic.sol +153 -0
  114. package/contracts/base/noop/NoopStrategy.sol +89 -0
  115. package/contracts/base/noop/NoopStrategyUpgradeable.sol +92 -0
  116. package/contracts/base/sushi-base/MiniChefV2Strategy.sol +380 -0
  117. package/contracts/base/sushi-base/interface/IMiniChefV2.sol +31 -0
  118. package/contracts/base/sushi-base/interface/IRewarder.sol +9 -0
  119. package/contracts/base/sushi-base/lib/BoringERC20.sol +30 -0
  120. package/contracts/base/upgradability/Address.sol +33 -0
  121. package/contracts/base/upgradability/BaseUpgradeabilityProxy.sol +61 -0
  122. package/contracts/base/upgradability/BaseUpgradeableStrategy.sol +111 -0
  123. package/contracts/base/upgradability/BaseUpgradeableStrategyStorage.sol +176 -0
  124. package/contracts/base/upgradability/BaseUpgradeableStrategyStorageV2.sol +290 -0
  125. package/contracts/base/upgradability/BaseUpgradeableStrategyV2.sol +145 -0
  126. package/contracts/base/upgradability/IUpgradable.sol +7 -0
  127. package/contracts/base/upgradability/Proxy.sol +71 -0
  128. package/contracts/base/upgradability/ReentrancyGuard.sol +57 -0
  129. package/contracts/base/upgradability/ReentrancyGuardUpgradeable.sol +51 -0
  130. package/contracts/base/upgradability/StrategyProxy.sol +35 -0
  131. package/contracts/base/wmatic/WMATIC.sol +8 -0
  132. package/contracts/strategies/aave/AaveSupplyStrategy.sol +213 -0
  133. package/contracts/strategies/aave/AaveSupplyStrategyMainnet_DAI.sol +23 -0
  134. package/contracts/strategies/aave/AaveSupplyStrategyMainnet_EURS.sol +23 -0
  135. package/contracts/strategies/aave/AaveSupplyStrategyMainnet_USDC.sol +23 -0
  136. package/contracts/strategies/aave/AaveSupplyStrategyMainnet_USDCe.sol +23 -0
  137. package/contracts/strategies/aave/AaveSupplyStrategyMainnet_USDT.sol +23 -0
  138. package/contracts/strategies/ape/ApeStrategyMainnet_BANANA_MATIC.sol +36 -0
  139. package/contracts/strategies/ape/ApeStrategyMainnet_BNB_MATIC.sol +36 -0
  140. package/contracts/strategies/ape/ApeStrategyMainnet_BTC_MATIC.sol +36 -0
  141. package/contracts/strategies/ape/ApeStrategyMainnet_DAI_MATIC.sol +36 -0
  142. package/contracts/strategies/ape/ApeStrategyMainnet_DAI_USDC.sol +37 -0
  143. package/contracts/strategies/ape/ApeStrategyMainnet_ETH_MATIC.sol +36 -0
  144. package/contracts/strategies/ape/ApeStrategyMainnet_USDT_MATIC.sol +36 -0
  145. package/contracts/strategies/aura/AuraStrategy.sol +347 -0
  146. package/contracts/strategies/aura/AuraStrategyMainnet_jEUR_PAR.sol +30 -0
  147. package/contracts/strategies/aura/interface/IAuraBaseRewardPool.sol +25 -0
  148. package/contracts/strategies/aura/interface/IAuraBooster.sol +17 -0
  149. package/contracts/strategies/aura/interface/IAuraDepositor.sol +7 -0
  150. package/contracts/strategies/balancer/BalancerStrategyV3.sol +509 -0
  151. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2BRL.sol +39 -0
  152. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2BRLUSD.sol +38 -0
  153. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2EUR_PAR.sol +34 -0
  154. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2EUR_PARv2.sol +34 -0
  155. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2EUR_agEUR.sol +34 -0
  156. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_MATIC_USDC_ETH_BAL.sol +32 -0
  157. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_MaticX.sol +37 -0
  158. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_MaticX_amMatic.sol +38 -0
  159. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_SPHERE_MATIC.sol +34 -0
  160. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_TNGBL_USDC.sol +34 -0
  161. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_WBTC_ETH_USDC.sol +32 -0
  162. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_bbamusd.sol +36 -0
  163. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_frxETH.sol +32 -0
  164. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_frxETH_amWETH.sol +35 -0
  165. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_stETH.sol +35 -0
  166. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_stMatic.sol +36 -0
  167. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_stMatic_amMatic.sol +39 -0
  168. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_tetuBal.sol +36 -0
  169. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_wUSDR_USDC.sol +34 -0
  170. package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_wstETH_amWETH.sol +37 -0
  171. package/contracts/strategies/balancer/interface/Gauge.sol +26 -0
  172. package/contracts/strategies/balancer/interface/IBVault.sol +557 -0
  173. package/contracts/strategies/balancer/interface/IBalanceMinter.sol +114 -0
  174. package/contracts/strategies/complifi/ComplifiDerivStrategy.sol +381 -0
  175. package/contracts/strategies/complifi/ComplifiDerivStrategyMainnet_ETH5x.sol +35 -0
  176. package/contracts/strategies/complifi/ComplifiStrategy.sol +362 -0
  177. package/contracts/strategies/complifi/ComplifiStrategyMainnet_COMFI_WETH.sol +34 -0
  178. package/contracts/strategies/complifi/interfaces/ILiquidityMining.sol +13 -0
  179. package/contracts/strategies/complifi/interfaces/ILiquidityPool.sol +63 -0
  180. package/contracts/strategies/complifi/interfaces/IProxyActions.sol +10 -0
  181. package/contracts/strategies/complifi/interfaces/IUSDCVault.sol +55 -0
  182. package/contracts/strategies/compound/CompoundStrategy.sol +296 -0
  183. package/contracts/strategies/compound/CompoundStrategyMainnet_USDC.sol +28 -0
  184. package/contracts/strategies/compound/CompoundStrategyMainnet_USDT.sol +28 -0
  185. package/contracts/strategies/compound-blue/CompoundBlueStrategy.sol +292 -0
  186. package/contracts/strategies/compound-blue/CompoundBlueStrategyMainnet_ETH.sol +27 -0
  187. package/contracts/strategies/compound-blue/CompoundBlueStrategyMainnet_USDC.sol +27 -0
  188. package/contracts/strategies/compound-blue/CompoundBlueStrategyMainnet_USDT.sol +27 -0
  189. package/contracts/strategies/convex/ConvexStrategyMainnet_3CRV.sol +40 -0
  190. package/contracts/strategies/convex/ConvexStrategyMainnet_3CRYPTO.sol +37 -0
  191. package/contracts/strategies/convex/ConvexStrategyMainnet_CRV_3CRYPTO copy.sol +37 -0
  192. package/contracts/strategies/convex/ConvexStrategyMainnet_MATIC_3CRYPTO.sol +37 -0
  193. package/contracts/strategies/convex/ConvexStrategyMainnet_USDR.sol +40 -0
  194. package/contracts/strategies/convex/ConvexStrategyMainnet_aCRV.sol +38 -0
  195. package/contracts/strategies/convex/base/ConvexStrategy.sol +480 -0
  196. package/contracts/strategies/convex/interface/IBaseRewardPool.sol +13 -0
  197. package/contracts/strategies/convex/interface/IBooster.sol +10 -0
  198. package/contracts/strategies/gamma-merkl/GammaMerklStrategy.sol +272 -0
  199. package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_ETH_USDC.sol +25 -0
  200. package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_ETH_USDT.sol +25 -0
  201. package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_MATIC_USDT.sol +25 -0
  202. package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_TBTC_ETH.sol +25 -0
  203. package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_WBTC_ETH_w.sol +25 -0
  204. package/contracts/strategies/genomes/NoopStrategy_GENE_ETH.sol +23 -0
  205. package/contracts/strategies/genomes/NoopStrategy_GNOME_ETH.sol +23 -0
  206. package/contracts/strategies/idle/IdleFinanceStrategy.sol +240 -0
  207. package/contracts/strategies/idle/IdleStrategyDAIMainnet.sol +33 -0
  208. package/contracts/strategies/idle/IdleStrategyUSDCMainnet.sol +33 -0
  209. package/contracts/strategies/idle/IdleStrategyWETHMainnet.sol +30 -0
  210. package/contracts/strategies/idle/interface/IdleToken.sol +58 -0
  211. package/contracts/strategies/jarvis/JarvisHodlStrategyV3.sol +351 -0
  212. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2CAD.sol +34 -0
  213. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR.sol +34 -0
  214. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR_EURT.sol +34 -0
  215. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR_EURe.sol +34 -0
  216. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR_PAR.sol +34 -0
  217. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2JPY.sol +34 -0
  218. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2JPYv2.sol +34 -0
  219. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2NZD.sol +34 -0
  220. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2SGD.sol +34 -0
  221. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jCHF_USDC.sol +35 -0
  222. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jCHF_WETH.sol +35 -0
  223. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jEUR_USDC.sol +35 -0
  224. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jEUR_WETH.sol +35 -0
  225. package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jGBP_USDC.sol +35 -0
  226. package/contracts/strategies/jarvis/JarvisStrategyV3.sol +281 -0
  227. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_AUR3_USDC.sol +27 -0
  228. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_AURJUL22_WETH.sol +27 -0
  229. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_DEN2_4EUR.sol +27 -0
  230. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_DEN3_4EUR.sol +27 -0
  231. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_DEN4_4EUR.sol +27 -0
  232. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTANGLENOV22_2EURagEUR.sol +27 -0
  233. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTANGLE_2EURagEUR.sol +27 -0
  234. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTJUL22_USDC.sol +27 -0
  235. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTMAY22_USDC.sol +27 -0
  236. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTMIMONOV22_2EURPAR.sol +27 -0
  237. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTMIMO_2EURPAR.sol +27 -0
  238. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTNOV22_USDC.sol +27 -0
  239. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTSEP22_USDC.sol +27 -0
  240. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_QUI_2CAD.sol +27 -0
  241. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_SES_2JPY.sol +28 -0
  242. package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_agDEN_2EUR.sol +27 -0
  243. package/contracts/strategies/jarvis/interface/IElysianFields.sol +11 -0
  244. package/contracts/strategies/jarvis/interface/IKyberFairLaunch.sol +13 -0
  245. package/contracts/strategies/jarvis/interface/IKyberRewardLocker.sol +9 -0
  246. package/contracts/strategies/meshswap/MeshswapStrategy.sol +304 -0
  247. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_MESH_oMOOI.sol +30 -0
  248. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_MESH_oZEMIT.sol +30 -0
  249. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_USDC_oUSDC.sol +31 -0
  250. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_USDT_oUSDT.sol +31 -0
  251. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_WMATIC_MESH.sol +27 -0
  252. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_WMATIC_USDC.sol +28 -0
  253. package/contracts/strategies/meshswap/MeshswapStrategyMainnet_WMATIC_USDT.sol +28 -0
  254. package/contracts/strategies/meshswap/interface/IExchange.sol +9 -0
  255. package/contracts/strategies/meshswap/interface/IRouter.sol +68 -0
  256. package/contracts/strategies/pearl/CaviarStrategy.sol +244 -0
  257. package/contracts/strategies/pearl/CaviarStrategyMainnet_CVR.sol +26 -0
  258. package/contracts/strategies/pearl/PearlHodlStrategy.sol +254 -0
  259. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_CVR_PEARL.sol +27 -0
  260. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_DAI_USDR.sol +27 -0
  261. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_ETH_USDR.sol +27 -0
  262. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_MATIC_USDR.sol +27 -0
  263. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_PEARL_USDR.sol +27 -0
  264. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_STAR_USDR.sol +27 -0
  265. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_TNGBL_USDR.sol +27 -0
  266. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_USDC_USDR.sol +27 -0
  267. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_USDT_USDR.sol +27 -0
  268. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_WBTC_USDR.sol +27 -0
  269. package/contracts/strategies/pearl/PearlHodlStrategyMainnet_wUSDR_USDR.sol +27 -0
  270. package/contracts/strategies/quick-gamma/QuickGammaStrategy.sol +400 -0
  271. package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_ETH_narrow.sol +31 -0
  272. package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_ETH_wide.sol +31 -0
  273. package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_USDC_narrow.sol +31 -0
  274. package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_USDC_wide.sol +31 -0
  275. package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_USDC_ETH_narrow.sol +34 -0
  276. package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_USDC_ETH_wide.sol +34 -0
  277. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2.sol +348 -0
  278. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_USDC_DAI.sol +28 -0
  279. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_USDC_USDT.sol +29 -0
  280. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_WBTC_ETH_narrow.sol +28 -0
  281. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_WBTC_USDC_narrow.sol +28 -0
  282. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_cbETH_ETH.sol +28 -0
  283. package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_wstETH_ETH.sol +28 -0
  284. package/contracts/strategies/uniswap-gamma/UniswapGammaStrategy.sol +312 -0
  285. package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_USDC_DAI.sol +28 -0
  286. package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_USDC_USDT.sol +28 -0
  287. package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_USDC_WETH.sol +28 -0
  288. package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_WMATIC_USDC.sol +28 -0
  289. package/contracts/strategies/yel/YelStrategy.sol +350 -0
  290. package/contracts/strategies/yel/YelStrategyMainnet_YEL_WETH.sol +29 -0
  291. package/hardhat.config.js +58 -0
  292. package/index.js +42 -0
  293. package/package.json +56 -6
  294. package/scripts/01-deploy-vault-regular-with-upgradable-strategy.js +41 -0
  295. package/scripts/02-deploy-vault-regular.js +35 -0
  296. package/scripts/03-deploy-upgradable-strategy.js +34 -0
  297. package/scripts/04-deploy-new-implementation.js +24 -0
  298. package/scripts/README.md +55 -0
  299. package/scripts/utils.js +42 -0
  300. package/test/aave/dai.js +207 -0
  301. package/test/aave/eurs.js +207 -0
  302. package/test/aave/usdc.js +206 -0
  303. package/test/aave/usdce.js +206 -0
  304. package/test/aave/usdt.js +206 -0
  305. package/test/ape/banana-matic.js +157 -0
  306. package/test/ape/bnb-matic.js +159 -0
  307. package/test/ape/btc-matic.js +159 -0
  308. package/test/ape/dai-matic.js +159 -0
  309. package/test/ape/dai-usdc.js +163 -0
  310. package/test/ape/eth-matic.js +158 -0
  311. package/test/ape/usdt-matic.js +159 -0
  312. package/test/aura/jeur-par.js +135 -0
  313. package/test/balancer/2brl_v3.js +123 -0
  314. package/test/balancer/2brlusd_v3.js +123 -0
  315. package/test/balancer/2eur_ageur.js +141 -0
  316. package/test/balancer/2eur_par.js +141 -0
  317. package/test/balancer/2eur_par_v2.js +123 -0
  318. package/test/balancer/bbamusd_v3.js +124 -0
  319. package/test/balancer/btc.js +131 -0
  320. package/test/balancer/frxETH.js +123 -0
  321. package/test/balancer/frxeth_amweth.js +123 -0
  322. package/test/balancer/matic_usdc_eth_bal.js +123 -0
  323. package/test/balancer/maticx_ammatic.js +123 -0
  324. package/test/balancer/maticx_v2.js +120 -0
  325. package/test/balancer/maticx_v3.js +141 -0
  326. package/test/balancer/polybase.js +131 -0
  327. package/test/balancer/polybase_v2.js +121 -0
  328. package/test/balancer/polydefi.js +131 -0
  329. package/test/balancer/polydefi2.js +131 -0
  330. package/test/balancer/qipool.js +136 -0
  331. package/test/balancer/sphere_matic.js +123 -0
  332. package/test/balancer/stETH.js +123 -0
  333. package/test/balancer/stable.js +131 -0
  334. package/test/balancer/stable_v2.js +121 -0
  335. package/test/balancer/stmatic_ammatic.js +123 -0
  336. package/test/balancer/stmatic_v2.js +120 -0
  337. package/test/balancer/stmatic_v3.js +141 -0
  338. package/test/balancer/tetubal_v3.js +123 -0
  339. package/test/balancer/tngbl_usdc.js +123 -0
  340. package/test/balancer/tricrypto.js +131 -0
  341. package/test/balancer/tusd_stable.js +142 -0
  342. package/test/balancer/usdc_weth.js +136 -0
  343. package/test/balancer/usdc_weth_v2.js +123 -0
  344. package/test/balancer/wbtc_eth_usdc.js +123 -0
  345. package/test/balancer/wbtc_weth.js +136 -0
  346. package/test/balancer/wsteth_amweth.js +123 -0
  347. package/test/balancer/wusdr_usdc.js +123 -0
  348. package/test/compound/usdc.js +127 -0
  349. package/test/compound/usdt.js +129 -0
  350. package/test/compound-blue/eth.js +136 -0
  351. package/test/compound-blue/usdc.js +136 -0
  352. package/test/compound-blue/usdt.js +136 -0
  353. package/test/convex/3crv.js +123 -0
  354. package/test/convex/3crypto.js +123 -0
  355. package/test/convex/acrv.js +123 -0
  356. package/test/convex/crv_3crypto.js +123 -0
  357. package/test/convex/matic_3crypto.js +123 -0
  358. package/test/convex/usdr.js +123 -0
  359. package/test/core/emission-fork.js +197 -0
  360. package/test/core/emission.js +209 -0
  361. package/test/core/vault_upgrade.js +129 -0
  362. package/test/curve/aave.js +132 -0
  363. package/test/curve/atricrypto3.js +135 -0
  364. package/test/curve/eurtusd.js +135 -0
  365. package/test/gamma-merkl/qs-eth-usdc.js +212 -0
  366. package/test/gamma-merkl/qs-eth-usdt.js +213 -0
  367. package/test/gamma-merkl/qs-matic-usdt.js +213 -0
  368. package/test/gamma-merkl/qs-tbtc-eth.js +213 -0
  369. package/test/gamma-merkl/qs-wbtc-eth-w.js +213 -0
  370. package/test/genomes/gene-eth.js +115 -0
  371. package/test/genomes/gnome-eth.js +115 -0
  372. package/test/idle/dai.js +129 -0
  373. package/test/idle/usdc.js +128 -0
  374. package/test/idle/weth.js +128 -0
  375. package/test/jarvis/2cad-hodl.js +183 -0
  376. package/test/jarvis/2cad-update-nov22.js +182 -0
  377. package/test/jarvis/2cad-update.js +177 -0
  378. package/test/jarvis/2cad-update2.js +182 -0
  379. package/test/jarvis/2cad-update3.js +182 -0
  380. package/test/jarvis/2eur-ageur-update-nov22.js +182 -0
  381. package/test/jarvis/2eur-ageur-update.js +182 -0
  382. package/test/jarvis/2eur-eure-hodl.js +176 -0
  383. package/test/jarvis/2eur-eurt-hodl.js +176 -0
  384. package/test/jarvis/2eur-eurt-update-nov22.js +182 -0
  385. package/test/jarvis/2eur-hodl.js +176 -0
  386. package/test/jarvis/2eur-par-hodl.js +176 -0
  387. package/test/jarvis/2eur-par-update-nov22.js +182 -0
  388. package/test/jarvis/2jpy-hodl.js +244 -0
  389. package/test/jarvis/2jpy-update-nov22.js +182 -0
  390. package/test/jarvis/2jpy-update.js +177 -0
  391. package/test/jarvis/2jpy-update2.js +182 -0
  392. package/test/jarvis/2jpyv2-upgrade.js +184 -0
  393. package/test/jarvis/2nzd-hodl.js +176 -0
  394. package/test/jarvis/2nzd-update.js +182 -0
  395. package/test/jarvis/2sgd-hodl.js +176 -0
  396. package/test/jarvis/2sgd-update-nov22.js +182 -0
  397. package/test/jarvis/2sgd-update.js +182 -0
  398. package/test/jarvis/2sgd-update2.js +182 -0
  399. package/test/jarvis/4eur-hodl-upgrade.js +177 -0
  400. package/test/jarvis/4eur-hodl.js +183 -0
  401. package/test/jarvis/4eur-update.js +181 -0
  402. package/test/jarvis/4eur-update2.js +181 -0
  403. package/test/jarvis/agden-2eur.js +222 -0
  404. package/test/jarvis/aur-usdc-v2.js +115 -0
  405. package/test/jarvis/aur-usdc.js +127 -0
  406. package/test/jarvis/aur3-usdc.js +115 -0
  407. package/test/jarvis/aurjul22-weth.js +222 -0
  408. package/test/jarvis/den-4eur.js +115 -0
  409. package/test/jarvis/den2-4eur.js +220 -0
  410. package/test/jarvis/den3-4eur.js +220 -0
  411. package/test/jarvis/den4-4eur.js +220 -0
  412. package/test/jarvis/jchf-usdc-hodl-v2.js +184 -0
  413. package/test/jarvis/jchf-usdc-hodl-v3.js +178 -0
  414. package/test/jarvis/jchf-usdc-hodl.js +193 -0
  415. package/test/jarvis/jchf-weth-hodl.js +176 -0
  416. package/test/jarvis/jeur-usdc-hodl-v2.js +184 -0
  417. package/test/jarvis/jeur-usdc-hodl-v3.js +178 -0
  418. package/test/jarvis/jeur-usdc-hodl.js +193 -0
  419. package/test/jarvis/jeur-weth-hodl.js +176 -0
  420. package/test/jarvis/jgbp-usdc-hodl-v2.js +184 -0
  421. package/test/jarvis/jgbp-usdc-hodl-v3.js +178 -0
  422. package/test/jarvis/jgbp-usdc-hodl.js +193 -0
  423. package/test/jarvis/jrtangle-2eurageur.js +220 -0
  424. package/test/jarvis/jrtanglenov22-2eurageur.js +220 -0
  425. package/test/jarvis/jrtjul22-usdc.js +115 -0
  426. package/test/jarvis/jrtmay22-usdc.js +115 -0
  427. package/test/jarvis/jrtmimo-2eurpar.js +220 -0
  428. package/test/jarvis/jrtmimonov22-2eurpar.js +220 -0
  429. package/test/jarvis/jrtnov22-usdc.js +220 -0
  430. package/test/jarvis/jrtsep22-usdc.js +220 -0
  431. package/test/jarvis/qui-2cad.js +218 -0
  432. package/test/jarvis/ses-2jpy.js +222 -0
  433. package/test/meshswap/mesh-omooi.js +197 -0
  434. package/test/meshswap/mesh-ozemit.js +197 -0
  435. package/test/meshswap/usdc-ousdc.js +197 -0
  436. package/test/meshswap/usdt-ousdt.js +197 -0
  437. package/test/meshswap/wmatic-mesh.js +197 -0
  438. package/test/meshswap/wmatic-usdc.js +197 -0
  439. package/test/meshswap/wmatic-usdt.js +197 -0
  440. package/test/mstable/musd.js +123 -0
  441. package/test/pearl/cvr-pearl.js +198 -0
  442. package/test/pearl/cvr.js +133 -0
  443. package/test/pearl/dai-usdr.js +198 -0
  444. package/test/pearl/eth-usdr.js +198 -0
  445. package/test/pearl/matic-usdr.js +198 -0
  446. package/test/pearl/pearl-usdr.js +198 -0
  447. package/test/pearl/star-usdr.js +186 -0
  448. package/test/pearl/tngbl-usdr.js +198 -0
  449. package/test/pearl/usdc-usdr.js +198 -0
  450. package/test/pearl/usdt-usdr.js +198 -0
  451. package/test/pearl/wbtc-usdr.js +198 -0
  452. package/test/pearl/wusdr-usdr.js +198 -0
  453. package/test/popsicle/ice-weth.js +128 -0
  454. package/test/quick/eth-matic.js +132 -0
  455. package/test/quick/eth-usdt.js +140 -0
  456. package/test/quick/ifarm-quick.js +147 -0
  457. package/test/quick/matic-usdc.js +145 -0
  458. package/test/quick/psp-matic.js +124 -0
  459. package/test/quick/wbtc-eth.js +145 -0
  460. package/test/quick-gamma/cbeth-eth.js +207 -0
  461. package/test/quick-gamma/matic-eth-narrow.js +201 -0
  462. package/test/quick-gamma/matic-eth-wide.js +197 -0
  463. package/test/quick-gamma/matic-usdc-narrow.js +197 -0
  464. package/test/quick-gamma/matic-usdc-wide.js +197 -0
  465. package/test/quick-gamma/upgrade/matic-eth-narrow.js +204 -0
  466. package/test/quick-gamma/upgrade/matic-usdc-narrow.js +199 -0
  467. package/test/quick-gamma/usdc-dai.js +209 -0
  468. package/test/quick-gamma/usdc-eth-narrow.js +197 -0
  469. package/test/quick-gamma/usdc-eth-wide.js +197 -0
  470. package/test/quick-gamma/usdc-usdt.js +209 -0
  471. package/test/quick-gamma/wbtc-eth-narrow.js +207 -0
  472. package/test/quick-gamma/wbtc-usdc-narrow.js +209 -0
  473. package/test/quick-gamma/wsteth-eth.js +207 -0
  474. package/test/sushi/eth-usdt.js +153 -0
  475. package/test/sushi/matic-eth.js +138 -0
  476. package/test/sushi/usdc-eth.js +153 -0
  477. package/test/test-config.js +24 -0
  478. package/test/uniswap-gamma/usdc-dai.js +212 -0
  479. package/test/uniswap-gamma/usdc-usdt.js +212 -0
  480. package/test/uniswap-gamma/usdc-weth.js +212 -0
  481. package/test/uniswap-gamma/wmatic-usdc.js +210 -0
  482. package/test/utilities/Utils.js +96 -0
  483. package/test/utilities/hh-utils.js +242 -0
  484. package/test/utilities/make-vault.js +10 -0
  485. package/test/yel/yel-wmatic.js +129 -0
@@ -0,0 +1,137 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.5.0;
3
+
4
+ import './IUniswapV2Router01.sol';
5
+
6
+ interface IUniswapV2Router02 {
7
+ function factory() external pure returns (address);
8
+ function WETH() external pure returns (address);
9
+
10
+ function addLiquidity(
11
+ address tokenA,
12
+ address tokenB,
13
+ uint amountADesired,
14
+ uint amountBDesired,
15
+ uint amountAMin,
16
+ uint amountBMin,
17
+ address to,
18
+ uint deadline
19
+ ) external returns (uint amountA, uint amountB, uint liquidity);
20
+ function addLiquidityETH(
21
+ address token,
22
+ uint amountTokenDesired,
23
+ uint amountTokenMin,
24
+ uint amountETHMin,
25
+ address to,
26
+ uint deadline
27
+ ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
28
+ function removeLiquidity(
29
+ address tokenA,
30
+ address tokenB,
31
+ uint liquidity,
32
+ uint amountAMin,
33
+ uint amountBMin,
34
+ address to,
35
+ uint deadline
36
+ ) external returns (uint amountA, uint amountB);
37
+ function removeLiquidityETH(
38
+ address token,
39
+ uint liquidity,
40
+ uint amountTokenMin,
41
+ uint amountETHMin,
42
+ address to,
43
+ uint deadline
44
+ ) external returns (uint amountToken, uint amountETH);
45
+ function removeLiquidityWithPermit(
46
+ address tokenA,
47
+ address tokenB,
48
+ uint liquidity,
49
+ uint amountAMin,
50
+ uint amountBMin,
51
+ address to,
52
+ uint deadline,
53
+ bool approveMax, uint8 v, bytes32 r, bytes32 s
54
+ ) external returns (uint amountA, uint amountB);
55
+ function removeLiquidityETHWithPermit(
56
+ address token,
57
+ uint liquidity,
58
+ uint amountTokenMin,
59
+ uint amountETHMin,
60
+ address to,
61
+ uint deadline,
62
+ bool approveMax, uint8 v, bytes32 r, bytes32 s
63
+ ) external returns (uint amountToken, uint amountETH);
64
+ function swapExactTokensForTokens(
65
+ uint amountIn,
66
+ uint amountOutMin,
67
+ address[] calldata path,
68
+ address to,
69
+ uint deadline
70
+ ) external returns (uint[] memory amounts);
71
+ function swapTokensForExactTokens(
72
+ uint amountOut,
73
+ uint amountInMax,
74
+ address[] calldata path,
75
+ address to,
76
+ uint deadline
77
+ ) external returns (uint[] memory amounts);
78
+ function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
79
+ external
80
+ payable
81
+ returns (uint[] memory amounts);
82
+ function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
83
+ external
84
+ returns (uint[] memory amounts);
85
+ function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
86
+ external
87
+ returns (uint[] memory amounts);
88
+ function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
89
+ external
90
+ payable
91
+ returns (uint[] memory amounts);
92
+
93
+ function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
94
+ function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
95
+ function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
96
+ function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
97
+ function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
98
+
99
+ function removeLiquidityETHSupportingFeeOnTransferTokens(
100
+ address token,
101
+ uint liquidity,
102
+ uint amountTokenMin,
103
+ uint amountETHMin,
104
+ address to,
105
+ uint deadline
106
+ ) external returns (uint amountETH);
107
+ function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
108
+ address token,
109
+ uint liquidity,
110
+ uint amountTokenMin,
111
+ uint amountETHMin,
112
+ address to,
113
+ uint deadline,
114
+ bool approveMax, uint8 v, bytes32 r, bytes32 s
115
+ ) external returns (uint amountETH);
116
+
117
+ function swapExactTokensForTokensSupportingFeeOnTransferTokens(
118
+ uint amountIn,
119
+ uint amountOutMin,
120
+ address[] calldata path,
121
+ address to,
122
+ uint deadline
123
+ ) external;
124
+ function swapExactETHForTokensSupportingFeeOnTransferTokens(
125
+ uint amountOutMin,
126
+ address[] calldata path,
127
+ address to,
128
+ uint deadline
129
+ ) external payable;
130
+ function swapExactTokensForETHSupportingFeeOnTransferTokens(
131
+ uint amountIn,
132
+ uint amountOutMin,
133
+ address[] calldata path,
134
+ address to,
135
+ uint deadline
136
+ ) external;
137
+ }
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: GPL-2.0-or-later
2
+ pragma solidity >=0.5.0;
3
+
4
+ import './pool/IUniswapV3PoolImmutables.sol';
5
+ import './pool/IUniswapV3PoolState.sol';
6
+ import './pool/IUniswapV3PoolDerivedState.sol';
7
+ import './pool/IUniswapV3PoolActions.sol';
8
+ import './pool/IUniswapV3PoolOwnerActions.sol';
9
+ import './pool/IUniswapV3PoolEvents.sol';
10
+
11
+ /// @title The interface for a Uniswap V3 Pool
12
+ /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
13
+ /// to the ERC20 specification
14
+ /// @dev The pool interface is broken up into many smaller pieces
15
+ interface IUniswapV3Pool is
16
+ IUniswapV3PoolImmutables,
17
+ IUniswapV3PoolState,
18
+ IUniswapV3PoolDerivedState,
19
+ IUniswapV3PoolActions,
20
+ IUniswapV3PoolOwnerActions,
21
+ IUniswapV3PoolEvents
22
+ {
23
+
24
+ }
@@ -0,0 +1,64 @@
1
+ // SPDX-License-Identifier: Unlicense
2
+ pragma solidity 0.6.12;
3
+ pragma experimental ABIEncoderV2;
4
+
5
+ interface IUniswapV3Router {
6
+
7
+ struct ExactInputSingleParams {
8
+ address tokenIn;
9
+ address tokenOut;
10
+ uint24 fee;
11
+ address recipient;
12
+ uint256 deadline;
13
+ uint256 amountIn;
14
+ uint256 amountOutMinimum;
15
+ uint160 sqrtPriceLimitX96;
16
+ }
17
+
18
+ /// @notice Swaps `amountIn` of one token for as much as possible of another token
19
+ /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
20
+ /// @return amountOut The amount of the received token
21
+ function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
22
+
23
+ struct ExactInputParams {
24
+ bytes path;
25
+ address recipient;
26
+ uint256 deadline;
27
+ uint256 amountIn;
28
+ uint256 amountOutMinimum;
29
+ }
30
+
31
+ /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
32
+ /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
33
+ /// @return amountOut The amount of the received token
34
+ function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
35
+
36
+ struct ExactOutputSingleParams {
37
+ address tokenIn;
38
+ address tokenOut;
39
+ uint24 fee;
40
+ address recipient;
41
+ uint256 deadline;
42
+ uint256 amountOut;
43
+ uint256 amountInMaximum;
44
+ uint160 sqrtPriceLimitX96;
45
+ }
46
+
47
+ /// @notice Swaps as little as possible of one token for `amountOut` of another token
48
+ /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
49
+ /// @return amountIn The amount of the input token
50
+ function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
51
+
52
+ struct ExactOutputParams {
53
+ bytes path;
54
+ address recipient;
55
+ uint256 deadline;
56
+ uint256 amountOut;
57
+ uint256 amountInMaximum;
58
+ }
59
+
60
+ /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
61
+ /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
62
+ /// @return amountIn The amount of the input token
63
+ function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
64
+ }
@@ -0,0 +1,8 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.5.0;
3
+
4
+ interface IWETH {
5
+ function deposit() external payable;
6
+ function transfer(address to, uint value) external returns (bool);
7
+ function withdraw(uint) external;
8
+ }
@@ -0,0 +1,103 @@
1
+ // SPDX-License-Identifier: GPL-2.0-or-later
2
+ pragma solidity >=0.5.0;
3
+
4
+ /// @title Permissionless pool actions
5
+ /// @notice Contains pool methods that can be called by anyone
6
+ interface IUniswapV3PoolActions {
7
+ /// @notice Sets the initial price for the pool
8
+ /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
9
+ /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
10
+ function initialize(uint160 sqrtPriceX96) external;
11
+
12
+ /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
13
+ /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
14
+ /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
15
+ /// on tickLower, tickUpper, the amount of liquidity, and the current price.
16
+ /// @param recipient The address for which the liquidity will be created
17
+ /// @param tickLower The lower tick of the position in which to add liquidity
18
+ /// @param tickUpper The upper tick of the position in which to add liquidity
19
+ /// @param amount The amount of liquidity to mint
20
+ /// @param data Any data that should be passed through to the callback
21
+ /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
22
+ /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
23
+ function mint(
24
+ address recipient,
25
+ int24 tickLower,
26
+ int24 tickUpper,
27
+ uint128 amount,
28
+ bytes calldata data
29
+ ) external returns (uint256 amount0, uint256 amount1);
30
+
31
+ /// @notice Collects tokens owed to a position
32
+ /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
33
+ /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
34
+ /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
35
+ /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
36
+ /// @param recipient The address which should receive the fees collected
37
+ /// @param tickLower The lower tick of the position for which to collect fees
38
+ /// @param tickUpper The upper tick of the position for which to collect fees
39
+ /// @param amount0Requested How much token0 should be withdrawn from the fees owed
40
+ /// @param amount1Requested How much token1 should be withdrawn from the fees owed
41
+ /// @return amount0 The amount of fees collected in token0
42
+ /// @return amount1 The amount of fees collected in token1
43
+ function collect(
44
+ address recipient,
45
+ int24 tickLower,
46
+ int24 tickUpper,
47
+ uint128 amount0Requested,
48
+ uint128 amount1Requested
49
+ ) external returns (uint128 amount0, uint128 amount1);
50
+
51
+ /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
52
+ /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
53
+ /// @dev Fees must be collected separately via a call to #collect
54
+ /// @param tickLower The lower tick of the position for which to burn liquidity
55
+ /// @param tickUpper The upper tick of the position for which to burn liquidity
56
+ /// @param amount How much liquidity to burn
57
+ /// @return amount0 The amount of token0 sent to the recipient
58
+ /// @return amount1 The amount of token1 sent to the recipient
59
+ function burn(
60
+ int24 tickLower,
61
+ int24 tickUpper,
62
+ uint128 amount
63
+ ) external returns (uint256 amount0, uint256 amount1);
64
+
65
+ /// @notice Swap token0 for token1, or token1 for token0
66
+ /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
67
+ /// @param recipient The address to receive the output of the swap
68
+ /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
69
+ /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
70
+ /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
71
+ /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
72
+ /// @param data Any data to be passed through to the callback
73
+ /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
74
+ /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
75
+ function swap(
76
+ address recipient,
77
+ bool zeroForOne,
78
+ int256 amountSpecified,
79
+ uint160 sqrtPriceLimitX96,
80
+ bytes calldata data
81
+ ) external returns (int256 amount0, int256 amount1);
82
+
83
+ /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
84
+ /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
85
+ /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
86
+ /// with 0 amount{0,1} and sending the donation amount(s) from the callback
87
+ /// @param recipient The address which will receive the token0 and token1 amounts
88
+ /// @param amount0 The amount of token0 to send
89
+ /// @param amount1 The amount of token1 to send
90
+ /// @param data Any data to be passed through to the callback
91
+ function flash(
92
+ address recipient,
93
+ uint256 amount0,
94
+ uint256 amount1,
95
+ bytes calldata data
96
+ ) external;
97
+
98
+ /// @notice Increase the maximum number of price and liquidity observations that this pool will store
99
+ /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
100
+ /// the input observationCardinalityNext.
101
+ /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
102
+ function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
103
+ }
@@ -0,0 +1,40 @@
1
+ // SPDX-License-Identifier: GPL-2.0-or-later
2
+ pragma solidity >=0.5.0;
3
+
4
+ /// @title Pool state that is not stored
5
+ /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
6
+ /// blockchain. The functions here may have variable gas costs.
7
+ interface IUniswapV3PoolDerivedState {
8
+ /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
9
+ /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
10
+ /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
11
+ /// you must call it with secondsAgos = [3600, 0].
12
+ /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
13
+ /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
14
+ /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
15
+ /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
16
+ /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
17
+ /// timestamp
18
+ function observe(uint32[] calldata secondsAgos)
19
+ external
20
+ view
21
+ returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
22
+
23
+ /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
24
+ /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
25
+ /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
26
+ /// snapshot is taken and the second snapshot is taken.
27
+ /// @param tickLower The lower tick of the range
28
+ /// @param tickUpper The upper tick of the range
29
+ /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
30
+ /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
31
+ /// @return secondsInside The snapshot of seconds per liquidity for the range
32
+ function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
33
+ external
34
+ view
35
+ returns (
36
+ int56 tickCumulativeInside,
37
+ uint160 secondsPerLiquidityInsideX128,
38
+ uint32 secondsInside
39
+ );
40
+ }
@@ -0,0 +1,121 @@
1
+ // SPDX-License-Identifier: GPL-2.0-or-later
2
+ pragma solidity >=0.5.0;
3
+
4
+ /// @title Events emitted by a pool
5
+ /// @notice Contains all events emitted by the pool
6
+ interface IUniswapV3PoolEvents {
7
+ /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
8
+ /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
9
+ /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
10
+ /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
11
+ event Initialize(uint160 sqrtPriceX96, int24 tick);
12
+
13
+ /// @notice Emitted when liquidity is minted for a given position
14
+ /// @param sender The address that minted the liquidity
15
+ /// @param owner The owner of the position and recipient of any minted liquidity
16
+ /// @param tickLower The lower tick of the position
17
+ /// @param tickUpper The upper tick of the position
18
+ /// @param amount The amount of liquidity minted to the position range
19
+ /// @param amount0 How much token0 was required for the minted liquidity
20
+ /// @param amount1 How much token1 was required for the minted liquidity
21
+ event Mint(
22
+ address sender,
23
+ address indexed owner,
24
+ int24 indexed tickLower,
25
+ int24 indexed tickUpper,
26
+ uint128 amount,
27
+ uint256 amount0,
28
+ uint256 amount1
29
+ );
30
+
31
+ /// @notice Emitted when fees are collected by the owner of a position
32
+ /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
33
+ /// @param owner The owner of the position for which fees are collected
34
+ /// @param tickLower The lower tick of the position
35
+ /// @param tickUpper The upper tick of the position
36
+ /// @param amount0 The amount of token0 fees collected
37
+ /// @param amount1 The amount of token1 fees collected
38
+ event Collect(
39
+ address indexed owner,
40
+ address recipient,
41
+ int24 indexed tickLower,
42
+ int24 indexed tickUpper,
43
+ uint128 amount0,
44
+ uint128 amount1
45
+ );
46
+
47
+ /// @notice Emitted when a position's liquidity is removed
48
+ /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
49
+ /// @param owner The owner of the position for which liquidity is removed
50
+ /// @param tickLower The lower tick of the position
51
+ /// @param tickUpper The upper tick of the position
52
+ /// @param amount The amount of liquidity to remove
53
+ /// @param amount0 The amount of token0 withdrawn
54
+ /// @param amount1 The amount of token1 withdrawn
55
+ event Burn(
56
+ address indexed owner,
57
+ int24 indexed tickLower,
58
+ int24 indexed tickUpper,
59
+ uint128 amount,
60
+ uint256 amount0,
61
+ uint256 amount1
62
+ );
63
+
64
+ /// @notice Emitted by the pool for any swaps between token0 and token1
65
+ /// @param sender The address that initiated the swap call, and that received the callback
66
+ /// @param recipient The address that received the output of the swap
67
+ /// @param amount0 The delta of the token0 balance of the pool
68
+ /// @param amount1 The delta of the token1 balance of the pool
69
+ /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
70
+ /// @param liquidity The liquidity of the pool after the swap
71
+ /// @param tick The log base 1.0001 of price of the pool after the swap
72
+ event Swap(
73
+ address indexed sender,
74
+ address indexed recipient,
75
+ int256 amount0,
76
+ int256 amount1,
77
+ uint160 sqrtPriceX96,
78
+ uint128 liquidity,
79
+ int24 tick
80
+ );
81
+
82
+ /// @notice Emitted by the pool for any flashes of token0/token1
83
+ /// @param sender The address that initiated the swap call, and that received the callback
84
+ /// @param recipient The address that received the tokens from flash
85
+ /// @param amount0 The amount of token0 that was flashed
86
+ /// @param amount1 The amount of token1 that was flashed
87
+ /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
88
+ /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
89
+ event Flash(
90
+ address indexed sender,
91
+ address indexed recipient,
92
+ uint256 amount0,
93
+ uint256 amount1,
94
+ uint256 paid0,
95
+ uint256 paid1
96
+ );
97
+
98
+ /// @notice Emitted by the pool for increases to the number of observations that can be stored
99
+ /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
100
+ /// just before a mint/swap/burn.
101
+ /// @param observationCardinalityNextOld The previous value of the next observation cardinality
102
+ /// @param observationCardinalityNextNew The updated value of the next observation cardinality
103
+ event IncreaseObservationCardinalityNext(
104
+ uint16 observationCardinalityNextOld,
105
+ uint16 observationCardinalityNextNew
106
+ );
107
+
108
+ /// @notice Emitted when the protocol fee is changed by the pool
109
+ /// @param feeProtocol0Old The previous value of the token0 protocol fee
110
+ /// @param feeProtocol1Old The previous value of the token1 protocol fee
111
+ /// @param feeProtocol0New The updated value of the token0 protocol fee
112
+ /// @param feeProtocol1New The updated value of the token1 protocol fee
113
+ event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
114
+
115
+ /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
116
+ /// @param sender The address that collects the protocol fees
117
+ /// @param recipient The address that receives the collected protocol fees
118
+ /// @param amount0 The amount of token0 protocol fees that is withdrawn
119
+ /// @param amount0 The amount of token1 protocol fees that is withdrawn
120
+ event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
121
+ }
@@ -0,0 +1,35 @@
1
+ // SPDX-License-Identifier: GPL-2.0-or-later
2
+ pragma solidity >=0.5.0;
3
+
4
+ /// @title Pool state that never changes
5
+ /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
6
+ interface IUniswapV3PoolImmutables {
7
+ /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
8
+ /// @return The contract address
9
+ function factory() external view returns (address);
10
+
11
+ /// @notice The first of the two tokens of the pool, sorted by address
12
+ /// @return The token contract address
13
+ function token0() external view returns (address);
14
+
15
+ /// @notice The second of the two tokens of the pool, sorted by address
16
+ /// @return The token contract address
17
+ function token1() external view returns (address);
18
+
19
+ /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
20
+ /// @return The fee
21
+ function fee() external view returns (uint24);
22
+
23
+ /// @notice The pool tick spacing
24
+ /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
25
+ /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
26
+ /// This value is an int24 to avoid casting even though it is always positive.
27
+ /// @return The tick spacing
28
+ function tickSpacing() external view returns (int24);
29
+
30
+ /// @notice The maximum amount of position liquidity that can use any tick in the range
31
+ /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
32
+ /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
33
+ /// @return The max amount of liquidity per tick
34
+ function maxLiquidityPerTick() external view returns (uint128);
35
+ }
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: GPL-2.0-or-later
2
+ pragma solidity >=0.5.0;
3
+
4
+ /// @title Permissioned pool actions
5
+ /// @notice Contains pool methods that may only be called by the factory owner
6
+ interface IUniswapV3PoolOwnerActions {
7
+ /// @notice Set the denominator of the protocol's % share of the fees
8
+ /// @param feeProtocol0 new protocol fee for token0 of the pool
9
+ /// @param feeProtocol1 new protocol fee for token1 of the pool
10
+ function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;
11
+
12
+ /// @notice Collect the protocol fee accrued to the pool
13
+ /// @param recipient The address to which collected protocol fees should be sent
14
+ /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
15
+ /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
16
+ /// @return amount0 The protocol fee collected in token0
17
+ /// @return amount1 The protocol fee collected in token1
18
+ function collectProtocol(
19
+ address recipient,
20
+ uint128 amount0Requested,
21
+ uint128 amount1Requested
22
+ ) external returns (uint128 amount0, uint128 amount1);
23
+ }