BuildapireferenceIMetricsRecorder

IMetricsRecorder

Source: https://github.com/tangle-network/tnt-core/blob/main/src/interfaces/IMetricsRecorder.sol

IMetricsRecorder

Minimal interface for recording protocol activity metrics

Implemented by TangleMetrics, called by core contracts

Functions

recordStake

function recordStake(address delegator, address operator, address asset, uint256 amount) external

Record a stake/delegation event

Parameters
NameTypeDescription
delegatoraddressThe delegator address
operatoraddressThe operator receiving delegation
assetaddressThe asset being staked (address(0) for native)
amountuint256The amount staked

recordUnstake

function recordUnstake(address delegator, address operator, address asset, uint256 amount) external

Record an unstake event

Parameters
NameTypeDescription
delegatoraddressThe delegator address
operatoraddressThe operator losing delegation
assetaddressThe asset being unstaked
amountuint256The amount unstaked

recordOperatorRegistered

function recordOperatorRegistered(address operator, address asset, uint256 amount) external

Record operator registration

Parameters
NameTypeDescription
operatoraddressThe operator address
assetaddressThe asset staked
amountuint256Initial stake amount

recordHeartbeat

function recordHeartbeat(address operator, uint64 serviceId, uint64 timestamp) external

Record operator heartbeat (liveness proof)

Parameters
NameTypeDescription
operatoraddressThe operator address
serviceIduint64The service ID
timestampuint64Block timestamp of heartbeat

recordJobCompletion

function recordJobCompletion(address operator, uint64 serviceId, uint64 jobCallId, bool success) external

Record job completion by operator

Parameters
NameTypeDescription
operatoraddressThe operator address
serviceIduint64The service ID
jobCallIduint64The job call ID
successboolWhether the job succeeded

recordSlash

function recordSlash(address operator, uint64 serviceId, uint256 amount) external

Record operator slashing (negative metric)

Parameters
NameTypeDescription
operatoraddressThe operator address
serviceIduint64The service ID
amountuint256Amount slashed

recordServiceCreated

function recordServiceCreated(uint64 serviceId, uint64 blueprintId, address owner, uint256 operatorCount) external

Record service creation/activation

Parameters
NameTypeDescription
serviceIduint64The service ID
blueprintIduint64The blueprint ID
owneraddressThe service owner
operatorCountuint256Number of operators

recordServiceTerminated

function recordServiceTerminated(uint64 serviceId, uint256 duration) external

Record service termination

Parameters
NameTypeDescription
serviceIduint64The service ID
durationuint256How long the service ran (seconds)

recordJobCall

function recordJobCall(uint64 serviceId, address caller, uint64 jobCallId) external

Record a job call on a service

Parameters
NameTypeDescription
serviceIduint64The service ID
calleraddressWho initiated the job
jobCallIduint64The job call ID

recordPayment

function recordPayment(address payer, uint64 serviceId, address token, uint256 amount) external

Record fee payment for a service

Parameters
NameTypeDescription
payeraddressWho paid the fee
serviceIduint64The service ID
tokenaddressThe payment token (address(0) for native)
amountuint256The amount paid

recordBlueprintCreated

function recordBlueprintCreated(uint64 blueprintId, address developer) external

Record blueprint creation

Parameters
NameTypeDescription
blueprintIduint64The blueprint ID
developeraddressThe developer address

recordBlueprintRegistration

function recordBlueprintRegistration(uint64 blueprintId, address operator) external

Record operator registration to a blueprint

Parameters
NameTypeDescription
blueprintIduint64The blueprint ID
operatoraddressThe operator address