Skip to content

Conversation

@16slim
Copy link
Collaborator

@16slim 16slim commented Jul 7, 2022

Necessary changes for foundry migration!

@16slim
Copy link
Collaborator Author

16slim commented Jul 7, 2022

image

@16slim 16slim requested a review from charlesndalton July 7, 2022 09:55
Copy link
Collaborator

@charlesndalton charlesndalton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, reviewed

src/Strategy.sol Outdated

function balanceOfStakedSanToken() public view returns (uint256) {
return IERC20(address(sanTokenGauge)).balanceOf(address(this));
return strategyProxy.balanceOf(address(sanTokenGauge));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add a helper function like you did with balanceOfSanToken?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I am not understanding, it's the same case as balanceOfSanToken no? Calling a function in the proxy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was saying add a balanceOfStakedSanToken function in the proxy, like this:

function balanceOfSanToken(address sanToken) public view returns (uint256) {
return IERC20(sanToken).balanceOf(address(yearnAngleVoter));
}

@16slim
Copy link
Collaborator Author

16slim commented Jul 15, 2022

Passing:
image

@charlesndalton
Copy link
Collaborator

LGTM! Think it would be great to get @wavey0x review as well if he's able

@16slim
Copy link
Collaborator Author

16slim commented Jul 18, 2022

image

voters[_voter] = false;
}

function lock(uint256 amount, uint256 unlockTime) external {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see any harm adjusting this function to have zero arguments? My thought is that we always max lock the full balance. There is no access control on this function, what if someone locks for less than max? Do we care?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included a msg.sender check to it too to check for governance, I normally prefer to leave things as flexible as possible just in case. Wdyt?


function lock(uint256 amount, uint256 unlockTime) external {
if (amount > 0) {
IERC20(angleToken).transfer(address(yearnAngleVoter), amount);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to define the expected behavior of this function a bit better. Ideally we have an open .lock() function which allows anyone to max lock any ANGLE in the voter on our behalf.

Seems this design is expecting the proxy to carry an ANGLE token balance. Usually all tokens kept will be in the voter, not proxy. Which means this logic will probably get skipped.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the flow to leave the tokens in voter proxy rather than voter as I wanted to the voter to be a mere interface for veAngle. But as I think it's standard design, I changed it to Angle rewards be kept in the voter instead

src/Strategy.sol Outdated

uint256 _stakedBalance = balanceOfStakedSanToken();
if (_stakedBalance > 0) {
strategyProxy.withdraw(address(sanTokenGauge), address(sanToken), _stakedBalance);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not withdrawAll?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about its existence, should be same result but replacing as it's exactly its purpose!

@16slim
Copy link
Collaborator Author

16slim commented Jul 22, 2022

All passing:
image

@16slim
Copy link
Collaborator Author

16slim commented Jul 22, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants