-
Notifications
You must be signed in to change notification settings - Fork 16
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
Do not create empty liquidation slices #113
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, LGTM!
* become overburrowed, and eventually liquidatable. Note that this | ||
* could be because of the index, but also it can happen because of the | ||
* fees alone if the index remains the same. *) | ||
let blocks_passed = 211 in (* NOTE: I am a little surprised/worried about this being again 211... *) |
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.
Hmm I feel like this must have to do with the constant burrow_fee_percentage
which goes into calculating the index but am not 100% sure
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.
Yeah, that is quite possible 👍 Now that I think about it, we also clamp when computing the protected index to protect the system from price spikes (malicious or not) so I shouldn't have been so surprised after all! I might tinker a little though, to see if I can make it need a different number of blocks passed.
if Ligo.eq_tez_tez tez_to_auction (Ligo.tez_from_literal "0mutez") then | ||
(* If the slice would be empty, don't create it. *) | ||
{ state with burrows = Ligo.Big_map.update burrow_id (Some updated_burrow) state.burrows; } |
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 makes sense to me how this is written, but I wonder what updates there would be to the state of the burrow if no tez is sent to auction? I suppose maybe the kit gets rebalanced?
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, no tez is sent to auction, true, but tez does leave the burrow: the liquidation reward is paid regardless of whether we send something to auction. I don't expect any rebalancing of kit though, since no kit moved in or out of the burrow.
Thanks for having a look @dorranh! |
Closes #95.