-
Notifications
You must be signed in to change notification settings - Fork 414
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
basic rate-limited hole #218
base: liq-2.0
Are you sure you want to change the base?
Conversation
// Risk of overflow should be extremely small, even if milk.last = 0; | ||
// can anyway be made less likely to overflow with a little more work. | ||
uint256 pile = mul(sub(block.timestamp, milk.last) / milk.qntm, milk.clod); | ||
pile = min(milk.dirt, milk.trid, pile); |
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.
given trid <= dirt
, why is dirt
needed here?
uint256 trid; // Amt of dirt dug by auctions. [rad] | ||
// Packed in to a single slot to minimze gas costs. | ||
uint224 clod; // Amount of dirt to remove per time quantum [rad] | ||
uint32 qntm; // Time between removal of clods [seconds] |
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.
how about removing this and setting clod
in a per-second basis to save some gas?
So the assumption here is that during sharp price declines |
After thinking about this a lot, I think that making
What I really like about this option, is that it would be a pretty small code change, possibly easier to audit and verify. |
DO NOT MERGE, FOR DISCUSSION PURPOSES ONLY
Here's a basic implementation of a
hole
that decays in a stepwise linear fashion.It's stepwise because a continuous decrease would likely lead to too many small auctions in a case where we bumped into a
hole
limit.Every
qntm
seconds,dirt
can decrease by up toclod
. This is triggered inbark
(adds a lot ofSSTORE
ops, so incentives will matter). But the decrease is only allowed if enough DAI has been collected from auctions or is no longer associated with an auction. This is tracked astrid
(dirt
that has been "reversed"), so that if auctions are failing to recapitalize, we don't continue to liquidate. I think there may be an argument for removing this and simplifying to a purely time-based mechanism, but wanted to start from this formulation.