-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat(StakeVault): add withdraw function and improve documentation #144
base: develop
Are you sure you want to change the base?
Conversation
This commit introduces new functions for keeping track of the total amount staked and implements a function to check the available amount of tokens that can be withdrawn. Users are able to withdraw tokens that are not commited to stake by calling the withdraw functions. These changes enhance the overall usability and flexibility of the StakeVault contract.
if (_token == STAKED_TOKEN) { | ||
return STAKED_TOKEN.balanceOf(address(this)) - amountStaked; | ||
} | ||
return _token.balanceOf(address(this)); |
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.
In which case would we not want to get the amount from whatever STAKED_TOKEN
is?
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.
Ah I see.. i think this is for when possibly, accidentially funds where sent to the stakevault?
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.
Yes, and can also be used as a feature to StakeVault receive rewards from StakeManager.
*/ | ||
function withdraw(uint256 _amount) external onlyOwner { | ||
_withdraw(_amount, payable(msg.sender)); | ||
} |
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 just realized, there's actually very little point in having this here because this contract cannot receive any eth. There's no receive()
or fallback
implementation here. So we might as well drop this.
Description
Fixes #143
This commit introduces new functions for keeping track of the total amount staked and implements a function to check the available amount of tokens that can be withdrawn. Users are able to withdraw tokens that are not commited to stake by calling the withdraw functions. These changes enhance the overall usability and flexibility of the StakeVault contract.
Checklist
Ensure you completed all of the steps below before submitting your pull request:
pnpm adorno
?pnpm verify
?