Keeper
Inherits: AccessControlUpgradeable, UUPSUpgradeable, IKeeper
Follows Tapio Governance model
Fast-path executor that lets curators adjust parameters within bounds enforced by ParameterRegistry
UUPS upgradeable. Governor is admin, curator and guardian are roles.
State Variables
DENOMINATOR
This is the denominator used for formatting ranges
uint256 private constant DENOMINATOR = 1e10;
PROTOCOL_OWNER_ROLE
bytes32 public constant PROTOCOL_OWNER_ROLE = keccak256("PROTOCOL_OWNER_ROLE");
CURATOR_ROLE
bytes32 public constant CURATOR_ROLE = keccak256("CURATOR_ROLE");
GUARDIAN_ROLE
bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
GOVERNOR_ROLE
bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE");
registry
IParameterRegistry private registry;
rampAController
IRampAController private rampAController;
spa
SelfPeggingAsset private spa;
spaToken
SPAToken private spaToken;
treasury
address public treasury;
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor();
initialize
function initialize(
address _owner,
address _governor,
address _curator,
address _guardian,
IParameterRegistry _registry,
IRampAController _rampAController,
SelfPeggingAsset _spa,
SPAToken _spaToken
)
public
initializer;
rampA
Allows curators to gradually ramp the A coefficient within allowed bounds
function rampA(uint256 newA, uint256 endTime) external override onlyRole(CURATOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newA | uint256 | The target A value |
endTime | uint256 | Timestamp when ramping should complete |
setMinRampTime
Set the minimum ramp time
function setMinRampTime(uint256 newMinRampTime) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newMinRampTime | uint256 | is the new minimum ramp time |
setSwapFee
Set the swap fee within allowed bounds
function setSwapFee(uint256 newFee) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newFee | uint256 | The new swap fee value |
setMintFee
Set the mint fee within allowed bounds
function setMintFee(uint256 newFee) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newFee | uint256 | The new mint fee value |
setRedeemFee
Set the redeem fee within allowed bounds
function setRedeemFee(uint256 newFee) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newFee | uint256 | The new redeem fee value |
cancelRamp
Allows guardians to cancel an ongoing A ramp in emergencies
function cancelRamp() external override onlyRole(GUARDIAN_ROLE);
setOffPegFeeMultiplier
Set the off-peg fee multiplier within allowed bounds
function setOffPegFeeMultiplier(uint256 newMultiplier) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newMultiplier | uint256 | The new off-peg fee multiplier value |
setExchangeRateFeeFactor
Set the exchange rate fee within allowed bounds
function setExchangeRateFeeFactor(uint256 newFeeFactor) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newFeeFactor | uint256 | The new exchange rate fee value |
setBufferPercent
Set the buffer within allowed bounds
function setBufferPercent(uint256 newBuffer) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBuffer | uint256 | The new buffer value |
setTokenSymbol
Set the token symbol
function setTokenSymbol(string calldata newSymbol) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newSymbol | string | The new token symbol |
setDecayPeriod
Set the decay period
function setDecayPeriod(uint256 newDecayPeriod) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newDecayPeriod | uint256 | The new decay period in seconds |
setRateChangeSkipPeriod
Set the rate change skip period
function setRateChangeSkipPeriod(uint256 newSkipPeriod) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newSkipPeriod | uint256 | The new skip period in seconds |
updateFeeErrorMargin
Set the fee error margin within allowed bounds
function updateFeeErrorMargin(uint256 newMargin) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newMargin | uint256 | The new fee error margin value |
updateYieldErrorMargin
Set the yield error margin within allowed bounds
function updateYieldErrorMargin(uint256 newMargin) external override onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newMargin | uint256 | The new yield error margin value |
distributeLoss
Distribute any losses incurred
function distributeLoss() external override onlyRole(GOVERNOR_ROLE);
setTreasury
Set treasury address that will receive withdrawn SPA tokens from Buffer
function setTreasury(address newTreasury) external onlyRole(GOVERNOR_ROLE);
withdrawAdminFee
Withdraw Buffer through SPAToken and send newly-minted SPA tokens to Treasury
function withdrawAdminFee(uint256 amount) external onlyRole(GOVERNOR_ROLE);
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of tokens to withdraw (18-decimals) |
pause
Pause the SPA
function pause() external override onlyRole(GUARDIAN_ROLE);
unpause
Unpause the SPA
function unpause() external override onlyRole(PROTOCOL_OWNER_ROLE);
getRegistry
Get the parameter registry used for bounds checking
function getRegistry() external view override returns (IParameterRegistry);
Returns
Name | Type | Description |
---|---|---|
<none> | IParameterRegistry | The parameter registry address |
getRampAController
Get the RampAController being managed
function getRampAController() external view override returns (IRampAController);
Returns
Name | Type | Description |
---|---|---|
<none> | IRampAController | The RampAController address |
getSpa
Get the SelfPeggingAsset being managed
function getSpa() external view override returns (SelfPeggingAsset);
Returns
Name | Type | Description |
---|---|---|
<none> | SelfPeggingAsset | The SelfPeggingAsset address |
getSpaToken
Get the SPA token being managed
function getSpaToken() external view override returns (SPAToken);
Returns
Name | Type | Description |
---|---|---|
<none> | SPAToken | The SPA token address |
_authorizeUpgrade
Authorisation to upgrade the implementation of the contract.
function _authorizeUpgrade(address) internal override onlyRole(PROTOCOL_OWNER_ROLE);
checkBounds
Validates if new value is within both absolute and relative bounds
function checkBounds(uint256 newValue, uint256 currentValue, IParameterRegistry.Bounds memory bounds) internal pure;
Parameters
Name | Type | Description |
---|---|---|
newValue | uint256 | The new value to check |
currentValue | uint256 | The current value for relative bounds checking |
bounds | IParameterRegistry.Bounds | The bounds object containing min, max, and relative change limits |
checkRange
Checks if new value is within the allowed relative change from current value
function checkRange(uint256 newValue, uint256 currentValue, IParameterRegistry.Bounds memory bounds) internal pure;
Parameters
Name | Type | Description |
---|---|---|
newValue | uint256 | The new value to check |
currentValue | uint256 | The current value to compare against |
bounds | IParameterRegistry.Bounds | The bounds object containing relative change limits |
Errors
ZeroAddress
error ZeroAddress();
OutOfBounds
error OutOfBounds();
DeltaTooBig
error DeltaTooBig();
RelativeRangeNotSet
error RelativeRangeNotSet();
WrongSymbol
error WrongSymbol();