Skip to main content

Kpis

Asset Tokenization Studio Team

KPI Management Facet

Manages KPI data points used by KPI-linked rate logic for asset instruments.

This facet stores and queries KPI checkpoints through KpisStorageWrapper. It must be initialised once by an account with the default admin role before dependent resolver-based functionality is considered ready. Mutating operations require the token to be operational, activated, unpaused, and the caller to hold the KPI manager role.

Methods​

addKpiData​

function addKpiData(uint256 _date, uint256 _value, address _project) external nonpayable

Records a KPI data point for _project at _date.

Persists a KPI checkpoint for _project; reverts unless _date is valid. Emits {KpiDataAdded}.

Parameters​

NameTypeDescription
_dateuint256Unix timestamp for the data point.
_valueuint256KPI value to record.
_projectaddressAddress of the project the data point belongs to.

getLatestKpiData​

function getLatestKpiData(uint256 _from, uint256 _to, address _project) external view returns (uint256 value_, bool exists_)

Returns the most recent KPI value for _project within [_from, _to].

Reverts with InvalidDateRange if _from > _to.

Parameters​

NameTypeDescription
_fromuint256Start of the search window (Unix timestamp, inclusive).
_touint256End of the search window (Unix timestamp, inclusive).
_projectaddressAddress of the project to query.

Returns​

NameTypeDescription
value_uint256The latest KPI value found in the range, or 0 if none.
exists_booltrue if at least one data point exists within the range.

getMinDate​

function getMinDate() external view returns (uint256 minDate_)

Returns the earliest valid date for KPI data points on this token.

Returns​

NameTypeDescription
minDate_uint256The configured minimum date (Unix timestamp).

initializeKpis​

function initializeKpis() external nonpayable

Initialises the KPI capability on the token.

Marks the KPI latest KPI-linked rate resolver as ready and emits KpisInitialized.

isCheckPointDate​

function isCheckPointDate(uint256 _date, address _project) external view returns (bool exists_)

Checks whether a KPI data point exists for _project at exactly _date.

Parameters​

NameTypeDescription
_dateuint256Unix timestamp to look up.
_projectaddressAddress of the project to query.

Returns​

NameTypeDescription
exists_booltrue if a data point is registered for (project, date).

Events​

KpiDataAdded​

event KpiDataAdded(address indexed project, uint256 date, uint256 value)

Emitted when a new KPI data point is recorded.

Parameters​

NameTypeDescription
project indexedaddressAddress of the project the data point belongs to.
dateuint256Unix timestamp identifying the data point.
valueuint256KPI value recorded at date.

KpisInitialized​

event KpisInitialized()

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

Fires exclusively from initializeKpis.

Errors​

AccountHasNoRole​

error AccountHasNoRole(address account, bytes32 role)

Thrown when an account does not hold a required role.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the role.
rolebytes32The role that is not held.

AssetNotOperational​

error AssetNotOperational(bytes32 configId, uint256 versionId)

Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.

Parameters​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration version whose operational status was checked.

CouponNotFound​

error CouponNotFound(uint256 couponID)

Reverts when a coupon identifier does not resolve to an existing corporate action.

Parameters​

NameTypeDescription
couponIDuint256The coupon identifier that was not found.

Deactivated​

error Deactivated()

Thrown when an operation guarded by onlyActivated is attempted on a token whose deactivation flag has already been set.

FacetAlreadyRegistered​

error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)

Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last version recorded for that facet at the time of the check.

InvalidDate​

error InvalidDate(uint256 providedDate, uint256 minDate, uint256 maxDate)

Thrown when _date falls outside the token's allowed [minDate, maxDate] window.

Parameters​

NameTypeDescription
providedDateuint256The date supplied by the caller.
minDateuint256Lower bound of the valid date range.
maxDateuint256Upper bound of the valid date range.

InvalidDateRange​

error InvalidDateRange(uint256 fromDate, uint256 toDate)

Thrown when the supplied date range is invalid (e.g. fromDate > toDate).

Parameters​

NameTypeDescription
fromDateuint256Start of the requested range.
toDateuint256End of the requested range.

IsPaused​

error IsPaused()

Thrown when an operation that requires the token to be unpaused is attempted while the token is paused (own flag or any external pause contract).

KpiDataAlreadyExists​

error KpiDataAlreadyExists(uint256 date)

Thrown when a KPI data point already exists for the given date and project.

Parameters​

NameTypeDescription
dateuint256The duplicate date supplied by the caller.

UnexpectedError​

error UnexpectedError(bytes4 _errorId)

Reverts when an unreachable validation state is detected.

Replaces assertions for defensive handling of logically impossible states.

Parameters​

NameTypeDescription
_errorIdbytes4Identifier of the unexpected validation condition.

UnrecognizedResolverProxyVersion​

error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)

Thrown when the provided proxy version does not match any BLR compatible standard.

Parameters​

NameTypeDescription
_resolverProxyVersionbytes8proxy version that is not compatible with the BLR.

WalletRecovered​

error WalletRecovered()

Thrown when attempting to recover a wallet that has already been recovered.