@harvest-finance/harvest-strategy-arbitrum 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-arbitrum might be problematic. Click here for more details.
- package/README.md +127 -5
- package/contracts/base/Controller.sol +358 -0
- package/contracts/base/Drip.sol +86 -0
- package/contracts/base/PotPool.sol +367 -0
- package/contracts/base/ProfitSharingReceiver.sol +38 -0
- package/contracts/base/Reader.sol +54 -0
- package/contracts/base/RewardForwarder.sol +109 -0
- package/contracts/base/VaultProxy.sol +34 -0
- package/contracts/base/VaultStorage.sol +205 -0
- package/contracts/base/VaultV1.sol +371 -0
- package/contracts/base/VaultV1GMX.sol +465 -0
- package/contracts/base/VaultV2.sol +111 -0
- package/contracts/base/VaultV2GMX.sol +111 -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 +41 -0
- package/contracts/base/factory/strategy/UpgradableStrategyFactory.sol +19 -0
- package/contracts/base/factory/vault/RegularVaultFactory.sol +34 -0
- package/contracts/base/incentives/GlobalIncentivesExecutor.sol +85 -0
- package/contracts/base/incentives/GlobalIncentivesHelper.sol +174 -0
- package/contracts/base/incentives/NotifyHelperGeneric.sol +61 -0
- package/contracts/base/incentives/NotifyHelperStateful.sol +290 -0
- package/contracts/base/incentives/ViewerNotifyHelperStateful.sol +25 -0
- package/contracts/base/inheritance/Controllable.sol +25 -0
- package/contracts/base/inheritance/ControllableInit.sol +30 -0
- package/contracts/base/inheritance/Governable.sol +28 -0
- package/contracts/base/inheritance/GovernableInit.sol +50 -0
- package/contracts/base/inheritance/IUpgradeSource.sol +7 -0
- package/contracts/base/inheritance/OwnableWhitelist.sol +17 -0
- package/contracts/base/inheritance/Storage.sol +35 -0
- package/contracts/base/interface/IBalDex.sol +7 -0
- package/contracts/base/interface/IController.sol +132 -0
- package/contracts/base/interface/IDex.sol +9 -0
- package/contracts/base/interface/IERC4626.sol +261 -0
- package/contracts/base/interface/IGMXStrategy.sol +37 -0
- package/contracts/base/interface/IGlobalIncentivesHelper.sol +6 -0
- package/contracts/base/interface/IPotPool.sol +70 -0
- package/contracts/base/interface/IProfitSharingReceiver.sol +9 -0
- package/contracts/base/interface/IRewardForwarder.sol +57 -0
- package/contracts/base/interface/IStrategy.sol +37 -0
- package/contracts/base/interface/IUniversalLiquidator.sol +21 -0
- package/contracts/base/interface/IUniversalLiquidatorRegistry.sol +20 -0
- package/contracts/base/interface/IUpgradeSource.sol +9 -0
- package/contracts/base/interface/IVault.sol +58 -0
- package/contracts/base/interface/IVaultGMX.sol +71 -0
- package/contracts/base/interface/aura/IAuraBaseRewardPool.sol +25 -0
- package/contracts/base/interface/aura/IAuraBooster.sol +17 -0
- package/contracts/base/interface/aura/IAuraDepositor.sol +7 -0
- package/contracts/base/interface/balancer/Gauge.sol +22 -0
- package/contracts/base/interface/balancer/IBVault.sol +580 -0
- package/contracts/base/interface/balancer/IBalancerMinter.sol +114 -0
- package/contracts/base/interface/balancer/IGyroPool.sol +7 -0
- package/contracts/base/interface/balancer/linearPool/ILinearPool.sol +184 -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 +56 -0
- package/contracts/base/interface/compound/CTokenInterface.sol +29 -0
- package/contracts/base/interface/compound/IComptroller.sol +9 -0
- package/contracts/base/interface/dolomite/IDepositWithdraw.sol +13 -0
- package/contracts/base/interface/dolomite/IDolomiteMargin.sol +15 -0
- package/contracts/base/interface/dolomite/IRewardsDistributor.sol +11 -0
- package/contracts/base/interface/gamma/IClearing.sol +7 -0
- package/contracts/base/interface/gamma/IHypervisor.sol +9 -0
- package/contracts/base/interface/gamma/IUniProxy.sol +14 -0
- package/contracts/base/interface/gmx/EventUtils.sol +253 -0
- package/contracts/base/interface/gmx/ICallbackReceiver.sol +119 -0
- package/contracts/base/interface/gmx/IDataStore.sol +7 -0
- package/contracts/base/interface/gmx/IExchangeRouter.sol +38 -0
- package/contracts/base/interface/gmx/IGMXViewer.sol +7 -0
- package/contracts/base/interface/gmx/IHandler.sol +12 -0
- package/contracts/base/interface/gmx/IMarket.sol +7 -0
- package/contracts/base/interface/gmx/IOracle.sol +6 -0
- package/contracts/base/interface/gmx/IPriceFeed.sol +12 -0
- package/contracts/base/interface/gmx/IReader.sol +49 -0
- package/contracts/base/interface/gmx/IRoleStore.sol +6 -0
- package/contracts/base/interface/ipor/Errors.sol +20 -0
- package/contracts/base/interface/ipor/FuseStorageLib.sol +71 -0
- package/contracts/base/interface/ipor/FusesLib.sol +149 -0
- package/contracts/base/interface/ipor/IFuseCommon.sol +9 -0
- package/contracts/base/interface/ipor/IFuseInstantWithdraw.sol +14 -0
- package/contracts/base/interface/ipor/IMarketBalanceFuse.sol +10 -0
- package/contracts/base/interface/ipor/IPriceOracleMiddleware.sol +42 -0
- package/contracts/base/interface/ipor/IporMath.sol +110 -0
- package/contracts/base/interface/ipor/PlasmaVaultConfigLib.sol +106 -0
- package/contracts/base/interface/ipor/PlasmaVaultLib.sol +293 -0
- package/contracts/base/interface/ipor/PlasmaVaultStorageLib.sol +352 -0
- package/contracts/base/interface/merkl/IDistributor.sol +6 -0
- package/contracts/base/interface/notional/INProxy.sol +44 -0
- package/contracts/base/interface/notional/IPrimeToken.sol +6 -0
- package/contracts/base/interface/venus/IRewardsDistributor.sol +6 -0
- package/contracts/base/interface/weth/IWETH.sol +39 -0
- package/contracts/base/ipor/Erc4626BalanceFuse.sol +54 -0
- package/contracts/base/ipor/Erc4626SupplyFuse.sol +134 -0
- package/contracts/base/noop/NoopStrategyUpgradeable.sol +90 -0
- package/contracts/base/upgradability/BaseUpgradeabilityProxy.sol +60 -0
- package/contracts/base/upgradability/BaseUpgradeableStrategy.sol +144 -0
- package/contracts/base/upgradability/BaseUpgradeableStrategyStorage.sol +284 -0
- package/contracts/base/upgradability/IUpgradable.sol +7 -0
- package/contracts/base/upgradability/ReentrancyGuardUpgradeable.sol +51 -0
- package/contracts/base/upgradability/StrategyProxy.sol +34 -0
- package/contracts/strategies/aura/AuraStrategy.sol +403 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_MORE_GYD.sol +32 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_sUSDe_GYD.sol +31 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_waFRAX_sFRAX.sol +31 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_waGHO_GYD.sol +31 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_waUSDC_GHO.sol +32 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_waUSDC_GYD.sol +31 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_waUSDT_GYD.sol +31 -0
- package/contracts/strategies/aura/AuraStrategyMainnet_wstETH_GYD.sol +31 -0
- package/contracts/strategies/camelot/CamelotV3Strategy.sol +304 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_ARB_USDC.sol +28 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_ETH_USDC.sol +28 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_ETH_USDT.sol +28 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_GMX_ETH.sol +28 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_GRAIL_ETH.sol +28 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_USDC_USDT.sol +28 -0
- package/contracts/strategies/camelot/CamelotV3StrategyMainnet_WBTC_ETH.sol +28 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategy.sol +273 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_DAI.sol +26 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_GMX.sol +26 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_USDC.sol +26 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_USDCe.sol +26 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_USDT.sol +26 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_WBTC.sol +26 -0
- package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_WETH.sol +26 -0
- package/contracts/strategies/fluid/FluidLendStrategy.sol +241 -0
- package/contracts/strategies/fluid/FluidLendStrategyMainnet_ETH.sol +25 -0
- package/contracts/strategies/fluid/FluidLendStrategyMainnet_USDC.sol +25 -0
- package/contracts/strategies/fluid/FluidLendStrategyMainnet_USDT.sol +25 -0
- package/contracts/strategies/gmx/GMXStrategy.sol +472 -0
- package/contracts/strategies/gmx/GMXStrategyMainnet_WBTC.sol +25 -0
- package/contracts/strategies/gmx/GMXViewer.sol +110 -0
- package/contracts/strategies/notional/NotionalStrategy.sol +223 -0
- package/contracts/strategies/notional/NotionalStrategyMainnet_nETH.sol +27 -0
- package/contracts/strategies/notional/NotionalStrategyMainnet_nUSDC.sol +27 -0
- package/contracts/strategies/notional/NotionalStrategyMainnet_nUSDT.sol +27 -0
- package/contracts/strategies/notional/NotionalStrategyMainnet_nwstETH.sol +27 -0
- package/contracts/strategies/venus/VenusFoldStrategy.sol +591 -0
- package/contracts/strategies/venus/VenusFoldStrategyMainnet_ARB.sol +32 -0
- package/contracts/strategies/venus/VenusFoldStrategyMainnet_ETH_core.sol +32 -0
- package/contracts/strategies/venus/VenusFoldStrategyMainnet_ETH_lsd.sol +32 -0
- package/contracts/strategies/venus/VenusFoldStrategyMainnet_USDC.sol +32 -0
- package/contracts/strategies/venus/VenusFoldStrategyMainnet_USDT.sol +32 -0
- package/contracts/strategies/venus/VenusFoldStrategyMainnet_WBTC.sol +32 -0
- package/hardhat.config.js +60 -0
- package/index.js +42 -0
- package/package.json +38 -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 +40 -0
- package/scripts/04-deploy-new-implementation.js +24 -0
- package/scripts/05-deploy-GMXViewer.js +17 -0
- package/scripts/06-deploy-GMXVault.js +49 -0
- package/scripts/07-deploy-ipor-fuses.js +29 -0
- package/scripts/08-deploy-drip.js +20 -0
- package/scripts/README.md +55 -0
- package/scripts/utils.js +22 -0
- package/test/aura/more-gyd.js +140 -0
- package/test/aura/susde-gyd.js +140 -0
- package/test/aura/wafrax-sfrax.js +140 -0
- package/test/aura/wagho-gyd.js +140 -0
- package/test/aura/wausdc-gho.js +141 -0
- package/test/aura/wausdc-gyd.js +140 -0
- package/test/aura/wausdt-gyd.js +140 -0
- package/test/aura/wsteth-gyd.js +138 -0
- package/test/camelot/arb-usdc.js +125 -0
- package/test/camelot/eth-usdc.js +125 -0
- package/test/camelot/eth-usdt.js +125 -0
- package/test/camelot/gmx-eth.js +125 -0
- package/test/camelot/grail-eth.js +125 -0
- package/test/camelot/usdc-usdt.js +125 -0
- package/test/camelot/wbtc-eth.js +125 -0
- package/test/dolomite/dai.js +127 -0
- package/test/dolomite/gmx.js +134 -0
- package/test/dolomite/usdc.js +127 -0
- package/test/dolomite/usdce.js +127 -0
- package/test/dolomite/usdt.js +127 -0
- package/test/dolomite/wbtc.js +127 -0
- package/test/dolomite/weth.js +127 -0
- package/test/fluid/eth.js +127 -0
- package/test/fluid/usdc.js +134 -0
- package/test/fluid/usdt.js +134 -0
- package/test/gmx/wbtc.js +184 -0
- package/test/notional/neth.js +133 -0
- package/test/notional/nusdc.js +133 -0
- package/test/notional/nusdt.js +133 -0
- package/test/notional/nwsteth.js +133 -0
- package/test/test-config.js +28 -0
- package/test/utilities/Utils.js +96 -0
- package/test/utilities/hh-utils.js +248 -0
- package/test/utilities/make-vault.js +16 -0
- package/test/venus/arb.js +135 -0
- package/test/venus/eth-core.js +133 -0
- package/test/venus/eth-lsd.js +133 -0
- package/test/venus/usdc.js +133 -0
- package/test/venus/usdt.js +133 -0
- package/test/venus/wbtc.js +133 -0
@@ -0,0 +1,223 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
pragma solidity 0.8.26;
|
3
|
+
|
4
|
+
import "@openzeppelin/contracts/utils/math/Math.sol";
|
5
|
+
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
|
6
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
7
|
+
import "../../base/interface/IUniversalLiquidator.sol";
|
8
|
+
import "../../base/upgradability/BaseUpgradeableStrategy.sol";
|
9
|
+
import "../../base/interface/notional/IPrimeToken.sol";
|
10
|
+
import "../../base/interface/notional/INProxy.sol";
|
11
|
+
import "../../base/interface/weth/IWETH.sol";
|
12
|
+
|
13
|
+
contract NotionalStrategy is BaseUpgradeableStrategy {
|
14
|
+
|
15
|
+
using SafeMath for uint256;
|
16
|
+
using SafeERC20 for IERC20;
|
17
|
+
|
18
|
+
address public constant harvestMSIG = address(0xf3D1A027E858976634F81B7c41B09A05A46EdA21);
|
19
|
+
address public constant weth = address(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);
|
20
|
+
address public constant usdc_bridged = address(0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8);
|
21
|
+
address public constant usdc_native = address(0xaf88d065e77c8cC2239327C5EDb3A432268e5831);
|
22
|
+
|
23
|
+
// additional storage slots (on top of BaseUpgradeableStrategy ones) are defined here
|
24
|
+
bytes32 internal constant _N_PROXY_SLOT = 0x67fd3246a4588df947995025dbc3c07f488375e3daeac5ba64360dc24b94304b;
|
25
|
+
|
26
|
+
// this would be reset on each upgrade
|
27
|
+
address[] public rewardTokens;
|
28
|
+
|
29
|
+
constructor() BaseUpgradeableStrategy() {
|
30
|
+
assert(_N_PROXY_SLOT == bytes32(uint256(keccak256("eip1967.strategyStorage.nProxy")) - 1));
|
31
|
+
}
|
32
|
+
|
33
|
+
function initializeBaseStrategy(
|
34
|
+
address _storage,
|
35
|
+
address _underlying,
|
36
|
+
address _vault,
|
37
|
+
address _nProxy,
|
38
|
+
address _rewardToken
|
39
|
+
) public initializer {
|
40
|
+
|
41
|
+
BaseUpgradeableStrategy.initialize(
|
42
|
+
_storage,
|
43
|
+
_underlying,
|
44
|
+
_vault,
|
45
|
+
_nProxy,
|
46
|
+
_rewardToken,
|
47
|
+
harvestMSIG
|
48
|
+
);
|
49
|
+
|
50
|
+
_setNProxy(_nProxy);
|
51
|
+
}
|
52
|
+
|
53
|
+
function depositArbCheck() public pure returns(bool) {
|
54
|
+
return true;
|
55
|
+
}
|
56
|
+
|
57
|
+
function _rewardPoolBalance() internal view returns (uint256 balance) {
|
58
|
+
balance = IERC20(underlying()).balanceOf(address(this));
|
59
|
+
}
|
60
|
+
|
61
|
+
/*
|
62
|
+
* In case there are some issues discovered about the pool or underlying asset
|
63
|
+
* Governance can exit the pool properly
|
64
|
+
* The function is only used for emergency to exit the pool
|
65
|
+
*/
|
66
|
+
function emergencyExit() public onlyGovernance {
|
67
|
+
_setPausedInvesting(true);
|
68
|
+
}
|
69
|
+
|
70
|
+
/*
|
71
|
+
* Resumes the ability to invest into the underlying reward pools
|
72
|
+
*/
|
73
|
+
function continueInvesting() public onlyGovernance {
|
74
|
+
_setPausedInvesting(false);
|
75
|
+
}
|
76
|
+
|
77
|
+
function unsalvagableTokens(address token) public view returns (bool) {
|
78
|
+
return (token == rewardToken() || token == underlying());
|
79
|
+
}
|
80
|
+
|
81
|
+
function addRewardToken(address _token) public onlyGovernance {
|
82
|
+
rewardTokens.push(_token);
|
83
|
+
}
|
84
|
+
|
85
|
+
function _liquidateReward() internal {
|
86
|
+
if (!sell()) {
|
87
|
+
// Profits can be disabled for possible simplified and rapid exit
|
88
|
+
emit ProfitsNotCollected(sell(), false);
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
address _rewardToken = rewardToken();
|
92
|
+
address _universalLiquidator = universalLiquidator();
|
93
|
+
for(uint256 i = 0; i < rewardTokens.length; i++){
|
94
|
+
address token = rewardTokens[i];
|
95
|
+
uint256 rewardBalance = IERC20(token).balanceOf(address(this));
|
96
|
+
if (rewardBalance == 0) {
|
97
|
+
continue;
|
98
|
+
}
|
99
|
+
if (token != _rewardToken){
|
100
|
+
IERC20(token).safeApprove(_universalLiquidator, 0);
|
101
|
+
IERC20(token).safeApprove(_universalLiquidator, rewardBalance);
|
102
|
+
IUniversalLiquidator(_universalLiquidator).swap(token, _rewardToken, rewardBalance, 1, address(this));
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
uint256 rewardBalance = IERC20(_rewardToken).balanceOf(address(this));
|
107
|
+
_notifyProfitInRewardToken(_rewardToken, rewardBalance);
|
108
|
+
uint256 remainingRewardBalance = IERC20(_rewardToken).balanceOf(address(this));
|
109
|
+
|
110
|
+
if (remainingRewardBalance < 1e4) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
114
|
+
address _depositToken = IPrimeToken(underlying()).asset();
|
115
|
+
if (_depositToken == usdc_bridged) {
|
116
|
+
_depositToken = usdc_native;
|
117
|
+
}
|
118
|
+
if (_depositToken != _rewardToken) {
|
119
|
+
IERC20(_rewardToken).safeApprove(_universalLiquidator, 0);
|
120
|
+
IERC20(_rewardToken).safeApprove(_universalLiquidator, remainingRewardBalance);
|
121
|
+
IUniversalLiquidator(_universalLiquidator).swap(_rewardToken, _depositToken, remainingRewardBalance, 1, address(this));
|
122
|
+
}
|
123
|
+
|
124
|
+
uint256 tokenBalance = IERC20(_depositToken).balanceOf(address(this));
|
125
|
+
if (tokenBalance > 0 && !(_depositToken == underlying())) {
|
126
|
+
depositLP(_depositToken, tokenBalance);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function depositLP(address token, uint256 balance) internal {
|
131
|
+
address _nProxy = nProxy();
|
132
|
+
uint16 currencyId;
|
133
|
+
uint256 value;
|
134
|
+
if (token == weth) {
|
135
|
+
currencyId = uint16(1);
|
136
|
+
IWETH(weth).withdraw(balance);
|
137
|
+
value = balance;
|
138
|
+
} else if (token == usdc_native) {
|
139
|
+
currencyId = uint16(3);
|
140
|
+
} else {
|
141
|
+
currencyId = INProxy(_nProxy).getCurrencyId(token);
|
142
|
+
}
|
143
|
+
|
144
|
+
INProxy.BalanceAction[] memory actions = new INProxy.BalanceAction[](1);
|
145
|
+
INProxy.BalanceAction memory action;
|
146
|
+
action.actionType = INProxy.DepositActionType.DepositUnderlyingAndMintNToken;
|
147
|
+
action.currencyId = currencyId;
|
148
|
+
action.depositActionAmount = balance;
|
149
|
+
action.withdrawAmountInternalPrecision = 0;
|
150
|
+
action.withdrawEntireCashBalance = false;
|
151
|
+
action.redeemToUnderlying = true;
|
152
|
+
|
153
|
+
actions[0] = action;
|
154
|
+
if (token != weth) {
|
155
|
+
IERC20(token).safeApprove(_nProxy, 0);
|
156
|
+
IERC20(token).safeApprove(_nProxy, balance);
|
157
|
+
}
|
158
|
+
INProxy(_nProxy).batchBalanceAction{value: value}(address(this), actions);
|
159
|
+
}
|
160
|
+
|
161
|
+
/** Withdraws all the asset to the vault
|
162
|
+
*/
|
163
|
+
function withdrawAllToVault() public restricted {
|
164
|
+
address _underlying = underlying();
|
165
|
+
_liquidateReward();
|
166
|
+
IERC20(_underlying).safeTransfer(vault(), IERC20(_underlying).balanceOf(address(this)));
|
167
|
+
}
|
168
|
+
|
169
|
+
/** Withdraws specific amount of asset to the vault
|
170
|
+
*/
|
171
|
+
function withdrawToVault(uint256 amount) public restricted {
|
172
|
+
IERC20(underlying()).safeTransfer(vault(), amount);
|
173
|
+
}
|
174
|
+
|
175
|
+
/*
|
176
|
+
* Note that we currently do not have a mechanism here to include the
|
177
|
+
* amount of reward that is accrued.
|
178
|
+
*/
|
179
|
+
function investedUnderlyingBalance() external view returns (uint256) {
|
180
|
+
// Adding the amount locked in the reward pool and the amount that is somehow in this contract
|
181
|
+
// both are in the units of "underlying"
|
182
|
+
// The second part is needed because there is the emergency exit mechanism
|
183
|
+
// which would break the assumption that all the funds are always inside of the reward pool
|
184
|
+
return _rewardPoolBalance();
|
185
|
+
}
|
186
|
+
|
187
|
+
/*
|
188
|
+
* Governance or Controller can claim coins that are somehow transferred into the contract
|
189
|
+
* Note that they cannot come in take away coins that are used and defined in the strategy itself
|
190
|
+
*/
|
191
|
+
function salvage(address recipient, address token, uint256 amount) external onlyControllerOrGovernance {
|
192
|
+
// To make sure that governance cannot come in and take away the coins
|
193
|
+
require(!unsalvagableTokens(token), "token is defined as not salvagable");
|
194
|
+
IERC20(token).safeTransfer(recipient, amount);
|
195
|
+
}
|
196
|
+
|
197
|
+
/*
|
198
|
+
* Get the reward, sell it in exchange for underlying, invest what you got.
|
199
|
+
* It's not much, but it's honest work.
|
200
|
+
*
|
201
|
+
* Note that although `onlyNotPausedInvesting` is not added here,
|
202
|
+
* calling `investAllUnderlying()` affectively blocks the usage of `doHardWork`
|
203
|
+
* when the investing is being paused by governance.
|
204
|
+
*/
|
205
|
+
function doHardWork() external onlyNotPausedInvesting restricted {
|
206
|
+
INProxy(nProxy()).nTokenClaimIncentives();
|
207
|
+
_liquidateReward();
|
208
|
+
}
|
209
|
+
|
210
|
+
function _setNProxy(address _value) internal {
|
211
|
+
setAddress(_N_PROXY_SLOT, _value);
|
212
|
+
}
|
213
|
+
|
214
|
+
function nProxy() public view returns (address) {
|
215
|
+
return getAddress(_N_PROXY_SLOT);
|
216
|
+
}
|
217
|
+
|
218
|
+
function finalizeUpgrade() external onlyGovernance {
|
219
|
+
_finalizeUpgrade();
|
220
|
+
}
|
221
|
+
|
222
|
+
receive() external payable {} // this is needed for the receiving Matic
|
223
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
pragma solidity 0.8.26;
|
3
|
+
|
4
|
+
import "./NotionalStrategy.sol";
|
5
|
+
|
6
|
+
contract NotionalStrategyMainnet_nETH is NotionalStrategy {
|
7
|
+
|
8
|
+
constructor() {}
|
9
|
+
|
10
|
+
function initializeStrategy(
|
11
|
+
address _storage,
|
12
|
+
address _vault
|
13
|
+
) public initializer {
|
14
|
+
address underlying = address(0x18b0Fc5A233acF1586Da7C199Ca9E3f486305A29);
|
15
|
+
address nProxy = address(0x1344A36A1B56144C3Bc62E7757377D288fDE0369);
|
16
|
+
address note = address(0x019bE259BC299F3F653688c7655C87F998Bc7bC1);
|
17
|
+
address arb = address(0x912CE59144191C1204E64559FE8253a0e49E6548);
|
18
|
+
NotionalStrategy.initializeBaseStrategy(
|
19
|
+
_storage,
|
20
|
+
underlying,
|
21
|
+
_vault,
|
22
|
+
nProxy,
|
23
|
+
note
|
24
|
+
);
|
25
|
+
rewardTokens = [note,arb];
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
pragma solidity 0.8.26;
|
3
|
+
|
4
|
+
import "./NotionalStrategy.sol";
|
5
|
+
|
6
|
+
contract NotionalStrategyMainnet_nUSDC is NotionalStrategy {
|
7
|
+
|
8
|
+
constructor() {}
|
9
|
+
|
10
|
+
function initializeStrategy(
|
11
|
+
address _storage,
|
12
|
+
address _vault
|
13
|
+
) public initializer {
|
14
|
+
address underlying = address(0x0F13fb925eDC3E1FE947209010d9c0E072986ADc);
|
15
|
+
address nProxy = address(0x1344A36A1B56144C3Bc62E7757377D288fDE0369);
|
16
|
+
address note = address(0x019bE259BC299F3F653688c7655C87F998Bc7bC1);
|
17
|
+
address arb = address(0x912CE59144191C1204E64559FE8253a0e49E6548);
|
18
|
+
NotionalStrategy.initializeBaseStrategy(
|
19
|
+
_storage,
|
20
|
+
underlying,
|
21
|
+
_vault,
|
22
|
+
nProxy,
|
23
|
+
note
|
24
|
+
);
|
25
|
+
rewardTokens = [note,arb];
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
pragma solidity 0.8.26;
|
3
|
+
|
4
|
+
import "./NotionalStrategy.sol";
|
5
|
+
|
6
|
+
contract NotionalStrategyMainnet_nUSDT is NotionalStrategy {
|
7
|
+
|
8
|
+
constructor() {}
|
9
|
+
|
10
|
+
function initializeStrategy(
|
11
|
+
address _storage,
|
12
|
+
address _vault
|
13
|
+
) public initializer {
|
14
|
+
address underlying = address(0x9c0Fbb8caDE7B178b135fD2F1da125a37B27f442);
|
15
|
+
address nProxy = address(0x1344A36A1B56144C3Bc62E7757377D288fDE0369);
|
16
|
+
address note = address(0x019bE259BC299F3F653688c7655C87F998Bc7bC1);
|
17
|
+
address arb = address(0x912CE59144191C1204E64559FE8253a0e49E6548);
|
18
|
+
NotionalStrategy.initializeBaseStrategy(
|
19
|
+
_storage,
|
20
|
+
underlying,
|
21
|
+
_vault,
|
22
|
+
nProxy,
|
23
|
+
note
|
24
|
+
);
|
25
|
+
rewardTokens = [note,arb];
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//SPDX-License-Identifier: Unlicense
|
2
|
+
pragma solidity 0.8.26;
|
3
|
+
|
4
|
+
import "./NotionalStrategy.sol";
|
5
|
+
|
6
|
+
contract NotionalStrategyMainnet_nwstETH is NotionalStrategy {
|
7
|
+
|
8
|
+
constructor() {}
|
9
|
+
|
10
|
+
function initializeStrategy(
|
11
|
+
address _storage,
|
12
|
+
address _vault
|
13
|
+
) public initializer {
|
14
|
+
address underlying = address(0x06D45ef1f8b3C37b0de66f156B11F10b4837619A);
|
15
|
+
address nProxy = address(0x1344A36A1B56144C3Bc62E7757377D288fDE0369);
|
16
|
+
address note = address(0x019bE259BC299F3F653688c7655C87F998Bc7bC1);
|
17
|
+
address arb = address(0x912CE59144191C1204E64559FE8253a0e49E6548);
|
18
|
+
NotionalStrategy.initializeBaseStrategy(
|
19
|
+
_storage,
|
20
|
+
underlying,
|
21
|
+
_vault,
|
22
|
+
nProxy,
|
23
|
+
note
|
24
|
+
);
|
25
|
+
rewardTokens = [note,arb];
|
26
|
+
}
|
27
|
+
}
|