@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,557 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+ pragma solidity 0.6.12;
3
+ pragma experimental ABIEncoderV2;
4
+
5
+ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6
+
7
+ interface IAsset {
8
+ }
9
+
10
+ interface IBVault {
11
+ // Internal Balance
12
+ //
13
+ // Users can deposit tokens into the Vault, where they are allocated to their Internal Balance, and later
14
+ // transferred or withdrawn. It can also be used as a source of tokens when joining Pools, as a destination
15
+ // when exiting them, and as either when performing swaps. This usage of Internal Balance results in greatly reduced
16
+ // gas costs when compared to relying on plain ERC20 transfers, leading to large savings for frequent users.
17
+ //
18
+ // Internal Balance management features batching, which means a single contract call can be used to perform multiple
19
+ // operations of different kinds, with different senders and recipients, at once.
20
+
21
+ /**
22
+ * @dev Returns `user`'s Internal Balance for a set of tokens.
23
+ */
24
+ function getInternalBalance(address user, IERC20[] calldata tokens) external view returns (uint256[] memory);
25
+
26
+ /**
27
+ * @dev Performs a set of user balance operations, which involve Internal Balance (deposit, withdraw or transfer)
28
+ * and plain ERC20 transfers using the Vault's allowance. This last feature is particularly useful for relayers, as
29
+ * it lets integrators reuse a user's Vault allowance.
30
+ *
31
+ * For each operation, if the caller is not `sender`, it must be an authorized relayer for them.
32
+ */
33
+ function manageUserBalance(UserBalanceOp[] calldata ops) external payable;
34
+
35
+ /**
36
+ * @dev Data for `manageUserBalance` operations, which include the possibility for ETH to be sent and received
37
+ without manual WETH wrapping or unwrapping.
38
+ */
39
+ struct UserBalanceOp {
40
+ UserBalanceOpKind kind;
41
+ IAsset asset;
42
+ uint256 amount;
43
+ address sender;
44
+ address payable recipient;
45
+ }
46
+
47
+ // There are four possible operations in `manageUserBalance`:
48
+ //
49
+ // - DEPOSIT_INTERNAL
50
+ // Increases the Internal Balance of the `recipient` account by transferring tokens from the corresponding
51
+ // `sender`. The sender must have allowed the Vault to use their tokens via `IERC20.approve()`.
52
+ //
53
+ // ETH can be used by passing the ETH sentinel value as the asset and forwarding ETH in the call: it will be wrapped
54
+ // and deposited as WETH. Any ETH amount remaining will be sent back to the caller (not the sender, which is
55
+ // relevant for relayers).
56
+ //
57
+ // Emits an `InternalBalanceChanged` event.
58
+ //
59
+ //
60
+ // - WITHDRAW_INTERNAL
61
+ // Decreases the Internal Balance of the `sender` account by transferring tokens to the `recipient`.
62
+ //
63
+ // ETH can be used by passing the ETH sentinel value as the asset. This will deduct WETH instead, unwrap it and send
64
+ // it to the recipient as ETH.
65
+ //
66
+ // Emits an `InternalBalanceChanged` event.
67
+ //
68
+ //
69
+ // - TRANSFER_INTERNAL
70
+ // Transfers tokens from the Internal Balance of the `sender` account to the Internal Balance of `recipient`.
71
+ //
72
+ // Reverts if the ETH sentinel value is passed.
73
+ //
74
+ // Emits an `InternalBalanceChanged` event.
75
+ //
76
+ //
77
+ // - TRANSFER_EXTERNAL
78
+ // Transfers tokens from `sender` to `recipient`, using the Vault's ERC20 allowance. This is typically used by
79
+ // relayers, as it lets them reuse a user's Vault allowance.
80
+ //
81
+ // Reverts if the ETH sentinel value is passed.
82
+ //
83
+ // Emits an `ExternalBalanceTransfer` event.
84
+
85
+ enum UserBalanceOpKind { DEPOSIT_INTERNAL, WITHDRAW_INTERNAL, TRANSFER_INTERNAL, TRANSFER_EXTERNAL }
86
+
87
+ /**
88
+ * @dev Emitted when a user's Internal Balance changes, either from calls to `manageUserBalance`, or through
89
+ * interacting with Pools using Internal Balance.
90
+ *
91
+ * Because Internal Balance works exclusively with ERC20 tokens, ETH deposits and withdrawals will use the WETH
92
+ * address.
93
+ */
94
+ event InternalBalanceChanged(address indexed user, IERC20 indexed token, int256 delta);
95
+
96
+ /**
97
+ * @dev Emitted when a user's Vault ERC20 allowance is used by the Vault to transfer tokens to an external account.
98
+ */
99
+ event ExternalBalanceTransfer(IERC20 indexed token, address indexed sender, address recipient, uint256 amount);
100
+
101
+ // Pools
102
+ //
103
+ // There are three specialization settings for Pools, which allow for cheaper swaps at the cost of reduced
104
+ // functionality:
105
+ //
106
+ // - General: no specialization, suited for all Pools. IGeneralPool is used for swap request callbacks, passing the
107
+ // balance of all tokens in the Pool. These Pools have the largest swap costs (because of the extra storage reads),
108
+ // which increase with the number of registered tokens.
109
+ //
110
+ // - Minimal Swap Info: IMinimalSwapInfoPool is used instead of IGeneralPool, which saves gas by only passing the
111
+ // balance of the two tokens involved in the swap. This is suitable for some pricing algorithms, like the weighted
112
+ // constant product one popularized by Balancer V1. Swap costs are smaller compared to general Pools, and are
113
+ // independent of the number of registered tokens.
114
+ //
115
+ // - Two Token: only allows two tokens to be registered. This achieves the lowest possible swap gas cost. Like
116
+ // minimal swap info Pools, these are called via IMinimalSwapInfoPool.
117
+
118
+ enum PoolSpecialization { GENERAL, MINIMAL_SWAP_INFO, TWO_TOKEN }
119
+
120
+ /**
121
+ * @dev Registers the caller account as a Pool with a given specialization setting. Returns the Pool's ID, which
122
+ * is used in all Pool-related functions. Pools cannot be deregistered, nor can the Pool's specialization be
123
+ * changed.
124
+ *
125
+ * The caller is expected to be a smart contract that implements either `IGeneralPool` or `IMinimalSwapInfoPool`,
126
+ * depending on the chosen specialization setting. This contract is known as the Pool's contract.
127
+ *
128
+ * Note that the same contract may register itself as multiple Pools with unique Pool IDs, or in other words,
129
+ * multiple Pools may share the same contract.
130
+ *
131
+ * Emits a `PoolRegistered` event.
132
+ */
133
+ function registerPool(PoolSpecialization specialization) external returns (bytes32);
134
+
135
+ /**
136
+ * @dev Emitted when a Pool is registered by calling `registerPool`.
137
+ */
138
+ event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, PoolSpecialization specialization);
139
+
140
+ /**
141
+ * @dev Returns a Pool's contract address and specialization setting.
142
+ */
143
+ function getPool(bytes32 poolId) external view returns (address, PoolSpecialization);
144
+
145
+ /**
146
+ * @dev Registers `tokens` for the `poolId` Pool. Must be called by the Pool's contract.
147
+ *
148
+ * Pools can only interact with tokens they have registered. Users join a Pool by transferring registered tokens,
149
+ * exit by receiving registered tokens, and can only swap registered tokens.
150
+ *
151
+ * Each token can only be registered once. For Pools with the Two Token specialization, `tokens` must have a length
152
+ * of two, that is, both tokens must be registered in the same `registerTokens` call, and they must be sorted in
153
+ * ascending order.
154
+ *
155
+ * The `tokens` and `assetManagers` arrays must have the same length, and each entry in these indicates the Asset
156
+ * Manager for the corresponding token. Asset Managers can manage a Pool's tokens via `managePoolBalance`,
157
+ * depositing and withdrawing them directly, and can even set their balance to arbitrary amounts. They are therefore
158
+ * expected to be highly secured smart contracts with sound design principles, and the decision to register an
159
+ * Asset Manager should not be made lightly.
160
+ *
161
+ * Pools can choose not to assign an Asset Manager to a given token by passing in the zero address. Once an Asset
162
+ * Manager is set, it cannot be changed except by deregistering the associated token and registering again with a
163
+ * different Asset Manager.
164
+ *
165
+ * Emits a `TokensRegistered` event.
166
+ */
167
+ function registerTokens(
168
+ bytes32 poolId,
169
+ IERC20[] calldata tokens,
170
+ address[] calldata assetManagers
171
+ ) external;
172
+
173
+ /**
174
+ * @dev Emitted when a Pool registers tokens by calling `registerTokens`.
175
+ */
176
+ event TokensRegistered(bytes32 indexed poolId, IERC20[] tokens, address[] assetManagers);
177
+
178
+ /**
179
+ * @dev Deregisters `tokens` for the `poolId` Pool. Must be called by the Pool's contract.
180
+ *
181
+ * Only registered tokens (via `registerTokens`) can be deregistered. Additionally, they must have zero total
182
+ * balance. For Pools with the Two Token specialization, `tokens` must have a length of two, that is, both tokens
183
+ * must be deregistered in the same `deregisterTokens` call.
184
+ *
185
+ * A deregistered token can be re-registered later on, possibly with a different Asset Manager.
186
+ *
187
+ * Emits a `TokensDeregistered` event.
188
+ */
189
+ function deregisterTokens(bytes32 poolId, IERC20[] calldata tokens) external;
190
+
191
+ /**
192
+ * @dev Emitted when a Pool deregisters tokens by calling `deregisterTokens`.
193
+ */
194
+ event TokensDeregistered(bytes32 indexed poolId, IERC20[] tokens);
195
+
196
+ /**
197
+ * @dev Returns detailed information for a Pool's registered token.
198
+ *
199
+ * `cash` is the number of tokens the Vault currently holds for the Pool. `managed` is the number of tokens
200
+ * withdrawn and held outside the Vault by the Pool's token Asset Manager. The Pool's total balance for `token`
201
+ * equals the sum of `cash` and `managed`.
202
+ *
203
+ * Internally, `cash` and `managed` are stored using 112 bits. No action can ever cause a Pool's token `cash`,
204
+ * `managed` or `total` balance to be greater than 2^112 - 1.
205
+ *
206
+ * `lastChangeBlock` is the number of the block in which `token`'s total balance was last modified (via either a
207
+ * join, exit, swap, or Asset Manager update). This value is useful to avoid so-called 'sandwich attacks', for
208
+ * example when developing price oracles. A change of zero (e.g. caused by a swap with amount zero) is considered a
209
+ * change for this purpose, and will update `lastChangeBlock`.
210
+ *
211
+ * `assetManager` is the Pool's token Asset Manager.
212
+ */
213
+ function getPoolTokenInfo(bytes32 poolId, IERC20 token)
214
+ external
215
+ view
216
+ returns (
217
+ uint256 cash,
218
+ uint256 managed,
219
+ uint256 lastChangeBlock,
220
+ address assetManager
221
+ );
222
+
223
+ /**
224
+ * @dev Returns a Pool's registered tokens, the total balance for each, and the latest block when *any* of
225
+ * the tokens' `balances` changed.
226
+ *
227
+ * The order of the `tokens` array is the same order that will be used in `joinPool`, `exitPool`, as well as in all
228
+ * Pool hooks (where applicable). Calls to `registerTokens` and `deregisterTokens` may change this order.
229
+ *
230
+ * If a Pool only registers tokens once, and these are sorted in ascending order, they will be stored in the same
231
+ * order as passed to `registerTokens`.
232
+ *
233
+ * Total balances include both tokens held by the Vault and those withdrawn by the Pool's Asset Managers. These are
234
+ * the amounts used by joins, exits and swaps. For a detailed breakdown of token balances, use `getPoolTokenInfo`
235
+ * instead.
236
+ */
237
+ function getPoolTokens(bytes32 poolId)
238
+ external
239
+ view
240
+ returns (
241
+ address[] memory tokens,
242
+ uint256[] memory balances,
243
+ uint256 lastChangeBlock
244
+ );
245
+
246
+ /**
247
+ * @dev Called by users to join a Pool, which transfers tokens from `sender` into the Pool's balance. This will
248
+ * trigger custom Pool behavior, which will typically grant something in return to `recipient` - often tokenized
249
+ * Pool shares.
250
+ *
251
+ * If the caller is not `sender`, it must be an authorized relayer for them.
252
+ *
253
+ * The `assets` and `maxAmountsIn` arrays must have the same length, and each entry indicates the maximum amount
254
+ * to send for each asset. The amounts to send are decided by the Pool and not the Vault: it just enforces
255
+ * these maximums.
256
+ *
257
+ * If joining a Pool that holds WETH, it is possible to send ETH directly: the Vault will do the wrapping. To enable
258
+ * this mechanism, the IAsset sentinel value (the zero address) must be passed in the `assets` array instead of the
259
+ * WETH address. Note that it is not possible to combine ETH and WETH in the same join. Any excess ETH will be sent
260
+ * back to the caller (not the sender, which is important for relayers).
261
+ *
262
+ * `assets` must have the same length and order as the array returned by `getPoolTokens`. This prevents issues when
263
+ * interacting with Pools that register and deregister tokens frequently. If sending ETH however, the array must be
264
+ * sorted *before* replacing the WETH address with the ETH sentinel value (the zero address), which means the final
265
+ * `assets` array might not be sorted. Pools with no registered tokens cannot be joined.
266
+ *
267
+ * If `fromInternalBalance` is true, the caller's Internal Balance will be preferred: ERC20 transfers will only
268
+ * be made for the difference between the requested amount and Internal Balance (if any). Note that ETH cannot be
269
+ * withdrawn from Internal Balance: attempting to do so will trigger a revert.
270
+ *
271
+ * This causes the Vault to call the `IBasePool.onJoinPool` hook on the Pool's contract, where Pools implement
272
+ * their own custom logic. This typically requires additional information from the user (such as the expected number
273
+ * of Pool shares). This can be encoded in the `userData` argument, which is ignored by the Vault and passed
274
+ * directly to the Pool's contract, as is `recipient`.
275
+ *
276
+ * Emits a `PoolBalanceChanged` event.
277
+ */
278
+ function joinPool(
279
+ bytes32 poolId,
280
+ address sender,
281
+ address recipient,
282
+ JoinPoolRequest calldata request
283
+ ) external payable;
284
+
285
+ enum JoinKind { INIT, EXACT_TOKENS_IN_FOR_BPT_OUT, TOKEN_IN_FOR_EXACT_BPT_OUT }
286
+ enum ExitKind { EXACT_BPT_IN_FOR_ONE_TOKEN_OUT, EXACT_BPT_IN_FOR_TOKENS_OUT, BPT_IN_FOR_EXACT_TOKENS_OUT }
287
+
288
+ struct JoinPoolRequest {
289
+ IAsset[] assets;
290
+ uint256[] maxAmountsIn;
291
+ bytes userData;
292
+ bool fromInternalBalance;
293
+ }
294
+
295
+ /**
296
+ * @dev Called by users to exit a Pool, which transfers tokens from the Pool's balance to `recipient`. This will
297
+ * trigger custom Pool behavior, which will typically ask for something in return from `sender` - often tokenized
298
+ * Pool shares. The amount of tokens that can be withdrawn is limited by the Pool's `cash` balance (see
299
+ * `getPoolTokenInfo`).
300
+ *
301
+ * If the caller is not `sender`, it must be an authorized relayer for them.
302
+ *
303
+ * The `tokens` and `minAmountsOut` arrays must have the same length, and each entry in these indicates the minimum
304
+ * token amount to receive for each token contract. The amounts to send are decided by the Pool and not the Vault:
305
+ * it just enforces these minimums.
306
+ *
307
+ * If exiting a Pool that holds WETH, it is possible to receive ETH directly: the Vault will do the unwrapping. To
308
+ * enable this mechanism, the IAsset sentinel value (the zero address) must be passed in the `assets` array instead
309
+ * of the WETH address. Note that it is not possible to combine ETH and WETH in the same exit.
310
+ *
311
+ * `assets` must have the same length and order as the array returned by `getPoolTokens`. This prevents issues when
312
+ * interacting with Pools that register and deregister tokens frequently. If receiving ETH however, the array must
313
+ * be sorted *before* replacing the WETH address with the ETH sentinel value (the zero address), which means the
314
+ * final `assets` array might not be sorted. Pools with no registered tokens cannot be exited.
315
+ *
316
+ * If `toInternalBalance` is true, the tokens will be deposited to `recipient`'s Internal Balance. Otherwise,
317
+ * an ERC20 transfer will be performed. Note that ETH cannot be deposited to Internal Balance: attempting to
318
+ * do so will trigger a revert.
319
+ *
320
+ * `minAmountsOut` is the minimum amount of tokens the user expects to get out of the Pool, for each token in the
321
+ * `tokens` array. This array must match the Pool's registered tokens.
322
+ *
323
+ * This causes the Vault to call the `IBasePool.onExitPool` hook on the Pool's contract, where Pools implement
324
+ * their own custom logic. This typically requires additional information from the user (such as the expected number
325
+ * of Pool shares to return). This can be encoded in the `userData` argument, which is ignored by the Vault and
326
+ * passed directly to the Pool's contract.
327
+ *
328
+ * Emits a `PoolBalanceChanged` event.
329
+ */
330
+ function exitPool(
331
+ bytes32 poolId,
332
+ address sender,
333
+ address payable recipient,
334
+ ExitPoolRequest calldata request
335
+ ) external;
336
+
337
+ struct ExitPoolRequest {
338
+ IAsset[] assets;
339
+ uint256[] minAmountsOut;
340
+ bytes userData;
341
+ bool toInternalBalance;
342
+ }
343
+
344
+ /**
345
+ * @dev Emitted when a user joins or exits a Pool by calling `joinPool` or `exitPool`, respectively.
346
+ */
347
+ event PoolBalanceChanged(
348
+ bytes32 indexed poolId,
349
+ address indexed liquidityProvider,
350
+ IERC20[] tokens,
351
+ int256[] deltas,
352
+ uint256[] protocolFeeAmounts
353
+ );
354
+
355
+ enum PoolBalanceChangeKind { JOIN, EXIT }
356
+
357
+ // Swaps
358
+ //
359
+ // Users can swap tokens with Pools by calling the `swap` and `batchSwap` functions. To do this,
360
+ // they need not trust Pool contracts in any way: all security checks are made by the Vault. They must however be
361
+ // aware of the Pools' pricing algorithms in order to estimate the prices Pools will quote.
362
+ //
363
+ // The `swap` function executes a single swap, while `batchSwap` can perform multiple swaps in sequence.
364
+ // In each individual swap, tokens of one kind are sent from the sender to the Pool (this is the 'token in'),
365
+ // and tokens of another kind are sent from the Pool to the recipient in exchange (this is the 'token out').
366
+ // More complex swaps, such as one token in to multiple tokens out can be achieved by batching together
367
+ // individual swaps.
368
+ //
369
+ // There are two swap kinds:
370
+ // - 'given in' swaps, where the amount of tokens in (sent to the Pool) is known, and the Pool determines (via the
371
+ // `onSwap` hook) the amount of tokens out (to send to the recipient).
372
+ // - 'given out' swaps, where the amount of tokens out (received from the Pool) is known, and the Pool determines
373
+ // (via the `onSwap` hook) the amount of tokens in (to receive from the sender).
374
+ //
375
+ // Additionally, it is possible to chain swaps using a placeholder input amount, which the Vault replaces with
376
+ // the calculated output of the previous swap. If the previous swap was 'given in', this will be the calculated
377
+ // tokenOut amount. If the previous swap was 'given out', it will use the calculated tokenIn amount. These extended
378
+ // swaps are known as 'multihop' swaps, since they 'hop' through a number of intermediate tokens before arriving at
379
+ // the final intended token.
380
+ //
381
+ // In all cases, tokens are only transferred in and out of the Vault (or withdrawn from and deposited into Internal
382
+ // Balance) after all individual swaps have been completed, and the net token balance change computed. This makes
383
+ // certain swap patterns, such as multihops, or swaps that interact with the same token pair in multiple Pools, cost
384
+ // much less gas than they would otherwise.
385
+ //
386
+ // It also means that under certain conditions it is possible to perform arbitrage by swapping with multiple
387
+ // Pools in a way that results in net token movement out of the Vault (profit), with no tokens being sent in (only
388
+ // updating the Pool's internal accounting).
389
+ //
390
+ // To protect users from front-running or the market changing rapidly, they supply a list of 'limits' for each token
391
+ // involved in the swap, where either the maximum number of tokens to send (by passing a positive value) or the
392
+ // minimum amount of tokens to receive (by passing a negative value) is specified.
393
+ //
394
+ // Additionally, a 'deadline' timestamp can also be provided, forcing the swap to fail if it occurs after
395
+ // this point in time (e.g. if the transaction failed to be included in a block promptly).
396
+ //
397
+ // If interacting with Pools that hold WETH, it is possible to both send and receive ETH directly: the Vault will do
398
+ // the wrapping and unwrapping. To enable this mechanism, the IAsset sentinel value (the zero address) must be
399
+ // passed in the `assets` array instead of the WETH address. Note that it is possible to combine ETH and WETH in the
400
+ // same swap. Any excess ETH will be sent back to the caller (not the sender, which is relevant for relayers).
401
+ //
402
+ // Finally, Internal Balance can be used when either sending or receiving tokens.
403
+
404
+ enum SwapKind { GIVEN_IN, GIVEN_OUT }
405
+
406
+ /**
407
+ * @dev Performs a swap with a single Pool.
408
+ *
409
+ * If the swap is 'given in' (the number of tokens to send to the Pool is known), it returns the amount of tokens
410
+ * taken from the Pool, which must be greater than or equal to `limit`.
411
+ *
412
+ * If the swap is 'given out' (the number of tokens to take from the Pool is known), it returns the amount of tokens
413
+ * sent to the Pool, which must be less than or equal to `limit`.
414
+ *
415
+ * Internal Balance usage and the recipient are determined by the `funds` struct.
416
+ *
417
+ * Emits a `Swap` event.
418
+ */
419
+ function swap(
420
+ SingleSwap calldata singleSwap,
421
+ FundManagement calldata funds,
422
+ uint256 limit,
423
+ uint256 deadline
424
+ ) external payable returns (uint256);
425
+
426
+ /**
427
+ * @dev Data for a single swap executed by `swap`. `amount` is either `amountIn` or `amountOut` depending on
428
+ * the `kind` value.
429
+ *
430
+ * `assetIn` and `assetOut` are either token addresses, or the IAsset sentinel value for ETH (the zero address).
431
+ * Note that Pools never interact with ETH directly: it will be wrapped to or unwrapped from WETH by the Vault.
432
+ *
433
+ * The `userData` field is ignored by the Vault, but forwarded to the Pool in the `onSwap` hook, and may be
434
+ * used to extend swap behavior.
435
+ */
436
+ struct SingleSwap {
437
+ bytes32 poolId;
438
+ SwapKind kind;
439
+ IAsset assetIn;
440
+ IAsset assetOut;
441
+ uint256 amount;
442
+ bytes userData;
443
+ }
444
+
445
+ /**
446
+ * @dev Performs a series of swaps with one or multiple Pools. In each individual swap, the caller determines either
447
+ * the amount of tokens sent to or received from the Pool, depending on the `kind` value.
448
+ *
449
+ * Returns an array with the net Vault asset balance deltas. Positive amounts represent tokens (or ETH) sent to the
450
+ * Vault, and negative amounts represent tokens (or ETH) sent by the Vault. Each delta corresponds to the asset at
451
+ * the same index in the `assets` array.
452
+ *
453
+ * Swaps are executed sequentially, in the order specified by the `swaps` array. Each array element describes a
454
+ * Pool, the token to be sent to this Pool, the token to receive from it, and an amount that is either `amountIn` or
455
+ * `amountOut` depending on the swap kind.
456
+ *
457
+ * Multihop swaps can be executed by passing an `amount` value of zero for a swap. This will cause the amount in/out
458
+ * of the previous swap to be used as the amount in for the current one. In a 'given in' swap, 'tokenIn' must equal
459
+ * the previous swap's `tokenOut`. For a 'given out' swap, `tokenOut` must equal the previous swap's `tokenIn`.
460
+ *
461
+ * The `assets` array contains the addresses of all assets involved in the swaps. These are either token addresses,
462
+ * or the IAsset sentinel value for ETH (the zero address). Each entry in the `swaps` array specifies tokens in and
463
+ * out by referencing an index in `assets`. Note that Pools never interact with ETH directly: it will be wrapped to
464
+ * or unwrapped from WETH by the Vault.
465
+ *
466
+ * Internal Balance usage, sender, and recipient are determined by the `funds` struct. The `limits` array specifies
467
+ * the minimum or maximum amount of each token the vault is allowed to transfer.
468
+ *
469
+ * `batchSwap` can be used to make a single swap, like `swap` does, but doing so requires more gas than the
470
+ * equivalent `swap` call.
471
+ *
472
+ * Emits `Swap` events.
473
+ */
474
+ function batchSwap(
475
+ SwapKind kind,
476
+ BatchSwapStep[] calldata swaps,
477
+ IAsset[] calldata assets,
478
+ FundManagement calldata funds,
479
+ int256[] calldata limits,
480
+ uint256 deadline
481
+ ) external payable returns (int256[] memory);
482
+
483
+ /**
484
+ * @dev Data for each individual swap executed by `batchSwap`. The asset in and out fields are indexes into the
485
+ * `assets` array passed to that function, and ETH assets are converted to WETH.
486
+ *
487
+ * If `amount` is zero, the multihop mechanism is used to determine the actual amount based on the amount in/out
488
+ * from the previous swap, depending on the swap kind.
489
+ *
490
+ * The `userData` field is ignored by the Vault, but forwarded to the Pool in the `onSwap` hook, and may be
491
+ * used to extend swap behavior.
492
+ */
493
+ struct BatchSwapStep {
494
+ bytes32 poolId;
495
+ uint256 assetInIndex;
496
+ uint256 assetOutIndex;
497
+ uint256 amount;
498
+ bytes userData;
499
+ }
500
+
501
+ /**
502
+ * @dev Emitted for each individual swap performed by `swap` or `batchSwap`.
503
+ */
504
+ event Swap(
505
+ bytes32 indexed poolId,
506
+ IERC20 indexed tokenIn,
507
+ IERC20 indexed tokenOut,
508
+ uint256 amountIn,
509
+ uint256 amountOut
510
+ );
511
+
512
+ /**
513
+ * @dev All tokens in a swap are either sent from the `sender` account to the Vault, or from the Vault to the
514
+ * `recipient` account.
515
+ *
516
+ * If the caller is not `sender`, it must be an authorized relayer for them.
517
+ *
518
+ * If `fromInternalBalance` is true, the `sender`'s Internal Balance will be preferred, performing an ERC20
519
+ * transfer for the difference between the requested amount and the User's Internal Balance (if any). The `sender`
520
+ * must have allowed the Vault to use their tokens via `IERC20.approve()`. This matches the behavior of
521
+ * `joinPool`.
522
+ *
523
+ * If `toInternalBalance` is true, tokens will be deposited to `recipient`'s internal balance instead of
524
+ * transferred. This matches the behavior of `exitPool`.
525
+ *
526
+ * Note that ETH cannot be deposited to or withdrawn from Internal Balance: attempting to do so will trigger a
527
+ * revert.
528
+ */
529
+ struct FundManagement {
530
+ address sender;
531
+ bool fromInternalBalance;
532
+ address payable recipient;
533
+ bool toInternalBalance;
534
+ }
535
+
536
+ /**
537
+ * @dev Simulates a call to `batchSwap`, returning an array of Vault asset deltas. Calls to `swap` cannot be
538
+ * simulated directly, but an equivalent `batchSwap` call can and will yield the exact same result.
539
+ *
540
+ * Each element in the array corresponds to the asset at the same index, and indicates the number of tokens (or ETH)
541
+ * the Vault would take from the sender (if positive) or send to the recipient (if negative). The arguments it
542
+ * receives are the same that an equivalent `batchSwap` call would receive.
543
+ *
544
+ * Unlike `batchSwap`, this function performs no checks on the sender or recipient field in the `funds` struct.
545
+ * This makes it suitable to be called by off-chain applications via eth_call without needing to hold tokens,
546
+ * approve them for the Vault, or even know a user's address.
547
+ *
548
+ * Note that this function is not 'view' (due to implementation details): the client code must explicitly execute
549
+ * eth_call instead of eth_sendTransaction.
550
+ */
551
+ function queryBatchSwap(
552
+ SwapKind kind,
553
+ BatchSwapStep[] calldata swaps,
554
+ IAsset[] calldata assets,
555
+ FundManagement calldata funds
556
+ ) external returns (int256[] memory assetDeltas);
557
+ }
@@ -0,0 +1,114 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ // This program is free software: you can redistribute it and/or modify
3
+ // it under the terms of the GNU General Public License as published by
4
+ // the Free Software Foundation, either version 3 of the License, or
5
+ // (at your option) any later version.
6
+
7
+ // This program is distributed in the hope that it will be useful,
8
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ // GNU General Public License for more details.
11
+
12
+ // You should have received a copy of the GNU General Public License
13
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
14
+
15
+ pragma solidity 0.6.12;
16
+
17
+
18
+ /**
19
+ * @dev Base minter interface, applicable to Mainnet minter or L2 pseudo minters.
20
+ */
21
+ interface IBalancerMinter {
22
+ event Minted(address indexed recipient, address gauge, uint256 minted);
23
+
24
+ /**
25
+ * @notice Returns the address of the Balancer Governance Token
26
+ */
27
+ function getBalancerToken() external view returns (address);
28
+
29
+ /**
30
+ * @notice Mint everything which belongs to `msg.sender` and send to them
31
+ * @param gauge `LiquidityGauge` address to get mintable amount from
32
+ */
33
+ function mint(address gauge) external returns (uint256);
34
+
35
+ /**
36
+ * @notice Mint everything which belongs to `msg.sender` across multiple gauges
37
+ * @param gauges List of `LiquidityGauge` addresses
38
+ */
39
+ function mintMany(address[] calldata gauges) external returns (uint256);
40
+
41
+ /**
42
+ * @notice Mint tokens for `user`
43
+ * @dev Only possible when `msg.sender` has been approved by `user` to mint on their behalf
44
+ * @param gauge `LiquidityGauge` address to get mintable amount from
45
+ * @param user Address to mint to
46
+ */
47
+ function mintFor(address gauge, address user) external returns (uint256);
48
+
49
+ /**
50
+ * @notice Mint tokens for `user` across multiple gauges
51
+ * @dev Only possible when `msg.sender` has been approved by `user` to mint on their behalf
52
+ * @param gauges List of `LiquidityGauge` addresses
53
+ * @param user Address to mint to
54
+ */
55
+ function mintManyFor(address[] calldata gauges, address user) external returns (uint256);
56
+
57
+ /**
58
+ * @notice The total number of tokens minted for `user` from `gauge`
59
+ */
60
+ function minted(address user, address gauge) external view returns (uint256);
61
+
62
+ /**
63
+ * @notice Whether `minter` is approved to mint tokens for `user`
64
+ */
65
+ function getMinterApproval(address minter, address user) external view returns (bool);
66
+
67
+ /**
68
+ * @notice Set whether `minter` is approved to mint tokens on your behalf
69
+ */
70
+ function setMinterApproval(address minter, bool approval) external;
71
+
72
+ /**
73
+ * @notice Set whether `minter` is approved to mint tokens on behalf of `user`, who has signed a message authorizing
74
+ * them.
75
+ */
76
+ function setMinterApprovalWithSignature(
77
+ address minter,
78
+ bool approval,
79
+ address user,
80
+ uint256 deadline,
81
+ uint8 v,
82
+ bytes32 r,
83
+ bytes32 s
84
+ ) external;
85
+
86
+ // The below functions are near-duplicates of functions available above.
87
+ // They are included for ABI compatibility with snake_casing as used in vyper contracts.
88
+ // solhint-disable func-name-mixedcase
89
+
90
+ /**
91
+ * @notice Whether `minter` is approved to mint tokens for `user`
92
+ */
93
+ function allowed_to_mint_for(address minter, address user) external view returns (bool);
94
+
95
+ /**
96
+ * @notice Mint everything which belongs to `msg.sender` across multiple gauges
97
+ * @dev This function is not recommended as `mintMany()` is more flexible and gas efficient
98
+ * @param gauges List of `LiquidityGauge` addresses
99
+ */
100
+ function mint_many(address[8] calldata gauges) external;
101
+
102
+ /**
103
+ * @notice Mint tokens for `user`
104
+ * @dev Only possible when `msg.sender` has been approved by `user` to mint on their behalf
105
+ * @param gauge `LiquidityGauge` address to get mintable amount from
106
+ * @param user Address to mint to
107
+ */
108
+ function mint_for(address gauge, address user) external;
109
+
110
+ /**
111
+ * @notice Toggle whether `minter` is approved to mint tokens for `user`
112
+ */
113
+ function toggle_approve_mint(address minter) external;
114
+ }