feat: auto-liner#141
Open
wei3erHase wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AutoLiner
Summary
This PR adds AutoLiner, a utility contract that manages per-collateral SAFEEngine.debtCeiling over time so the live ceiling tracks debt usage while respecting a governance-defined cap, a minimum floor, and a cooldown between updates.
The contract introduces a clean split between:
Motivation
Before AutoLiner, SAFEEngine.debtCeiling was both:
That makes dynamic headroom management awkward, because lowering the live ceiling also overwrites the long-term intended cap.
With AutoLiner enabled for a collateral:
Behavior
For an initialized and active collateral, the target ceiling is:
min(max(minDebt, currentDebt + gap), ceilingCap)
Special case:
if (gap == type(uint256).max) target = ceilingCap;
updateCeiling(cType):
Configuration Model
Global params
Per-collateral params
Per-collateral state
Lifecycle
Onboarding
To enable AutoLiner for a collateral:
Local deactivation
Governance can disable AutoLiner for a collateral by setting:
ceilingCap = 0
This:
If governance wants a different live ceiling after deactivation, it must update SAFEEngine directly.
SAFEEngine disable
Setting:
SAFEEngine.debtCeiling = 0
blocks AutoLiner execution for that collateral, but does not erase local AutoLiner config.
Implementation Notes
Tests
Added and updated full coverage for:
Current results
Result:
Docs
The PRD was updated at:
It now documents: