Skip to content
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

Merged
merged 3 commits into from
May 4, 2021
Merged

Do not create empty liquidation slices #113

merged 3 commits into from
May 4, 2021

Conversation

gkaracha
Copy link
Contributor

@gkaracha gkaracha commented May 3, 2021

Closes #95.

@gkaracha gkaracha requested a review from dorranh May 3, 2021 14:47
Copy link
Contributor

@dorranh dorranh left a 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... *)
Copy link
Contributor

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

Copy link
Contributor Author

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.

Comment on lines +263 to +265
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; }
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@gkaracha
Copy link
Contributor Author

gkaracha commented May 4, 2021

Thanks for having a look @dorranh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Liquidation auctions can be created with no tez_to_auction
2 participants