IMigrationRatifier
Git Source - Generated with forge doc
Inherits: IRatifier
Title: IMigrationRatifier
Interface of migration ratifiers.
Migration and renewal takes are validated against per-user params and a protocol fee config.
Functions
MIGRATION_GROUP_HEADER
Reserved marker that every ratified offer's group must carry in its top 6 bytes: the
"tenor" domain prefix plus the reserved schema version byte, so the migration path can only ever write
Midnight's consumed[offer.maker][group] in a namespace disjoint from offer.maker's own non-migration offers
(which carry a different version). The low 208 bits stay free to vary per offer.
function MIGRATION_GROUP_HEADER() external view returns (bytes32);
MIGRATION_GROUP_HEADER_MASK
Mask selecting the top 6 bytes of group that MIGRATION_GROUP_HEADER occupies.
function MIGRATION_GROUP_HEADER_MASK() external view returns (bytes32);
MORPHO_MIDNIGHT
The Morpho Midnight protocol the ratifier reads from.
function MORPHO_MIDNIGHT() external view returns (IMidnight);
getEffectiveFeeConfig
Returns the effective fee config for (callback, tenorMarketId): the market-specific override if set (feeRecipient != address(0)), otherwise the action-level default keyed by tenorMarketId = bytes32(0).
function getEffectiveFeeConfig(address callback, bytes32 tenorMarketId) external view returns (FeeConfig memory);
feeConfigs
The raw fee config for (callback, tenorMarketId), without fallback to the default.
function feeConfigs(address callback, bytes32 tenorMarketId)
external
view
returns (address feeRecipient, uint96 feeRate);
userParams
The per-user migration params for the (callback, sourceTenorMarketId, targetTenorMarketId) tuple.
function userParams(address user, address callback, bytes32 sourceTenorMarketId, bytes32 targetTenorMarketId)
external
view
returns (
address interestRatePolicy,
uint32 renewalWindow,
uint32 minDuration,
uint32 maxDuration,
address renewalCadence,
uint40 limitRatePerSecond
);
setFeeConfig
Sets the protocol fee config for (callback, tenorMarketId).
Only callable by the ratifier owner.
Use tenorMarketId = bytes32(0) to write the action-level default.
function setFeeConfig(address callback, bytes32 tenorMarketId, uint256 feeRate, address feeRecipient) external;
setParams
Sets onBehalf's migration params for the (callback, sourceTenorMarketId, targetTenorMarketId) tuple.
Callable by onBehalf itself or anyone they have authorized on Midnight.
function setParams(
address onBehalf,
address callback,
bytes32 sourceTenorMarketId,
bytes32 targetTenorMarketId,
UserMigrationParams calldata params
) external;
clearParams
Clears onBehalf's migration params for the (callback, sourceTenorMarketId, targetTenorMarketId) tuple.
Callable by onBehalf itself or anyone they have authorized on Midnight.
function clearParams(address onBehalf, address callback, bytes32 sourceTenorMarketId, bytes32 targetTenorMarketId)
external;
Events
FeeConfigSet
event FeeConfigSet(address indexed callback, bytes32 indexed tenorMarketId, uint256 feeRate, address feeRecipient);
ParamsSet
event ParamsSet(
address indexed user,
address indexed callback,
bytes32 sourceTenorMarketId,
bytes32 targetTenorMarketId,
UserMigrationParams params
);
ParamsCleared
event ParamsCleared(
address indexed user, address indexed callback, bytes32 sourceTenorMarketId, bytes32 targetTenorMarketId
);
Errors
InvalidRenewalParams
error InvalidRenewalParams();
Unauthorized
error Unauthorized();
InvalidFeeConfig
error InvalidFeeConfig();
InvalidRenewalWindow
error InvalidRenewalWindow();
InvalidTargetMaturity
error InvalidTargetMaturity();
InvalidOfferRate
error InvalidOfferRate();
InvalidCallback
error InvalidCallback();
InvalidCallbackData
error InvalidCallbackData();
InvalidRatifierData
error InvalidRatifierData();
InvalidReceiver
error InvalidReceiver();
InvalidGroup
error InvalidGroup();
Structs
UserMigrationParams
Per-user policy bundle the ratifier reads when validating a take, keyed by (callback, sourceTenorMarketId, targetTenorMarketId) and stored on the implementing ratifier.
struct UserMigrationParams {
address interestRatePolicy;
uint32 renewalWindow;
uint32 minDuration;
uint32 maxDuration;
address renewalCadence;
uint40 limitRatePerSecond;
}
Properties
| Name | Type | Description |
|---|---|---|
interestRatePolicy | address | The policy contract supplying the user's rate ceiling/floor for this tuple. |
renewalWindow | uint32 | The number of seconds before source maturity within which a Midnight source becomes eligible. Must not exceed source maturity, and seeds the renewal period start (sourceMaturity - renewalWindow). Ignored for non-Midnight sources and non-binding for Midnight sources past maturity. |
minDuration | uint32 | The minimum duration the user accepts: block.timestamp + minDuration <= targetMaturity. |
maxDuration | uint32 | The maximum duration the user accepts: targetMaturity <= block.timestamp + maxDuration. |
renewalCadence | address | The cadence contract. If non-zero, targetMaturity must land on a cadence boundary. Required for Blue and vault entry flows (zero source maturity), where it also seeds the renewal period start; omitting it there reverts InvalidRenewalParams. |
limitRatePerSecond | uint40 | The user-supplied rate cap per second, combined with the policy rate (min for borrowers, max for lenders) before validation. |
FeeConfig
Protocol fee config for a (callback, tenorMarketId) pair.
tenorMarketId = bytes32(0) holds the action-level default; specific market ids override it.
struct FeeConfig {
address feeRecipient;
uint96 feeRate;
}
Properties
| Name | Type | Description |
|---|---|---|
feeRecipient | address | Receives the fee. address(0) marks the config as unset, falling back to the default. |
feeRate | uint96 | The fee rate in WAD, at most the callback's maximum fee rate. |