Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add UspEchidnaStrategy #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/strategies/VariableRewardsStrategyForSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "./VariableRewardsStrategy.sol";
* @notice Adapter strategy for VariableRewardsStrategy with SA deposit.
*/
abstract contract VariableRewardsStrategyForSA is VariableRewardsStrategy {
address private immutable swapPairDepositToken;
address internal immutable swapPairDepositToken;

constructor(
address _swapPairDepositToken,
Expand Down
29 changes: 29 additions & 0 deletions contracts/strategies/avalanche/echidna/UspEchidnaStrategy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

import "./EchidnaStrategy.sol";

contract UspEchidnaStrategy is EchidnaStrategy {
address public constant USP = 0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2;
IERC20 public constant USDC = IERC20(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E);

constructor(
EchidnaStrategySettings memory _echidnaStrategySettings,
VariableRewardsStrategySettings memory _variableRewardsStrategySettings,
StrategySettings memory _strategySettings
) EchidnaStrategy(_echidnaStrategySettings, _variableRewardsStrategySettings, _strategySettings) {}

function assignSwapPairSafely(address _swapPairDepositToken) internal override {}

function _convertRewardTokenToDepositToken(uint256 _fromAmount) internal override returns (uint256 toAmount) {
// swap WAVAX to USDC
WAVAX.approve(address(swapPairDepositToken), _fromAmount);
uint256 usdcAmount = DexLibrary.swap(_fromAmount, address(WAVAX), address(USDC), IPair(swapPairDepositToken));
WAVAX.approve(address(swapPairDepositToken), 0);

// swap USDC to USP
USDC.approve(address(platypusPool), usdcAmount);
(toAmount, ) = platypusPool.swap(address(USDC), USP, usdcAmount, 0, address(this), type(uint256).max);
USDC.approve(address(platypusPool), 0);
}
}