@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,48 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+ import "@openzeppelin/contracts/math/SafeMath.sol";
6
+ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
7
+ import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
8
+ import "../interface/IController.sol";
9
+ import "./Controllable.sol";
10
+
11
+ contract RewardTokenProfitNotifier is Controllable {
12
+ using SafeMath for uint256;
13
+ using SafeERC20 for IERC20;
14
+
15
+ uint256 public profitSharingNumerator;
16
+ uint256 public profitSharingDenominator;
17
+ address public rewardToken;
18
+
19
+ constructor(
20
+ address _storage,
21
+ address _rewardToken
22
+ ) public Controllable(_storage){
23
+ rewardToken = _rewardToken;
24
+ // persist in the state for immutability of the fee
25
+ profitSharingNumerator = 80;
26
+ profitSharingDenominator = 1000;
27
+ require(profitSharingNumerator < profitSharingDenominator, "invalid profit share");
28
+ }
29
+
30
+ event ProfitLogInReward(uint256 profitAmount, uint256 feeAmount, uint256 timestamp);
31
+ event ProfitAndBuybackLog(uint256 profitAmount, uint256 feeAmount, uint256 timestamp);
32
+
33
+ function notifyProfitInRewardToken(uint256 _rewardBalance) internal {
34
+ if( _rewardBalance > 0 ){
35
+ uint256 feeAmount = _rewardBalance.mul(profitSharingNumerator).div(profitSharingDenominator);
36
+ emit ProfitLogInReward(_rewardBalance, feeAmount, block.timestamp);
37
+ IERC20(rewardToken).safeApprove(controller(), 0);
38
+ IERC20(rewardToken).safeApprove(controller(), feeAmount);
39
+
40
+ IController(controller()).notifyFee(
41
+ rewardToken,
42
+ feeAmount
43
+ );
44
+ } else {
45
+ emit ProfitLogInReward(0, 0, block.timestamp);
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,36 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+ contract Storage {
6
+
7
+ address public governance;
8
+ address public controller;
9
+
10
+ constructor() public {
11
+ governance = msg.sender;
12
+ }
13
+
14
+ modifier onlyGovernance() {
15
+ require(isGovernance(msg.sender), "Not governance");
16
+ _;
17
+ }
18
+
19
+ function setGovernance(address _governance) public onlyGovernance {
20
+ require(_governance != address(0), "new governance shouldn't be empty");
21
+ governance = _governance;
22
+ }
23
+
24
+ function setController(address _controller) public onlyGovernance {
25
+ require(_controller != address(0), "new controller shouldn't be empty");
26
+ controller = _controller;
27
+ }
28
+
29
+ function isGovernance(address account) public view returns (bool) {
30
+ return account == governance;
31
+ }
32
+
33
+ function isController(address account) public view returns (bool) {
34
+ return account == controller;
35
+ }
36
+ }
@@ -0,0 +1,30 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+ interface IController {
6
+ // [Grey list]
7
+ // An EOA can safely interact with the system no matter what.
8
+ // If you're using Metamask, you're using an EOA.
9
+ // Only smart contracts may be affected by this grey list.
10
+ //
11
+ // This contract will not be able to ban any EOA from the system
12
+ // even if an EOA is being added to the greyList, he/she will still be able
13
+ // to interact with the whole system as if nothing happened.
14
+ // Only smart contracts will be affected by being added to the greyList.
15
+ // This grey list is only used in Vault.sol, see the code there for reference
16
+ function greyList(address _target) external view returns(bool);
17
+
18
+ function addVaultAndStrategy(address _vault, address _strategy) external;
19
+ function doHardWork(address _vault) external;
20
+
21
+ function salvage(address _token, uint256 amount) external;
22
+ function salvageStrategy(address _strategy, address _token, uint256 amount) external;
23
+
24
+ function notifyFee(address _underlying, uint256 fee) external;
25
+ function profitSharingNumerator() external view returns (uint256);
26
+ function profitSharingDenominator() external view returns (uint256);
27
+
28
+ function feeRewardForwarder() external view returns(address);
29
+ function setFeeRewardForwarder(address _value) external;
30
+ }
@@ -0,0 +1,135 @@
1
+ // SPDX-License-Identifier: Unlicense
2
+ pragma solidity 0.6.12;
3
+
4
+
5
+ interface IControllerV2 {
6
+
7
+ // ========================= Events =========================
8
+
9
+ event QueueProfitSharingChange(uint profitSharingNumerator, uint validAtTimestamp);
10
+ event ConfirmProfitSharingChange(uint profitSharingNumerator);
11
+
12
+ event QueueStrategistFeeChange(uint strategistFeeNumerator, uint validAtTimestamp);
13
+ event ConfirmStrategistFeeChange(uint strategistFeeNumerator);
14
+
15
+ event QueuePlatformFeeChange(uint platformFeeNumerator, uint validAtTimestamp);
16
+ event ConfirmPlatformFeeChange(uint platformFeeNumerator);
17
+
18
+ event QueueNextImplementationDelay(uint implementationDelay, uint validAtTimestamp);
19
+ event ConfirmNextImplementationDelay(uint implementationDelay);
20
+
21
+ event AddedStakingContract(address indexed stakingContract);
22
+ event RemovedStakingContract(address indexed stakingContract);
23
+
24
+ event SharePriceChangeLog(
25
+ address indexed vault,
26
+ address indexed strategy,
27
+ uint256 oldSharePrice,
28
+ uint256 newSharePrice,
29
+ uint256 timestamp
30
+ );
31
+
32
+ // ==================== Functions ====================
33
+
34
+ /**
35
+ * An EOA can safely interact with the system no matter what. If you're using Metamask, you're using an EOA. Only
36
+ * smart contracts may be affected by this grey list. This contract will not be able to ban any EOA from the system
37
+ * even if an EOA is being added to the greyList, he/she will still be able to interact with the whole system as if
38
+ * nothing happened. Only smart contracts will be affected by being added to the greyList. This grey list is only
39
+ * used in VaultV3.sol, see the code there for reference
40
+ */
41
+ function greyList(address _target) external view returns (bool);
42
+
43
+ function addressWhiteList(address _target) external view returns (bool);
44
+
45
+ function codeWhiteList(address _target) external view returns (bool);
46
+
47
+ function addToWhitelist(address _target) external;
48
+
49
+ function addCodeToWhitelist(address _target) external;
50
+
51
+ function store() external view returns (address);
52
+
53
+ function governance() external view returns (address);
54
+
55
+ function notifyFee(address _underlying, uint256 fee) external;
56
+
57
+ function doHardWork(address _vault) external;
58
+
59
+ function addHardWorker(address _worker) external;
60
+
61
+ function removeHardWorker(address _worker) external;
62
+
63
+ function salvage(address _token, uint256 amount) external;
64
+
65
+ function salvageStrategy(address _strategy, address _token, uint256 amount) external;
66
+
67
+ /**
68
+ * @return The targeted profit token to convert all-non-compounding rewards to. Defaults to WETH.
69
+ */
70
+ function targetToken() external view returns (address);
71
+
72
+ function setTargetToken(address _targetToken) external;
73
+
74
+ function profitSharingReceiver() external view returns (address);
75
+
76
+ function setProfitSharingReceiver(address _profitSharingReceiver) external;
77
+
78
+ function protocolFeeReceiver() external view returns (address);
79
+
80
+ function setProtocolFeeReceiver(address _protocolFeeReceiver) external;
81
+
82
+ function rewardForwarder() external view returns (address);
83
+
84
+ function setRewardForwarder(address _rewardForwarder) external;
85
+
86
+ function universalLiquidator() external view returns (address);
87
+
88
+ function setUniversalLiquidator(address _universalLiquidator) external;
89
+
90
+ function dolomiteYieldFarmingRouter() external view returns (address);
91
+
92
+ function setDolomiteYieldFarmingRouter(address _value) external;
93
+
94
+ function nextImplementationDelay() external view returns (uint256);
95
+
96
+ function profitSharingNumerator() external view returns (uint256);
97
+
98
+ function strategistFeeNumerator() external view returns (uint256);
99
+
100
+ function platformFeeNumerator() external view returns (uint256);
101
+
102
+ function feeDenominator() external view returns (uint256);
103
+
104
+ function setProfitSharingNumerator(uint _profitSharingNumerator) external;
105
+
106
+ function confirmSetProfitSharingNumerator() external;
107
+
108
+ function setStrategistFeeNumerator(uint _strategistFeeNumerator) external;
109
+
110
+ function confirmSetStrategistFeeNumerator() external;
111
+
112
+ function setPlatformFeeNumerator(uint _platformFeeNumerator) external;
113
+
114
+ function confirmSetPlatformFeeNumerator() external;
115
+
116
+ function setNextImplementationDelay(uint256 _nextImplementationDelay) external;
117
+
118
+ function confirmNextImplementationDelay() external;
119
+
120
+ function nextProfitSharingNumerator() external view returns (uint256);
121
+
122
+ function nextProfitSharingNumeratorTimestamp() external view returns (uint256);
123
+
124
+ function nextStrategistFeeNumerator() external view returns (uint256);
125
+
126
+ function nextStrategistFeeNumeratorTimestamp() external view returns (uint256);
127
+
128
+ function nextPlatformFeeNumerator() external view returns (uint256);
129
+
130
+ function nextPlatformFeeNumeratorTimestamp() external view returns (uint256);
131
+
132
+ function tempNextImplementationDelay() external view returns (uint256);
133
+
134
+ function tempNextImplementationDelayTimestamp() external view returns (uint256);
135
+ }
@@ -0,0 +1,263 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+
6
+ interface IERC4626 {
7
+
8
+ // ========================= Events =========================
9
+
10
+ /**
11
+ * Caller has exchanged assets for shares, and transferred those shares to owner.
12
+ *
13
+ * MUST be emitted when tokens are deposited into the Vault via the mint and deposit methods.
14
+ */
15
+ event Deposit(
16
+ address indexed sender,
17
+ address indexed receiver,
18
+ uint256 assets,
19
+ uint256 shares
20
+ );
21
+
22
+ /**
23
+ * Caller has exchanged shares, owned by owner, for assets, and transferred those assets to receiver.
24
+ *
25
+ * MUST be emitted when shares are withdrawn from the Vault in ERC4626.redeem or ERC4626.withdraw methods.
26
+ */
27
+ event Withdraw(
28
+ address indexed sender,
29
+ address indexed receiver,
30
+ address indexed owner,
31
+ uint256 assets,
32
+ uint256 shares
33
+ );
34
+
35
+ // ========================= Functions =========================
36
+
37
+ /**
38
+ * @return assetTokenAddress The address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
39
+ */
40
+ function asset() external view returns (address assetTokenAddress);
41
+
42
+ /**
43
+ * @return totalManagedAssets Total amount of the underlying asset that is “managed” by Vault. SHOULD include any compounding that
44
+ * occurs from yield. MUST be inclusive of any fees that are charged against assets in the Vault.
45
+ */
46
+ function totalAssets() external view returns (uint256 totalManagedAssets);
47
+
48
+ /**
49
+ * @return assetsPerUnitShare The amount of underlying the Vault would exchange for 1 unit of shares, in an ideal scenario where all
50
+ * the conditions are met. MUST NOT be inclusive of any fees that are charged against assets in the Vault.
51
+ * MUST NOT show any variations depending on the caller. MUST NOT reflect slippage or other on-chain
52
+ * conditions, when performing the actual exchange. MUST NOT revert unless due to integer overflow caused
53
+ * by an unreasonably large input. MUST round down towards 0. This calculation MAY NOT reflect the
54
+ * “per-user” price-per-share, and instead should reflect the “average-user’s” price-per-share, meaning
55
+ * what the average user should expect to see when exchanging to and from. This function should normally
56
+ * return more than `10 ** underlying().decimals`.
57
+ */
58
+ function assetsPerShare() external view returns (uint256 assetsPerUnitShare);
59
+
60
+ /**
61
+ * @return assets Total amount of the underlying asset that is “managed” by Vault for the `depositor`. SHOULD include any
62
+ * compounding that occurs from yield. MUST be inclusive of any fees that are charged against assets in the
63
+ * Vault.
64
+ */
65
+ function assetsOf(address depositor) external view returns (uint256 assets);
66
+
67
+ /**
68
+ * Maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit
69
+ * call. MUST return the maximum amount of assets deposit would allow to be deposited for receiver and not cause a
70
+ * revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if
71
+ * necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset. MUST factor
72
+ * in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return
73
+ * 0. MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
74
+ */
75
+ function maxDeposit(address caller) external view returns (uint256 maxAssets);
76
+
77
+ /**
78
+ * Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current
79
+ * on-chain conditions.
80
+ *
81
+ * MUST return as close to and no more than the exact amount of Vault shares that would be
82
+ * minted in a deposit call in the same transaction. I.e. deposit should return the same or more shares as
83
+ * previewDeposit if called in the same transaction. MUST NOT account for deposit limits like those returned from
84
+ * maxDeposit and should always act as though the deposit would be accepted, regardless if the user has enough
85
+ * tokens approved, etc.
86
+ *
87
+ * MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
88
+ *
89
+ * MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also
90
+ * cause deposit to revert.
91
+ *
92
+ * Note that any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
93
+ * share price or some other type of condition, meaning the depositor will lose assets by depositing.
94
+ */
95
+ function previewDeposit(uint256 assets) external view returns (uint256 shares);
96
+
97
+ /**
98
+ * Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
99
+ *
100
+ * MUST emit the Deposit event.
101
+ *
102
+ * MUST support ERC-20 approve / transferFrom on asset as a deposit flow. MAY support an additional flow in which
103
+ * the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during
104
+ * deposit.
105
+ *
106
+ * MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
107
+ * approving enough underlying tokens to the Vault contract, etc).
108
+ *
109
+ * Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
110
+ */
111
+ function deposit(uint256 assets, address receiver) external returns (uint256 shares);
112
+
113
+ /**
114
+ * Maximum amount of shares that can be minted from the Vault for the receiver, through a mint call.
115
+ *
116
+ * MUST return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert,
117
+ * which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).
118
+ * This assumes that the user has infinite assets, i.e. MUST NOT rely on balanceOf of asset.
119
+ *
120
+ * MUST factor in both global and user-specific limits, like if mints are entirely disabled (even temporarily) it
121
+ * MUST return 0.
122
+ *
123
+ * MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
124
+ */
125
+ function maxMint(address caller) external view returns (uint256 maxShares);
126
+
127
+ /**
128
+ * Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given current
129
+ * on-chain conditions.
130
+ *
131
+ * MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call in
132
+ * the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the same
133
+ * transaction.
134
+ *
135
+ * MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint would
136
+ * be accepted, regardless if the user has enough tokens approved, etc.
137
+ *
138
+ * MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
139
+ *
140
+ * MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also
141
+ * cause mint to revert.
142
+ *
143
+ * Note that any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
144
+ * share price or some other type of condition, meaning the depositor will lose assets by minting.
145
+ */
146
+ function previewMint(uint256 shares) external view returns (uint256 assets);
147
+
148
+ /**
149
+ * Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
150
+ *
151
+ * MUST emit the Deposit event.
152
+ *
153
+ * MUST support ERC-20 approve / transferFrom on asset as a mint flow. MAY support an additional flow in which the
154
+ * underlying tokens are owned by the Vault contract before the mint execution, and are accounted for during mint.
155
+ *
156
+ * MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
157
+ * approving enough underlying tokens to the Vault contract, etc).
158
+ *
159
+ * Note that most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
160
+ */
161
+ function mint(uint256 shares, address receiver) external returns (uint256 assets);
162
+
163
+ /**
164
+ * Maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a
165
+ * withdraw call.
166
+ *
167
+ * MUST return the maximum amount of assets that could be transferred from owner through withdraw and not cause a
168
+ * revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if
169
+ * necessary).
170
+ *
171
+ * MUST factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily)
172
+ * it MUST return 0.
173
+ */
174
+ function maxWithdraw(address caller) external view returns (uint256 maxAssets);
175
+
176
+ /**
177
+ * Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given
178
+ * current on-chain conditions.
179
+ *
180
+ * MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
181
+ * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if called
182
+ * in the same transaction.
183
+ *
184
+ * MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though the
185
+ * withdrawal would be accepted, regardless if the user has enough shares, etc.
186
+ *
187
+ * MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
188
+ *
189
+ * MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also
190
+ * cause withdraw to revert.
191
+ *
192
+ * Note that any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage
193
+ * in share price or some other type of condition, meaning the depositor will lose assets by depositing.
194
+ */
195
+ function previewWithdraw(uint256 assets) external view returns (uint256 shares);
196
+
197
+ /**
198
+ * Burns shares from owner and sends exactly assets of underlying tokens to receiver.
199
+ *
200
+ * MUST emit the Withdraw event.
201
+ *
202
+ * MUST support a withdraw flow where the shares are burned from owner directly where owner is msg.sender or
203
+ * msg.sender has ERC-20 approval over the shares of owner. MAY support an additional flow in which the shares are
204
+ * transferred to the Vault contract before the withdraw execution, and are accounted for during withdraw.
205
+ *
206
+ * MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not
207
+ * having enough shares, etc).
208
+ *
209
+ * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
210
+ * Those methods should be performed separately.
211
+ */
212
+ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
213
+
214
+ /**
215
+ * Maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call.
216
+ *
217
+ * MUST return the maximum amount of shares that could be transferred from owner through redeem and not cause a
218
+ * revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if
219
+ * necessary).
220
+ *
221
+ * MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily)
222
+ * it MUST return 0.
223
+ */
224
+ function maxRedeem(address caller) external view returns (uint256 maxShares);
225
+
226
+ /**
227
+ * Allows an on-chain or off-chain user to simulate the effects of their redemption at the current block, given
228
+ * current on-chain conditions.
229
+ *
230
+ * MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call in
231
+ * the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the same
232
+ * transaction.
233
+ *
234
+ * MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
235
+ * redemption would be accepted, regardless if the user has enough shares, etc.
236
+ *
237
+ * MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
238
+ *
239
+ * MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also
240
+ * cause redeem to revert.
241
+ *
242
+ * Note that any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
243
+ * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
244
+ */
245
+ function previewRedeem(uint256 shares) external view returns (uint256 assets);
246
+
247
+ /**
248
+ * Burns exactly shares from owner and sends assets of underlying tokens to receiver.
249
+ *
250
+ * MUST emit the Withdraw event.
251
+ *
252
+ * MUST support a redeem flow where the shares are burned from owner directly where owner is msg.sender or
253
+ * msg.sender has ERC-20 approval over the shares of owner. MAY support an additional flow in which the shares are
254
+ * transferred to the Vault contract before the redeem execution, and are accounted for during redeem.
255
+ *
256
+ * MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not
257
+ * having enough shares, etc).
258
+ *
259
+ * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
260
+ * Those methods should be performed separately.
261
+ */
262
+ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
263
+ }
@@ -0,0 +1,9 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+ interface IFeeRewardForwarder {
6
+ function poolNotifyFixedTarget(address _token, uint256 _amount) external;
7
+ function profitSharingPool() external view returns (address);
8
+ function setConversionPath(address[] calldata _route, address[] calldata _routers) external;
9
+ }
@@ -0,0 +1,10 @@
1
+ // SPDX-License-Identifier: Unlicense
2
+ pragma solidity 0.6.12;
3
+
4
+
5
+ interface IProfitSharingReceiver {
6
+
7
+ function governance() external view returns (address);
8
+
9
+ function withdrawTokens(address[] calldata _tokens) external;
10
+ }
@@ -0,0 +1,58 @@
1
+ // SPDX-License-Identifier: Unlicense
2
+ pragma solidity 0.6.12;
3
+
4
+
5
+ /**
6
+ * @dev A routing contract that is responsible for taking the harvested gains and routing them into FARM and additional
7
+ * buyback tokens for the corresponding strategy
8
+ */
9
+ interface IRewardForwarder {
10
+
11
+ function store() external view returns (address);
12
+
13
+ function governance() external view returns (address);
14
+
15
+ /**
16
+ * @dev This function sends converted `_buybackTokens` to `msg.sender`. The returned amounts will match the
17
+ * `amounts` return value. The fee amounts are converted to the profit sharing token and sent to the proper
18
+ * addresses (profit sharing, strategist, and governance (platform)).
19
+ *
20
+ * @param _token the token that will be compounded or sold into the profit sharing token for the Harvest
21
+ * collective (users that stake iFARM)
22
+ * @param _profitSharingFee the amount of `_token` that will be sold into the profit sharing token
23
+ * @param _strategistFee the amount of `_token` that will be sold into the profit sharing token for the
24
+ * strategist
25
+ * @param _platformFee the amount of `_token` that will be sold into the profit sharing token for the Harvest
26
+ * treasury
27
+ * @param _buybackTokens the output tokens that `_buyBackAmounts` should be swapped to (outputToken)
28
+ * @param _buybackAmounts the amounts of `_token` that will be bought into more `_buybackTokens` token
29
+ * @return amounts The amounts that were purchased of _buybackTokens
30
+ */
31
+ function notifyFeeAndBuybackAmounts(
32
+ address _token,
33
+ uint256 _profitSharingFee,
34
+ uint256 _strategistFee,
35
+ uint256 _platformFee,
36
+ address[] calldata _buybackTokens,
37
+ uint256[] calldata _buybackAmounts
38
+ ) external returns (uint[] memory amounts);
39
+
40
+ /**
41
+ * @dev This function converts the fee amounts to the profit sharing token and sends them to the proper addresses
42
+ * (profit sharing, strategist, and governance (platform)).
43
+ *
44
+ * @param _token the token that will be compounded or sold into the profit sharing token for the Harvest
45
+ * collective (users that stake iFARM)
46
+ * @param _profitSharingFee the amount of `_token` that will be sold into the profit sharing token
47
+ * @param _strategistFee the amount of `_token` that will be sold into the profit sharing token for the
48
+ * strategist
49
+ * @param _platformFee the amount of `_token` that will be sold into the profit sharing token for the Harvest
50
+ * treasury
51
+ */
52
+ function notifyFee(
53
+ address _token,
54
+ uint256 _profitSharingFee,
55
+ uint256 _strategistFee,
56
+ uint256 _platformFee
57
+ ) external;
58
+ }
@@ -0,0 +1,34 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+ // Unifying the interface with the Synthetix Reward Pool
6
+ interface IRewardPool {
7
+ function rewardToken() external view returns (address);
8
+ function lpToken() external view returns (address);
9
+ function duration() external view returns (uint256);
10
+
11
+ function periodFinish() external view returns (uint256);
12
+ function rewardRate() external view returns (uint256);
13
+ function rewardPerTokenStored() external view returns (uint256);
14
+
15
+ function stake(uint256 amountWei) external;
16
+
17
+ // `balanceOf` would give the amount staked.
18
+ // As this is 1 to 1, this is also the holder's share
19
+ function balanceOf(address holder) external view returns (uint256);
20
+ // total shares & total lpTokens staked
21
+ function totalSupply() external view returns(uint256);
22
+
23
+ function withdraw(uint256 amountWei) external;
24
+ function exit() external;
25
+
26
+ // get claimed rewards
27
+ function earned(address holder) external view returns (uint256);
28
+
29
+ // claim rewards
30
+ function getReward() external;
31
+
32
+ // notify
33
+ function notifyRewardAmount(uint256 _amount) external;
34
+ }
@@ -0,0 +1,25 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+
3
+ pragma solidity 0.6.12;
4
+
5
+ interface IStrategy {
6
+
7
+ function unsalvagableTokens(address tokens) external view returns (bool);
8
+
9
+ function underlying() external view returns (address);
10
+ function vault() external view returns (address);
11
+
12
+ function withdrawAllToVault() external;
13
+ function withdrawToVault(uint256 amount) external;
14
+
15
+ function investedUnderlyingBalance() external view returns (uint256); // itsNotMuch()
16
+
17
+ // should only be called by controller
18
+ function salvage(address recipient, address token, uint256 amount) external;
19
+
20
+ function doHardWork() external;
21
+ function depositArbCheck() external view returns(bool);
22
+
23
+ function strategist() external view returns (address);
24
+ function salvageToken(address recipient, address token, uint amount) external;
25
+ }
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity 0.6.12;
3
+
4
+ interface IUniversalLiquidator {
5
+ event Swap(
6
+ address indexed sellToken,
7
+ address indexed buyToken,
8
+ address indexed receiver,
9
+ address initiator,
10
+ uint256 sellAmount,
11
+ uint256 minBuyAmount
12
+ );
13
+
14
+ function swap(
15
+ address _sellToken,
16
+ address _buyToken,
17
+ uint256 _sellAmount,
18
+ uint256 _minBuyAmount,
19
+ address _receiver
20
+ ) external returns (uint256);
21
+ }