Callbacks for Event-based Data Retrieval

Credora provides an efficient mechanism for retrieving data using a callback-based solution. This feature allows external entities to request data and receive the results asynchronously through a callback function.

The consuming smart contract should implement the desired callback belonging to the CredoraFunctions abstract contract.

Callbacks will be called if a valid subscription is active and if credit metrics change.

fulfillScore(bytes32 _entity, uint256 metric_data)
fulfillNAV(bytes32 _entity, uint256 metric_data)
fulfillRAE(bytes32 _entity, bytes8 metric_data)
fulfillBorrowCapacity(bytes32 _entity, uint256 metric_data)
fulfillImpliedPD(bytes32 _entity, uint256 metric_data)
fulfillImpliedPDtenor(bytes32 _entity, uint256 metric_data)
invalidateData(bytes32 _entity)

Testing Functions

Credora provides a set of functions for testing purposes that are enabled only on testnets.

testAccessData

ParameterTypeDescription

entity

bytes32

The name of the entity owning the data

Return: bytes memory - the full set of credit metrics contained for that entity, encoded as follows:

["bytes32", 
 "uint256", 
 "uint256", 
 "bytes8", 
 "uint256", 
 "uint256", 
 "uint256"] =
[ethers.encodeBytes32String(entityName), 
 scaledScore, 
 scaledNAV, 
 RAE, 
 scaledBorrowCapacity, 
 scaledImpliedPD, 
 scaledImpliedPDTenor]

TestTriggerCallbacks

ParameterTypeDescription

entity

bytes32

The name of the entity owning the data

metrics

bytes memory

The dataset to use for updating metrics encoded as:

["bytes32", 
 "uint256", 
 "uint256", 
 "bytes8", 
 "uint256", 
 "uint256", 
 "uint256"] =
[ethers.encodeBytes32String(entityName), 
 scaledScore, 
 scaledNAV, 
 RAE, 
 scaledBorrowCapacity, 
 scaledImpliedPD, 
 scaledImpliedPDTenor]

subscribedContract

address

The consuming contract whose callbacks must be triggered

Last updated