-
Notifications
You must be signed in to change notification settings - Fork 47
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
POC/ hexen r7 option 1 optimization #214
base: main
Are you sure you want to change the base?
Conversation
|
uint256 userPositionShare = self.positions.get(owner, binId, salt).share; | ||
if (userPositionShare > 0 && userPositionShare < MINIMUM_SHARE) { | ||
revert UserPosition__BelowMinimumShare(userPositionShare); | ||
} |
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.
It might be better to add this part in BinPosition::addShare, BinPosition::subShare:
- Conceptually, the check belongs to user position
- save some gas since it avoids call position.get twice
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.
ok , this is just a POC. will refactor logic if decide to use this.
…m threshold Remove all shares if the remaining shares fall below the minimum threshold
|
||
/// @dev Ensure bin user's position share is either 0 or greater than minimum share | ||
uint256 userPositionShare = self.positions.get(owner, binId, salt).share; | ||
if (userPositionShare > 0 && userPositionShare < MINIMUM_SHARE) { |
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.
if (userPositionShare > 0 && userPositionShare < MINIMUM_SHARE) { | |
if (userPositionShare < MINIMUM_SHARE) { |
I think this will be sufficient
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.
no , if removed all , userPositionShare will be 0 now , will get revert error
Check user position share compared with min