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
| Name | Type | Description |
|---|---|---|
| rate_ | uint256 | Scaled rate value. |
| decimals_ | uint8 | Decimal precision; divide rate_ by 10 ** decimals_ for the effective rate. |
initializeFixedRate
function initializeFixedRate(IFixedRate.FixedRateData _initData) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| _initData | IFixedRate.FixedRateData | undefined |
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
| Name | Type | Description |
|---|---|---|
| _newRate | uint256 | New scaled rate value. |
| _newRateDecimals | uint8 | Decimal 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
| Name | Type | Description |
|---|---|---|
| initData | IFixedRate.FixedRateData | The 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
| Name | Type | Description |
|---|---|---|
operator indexed | address | Address that performed the update. |
| newRate | uint256 | New scaled rate value. |
| newRateDecimals | uint8 | New decimal precision for the rate. |
Errors
InterestRateIsFixed
error InterestRateIsFixed()
Thrown when setRate is called on a token whose rate has been locked.