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

[New Operator] StakeDAO + Yearn (curve pools) #119

Merged
merged 27 commits into from
Jun 10, 2022

Conversation

Yashiru
Copy link
Contributor

@Yashiru Yashiru commented Jun 7, 2022

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 use CurveHelpers.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 and IYearnVault.sol in order to make them usable in the same way in the StakingLPVaultHelpers.sol library

@Yashiru Yashiru added the To review Let people know this PR is ready for a review label Jun 7, 2022
@Yashiru Yashiru self-assigned this Jun 7, 2022
@linear
Copy link

linear bot commented Jun 7, 2022

SC-98 [Operator Proposal] - StakeDAO / Yearn (curve pools)

Merge of two operator proposals :

Since the developments are the same for Yearn and StakeDAO.

contracts/libraries/StakingLPVaultHelpers.sol Outdated Show resolved Hide resolved
contracts/libraries/StakingLPVaultHelpers.sol Show resolved Hide resolved
contracts/libraries/StakingLPVaultHelpers.sol Outdated Show resolved Hide resolved
test/shared/fixtures.ts Outdated Show resolved Hide resolved
test/shared/fixtures.ts Outdated Show resolved Hide resolved
test/unit/StakeDaoCurveStrategyOperator.unit.ts Outdated Show resolved Hide resolved
@maximebrugel maximebrugel changed the title Feature/sc 98 operator proposal stakedao yearn curve [Operator Proposal] StakeDAO + Yearn (curve pools) Jun 7, 2022
@maximebrugel maximebrugel changed the title [Operator Proposal] StakeDAO + Yearn (curve pools) [New Operator] StakeDAO + Yearn (curve pools) Jun 7, 2022
uint256 amount,
address outputToken,
uint256 poolCoinAmount,
string memory signature
Copy link
Contributor

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(
Copy link
Contributor

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(
Copy link
Contributor

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");
Copy link
Contributor

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?

Copy link
Contributor Author

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");
Copy link
Contributor

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?

Copy link
Contributor Author

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.

uint256 amount,
address outputToken,
uint256 poolCoinAmount,
string memory signature
Copy link
Contributor

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

@Yashiru Yashiru merged commit cea7f06 into master Jun 10, 2022
@Yashiru Yashiru deleted the feature/sc-98-operator-proposal-stakedao-yearn-curve branch June 10, 2022 09:26
@Yashiru Yashiru added Can merge Good to go and removed To review Let people know this PR is ready for a review labels Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can merge Good to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants