-
Notifications
You must be signed in to change notification settings - Fork 3
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
16slim/ve angle #6
base: master
Are you sure you want to change the base?
Conversation
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.
Nice, reviewed
src/Strategy.sol
Outdated
// ----------------- SUPPORT & UTILITY FUNCTIONS ---------- | ||
|
||
function balanceOfWant() public view returns (uint256) { | ||
return want.balanceOf(address(this)); | ||
} | ||
|
||
function balanceOfStakedSanToken() public view returns (uint256) { | ||
return IERC20(address(sanTokenGauge)).balanceOf(address(this)); | ||
return strategyProxy.balanceOf(address(sanTokenGauge)); |
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 we could add a helper function like you did with balanceOfSanToken?
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.
Sorry I am not understanding, it's the same case as balanceOfSanToken
no? Calling a function in the proxy
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 was saying add a balanceOfStakedSanToken function in the proxy, like this:
angle_protocol/src/AngleStrategyVoterProxy.sol
Lines 167 to 169 in d7571d9
function balanceOfSanToken(address sanToken) public view returns (uint256) { | |
return IERC20(sanToken).balanceOf(address(yearnAngleVoter)); | |
} |
LGTM! Think it would be great to get @wavey0x review as well if he's able |
src/AngleStrategyVoterProxy.sol
Outdated
voters[_voter] = false; | ||
} | ||
|
||
function lock(uint256 amount, uint256 unlockTime) external { |
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.
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?
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 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?
src/AngleStrategyVoterProxy.sol
Outdated
|
||
function lock(uint256 amount, uint256 unlockTime) external { | ||
if (amount > 0) { | ||
IERC20(angleToken).transfer(address(yearnAngleVoter), amount); |
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'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.
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 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); |
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.
why not withdrawAll
?
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 forgot about its existence, should be same result but replacing as it's exactly its purpose!
Necessary changes for foundry migration!