Skip to main content

IFixedRate

Asset Tokenization Studio Team

IFixedRate

Interface for managing a token's fixed interest rate — its value and decimal precision.

Once set, the rate may be updated by an authorised operator at any time; setRate reverts with InterestRateIsFixed when the token's rate is locked. The rate is stored as a scaled integer: the effective rate is rate / 10 ** rateDecimals.

Methods​

getRate​

function getRate() external view returns (uint256 rate_, uint8 decimals_)

Returns the current fixed interest rate and its decimal precision.

Returns​

NameTypeDescription
rate_uint256Scaled rate value.
decimals_uint8Decimal precision; divide rate_ by 10 ** decimals_ for the effective rate.

initializeFixedRate​

function initializeFixedRate(IFixedRate.FixedRateData _initData) external nonpayable

Parameters​

NameTypeDescription
_initDataIFixedRate.FixedRateDataundefined

setRate​

function setRate(uint256 _newRate, uint8 _newRateDecimals) external nonpayable

Updates the fixed interest rate.

Reverts with InterestRateIsFixed if the rate has been locked. Requires an authorised operator role.

Parameters​

NameTypeDescription
_newRateuint256New scaled rate value.
_newRateDecimalsuint8Decimal precision for _newRate.

Events​

FixedRateInitialized​

event FixedRateInitialized(IFixedRate.FixedRateData initData)

Emitted once when the FixedRate capability is initialised on a token.

Fires exclusively from initializeFixedRate after the storage write succeeds.

Parameters​

NameTypeDescription
initDataIFixedRate.FixedRateDataThe rate and decimal precision written during initialisation.

RateUpdated​

event RateUpdated(address indexed operator, uint256 newRate, uint8 newRateDecimals)

Emitted when the fixed rate is updated by an authorised operator.

Parameters​

NameTypeDescription
operator indexedaddressAddress that performed the update.
newRateuint256New scaled rate value.
newRateDecimalsuint8New decimal precision for the rate.

Errors​

InterestRateIsFixed​

error InterestRateIsFixed()

Thrown when setRate is called on a token whose rate has been locked.