Skip to main content

IInterestRatePolicy

Git Source - Generated with forge doc

Title: IInterestRatePolicy

Interface of interest rate policies that compute rates for renewal pricing.

Rate values are rates per second in WAD (1e18 = 100% per second). Policies receive the source and target market ids for collateral-sensitive pricing, the renewal period start timestamp to compute elapsed time internally, the user address (the position owner being renewed), the source and target maturities for context, and the user's side for direction-aware pricing.

Policies are user-supplied and untrusted by the protocol; integrators and keepers must treat getRate as potentially reverting or gas-expensive.

Functions

getRate

Returns the interest rate for the given renewal context.

function getRate(
bytes32 sourceTenorMarketId,
bytes32 targetTenorMarketId,
uint256 renewalPeriodStart,
address user,
uint256 sourceMaturity,
uint256 targetMaturity,
bool userIsBuyer
) external view returns (uint256 rate);

Parameters

NameTypeDescription
sourceTenorMarketIdbytes32The id of the source side of the renewal (the position being closed).
targetTenorMarketIdbytes32The id of the target side of the renewal (the position being entered).
renewalPeriodStartuint256The renewal period start timestamp (the policy computes the elapsed time internally).
useraddressThe position owner being renewed (the offer maker in the make-on-behalf flow).
sourceMaturityuint256The source market maturity (0 for Blue to Midnight migrations).
targetMaturityuint256The target market maturity (0 for Midnight to Blue exits).
userIsBuyerboolThe renewed user's side in the trade, derived from the migration direction.

Returns

NameTypeDescription
rateuint256The interpolated rate per second in WAD at the given elapsed time.