-
Notifications
You must be signed in to change notification settings - Fork 5
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
[New Operator] StakeDAO + Yearn (curve pools) #119
[New Operator] StakeDAO + Yearn (curve pools) #119
Conversation
Co-authored-by: Yashiru <[email protected]>
…o feature/sc-98-operator-proposal-stakedao-yearn-curve
SC-98 [Operator Proposal] - StakeDAO / Yearn (curve pools)
Merge of two operator proposals : Since the developments are the same for Yearn and StakeDAO. |
contracts/interfaces/external/IStakingVault/IStakeDaoStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/libraries/CurveHelpers.sol
Outdated
uint256 amount, | ||
address outputToken, | ||
uint256 poolCoinAmount, | ||
string memory signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use the selector (bytes4
and not a string
).
// Convert string signature to bytes4 to use as argument
bytes4(keccak256(bytes("my_signature"))):
Then, you can use abi.encodeWithSelector
|
||
function coins(uint256 index) external view returns (address); | ||
|
||
function remove_liquidity_one_coin( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove_liquidity_one_coin
function are never used with the Interface (only using the signature). We can remove them if we use directly the signature (literal).
|
||
function coins(uint256 index) external view returns (address); | ||
|
||
function remove_liquidity_one_coin( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove_liquidity_one_coin
function are never used with the Interface (only using the signature). We can remove them if we use directly the signature (literal).
require(strategy != address(0), "SDSS: INVALID_STRATEGY_ADDRESS"); | ||
require(curvePool.poolAddress != address(0), "SDSS: INVALID_POOL_ADDRESS"); | ||
require(strategies[strategy].poolAddress == address(0), "SDSS: ALREADY_EXISTENT_STRATEGY"); | ||
require(strategies[strategy].lpToken == address(0), "SDSS: ALREADY_EXISTENT_STRATEGY"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe using a different require message from the one before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also applied the same changes to YearnVaultStorage.sol
.
require(strategy != address(0), "SDSS: INVALID_STRATEGY_ADDRESS"); | ||
require(curvePool.poolAddress != address(0), "SDSS: INVALID_POOL_ADDRESS"); | ||
require(strategies[strategy].poolAddress == address(0), "SDSS: ALREADY_EXISTENT_STRATEGY"); | ||
require(strategies[strategy].lpToken == address(0), "SDSS: ALREADY_EXISTENT_STRATEGY"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe using a different require message from the one before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also applied the same changes to YearnVaultStorage.sol
.
contracts/libraries/CurveHelpers.sol
Outdated
uint256 amount, | ||
address outputToken, | ||
uint256 poolCoinAmount, | ||
string memory signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use the selector (bytes4
and not a string
).
Then, you can use abi.encodeWithSelector
Context
StakeDAO and Yearn branchs being very similar, it was necessary to merge them in order to factorize the code in common of these two branches.
The library
StakingLPVaultHelpers.sol
contain all the StakeDAO and Yearn factorized code. This file useCurveHelpers.sol
library wich contain all the common Curve pool features.To learn more about the initial PRs:
IStakingVault interface
The merging of these two branches resulted in the need to create a parent interface for
IStakeDaoStrategy.sol
andIYearnVault.sol
in order to make them usable in the same way in theStakingLPVaultHelpers.sol
library