-
Notifications
You must be signed in to change notification settings - Fork 39
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
build: limit modules #179
build: limit modules #179
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.
-
I have a concern about a vault manager using both deposit_limit and deposit_limit_module and not have the expected output. (i.e. set deposit_limit to 0 while deposit_limit_module returns a different value can lead to the manager to think nobody can deposit, but that not being true). A potential solution could be to require deposit_limit to be uint256.max to set deposit_limit_module, and deposit_limit_module to be set to empty(address) if you want to set deposit_limit. Does that make sense?
-
The only think I don't like about deposit_limit_module and withdraw_limit_module is that it adds gas to the most basic functions (deposit and redeem). but I like freedom of set up
This is a good point. Added asserts to both setters to make sure both arent used at once 5cc8b5f
Yes, its not ideal. However the withdraw_limit_module could actually be cheaper due to the need to iterate over a queue in order to get a correct amount with the new version. |
5cc8b5f
to
bfff8af
Compare
contracts/VaultV3.vy
Outdated
@@ -443,6 +459,9 @@ def _convert_to_assets(shares: uint256, rounding: Rounding) -> uint256: | |||
""" | |||
assets = shares * (total_assets / total_supply) --- (== price_per_share * shares) | |||
""" | |||
if shares == MAX_UINT256: |
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.
Should we also special case 0?
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.
Well people shouldnt be sending 0 in any of the external functions as an input.
But there is the case that the report event calls convert_to_assets twice with a 0 value if no fees are charged. So it would save gas there
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.
added ecf23db
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.
LGTM, but i did have 1 minor comment #179 (comment)
Description
Fixes # (issue)
Checklist