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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| The present amount. |
Returns
Name | Type | Description |
---|---|---|
|
| The principal amount rounded down. |
_getPrincipalAmountRoundedUp
Returns the principal amount (rounded up) given the present amount and an index.
Parameters
Name | Type | Description |
---|---|---|
|
| The present amount. |
Returns
Name | Type | Description |
---|---|---|
|
| The principal amount rounded up. |
_getPresentAmountRoundedDown
Returns the present amount (rounded down) given the principal amount and an index.
Parameters
Name | Type | Description |
---|---|---|
|
| The principal amount. |
|
| An index. |
Returns
Name | Type | Description |
---|---|---|
|
| The present amount rounded down. |
_getPresentAmountRoundedUp
Returns the present amount (rounded up) given the principal amount and an index.
Parameters
Name | Type | Description |
---|---|---|
|
| The principal amount. |
|
| An index. |
Returns
Name | Type | Description |
---|---|---|
|
| The present amount rounded up. |
_getPrincipalAmountRoundedDown
Returns the principal amount given the present amount, using the current index.
Parameters
Name | Type | Description |
---|---|---|
|
| The present amount. |
|
| An index. |
Returns
Name | Type | Description |
---|---|---|
|
| The principal amount rounded down. |
_getPrincipalAmountRoundedUp
Returns the principal amount given the present amount, using the current index.
Parameters
Name | Type | Description |
---|---|---|
|
| The present amount. |
|
| An index. |
Returns
Name | Type | Description |
---|---|---|
|
| The principal amount rounded up. |
_rate
To be overridden by the inheriting contract to return the current rate.