ContinuousIndexing
Inherits: IContinuousIndexing
Author: M^0 Labs
State Variables
latestIndex
The latest updated index.
_latestRate
The latest updated rate.
latestUpdateTimestamp
The latest timestamp when the index was updated.
Functions
constructor
Constructs the ContinuousIndexing contract.
updateIndex
Updates the latest index and latest accrual time in storage.
Returns
currentIndex_
uint128
index The new stored index for computing present amounts from principal amounts.
currentIndex
The current index that would be written to storage if updateIndex
is called.
_getPrincipalAmountRoundedDown
Returns the principal amount (rounded down) given the present amount, using the current index.
Parameters
presentAmount_
uint240
The present amount.
Returns
<none>
uint112
The principal amount rounded down.
_getPrincipalAmountRoundedUp
Returns the principal amount (rounded up) given the present amount and an index.
Parameters
presentAmount_
uint240
The present amount.
Returns
<none>
uint112
The principal amount rounded up.
_getPresentAmountRoundedDown
Returns the present amount (rounded down) given the principal amount and an index.
Parameters
principalAmount_
uint112
The principal amount.
index_
uint128
An index.
Returns
<none>
uint240
The present amount rounded down.
_getPresentAmountRoundedUp
Returns the present amount (rounded up) given the principal amount and an index.
Parameters
principalAmount_
uint112
The principal amount.
index_
uint128
An index.
Returns
<none>
uint240
The present amount rounded up.
_getPrincipalAmountRoundedDown
Returns the principal amount given the present amount, using the current index.
Parameters
presentAmount_
uint240
The present amount.
index_
uint128
An index.
Returns
<none>
uint112
The principal amount rounded down.
_getPrincipalAmountRoundedUp
Returns the principal amount given the present amount, using the current index.
Parameters
presentAmount_
uint240
The present amount.
index_
uint128
An index.
Returns
<none>
uint112
The principal amount rounded up.
_rate
To be overridden by the inheriting contract to return the current rate.