Skip to main content

StaticInterestRateOracle

Git Source

Inherits: IInterestRateOracle

Title: StaticInterestRateOracle

Author: SocksNFlops

The StaticInterestRateOracle contract is a contract that returns a static interest rate for new Mortgages being originated.

State Variables

BPS_DECIMALS

The number of decimals for basis points

int8 public constant BPS_DECIMALS = 4

PAYMENT_PLAN_SPREAD

The spread for mortgages with a payment plan

uint16 public constant PAYMENT_PLAN_SPREAD = 100

NO_PAYMENT_PLAN_SPREAD

The spread for mortgages without a payment plan

uint16 public constant NO_PAYMENT_PLAN_SPREAD = 200

baseRate

The base rate (excluding spread)

uint16 public immutable baseRate

Functions

constructor

Constructor

constructor(uint16 baseRate_) ;

Parameters

NameTypeDescription
baseRate_uint16The base rate (excluding spread)

interestRate

Returns the interest rate (in basis points) for a given total periods and amortization status

treasuryRate + 100 BPS spread (for mortgages with a payment plan)

treasuryRate + 200 BPS spread (for mortgages without a payment plan)

function interestRate(uint8 totalPeriods, bool hasPaymentPlan) external view override returns (uint16 rate);

Parameters

NameTypeDescription
totalPeriodsuint8The total number of periods for the mortgage
hasPaymentPlanboolWhether the mortgage has a payment plan

Returns

NameTypeDescription
rateuint16The interest rate

Errors

InvalidTotalPeriods

The error thrown when the total periods are invalid and not supported by the InterestRateOracle

error InvalidTotalPeriods(uint8 totalPeriods);

Parameters

NameTypeDescription
totalPeriodsuint8The total periods