-
Notifications
You must be signed in to change notification settings - Fork 9
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
Min deployment amount enforcement #150
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 that we can reuse that same existing logic 👍
Might seem a bit weird that it's a minimum amount of underlying asset, but denominated in perps?
Co-authored-by: Brandon Iles <brandon@fragments.org>
Good catch. Updating to check the underlying amounts tranched .. |
1b6b102
to
4a39197
Compare
4a39197
to
a2fcdce
Compare
revert NoDeployment(); | ||
(uint256 deployedAmt, TrancheData memory td) = _tranche(perp.getDepositBond()); | ||
uint256 perpsRolledOver = _rollover(perp, td); | ||
if (deployedAmt <= minDeploymentAmt || perpsRolledOver <= 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.
Do we still need to check perpsRolledOver <= 0
?
I think this would only be the case if we roll over a small enough dust amount of underlying such that perps rounds to 0. Would we still want to revert in that case? I think we'd want it to go through.
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.
Not having this check, opens up a grief attack when external callers can just tranche the underlying and the batch job has to pay for the gas to untranche (and or retranche into a new bond).
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, nice catch. Basically enforces that we only tranche the underlying if it can immediately be used for rotations.
Might be worth a code comment
Co-authored-by: Brandon Iles <brandon@fragments.org>
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
revert NoDeployment(); | ||
(uint256 deployedAmt, TrancheData memory td) = _tranche(perp.getDepositBond()); | ||
uint256 perpsRolledOver = _rollover(perp, td); | ||
if (deployedAmt <= minDeploymentAmt || perpsRolledOver <= 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.
Ah, nice catch. Basically enforces that we only tranche the underlying if it can immediately be used for rotations.
Might be worth a code comment
recoverAndRedeploy
minDeploymentAmt
param