Single Spot Debt Ceiling Setter
1. Summary
The SingleSpotDebtCeilingSetter
is meant to recompute the debtCeiling
for a single collateral type inside the SAFEEngine
.
The setter inherits functionality from the IncreasingTreasuryReimbursement.
2. Contract Variables & Functions
Variables
manualSetters[usr: address]
-addManualSetter
/removeManualSetter
- auth mechanism for addresses that can callmanualUpdateCeiling
maxCollateralCeiling
- the max amount of system coins that can be generated using the collateral type withcollateralName
minCollateralCeiling
- the min amount of system coins that must be generated using the collateral type withcollateralName
ceilingPercentageChange
- premium on top of the current amount of debt (backed by the collateral type withcollateralName
) minted. This is used to calculate a new ceilinglastUpdateTime
- when the debt ceiling was last updatedupdateDelay
- enforced time gap between callslastManualUpdateTime
- last timestamp of a manual updateblockIncreaseWhenRevalue
- flag that blocks an increase in the debt ceiling when the redemption rate is positiveblockDecreaseWhenDevalue
- flag that blocks a decrease in the debt ceiling when the redemption rate is negativecollateralName
- the targeted collateral's namesafeEngine
- theSAFEEngine
contractoracleRelayer
- theOracleRelayer
contract
Functions
modifyParameters
- modifies contract parametersautoUpdateCeiling(feeReceiver: address) external
- periodically updates the debt ceiling for the collateral type withcollateralName
. Can be called by anyonemanualUpdateCeiling()
- authed function that allowsmanualSetters
to update the debt ceiling whenever they wantgetNextCollateralCeiling() public view returns (uint256)
- view function meant to return the new and upcoming debt ceiling. It also checks forallowsIncrease
andallowsDecrease
getRawUpdatedCeiling() external view returns (uint256)
- view function meant to return the new and upcoming debt ceiling. It does not perform checks forallowsIncrease
andallowsDecrease
allowsIncrease(redemptionRate: uint256
,currentDebtCeiling: uint256
,updatedCeiling: uint256) public view returns (allowsIncrease: bool)
- view function meant to return whether an increase in the debt ceiling is currently allowedallowsDecrease(redemptionRate: uint256
,currentDebtCeiling: uint256
,updatedCeiling: uint256) public view returns (allowsDecrease: bool)
- view function meant to return whether a decrease in the debt ceiling is currently allowed
Modifiers
isManualSetter
- checks whether an address is part ofmanualSetters
.
Events
AddManualSetter
- emitted when a new manual setter is added. Contains:account
- new manual setter address
RemoveManualSetter
- emitted when a manual setter address is removed/blacklisted. Contains:account
- the setter address that's removed
UpdateCeiling
- emitted when a new ceiling is computed and set. Contains:nextCeiling
- the new ceiling
3. Walkthrough
autoUpdateCeiling
and manualUpdateCeiling
can both be used to recompute the debt ceiling for the collateral type with collateralName, although manualUpdateCeiling
can only be called by whitelisted manualSetters
. Both autoUpdateCeiling
and manualUpdateCeiling
call getNextCollateralCeiling
to calculate the new ceiling.
getNextCollateralCeiling
takes into account allowsIncrease
and allowsDecrease
to determine whether it is allowed to computed a higher or a lower ceiling (compared to the current one).
Both allowsIncrease
and allowsDecrease
look at the current redemptionRate
as well as at blockIncreaseWhenRevalue
and blockDecreaseWhenDevalue
to see whether they should allow or disallow an increase or decrease in the debt ceiling. blockIncreaseWhenRevalue
and blockDecreaseWhenDevalue
are by default set to zero so increases or decreases are always allowed, no matter what sign the redemption rate has.