@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.
- package/README.md +110 -5
- package/contracts/base/Controller.sol +125 -0
- package/contracts/base/ControllerV2.sol +363 -0
- package/contracts/base/FeeRewardForwarder.sol +163 -0
- package/contracts/base/PotPool.sol +360 -0
- package/contracts/base/ProfitSharingReceiver.sol +39 -0
- package/contracts/base/RewardForwarderV2.sol +109 -0
- package/contracts/base/Vault.sol +344 -0
- package/contracts/base/VaultERC4626.sol +113 -0
- package/contracts/base/VaultProxy.sol +35 -0
- package/contracts/base/VaultStorage.sol +199 -0
- package/contracts/base/VaultStorageV2.sol +196 -0
- package/contracts/base/VaultV2.sol +369 -0
- package/contracts/base/ape-base/MiniApeV2Strategy.sol +322 -0
- package/contracts/base/ape-base/interface/IMiniChefV2.sol +31 -0
- package/contracts/base/ape-base/interface/IRewarder.sol +10 -0
- package/contracts/base/factory/MegaFactory.sol +120 -0
- package/contracts/base/factory/interface/IPoolFactory.sol +6 -0
- package/contracts/base/factory/interface/IStrategyFactory.sol +6 -0
- package/contracts/base/factory/interface/IVaultFactory.sol +7 -0
- package/contracts/base/factory/pool/PotPoolFactory.sol +43 -0
- package/contracts/base/factory/strategy/UpgradableStrategyFactory.sol +19 -0
- package/contracts/base/factory/vault/RegularVaultFactory.sol +34 -0
- package/contracts/base/incentives/GlobalIncentivesHelper.sol +167 -0
- package/contracts/base/incentives/NotifyHelperGeneric.sol +61 -0
- package/contracts/base/incentives/NotifyHelperStateful.sol +290 -0
- package/contracts/base/inheritance/Controllable.sol +26 -0
- package/contracts/base/inheritance/ControllableInit.sol +31 -0
- package/contracts/base/inheritance/Governable.sol +29 -0
- package/contracts/base/inheritance/GovernableInit.sol +51 -0
- package/contracts/base/inheritance/IUpgradeSource.sol +8 -0
- package/contracts/base/inheritance/OwnableWhitelist.sol +17 -0
- package/contracts/base/inheritance/RewardTokenProfitNotifier.sol +48 -0
- package/contracts/base/inheritance/Storage.sol +36 -0
- package/contracts/base/interface/IController.sol +30 -0
- package/contracts/base/interface/IControllerV2.sol +135 -0
- package/contracts/base/interface/IERC4626.sol +263 -0
- package/contracts/base/interface/IFeeRewardForwarder.sol +9 -0
- package/contracts/base/interface/IProfitSharingReceiver.sol +10 -0
- package/contracts/base/interface/IRewardForwarder.sol +58 -0
- package/contracts/base/interface/IRewardPool.sol +34 -0
- package/contracts/base/interface/IStrategy.sol +25 -0
- package/contracts/base/interface/IUniversalLiquidator.sol +21 -0
- package/contracts/base/interface/IUniversalLiquidatorRegistry.sol +20 -0
- package/contracts/base/interface/IUpgradeSource.sol +8 -0
- package/contracts/base/interface/IVault.sol +35 -0
- package/contracts/base/interface/aave/DataTypes.sol +266 -0
- package/contracts/base/interface/aave/IAToken.sol +37 -0
- package/contracts/base/interface/aave/IPool.sol +13 -0
- package/contracts/base/interface/balancer/Gauge.sol +22 -0
- package/contracts/base/interface/balancer/IBVault.sol +557 -0
- package/contracts/base/interface/balancer/IBalancerMinter.sol +114 -0
- package/contracts/base/interface/balancer/linearPool/ILinearPool.sol +185 -0
- package/contracts/base/interface/balancer/linearPool/ILinearPoolFactory.sol +16 -0
- package/contracts/base/interface/balancer/linearPool/ILinearPoolRebalancer.sol +8 -0
- package/contracts/base/interface/balancer/linearPool/IPoolSwapStructs.sol +57 -0
- package/contracts/base/interface/caviar/ICaviarChef.sol +16 -0
- package/contracts/base/interface/compound/IComet.sol +114 -0
- package/contracts/base/interface/compound/ICometRewards.sol +17 -0
- package/contracts/base/interface/curve/Gauge.sol +25 -0
- package/contracts/base/interface/curve/ICurveDeposit_2token.sol +25 -0
- package/contracts/base/interface/curve/ICurveDeposit_2token_underlying.sol +31 -0
- package/contracts/base/interface/curve/ICurveDeposit_3token.sol +25 -0
- package/contracts/base/interface/curve/ICurveDeposit_3token_meta.sol +20 -0
- package/contracts/base/interface/curve/ICurveDeposit_3token_underlying.sol +31 -0
- package/contracts/base/interface/curve/ICurveDeposit_4token.sol +25 -0
- package/contracts/base/interface/curve/ICurveDeposit_4token_meta.sol +20 -0
- package/contracts/base/interface/curve/ICurveDeposit_4token_underlying.sol +31 -0
- package/contracts/base/interface/curve/ICurveDeposit_5token.sol +25 -0
- package/contracts/base/interface/curve/ICurveDeposit_5token_meta.sol +20 -0
- package/contracts/base/interface/curve/ICurveDeposit_5token_underlying.sol +31 -0
- package/contracts/base/interface/curve/ICurveDeposit_6token.sol +25 -0
- package/contracts/base/interface/curve/ICurveDeposit_6token_meta.sol +20 -0
- package/contracts/base/interface/gamma/IClearing.sol +8 -0
- package/contracts/base/interface/gamma/IHypervisor.sol +17 -0
- package/contracts/base/interface/gamma/IStakingRewards.sol +35 -0
- package/contracts/base/interface/gamma/IUniProxy.sol +15 -0
- package/contracts/base/interface/kyber/IDMMExchangeRouter.sol +69 -0
- package/contracts/base/interface/kyber/IDMMFactory.sol +35 -0
- package/contracts/base/interface/kyber/IDMMLiquidityRouter.sol +204 -0
- package/contracts/base/interface/kyber/IDMMPool.sol +42 -0
- package/contracts/base/interface/kyber/IDMMRouter01.sol +12 -0
- package/contracts/base/interface/kyber/IDMMRouter02.sol +55 -0
- package/contracts/base/interface/kyber/IKyberZap.sol +7 -0
- package/contracts/base/interface/merkl/IDistributor.sol +6 -0
- package/contracts/base/interface/morpho/IMetaMorpho.sol +7 -0
- package/contracts/base/interface/pearl/IGauge.sol +13 -0
- package/contracts/base/interface/pearl/IPair.sol +44 -0
- package/contracts/base/interface/pearl/IRouter.sol +305 -0
- package/contracts/base/interface/quickswap/IDragonLair.sol +25 -0
- package/contracts/base/interface/quickswap/IMasterChef.sol +13 -0
- package/contracts/base/interface/uniswap/IUniswapV2Factory.sol +15 -0
- package/contracts/base/interface/uniswap/IUniswapV2Migrator.sol +6 -0
- package/contracts/base/interface/uniswap/IUniswapV2Pair.sol +59 -0
- package/contracts/base/interface/uniswap/IUniswapV2Router01.sol +96 -0
- package/contracts/base/interface/uniswap/IUniswapV2Router02.sol +137 -0
- package/contracts/base/interface/uniswap/IUniswapV3Pool.sol +24 -0
- package/contracts/base/interface/uniswap/IUniswapV3Router.sol +64 -0
- package/contracts/base/interface/uniswap/IWETH.sol +8 -0
- package/contracts/base/interface/uniswap/pool/IUniswapV3PoolActions.sol +103 -0
- package/contracts/base/interface/uniswap/pool/IUniswapV3PoolDerivedState.sol +40 -0
- package/contracts/base/interface/uniswap/pool/IUniswapV3PoolEvents.sol +121 -0
- package/contracts/base/interface/uniswap/pool/IUniswapV3PoolImmutables.sol +35 -0
- package/contracts/base/interface/uniswap/pool/IUniswapV3PoolOwnerActions.sol +23 -0
- package/contracts/base/interface/uniswap/pool/IUniswapV3PoolState.sol +116 -0
- package/contracts/base/masterchef-base/MasterChefHodlStrategy.sol +240 -0
- package/contracts/base/masterchef-base/MasterChefStrategy.sol +364 -0
- package/contracts/base/masterchef-base/interfaces/IMasterChef.sol +12 -0
- package/contracts/base/migration/vaultMigratable_2JPYv2.sol +87 -0
- package/contracts/base/migration/vaultMigratable_bal2EUR_PAR.sol +121 -0
- package/contracts/base/migration/vaultMigratable_bal2EUR_agEUR.sol +121 -0
- package/contracts/base/migration/vaultMigratable_balMaticX.sol +153 -0
- package/contracts/base/migration/vaultMigratable_balStMatic.sol +153 -0
- package/contracts/base/noop/NoopStrategy.sol +89 -0
- package/contracts/base/noop/NoopStrategyUpgradeable.sol +92 -0
- package/contracts/base/sushi-base/MiniChefV2Strategy.sol +380 -0
- package/contracts/base/sushi-base/interface/IMiniChefV2.sol +31 -0
- package/contracts/base/sushi-base/interface/IRewarder.sol +9 -0
- package/contracts/base/sushi-base/lib/BoringERC20.sol +30 -0
- package/contracts/base/upgradability/Address.sol +33 -0
- package/contracts/base/upgradability/BaseUpgradeabilityProxy.sol +61 -0
- package/contracts/base/upgradability/BaseUpgradeableStrategy.sol +111 -0
- package/contracts/base/upgradability/BaseUpgradeableStrategyStorage.sol +176 -0
- package/contracts/base/upgradability/BaseUpgradeableStrategyStorageV2.sol +290 -0
- package/contracts/base/upgradability/BaseUpgradeableStrategyV2.sol +145 -0
- package/contracts/base/upgradability/IUpgradable.sol +7 -0
- package/contracts/base/upgradability/Proxy.sol +71 -0
- package/contracts/base/upgradability/ReentrancyGuard.sol +57 -0
- package/contracts/base/upgradability/ReentrancyGuardUpgradeable.sol +51 -0
- package/contracts/base/upgradability/StrategyProxy.sol +35 -0
- package/contracts/base/wmatic/WMATIC.sol +8 -0
- package/contracts/strategies/aave/AaveSupplyStrategy.sol +213 -0
- package/contracts/strategies/aave/AaveSupplyStrategyMainnet_DAI.sol +23 -0
- package/contracts/strategies/aave/AaveSupplyStrategyMainnet_EURS.sol +23 -0
- package/contracts/strategies/aave/AaveSupplyStrategyMainnet_USDC.sol +23 -0
- package/contracts/strategies/aave/AaveSupplyStrategyMainnet_USDCe.sol +23 -0
- package/contracts/strategies/aave/AaveSupplyStrategyMainnet_USDT.sol +23 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_BANANA_MATIC.sol +36 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_BNB_MATIC.sol +36 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_BTC_MATIC.sol +36 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_DAI_MATIC.sol +36 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_DAI_USDC.sol +37 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_ETH_MATIC.sol +36 -0
- package/contracts/strategies/ape/ApeStrategyMainnet_USDT_MATIC.sol +36 -0
- package/contracts/strategies/aura/AuraStrategy.sol +347 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_jEUR_PAR.sol +30 -0
- package/contracts/strategies/aura/interface/IAuraBaseRewardPool.sol +25 -0
- package/contracts/strategies/aura/interface/IAuraBooster.sol +17 -0
- package/contracts/strategies/aura/interface/IAuraDepositor.sol +7 -0
- package/contracts/strategies/balancer/BalancerStrategyV3.sol +509 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2BRL.sol +39 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2BRLUSD.sol +38 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2EUR_PAR.sol +34 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2EUR_PARv2.sol +34 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_2EUR_agEUR.sol +34 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_MATIC_USDC_ETH_BAL.sol +32 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_MaticX.sol +37 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_MaticX_amMatic.sol +38 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_SPHERE_MATIC.sol +34 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_TNGBL_USDC.sol +34 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_WBTC_ETH_USDC.sol +32 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_bbamusd.sol +36 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_frxETH.sol +32 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_frxETH_amWETH.sol +35 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_stETH.sol +35 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_stMatic.sol +36 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_stMatic_amMatic.sol +39 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_tetuBal.sol +36 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_wUSDR_USDC.sol +34 -0
- package/contracts/strategies/balancer/BalancerStrategyV3Mainnet_wstETH_amWETH.sol +37 -0
- package/contracts/strategies/balancer/interface/Gauge.sol +26 -0
- package/contracts/strategies/balancer/interface/IBVault.sol +557 -0
- package/contracts/strategies/balancer/interface/IBalanceMinter.sol +114 -0
- package/contracts/strategies/complifi/ComplifiDerivStrategy.sol +381 -0
- package/contracts/strategies/complifi/ComplifiDerivStrategyMainnet_ETH5x.sol +35 -0
- package/contracts/strategies/complifi/ComplifiStrategy.sol +362 -0
- package/contracts/strategies/complifi/ComplifiStrategyMainnet_COMFI_WETH.sol +34 -0
- package/contracts/strategies/complifi/interfaces/ILiquidityMining.sol +13 -0
- package/contracts/strategies/complifi/interfaces/ILiquidityPool.sol +63 -0
- package/contracts/strategies/complifi/interfaces/IProxyActions.sol +10 -0
- package/contracts/strategies/complifi/interfaces/IUSDCVault.sol +55 -0
- package/contracts/strategies/compound/CompoundStrategy.sol +296 -0
- package/contracts/strategies/compound/CompoundStrategyMainnet_USDC.sol +28 -0
- package/contracts/strategies/compound/CompoundStrategyMainnet_USDT.sol +28 -0
- package/contracts/strategies/compound-blue/CompoundBlueStrategy.sol +292 -0
- package/contracts/strategies/compound-blue/CompoundBlueStrategyMainnet_ETH.sol +27 -0
- package/contracts/strategies/compound-blue/CompoundBlueStrategyMainnet_USDC.sol +27 -0
- package/contracts/strategies/compound-blue/CompoundBlueStrategyMainnet_USDT.sol +27 -0
- package/contracts/strategies/convex/ConvexStrategyMainnet_3CRV.sol +40 -0
- package/contracts/strategies/convex/ConvexStrategyMainnet_3CRYPTO.sol +37 -0
- package/contracts/strategies/convex/ConvexStrategyMainnet_CRV_3CRYPTO copy.sol +37 -0
- package/contracts/strategies/convex/ConvexStrategyMainnet_MATIC_3CRYPTO.sol +37 -0
- package/contracts/strategies/convex/ConvexStrategyMainnet_USDR.sol +40 -0
- package/contracts/strategies/convex/ConvexStrategyMainnet_aCRV.sol +38 -0
- package/contracts/strategies/convex/base/ConvexStrategy.sol +480 -0
- package/contracts/strategies/convex/interface/IBaseRewardPool.sol +13 -0
- package/contracts/strategies/convex/interface/IBooster.sol +10 -0
- package/contracts/strategies/gamma-merkl/GammaMerklStrategy.sol +272 -0
- package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_ETH_USDC.sol +25 -0
- package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_ETH_USDT.sol +25 -0
- package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_MATIC_USDT.sol +25 -0
- package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_TBTC_ETH.sol +25 -0
- package/contracts/strategies/gamma-merkl/GammaMerklStrategyMainnet_QS_WBTC_ETH_w.sol +25 -0
- package/contracts/strategies/genomes/NoopStrategy_GENE_ETH.sol +23 -0
- package/contracts/strategies/genomes/NoopStrategy_GNOME_ETH.sol +23 -0
- package/contracts/strategies/idle/IdleFinanceStrategy.sol +240 -0
- package/contracts/strategies/idle/IdleStrategyDAIMainnet.sol +33 -0
- package/contracts/strategies/idle/IdleStrategyUSDCMainnet.sol +33 -0
- package/contracts/strategies/idle/IdleStrategyWETHMainnet.sol +30 -0
- package/contracts/strategies/idle/interface/IdleToken.sol +58 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3.sol +351 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2CAD.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR_EURT.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR_EURe.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2EUR_PAR.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2JPY.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2JPYv2.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2NZD.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_2SGD.sol +34 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jCHF_USDC.sol +35 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jCHF_WETH.sol +35 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jEUR_USDC.sol +35 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jEUR_WETH.sol +35 -0
- package/contracts/strategies/jarvis/JarvisHodlStrategyV3Mainnet_jGBP_USDC.sol +35 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3.sol +281 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_AUR3_USDC.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_AURJUL22_WETH.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_DEN2_4EUR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_DEN3_4EUR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_DEN4_4EUR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTANGLENOV22_2EURagEUR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTANGLE_2EURagEUR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTJUL22_USDC.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTMAY22_USDC.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTMIMONOV22_2EURPAR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTMIMO_2EURPAR.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTNOV22_USDC.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_JRTSEP22_USDC.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_QUI_2CAD.sol +27 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_SES_2JPY.sol +28 -0
- package/contracts/strategies/jarvis/JarvisStrategyV3Mainnet_agDEN_2EUR.sol +27 -0
- package/contracts/strategies/jarvis/interface/IElysianFields.sol +11 -0
- package/contracts/strategies/jarvis/interface/IKyberFairLaunch.sol +13 -0
- package/contracts/strategies/jarvis/interface/IKyberRewardLocker.sol +9 -0
- package/contracts/strategies/meshswap/MeshswapStrategy.sol +304 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_MESH_oMOOI.sol +30 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_MESH_oZEMIT.sol +30 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_USDC_oUSDC.sol +31 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_USDT_oUSDT.sol +31 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_WMATIC_MESH.sol +27 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_WMATIC_USDC.sol +28 -0
- package/contracts/strategies/meshswap/MeshswapStrategyMainnet_WMATIC_USDT.sol +28 -0
- package/contracts/strategies/meshswap/interface/IExchange.sol +9 -0
- package/contracts/strategies/meshswap/interface/IRouter.sol +68 -0
- package/contracts/strategies/pearl/CaviarStrategy.sol +244 -0
- package/contracts/strategies/pearl/CaviarStrategyMainnet_CVR.sol +26 -0
- package/contracts/strategies/pearl/PearlHodlStrategy.sol +254 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_CVR_PEARL.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_DAI_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_ETH_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_MATIC_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_PEARL_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_STAR_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_TNGBL_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_USDC_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_USDT_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_WBTC_USDR.sol +27 -0
- package/contracts/strategies/pearl/PearlHodlStrategyMainnet_wUSDR_USDR.sol +27 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategy.sol +400 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_ETH_narrow.sol +31 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_ETH_wide.sol +31 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_USDC_narrow.sol +31 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_MATIC_USDC_wide.sol +31 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_USDC_ETH_narrow.sol +34 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyMainnet_USDC_ETH_wide.sol +34 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2.sol +348 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_USDC_DAI.sol +28 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_USDC_USDT.sol +29 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_WBTC_ETH_narrow.sol +28 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_WBTC_USDC_narrow.sol +28 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_cbETH_ETH.sol +28 -0
- package/contracts/strategies/quick-gamma/QuickGammaStrategyV2Mainnet_wstETH_ETH.sol +28 -0
- package/contracts/strategies/uniswap-gamma/UniswapGammaStrategy.sol +312 -0
- package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_USDC_DAI.sol +28 -0
- package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_USDC_USDT.sol +28 -0
- package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_USDC_WETH.sol +28 -0
- package/contracts/strategies/uniswap-gamma/UniswapGammaStrategyMainnet_WMATIC_USDC.sol +28 -0
- package/contracts/strategies/yel/YelStrategy.sol +350 -0
- package/contracts/strategies/yel/YelStrategyMainnet_YEL_WETH.sol +29 -0
- package/hardhat.config.js +58 -0
- package/index.js +42 -0
- package/package.json +56 -6
- package/scripts/01-deploy-vault-regular-with-upgradable-strategy.js +41 -0
- package/scripts/02-deploy-vault-regular.js +35 -0
- package/scripts/03-deploy-upgradable-strategy.js +34 -0
- package/scripts/04-deploy-new-implementation.js +24 -0
- package/scripts/README.md +55 -0
- package/scripts/utils.js +42 -0
- package/test/aave/dai.js +207 -0
- package/test/aave/eurs.js +207 -0
- package/test/aave/usdc.js +206 -0
- package/test/aave/usdce.js +206 -0
- package/test/aave/usdt.js +206 -0
- package/test/ape/banana-matic.js +157 -0
- package/test/ape/bnb-matic.js +159 -0
- package/test/ape/btc-matic.js +159 -0
- package/test/ape/dai-matic.js +159 -0
- package/test/ape/dai-usdc.js +163 -0
- package/test/ape/eth-matic.js +158 -0
- package/test/ape/usdt-matic.js +159 -0
- package/test/aura/jeur-par.js +135 -0
- package/test/balancer/2brl_v3.js +123 -0
- package/test/balancer/2brlusd_v3.js +123 -0
- package/test/balancer/2eur_ageur.js +141 -0
- package/test/balancer/2eur_par.js +141 -0
- package/test/balancer/2eur_par_v2.js +123 -0
- package/test/balancer/bbamusd_v3.js +124 -0
- package/test/balancer/btc.js +131 -0
- package/test/balancer/frxETH.js +123 -0
- package/test/balancer/frxeth_amweth.js +123 -0
- package/test/balancer/matic_usdc_eth_bal.js +123 -0
- package/test/balancer/maticx_ammatic.js +123 -0
- package/test/balancer/maticx_v2.js +120 -0
- package/test/balancer/maticx_v3.js +141 -0
- package/test/balancer/polybase.js +131 -0
- package/test/balancer/polybase_v2.js +121 -0
- package/test/balancer/polydefi.js +131 -0
- package/test/balancer/polydefi2.js +131 -0
- package/test/balancer/qipool.js +136 -0
- package/test/balancer/sphere_matic.js +123 -0
- package/test/balancer/stETH.js +123 -0
- package/test/balancer/stable.js +131 -0
- package/test/balancer/stable_v2.js +121 -0
- package/test/balancer/stmatic_ammatic.js +123 -0
- package/test/balancer/stmatic_v2.js +120 -0
- package/test/balancer/stmatic_v3.js +141 -0
- package/test/balancer/tetubal_v3.js +123 -0
- package/test/balancer/tngbl_usdc.js +123 -0
- package/test/balancer/tricrypto.js +131 -0
- package/test/balancer/tusd_stable.js +142 -0
- package/test/balancer/usdc_weth.js +136 -0
- package/test/balancer/usdc_weth_v2.js +123 -0
- package/test/balancer/wbtc_eth_usdc.js +123 -0
- package/test/balancer/wbtc_weth.js +136 -0
- package/test/balancer/wsteth_amweth.js +123 -0
- package/test/balancer/wusdr_usdc.js +123 -0
- package/test/compound/usdc.js +127 -0
- package/test/compound/usdt.js +129 -0
- package/test/compound-blue/eth.js +136 -0
- package/test/compound-blue/usdc.js +136 -0
- package/test/compound-blue/usdt.js +136 -0
- package/test/convex/3crv.js +123 -0
- package/test/convex/3crypto.js +123 -0
- package/test/convex/acrv.js +123 -0
- package/test/convex/crv_3crypto.js +123 -0
- package/test/convex/matic_3crypto.js +123 -0
- package/test/convex/usdr.js +123 -0
- package/test/core/emission-fork.js +197 -0
- package/test/core/emission.js +209 -0
- package/test/core/vault_upgrade.js +129 -0
- package/test/curve/aave.js +132 -0
- package/test/curve/atricrypto3.js +135 -0
- package/test/curve/eurtusd.js +135 -0
- package/test/gamma-merkl/qs-eth-usdc.js +212 -0
- package/test/gamma-merkl/qs-eth-usdt.js +213 -0
- package/test/gamma-merkl/qs-matic-usdt.js +213 -0
- package/test/gamma-merkl/qs-tbtc-eth.js +213 -0
- package/test/gamma-merkl/qs-wbtc-eth-w.js +213 -0
- package/test/genomes/gene-eth.js +115 -0
- package/test/genomes/gnome-eth.js +115 -0
- package/test/idle/dai.js +129 -0
- package/test/idle/usdc.js +128 -0
- package/test/idle/weth.js +128 -0
- package/test/jarvis/2cad-hodl.js +183 -0
- package/test/jarvis/2cad-update-nov22.js +182 -0
- package/test/jarvis/2cad-update.js +177 -0
- package/test/jarvis/2cad-update2.js +182 -0
- package/test/jarvis/2cad-update3.js +182 -0
- package/test/jarvis/2eur-ageur-update-nov22.js +182 -0
- package/test/jarvis/2eur-ageur-update.js +182 -0
- package/test/jarvis/2eur-eure-hodl.js +176 -0
- package/test/jarvis/2eur-eurt-hodl.js +176 -0
- package/test/jarvis/2eur-eurt-update-nov22.js +182 -0
- package/test/jarvis/2eur-hodl.js +176 -0
- package/test/jarvis/2eur-par-hodl.js +176 -0
- package/test/jarvis/2eur-par-update-nov22.js +182 -0
- package/test/jarvis/2jpy-hodl.js +244 -0
- package/test/jarvis/2jpy-update-nov22.js +182 -0
- package/test/jarvis/2jpy-update.js +177 -0
- package/test/jarvis/2jpy-update2.js +182 -0
- package/test/jarvis/2jpyv2-upgrade.js +184 -0
- package/test/jarvis/2nzd-hodl.js +176 -0
- package/test/jarvis/2nzd-update.js +182 -0
- package/test/jarvis/2sgd-hodl.js +176 -0
- package/test/jarvis/2sgd-update-nov22.js +182 -0
- package/test/jarvis/2sgd-update.js +182 -0
- package/test/jarvis/2sgd-update2.js +182 -0
- package/test/jarvis/4eur-hodl-upgrade.js +177 -0
- package/test/jarvis/4eur-hodl.js +183 -0
- package/test/jarvis/4eur-update.js +181 -0
- package/test/jarvis/4eur-update2.js +181 -0
- package/test/jarvis/agden-2eur.js +222 -0
- package/test/jarvis/aur-usdc-v2.js +115 -0
- package/test/jarvis/aur-usdc.js +127 -0
- package/test/jarvis/aur3-usdc.js +115 -0
- package/test/jarvis/aurjul22-weth.js +222 -0
- package/test/jarvis/den-4eur.js +115 -0
- package/test/jarvis/den2-4eur.js +220 -0
- package/test/jarvis/den3-4eur.js +220 -0
- package/test/jarvis/den4-4eur.js +220 -0
- package/test/jarvis/jchf-usdc-hodl-v2.js +184 -0
- package/test/jarvis/jchf-usdc-hodl-v3.js +178 -0
- package/test/jarvis/jchf-usdc-hodl.js +193 -0
- package/test/jarvis/jchf-weth-hodl.js +176 -0
- package/test/jarvis/jeur-usdc-hodl-v2.js +184 -0
- package/test/jarvis/jeur-usdc-hodl-v3.js +178 -0
- package/test/jarvis/jeur-usdc-hodl.js +193 -0
- package/test/jarvis/jeur-weth-hodl.js +176 -0
- package/test/jarvis/jgbp-usdc-hodl-v2.js +184 -0
- package/test/jarvis/jgbp-usdc-hodl-v3.js +178 -0
- package/test/jarvis/jgbp-usdc-hodl.js +193 -0
- package/test/jarvis/jrtangle-2eurageur.js +220 -0
- package/test/jarvis/jrtanglenov22-2eurageur.js +220 -0
- package/test/jarvis/jrtjul22-usdc.js +115 -0
- package/test/jarvis/jrtmay22-usdc.js +115 -0
- package/test/jarvis/jrtmimo-2eurpar.js +220 -0
- package/test/jarvis/jrtmimonov22-2eurpar.js +220 -0
- package/test/jarvis/jrtnov22-usdc.js +220 -0
- package/test/jarvis/jrtsep22-usdc.js +220 -0
- package/test/jarvis/qui-2cad.js +218 -0
- package/test/jarvis/ses-2jpy.js +222 -0
- package/test/meshswap/mesh-omooi.js +197 -0
- package/test/meshswap/mesh-ozemit.js +197 -0
- package/test/meshswap/usdc-ousdc.js +197 -0
- package/test/meshswap/usdt-ousdt.js +197 -0
- package/test/meshswap/wmatic-mesh.js +197 -0
- package/test/meshswap/wmatic-usdc.js +197 -0
- package/test/meshswap/wmatic-usdt.js +197 -0
- package/test/mstable/musd.js +123 -0
- package/test/pearl/cvr-pearl.js +198 -0
- package/test/pearl/cvr.js +133 -0
- package/test/pearl/dai-usdr.js +198 -0
- package/test/pearl/eth-usdr.js +198 -0
- package/test/pearl/matic-usdr.js +198 -0
- package/test/pearl/pearl-usdr.js +198 -0
- package/test/pearl/star-usdr.js +186 -0
- package/test/pearl/tngbl-usdr.js +198 -0
- package/test/pearl/usdc-usdr.js +198 -0
- package/test/pearl/usdt-usdr.js +198 -0
- package/test/pearl/wbtc-usdr.js +198 -0
- package/test/pearl/wusdr-usdr.js +198 -0
- package/test/popsicle/ice-weth.js +128 -0
- package/test/quick/eth-matic.js +132 -0
- package/test/quick/eth-usdt.js +140 -0
- package/test/quick/ifarm-quick.js +147 -0
- package/test/quick/matic-usdc.js +145 -0
- package/test/quick/psp-matic.js +124 -0
- package/test/quick/wbtc-eth.js +145 -0
- package/test/quick-gamma/cbeth-eth.js +207 -0
- package/test/quick-gamma/matic-eth-narrow.js +201 -0
- package/test/quick-gamma/matic-eth-wide.js +197 -0
- package/test/quick-gamma/matic-usdc-narrow.js +197 -0
- package/test/quick-gamma/matic-usdc-wide.js +197 -0
- package/test/quick-gamma/upgrade/matic-eth-narrow.js +204 -0
- package/test/quick-gamma/upgrade/matic-usdc-narrow.js +199 -0
- package/test/quick-gamma/usdc-dai.js +209 -0
- package/test/quick-gamma/usdc-eth-narrow.js +197 -0
- package/test/quick-gamma/usdc-eth-wide.js +197 -0
- package/test/quick-gamma/usdc-usdt.js +209 -0
- package/test/quick-gamma/wbtc-eth-narrow.js +207 -0
- package/test/quick-gamma/wbtc-usdc-narrow.js +209 -0
- package/test/quick-gamma/wsteth-eth.js +207 -0
- package/test/sushi/eth-usdt.js +153 -0
- package/test/sushi/matic-eth.js +138 -0
- package/test/sushi/usdc-eth.js +153 -0
- package/test/test-config.js +24 -0
- package/test/uniswap-gamma/usdc-dai.js +212 -0
- package/test/uniswap-gamma/usdc-usdt.js +212 -0
- package/test/uniswap-gamma/usdc-weth.js +212 -0
- package/test/uniswap-gamma/wmatic-usdc.js +210 -0
- package/test/utilities/Utils.js +96 -0
- package/test/utilities/hh-utils.js +242 -0
- package/test/utilities/make-vault.js +10 -0
- package/test/yel/yel-wmatic.js +129 -0
@@ -0,0 +1,380 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
|
3
|
+
pragma solidity 0.6.12;
|
4
|
+
|
5
|
+
import "@openzeppelin/contracts/math/Math.sol";
|
6
|
+
import "@openzeppelin/contracts/math/SafeMath.sol";
|
7
|
+
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
8
|
+
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
|
9
|
+
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
|
10
|
+
import "../interface/IVault.sol";
|
11
|
+
import "../upgradability/BaseUpgradeableStrategy.sol";
|
12
|
+
import "./interface/IMiniChefV2.sol";
|
13
|
+
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol";
|
14
|
+
|
15
|
+
|
16
|
+
contract MiniChefV2Strategy is BaseUpgradeableStrategy {
|
17
|
+
|
18
|
+
using SafeMath for uint256;
|
19
|
+
using SafeERC20 for IERC20;
|
20
|
+
|
21
|
+
address public constant sushiswapRouterV2 = address(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506);
|
22
|
+
|
23
|
+
// additional storage slots (on top of BaseUpgradeableStrategy ones) are defined here
|
24
|
+
bytes32 internal constant _POOLID_SLOT = 0x3fd729bfa2e28b7806b03a6e014729f59477b530f995be4d51defc9dad94810b;
|
25
|
+
bytes32 internal constant _IS_LP_ASSET_SLOT = 0xc2f3dabf55b1bdda20d5cf5fcba9ba765dfc7c9dbaf28674ce46d43d60d58768;
|
26
|
+
bytes32 internal constant _SECOND_REWARD_TOKEN_SLOT = 0xd06e5f1f8ce4bdaf44326772fc9785917d444f120d759a01f1f440e0a42d67a3;
|
27
|
+
|
28
|
+
// this would be reset on each upgrade
|
29
|
+
mapping (address => address[]) public uniswapRoutes;
|
30
|
+
address[] public secondRewardRoute;
|
31
|
+
|
32
|
+
constructor() public BaseUpgradeableStrategy() {
|
33
|
+
assert(_POOLID_SLOT == bytes32(uint256(keccak256("eip1967.strategyStorage.poolId")) - 1));
|
34
|
+
assert(_IS_LP_ASSET_SLOT == bytes32(uint256(keccak256("eip1967.strategyStorage.isLpAsset")) - 1));
|
35
|
+
assert(_SECOND_REWARD_TOKEN_SLOT == bytes32(uint256(keccak256("eip1967.strategyStorage.secondRewardToken")) - 1));
|
36
|
+
}
|
37
|
+
|
38
|
+
function initializeBaseStrategy(
|
39
|
+
address _storage,
|
40
|
+
address _underlying,
|
41
|
+
address _vault,
|
42
|
+
address _rewardPool,
|
43
|
+
address _rewardToken,
|
44
|
+
address _secondRewardToken,
|
45
|
+
uint256 _poolID,
|
46
|
+
bool _isLpAsset
|
47
|
+
) public initializer {
|
48
|
+
|
49
|
+
BaseUpgradeableStrategy.initialize(
|
50
|
+
_storage,
|
51
|
+
_underlying,
|
52
|
+
_vault,
|
53
|
+
_rewardPool,
|
54
|
+
_rewardToken,
|
55
|
+
80, // profit sharing numerator
|
56
|
+
1000, // profit sharing denominator
|
57
|
+
true, // sell
|
58
|
+
1e18, // sell floor
|
59
|
+
12 hours // implementation change delay
|
60
|
+
);
|
61
|
+
|
62
|
+
IERC20 _lpt;
|
63
|
+
_lpt = IMiniChefV2(rewardPool()).lpToken(_poolID);
|
64
|
+
require(address(_lpt) == underlying(), "Pool Info does not match underlying");
|
65
|
+
_setPoolId(_poolID);
|
66
|
+
|
67
|
+
_setSecondRewardToken(_secondRewardToken);
|
68
|
+
|
69
|
+
if (_isLpAsset) {
|
70
|
+
address uniLPComponentToken0 = IUniswapV2Pair(underlying()).token0();
|
71
|
+
address uniLPComponentToken1 = IUniswapV2Pair(underlying()).token1();
|
72
|
+
|
73
|
+
// these would be required to be initialized separately by governance
|
74
|
+
uniswapRoutes[uniLPComponentToken0] = new address[](0);
|
75
|
+
uniswapRoutes[uniLPComponentToken1] = new address[](0);
|
76
|
+
} else {
|
77
|
+
uniswapRoutes[underlying()] = new address[](0);
|
78
|
+
}
|
79
|
+
|
80
|
+
setBoolean(_IS_LP_ASSET_SLOT, _isLpAsset);
|
81
|
+
}
|
82
|
+
|
83
|
+
function depositArbCheck() public pure returns(bool) {
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
|
87
|
+
function rewardPoolBalance() internal view returns (uint256 bal) {
|
88
|
+
(bal,) = IMiniChefV2(rewardPool()).userInfo(poolId(), address(this));
|
89
|
+
}
|
90
|
+
|
91
|
+
function exitRewardPool() internal {
|
92
|
+
uint256 bal = rewardPoolBalance();
|
93
|
+
if (bal != 0) {
|
94
|
+
IMiniChefV2(rewardPool()).withdrawAndHarvest(poolId(), bal, address(this));
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
function emergencyExitRewardPool() internal {
|
99
|
+
uint256 bal = rewardPoolBalance();
|
100
|
+
if (bal != 0) {
|
101
|
+
IMiniChefV2(rewardPool()).emergencyWithdraw(poolId(), address(this));
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
function harvestReward() internal {
|
106
|
+
IMiniChefV2(rewardPool()).harvest(poolId(), address(this));
|
107
|
+
}
|
108
|
+
|
109
|
+
function unsalvagableTokens(address token) public view returns (bool) {
|
110
|
+
return (token == rewardToken() || token == underlying());
|
111
|
+
}
|
112
|
+
|
113
|
+
function enterRewardPool() internal {
|
114
|
+
uint256 entireBalance = IERC20(underlying()).balanceOf(address(this));
|
115
|
+
IERC20(underlying()).safeApprove(rewardPool(), 0);
|
116
|
+
IERC20(underlying()).safeApprove(rewardPool(), entireBalance);
|
117
|
+
IMiniChefV2(rewardPool()).deposit(poolId(), entireBalance, address(this));
|
118
|
+
}
|
119
|
+
|
120
|
+
/*
|
121
|
+
* In case there are some issues discovered about the pool or underlying asset
|
122
|
+
* Governance can exit the pool properly
|
123
|
+
* The function is only used for emergency to exit the pool
|
124
|
+
*/
|
125
|
+
function emergencyExit() public onlyGovernance {
|
126
|
+
emergencyExitRewardPool();
|
127
|
+
_setPausedInvesting(true);
|
128
|
+
}
|
129
|
+
|
130
|
+
/*
|
131
|
+
* Resumes the ability to invest into the underlying reward pools
|
132
|
+
*/
|
133
|
+
|
134
|
+
function continueInvesting() public onlyGovernance {
|
135
|
+
_setPausedInvesting(false);
|
136
|
+
}
|
137
|
+
|
138
|
+
function setLiquidationPath(address _token, address [] memory _route) public onlyGovernance {
|
139
|
+
uniswapRoutes[_token] = _route;
|
140
|
+
}
|
141
|
+
|
142
|
+
// We assume that all the tradings can be done on Uniswap
|
143
|
+
function _liquidateReward() internal {
|
144
|
+
// we can accept 1 as minimum because this is called only by a trusted role
|
145
|
+
uint256 amountOutMin = 1;
|
146
|
+
|
147
|
+
// swap second reward token to reward token
|
148
|
+
uint256 secondRewardBalance = IERC20(secondRewardToken()).balanceOf(address(this));
|
149
|
+
|
150
|
+
// allow Uniswap to sell our reward
|
151
|
+
IERC20(secondRewardToken()).safeApprove(sushiswapRouterV2, 0);
|
152
|
+
IERC20(secondRewardToken()).safeApprove(sushiswapRouterV2, secondRewardBalance);
|
153
|
+
|
154
|
+
if (secondRewardBalance > 0) {
|
155
|
+
IUniswapV2Router02(sushiswapRouterV2).swapExactTokensForTokens(
|
156
|
+
secondRewardBalance,
|
157
|
+
amountOutMin,
|
158
|
+
secondRewardRoute,
|
159
|
+
address(this),
|
160
|
+
block.timestamp
|
161
|
+
);
|
162
|
+
}
|
163
|
+
|
164
|
+
uint256 rewardBalance = IERC20(rewardToken()).balanceOf(address(this));
|
165
|
+
if (!sell() || rewardBalance < sellFloor()) {
|
166
|
+
// Profits can be disabled for possible simplified and rapid exit
|
167
|
+
emit ProfitsNotCollected(sell(), rewardBalance < sellFloor());
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
|
171
|
+
notifyProfitInRewardToken(rewardBalance);
|
172
|
+
uint256 remainingRewardBalance = IERC20(rewardToken()).balanceOf(address(this));
|
173
|
+
|
174
|
+
if (remainingRewardBalance == 0) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
// allow Uniswap to sell our reward
|
179
|
+
IERC20(rewardToken()).safeApprove(sushiswapRouterV2, 0);
|
180
|
+
IERC20(rewardToken()).safeApprove(sushiswapRouterV2, remainingRewardBalance);
|
181
|
+
|
182
|
+
if (isLpAsset()) {
|
183
|
+
address uniLPComponentToken0 = IUniswapV2Pair(underlying()).token0();
|
184
|
+
address uniLPComponentToken1 = IUniswapV2Pair(underlying()).token1();
|
185
|
+
|
186
|
+
uint256 toToken0 = remainingRewardBalance.div(2);
|
187
|
+
uint256 toToken1 = remainingRewardBalance.sub(toToken0);
|
188
|
+
|
189
|
+
uint256 token0Amount;
|
190
|
+
|
191
|
+
if (uniswapRoutes[uniLPComponentToken0].length > 1) {
|
192
|
+
// if we need to liquidate the token0
|
193
|
+
IUniswapV2Router02(sushiswapRouterV2).swapExactTokensForTokens(
|
194
|
+
toToken0,
|
195
|
+
amountOutMin,
|
196
|
+
uniswapRoutes[uniLPComponentToken0],
|
197
|
+
address(this),
|
198
|
+
block.timestamp
|
199
|
+
);
|
200
|
+
token0Amount = IERC20(uniLPComponentToken0).balanceOf(address(this));
|
201
|
+
} else {
|
202
|
+
// otherwise we assme token0 is the reward token itself
|
203
|
+
token0Amount = toToken0;
|
204
|
+
}
|
205
|
+
|
206
|
+
uint256 token1Amount;
|
207
|
+
|
208
|
+
if (uniswapRoutes[uniLPComponentToken1].length > 1) {
|
209
|
+
// sell reward token to token1
|
210
|
+
IUniswapV2Router02(sushiswapRouterV2).swapExactTokensForTokens(
|
211
|
+
toToken1,
|
212
|
+
amountOutMin,
|
213
|
+
uniswapRoutes[uniLPComponentToken1],
|
214
|
+
address(this),
|
215
|
+
block.timestamp
|
216
|
+
);
|
217
|
+
token1Amount = IERC20(uniLPComponentToken1).balanceOf(address(this));
|
218
|
+
} else {
|
219
|
+
token1Amount = toToken1;
|
220
|
+
}
|
221
|
+
|
222
|
+
// provide token1 and token2 to SUSHI
|
223
|
+
IERC20(uniLPComponentToken0).safeApprove(sushiswapRouterV2, 0);
|
224
|
+
IERC20(uniLPComponentToken0).safeApprove(sushiswapRouterV2, token0Amount);
|
225
|
+
|
226
|
+
IERC20(uniLPComponentToken1).safeApprove(sushiswapRouterV2, 0);
|
227
|
+
IERC20(uniLPComponentToken1).safeApprove(sushiswapRouterV2, token1Amount);
|
228
|
+
|
229
|
+
// we provide liquidity to sushi
|
230
|
+
uint256 liquidity;
|
231
|
+
(,,liquidity) = IUniswapV2Router02(sushiswapRouterV2).addLiquidity(
|
232
|
+
uniLPComponentToken0,
|
233
|
+
uniLPComponentToken1,
|
234
|
+
token0Amount,
|
235
|
+
token1Amount,
|
236
|
+
1, // we are willing to take whatever the pair gives us
|
237
|
+
1, // we are willing to take whatever the pair gives us
|
238
|
+
address(this),
|
239
|
+
block.timestamp
|
240
|
+
);
|
241
|
+
} else {
|
242
|
+
IUniswapV2Router02(sushiswapRouterV2).swapExactTokensForTokens(
|
243
|
+
remainingRewardBalance,
|
244
|
+
amountOutMin,
|
245
|
+
uniswapRoutes[underlying()],
|
246
|
+
address(this),
|
247
|
+
block.timestamp
|
248
|
+
);
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
/*
|
253
|
+
* Stakes everything the strategy holds into the reward pool
|
254
|
+
*/
|
255
|
+
function investAllUnderlying() internal onlyNotPausedInvesting {
|
256
|
+
// this check is needed, because most of the SNX reward pools will revert if
|
257
|
+
// you try to stake(0).
|
258
|
+
if(IERC20(underlying()).balanceOf(address(this)) > 0) {
|
259
|
+
enterRewardPool();
|
260
|
+
}
|
261
|
+
}
|
262
|
+
|
263
|
+
/*
|
264
|
+
* Withdraws all the asset to the vault
|
265
|
+
*/
|
266
|
+
function withdrawAllToVault() public restricted {
|
267
|
+
if (address(rewardPool()) != address(0)) {
|
268
|
+
exitRewardPool();
|
269
|
+
}
|
270
|
+
_liquidateReward();
|
271
|
+
IERC20(underlying()).safeTransfer(vault(), IERC20(underlying()).balanceOf(address(this)));
|
272
|
+
}
|
273
|
+
|
274
|
+
/*
|
275
|
+
* Withdraws all the asset to the vault
|
276
|
+
*/
|
277
|
+
function withdrawToVault(uint256 amount) public restricted {
|
278
|
+
// Typically there wouldn't be any amount here
|
279
|
+
// however, it is possible because of the emergencyExit
|
280
|
+
uint256 entireBalance = IERC20(underlying()).balanceOf(address(this));
|
281
|
+
|
282
|
+
if(amount > entireBalance){
|
283
|
+
// While we have the check above, we still using SafeMath below
|
284
|
+
// for the peace of mind (in case something gets changed in between)
|
285
|
+
uint256 needToWithdraw = amount.sub(entireBalance);
|
286
|
+
uint256 toWithdraw = Math.min(rewardPoolBalance(), needToWithdraw);
|
287
|
+
IMiniChefV2(rewardPool()).withdraw(poolId(), toWithdraw, address(this));
|
288
|
+
}
|
289
|
+
|
290
|
+
IERC20(underlying()).safeTransfer(vault(), amount);
|
291
|
+
}
|
292
|
+
|
293
|
+
/*
|
294
|
+
* Note that we currently do not have a mechanism here to include the
|
295
|
+
* amount of reward that is accrued.
|
296
|
+
*/
|
297
|
+
function investedUnderlyingBalance() external view returns (uint256) {
|
298
|
+
if (rewardPool() == address(0)) {
|
299
|
+
return IERC20(underlying()).balanceOf(address(this));
|
300
|
+
}
|
301
|
+
// Adding the amount locked in the reward pool and the amount that is somehow in this contract
|
302
|
+
// both are in the units of "underlying"
|
303
|
+
// The second part is needed because there is the emergency exit mechanism
|
304
|
+
// which would break the assumption that all the funds are always inside of the reward pool
|
305
|
+
return rewardPoolBalance().add(IERC20(underlying()).balanceOf(address(this)));
|
306
|
+
}
|
307
|
+
|
308
|
+
/*
|
309
|
+
* Governance or Controller can claim coins that are somehow transferred into the contract
|
310
|
+
* Note that they cannot come in take away coins that are used and defined in the strategy itself
|
311
|
+
*/
|
312
|
+
function salvage(address recipient, address token, uint256 amount) external onlyControllerOrGovernance {
|
313
|
+
// To make sure that governance cannot come in and take away the coins
|
314
|
+
require(!unsalvagableTokens(token), "token is defined as not salvagable");
|
315
|
+
IERC20(token).safeTransfer(recipient, amount);
|
316
|
+
}
|
317
|
+
|
318
|
+
/*
|
319
|
+
* Get the reward, sell it in exchange for underlying, invest what you got.
|
320
|
+
* It's not much, but it's honest work.
|
321
|
+
*
|
322
|
+
* Note that although `onlyNotPausedInvesting` is not added here,
|
323
|
+
* calling `investAllUnderlying()` affectively blocks the usage of `doHardWork`
|
324
|
+
* when the investing is being paused by governance.
|
325
|
+
*/
|
326
|
+
function doHardWork() external onlyNotPausedInvesting restricted {
|
327
|
+
harvestReward();
|
328
|
+
_liquidateReward();
|
329
|
+
investAllUnderlying();
|
330
|
+
}
|
331
|
+
|
332
|
+
/**
|
333
|
+
* Can completely disable claiming UNI rewards and selling. Good for emergency withdraw in the
|
334
|
+
* simplest possible way.
|
335
|
+
*/
|
336
|
+
function setSell(bool s) public onlyGovernance {
|
337
|
+
_setSell(s);
|
338
|
+
}
|
339
|
+
|
340
|
+
/**
|
341
|
+
* Sets the minimum amount of CRV needed to trigger a sale.
|
342
|
+
*/
|
343
|
+
function setSellFloor(uint256 floor) public onlyGovernance {
|
344
|
+
_setSellFloor(floor);
|
345
|
+
}
|
346
|
+
|
347
|
+
// masterchef rewards pool ID
|
348
|
+
function _setPoolId(uint256 _value) internal {
|
349
|
+
setUint256(_POOLID_SLOT, _value);
|
350
|
+
}
|
351
|
+
|
352
|
+
function poolId() public view returns (uint256) {
|
353
|
+
return getUint256(_POOLID_SLOT);
|
354
|
+
}
|
355
|
+
|
356
|
+
// complexRewarder second reward
|
357
|
+
function _setSecondRewardToken(address _address) internal {
|
358
|
+
setAddress(_SECOND_REWARD_TOKEN_SLOT, _address);
|
359
|
+
}
|
360
|
+
|
361
|
+
function secondRewardToken() public view returns (address) {
|
362
|
+
return getAddress(_SECOND_REWARD_TOKEN_SLOT);
|
363
|
+
}
|
364
|
+
|
365
|
+
function isLpAsset() public view returns (bool) {
|
366
|
+
return getBoolean(_IS_LP_ASSET_SLOT);
|
367
|
+
}
|
368
|
+
|
369
|
+
function finalizeUpgrade() external onlyGovernance {
|
370
|
+
_finalizeUpgrade();
|
371
|
+
// reset the liquidation paths
|
372
|
+
// they need to be re-set manually
|
373
|
+
if (isLpAsset()) {
|
374
|
+
uniswapRoutes[IUniswapV2Pair(underlying()).token0()] = new address[](0);
|
375
|
+
uniswapRoutes[IUniswapV2Pair(underlying()).token1()] = new address[](0);
|
376
|
+
} else {
|
377
|
+
uniswapRoutes[underlying()] = new address[](0);
|
378
|
+
}
|
379
|
+
}
|
380
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
pragma solidity 0.6.12;
|
3
|
+
pragma experimental ABIEncoderV2;
|
4
|
+
|
5
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
6
|
+
import "./IRewarder.sol";
|
7
|
+
|
8
|
+
interface IMiniChefV2 {
|
9
|
+
struct UserInfo {
|
10
|
+
uint256 amount;
|
11
|
+
uint256 rewardDebt;
|
12
|
+
}
|
13
|
+
|
14
|
+
struct PoolInfo {
|
15
|
+
uint128 accSushiPerShare;
|
16
|
+
uint64 lastRewardTime;
|
17
|
+
uint64 allocPoint;
|
18
|
+
}
|
19
|
+
|
20
|
+
function rewarder(uint256 _pid) external view returns (IRewarder);
|
21
|
+
function poolLength() external view returns (uint256);
|
22
|
+
function updatePool(uint256 pid) external returns (IMiniChefV2.PoolInfo memory);
|
23
|
+
function userInfo(uint256 _pid, address _user) external view returns (uint256, uint256);
|
24
|
+
function lpToken(uint256 _pid) external view returns (IERC20);
|
25
|
+
function deposit(uint256 pid, uint256 amount, address to) external;
|
26
|
+
function withdraw(uint256 pid, uint256 amount, address to) external;
|
27
|
+
function harvest(uint256 pid, address to) external;
|
28
|
+
function withdrawAndHarvest(uint256 pid, uint256 amount, address to) external;
|
29
|
+
function emergencyWithdraw(uint256 pid, address to) external;
|
30
|
+
function pendingSushi(uint256 _pid, address _user) external view returns (uint256 pending);
|
31
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
|
3
|
+
pragma solidity 0.6.12;
|
4
|
+
import "../lib/BoringERC20.sol";
|
5
|
+
interface IRewarder {
|
6
|
+
using BoringERC20 for IERC20;
|
7
|
+
function onSushiReward(uint256 pid, address user, address recipient, uint256 sushiAmount, uint256 newLpAmount) external;
|
8
|
+
function pendingTokens(uint256 pid, address user, uint256 sushiAmount) external view returns (IERC20[] memory, uint256[] memory);
|
9
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
2
|
+
pragma solidity 0.6.12;
|
3
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
4
|
+
|
5
|
+
library BoringERC20 {
|
6
|
+
function safeSymbol(IERC20 token) internal view returns(string memory) {
|
7
|
+
(bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x95d89b41));
|
8
|
+
return success && data.length > 0 ? abi.decode(data, (string)) : "???";
|
9
|
+
}
|
10
|
+
|
11
|
+
function safeName(IERC20 token) internal view returns(string memory) {
|
12
|
+
(bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x06fdde03));
|
13
|
+
return success && data.length > 0 ? abi.decode(data, (string)) : "???";
|
14
|
+
}
|
15
|
+
|
16
|
+
function safeDecimals(IERC20 token) internal view returns (uint8) {
|
17
|
+
(bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(0x313ce567));
|
18
|
+
return success && data.length == 32 ? abi.decode(data, (uint8)) : 18;
|
19
|
+
}
|
20
|
+
|
21
|
+
function safeTransfer(IERC20 token, address to, uint256 amount) internal {
|
22
|
+
(bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, amount));
|
23
|
+
require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: Transfer failed");
|
24
|
+
}
|
25
|
+
|
26
|
+
function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal {
|
27
|
+
(bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, to, amount));
|
28
|
+
require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: TransferFrom failed");
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
|
3
|
+
pragma solidity 0.6.12;
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Utility library of inline functions on addresses
|
7
|
+
*
|
8
|
+
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
|
9
|
+
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
|
10
|
+
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
|
11
|
+
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
|
12
|
+
*/
|
13
|
+
library OpenZeppelinUpgradesAddress {
|
14
|
+
/**
|
15
|
+
* Returns whether the target address is a contract
|
16
|
+
* @dev This function will return false if invoked during the constructor of a contract,
|
17
|
+
* as the code is not actually created until after the constructor finishes.
|
18
|
+
* @param account address of the account to check
|
19
|
+
* @return whether the target address is a contract
|
20
|
+
*/
|
21
|
+
function isContract(address account) internal view returns (bool) {
|
22
|
+
uint256 size;
|
23
|
+
// XXX Currently there is no better way to check if there is a contract in an address
|
24
|
+
// than to check the size of the code at that address.
|
25
|
+
// See https://ethereum.stackexchange.com/a/14016/36603
|
26
|
+
// for more details about how this works.
|
27
|
+
// TODO Check this again before the Serenity release, because all addresses will be
|
28
|
+
// contracts then.
|
29
|
+
// solhint-disable-next-line no-inline-assembly
|
30
|
+
assembly { size := extcodesize(account) }
|
31
|
+
return size > 0;
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
|
3
|
+
pragma solidity 0.6.12;
|
4
|
+
|
5
|
+
import './Proxy.sol';
|
6
|
+
import './Address.sol';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @title BaseUpgradeabilityProxy
|
10
|
+
* @dev This contract implements a proxy that allows to change the
|
11
|
+
* implementation address to which it will delegate.
|
12
|
+
* Such a change is called an implementation upgrade.
|
13
|
+
*/
|
14
|
+
contract BaseUpgradeabilityProxy is Proxy {
|
15
|
+
/**
|
16
|
+
* @dev Emitted when the implementation is upgraded.
|
17
|
+
* @param implementation Address of the new implementation.
|
18
|
+
*/
|
19
|
+
event Upgraded(address indexed implementation);
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @dev Storage slot with the address of the current implementation.
|
23
|
+
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
|
24
|
+
* validated in the constructor.
|
25
|
+
*/
|
26
|
+
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @dev Returns the current implementation.
|
30
|
+
* @return impl Address of the current implementation
|
31
|
+
*/
|
32
|
+
function _implementation() internal view override returns (address impl) {
|
33
|
+
bytes32 slot = IMPLEMENTATION_SLOT;
|
34
|
+
assembly {
|
35
|
+
impl := sload(slot)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @dev Upgrades the proxy to a new implementation.
|
41
|
+
* @param newImplementation Address of the new implementation.
|
42
|
+
*/
|
43
|
+
function _upgradeTo(address newImplementation) internal {
|
44
|
+
_setImplementation(newImplementation);
|
45
|
+
emit Upgraded(newImplementation);
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @dev Sets the implementation address of the proxy.
|
50
|
+
* @param newImplementation Address of the new implementation.
|
51
|
+
*/
|
52
|
+
function _setImplementation(address newImplementation) internal {
|
53
|
+
require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
|
54
|
+
|
55
|
+
bytes32 slot = IMPLEMENTATION_SLOT;
|
56
|
+
|
57
|
+
assembly {
|
58
|
+
sstore(slot, newImplementation)
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
|
3
|
+
pragma solidity 0.6.12;
|
4
|
+
|
5
|
+
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
|
6
|
+
import "./BaseUpgradeableStrategyStorage.sol";
|
7
|
+
import "../inheritance/ControllableInit.sol";
|
8
|
+
import "../interface/IController.sol";
|
9
|
+
import "../interface/IFeeRewardForwarder.sol";
|
10
|
+
import "../interface/merkl/IDistributor.sol";
|
11
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
12
|
+
import "@openzeppelin/contracts/math/SafeMath.sol";
|
13
|
+
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
14
|
+
|
15
|
+
contract BaseUpgradeableStrategy is Initializable, ControllableInit, BaseUpgradeableStrategyStorage {
|
16
|
+
using SafeMath for uint256;
|
17
|
+
using SafeERC20 for IERC20;
|
18
|
+
|
19
|
+
event ProfitsNotCollected(bool sell, bool floor);
|
20
|
+
event ProfitLogInReward(uint256 profitAmount, uint256 feeAmount, uint256 timestamp);
|
21
|
+
event ProfitAndBuybackLog(uint256 profitAmount, uint256 feeAmount, uint256 timestamp);
|
22
|
+
|
23
|
+
modifier restricted() {
|
24
|
+
require(msg.sender == vault() || msg.sender == controller()
|
25
|
+
|| msg.sender == governance(),
|
26
|
+
"The sender has to be the controller, governance, or vault");
|
27
|
+
_;
|
28
|
+
}
|
29
|
+
|
30
|
+
// This is only used in `investAllUnderlying()`
|
31
|
+
// The user can still freely withdraw from the strategy
|
32
|
+
modifier onlyNotPausedInvesting() {
|
33
|
+
require(!pausedInvesting(), "Action blocked as the strategy is in emergency state");
|
34
|
+
_;
|
35
|
+
}
|
36
|
+
|
37
|
+
constructor() public BaseUpgradeableStrategyStorage() {
|
38
|
+
}
|
39
|
+
|
40
|
+
function initialize(
|
41
|
+
address _storage,
|
42
|
+
address _underlying,
|
43
|
+
address _vault,
|
44
|
+
address _rewardPool,
|
45
|
+
address _rewardToken,
|
46
|
+
uint256 _profitSharingNumerator,
|
47
|
+
uint256 _profitSharingDenominator,
|
48
|
+
bool _sell,
|
49
|
+
uint256 _sellFloor,
|
50
|
+
uint256 _implementationChangeDelay
|
51
|
+
) public initializer {
|
52
|
+
ControllableInit.initialize(
|
53
|
+
_storage
|
54
|
+
);
|
55
|
+
_setUnderlying(_underlying);
|
56
|
+
_setVault(_vault);
|
57
|
+
_setRewardPool(_rewardPool);
|
58
|
+
_setRewardToken(_rewardToken);
|
59
|
+
_setProfitSharingNumerator(_profitSharingNumerator);
|
60
|
+
_setProfitSharingDenominator(_profitSharingDenominator);
|
61
|
+
|
62
|
+
_setSell(_sell);
|
63
|
+
_setSellFloor(_sellFloor);
|
64
|
+
_setNextImplementationDelay(_implementationChangeDelay);
|
65
|
+
_setPausedInvesting(false);
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Schedules an upgrade for this vault's proxy.
|
70
|
+
*/
|
71
|
+
function scheduleUpgrade(address impl) public onlyGovernance {
|
72
|
+
_setNextImplementation(impl);
|
73
|
+
_setNextImplementationTimestamp(block.timestamp.add(nextImplementationDelay()));
|
74
|
+
}
|
75
|
+
|
76
|
+
function _finalizeUpgrade() internal {
|
77
|
+
_setNextImplementation(address(0));
|
78
|
+
_setNextImplementationTimestamp(0);
|
79
|
+
}
|
80
|
+
|
81
|
+
function shouldUpgrade() external view returns (bool, address) {
|
82
|
+
return (
|
83
|
+
nextImplementationTimestamp() != 0
|
84
|
+
&& block.timestamp > nextImplementationTimestamp()
|
85
|
+
&& nextImplementation() != address(0),
|
86
|
+
nextImplementation()
|
87
|
+
);
|
88
|
+
}
|
89
|
+
|
90
|
+
function toggleMerklOperator(address merklClaim, address operator) external onlyGovernance {
|
91
|
+
IDistributor(merklClaim).toggleOperator(address(this), operator);
|
92
|
+
}
|
93
|
+
|
94
|
+
// reward notification
|
95
|
+
|
96
|
+
function notifyProfitInRewardToken(uint256 _rewardBalance) internal {
|
97
|
+
if( _rewardBalance > 0 ){
|
98
|
+
uint256 feeAmount = _rewardBalance.mul(profitSharingNumerator()).div(profitSharingDenominator());
|
99
|
+
emit ProfitLogInReward(_rewardBalance, feeAmount, block.timestamp);
|
100
|
+
IERC20(rewardToken()).safeApprove(controller(), 0);
|
101
|
+
IERC20(rewardToken()).safeApprove(controller(), feeAmount);
|
102
|
+
|
103
|
+
IController(controller()).notifyFee(
|
104
|
+
rewardToken(),
|
105
|
+
feeAmount
|
106
|
+
);
|
107
|
+
} else {
|
108
|
+
emit ProfitLogInReward(0, 0, block.timestamp);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|