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) externalRecord a stake/delegation event
Parameters
| Name | Type | Description |
|---|---|---|
| delegator | address | The delegator address |
| operator | address | The operator receiving delegation |
| asset | address | The asset being staked (address(0) for native) |
| amount | uint256 | The amount staked |
recordUnstake
function recordUnstake(address delegator, address operator, address asset, uint256 amount) externalRecord an unstake event
Parameters
| Name | Type | Description |
|---|---|---|
| delegator | address | The delegator address |
| operator | address | The operator losing delegation |
| asset | address | The asset being unstaked |
| amount | uint256 | The amount unstaked |
recordOperatorRegistered
function recordOperatorRegistered(address operator, address asset, uint256 amount) externalRecord operator registration
Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | The operator address |
| asset | address | The asset staked |
| amount | uint256 | Initial stake amount |
recordHeartbeat
function recordHeartbeat(address operator, uint64 serviceId, uint64 timestamp) externalRecord operator heartbeat (liveness proof)
Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | The operator address |
| serviceId | uint64 | The service ID |
| timestamp | uint64 | Block timestamp of heartbeat |
recordJobCompletion
function recordJobCompletion(address operator, uint64 serviceId, uint64 jobCallId, bool success) externalRecord job completion by operator
Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | The operator address |
| serviceId | uint64 | The service ID |
| jobCallId | uint64 | The job call ID |
| success | bool | Whether the job succeeded |
recordSlash
function recordSlash(address operator, uint64 serviceId, uint256 amount) externalRecord operator slashing (negative metric)
Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | The operator address |
| serviceId | uint64 | The service ID |
| amount | uint256 | Amount slashed |
recordServiceCreated
function recordServiceCreated(uint64 serviceId, uint64 blueprintId, address owner, uint256 operatorCount) externalRecord service creation/activation
Parameters
| Name | Type | Description |
|---|---|---|
| serviceId | uint64 | The service ID |
| blueprintId | uint64 | The blueprint ID |
| owner | address | The service owner |
| operatorCount | uint256 | Number of operators |
recordServiceTerminated
function recordServiceTerminated(uint64 serviceId, uint256 duration) externalRecord service termination
Parameters
| Name | Type | Description |
|---|---|---|
| serviceId | uint64 | The service ID |
| duration | uint256 | How long the service ran (seconds) |
recordJobCall
function recordJobCall(uint64 serviceId, address caller, uint64 jobCallId) externalRecord a job call on a service
Parameters
| Name | Type | Description |
|---|---|---|
| serviceId | uint64 | The service ID |
| caller | address | Who initiated the job |
| jobCallId | uint64 | The job call ID |
recordPayment
function recordPayment(address payer, uint64 serviceId, address token, uint256 amount) externalRecord fee payment for a service
Parameters
| Name | Type | Description |
|---|---|---|
| payer | address | Who paid the fee |
| serviceId | uint64 | The service ID |
| token | address | The payment token (address(0) for native) |
| amount | uint256 | The amount paid |
recordBlueprintCreated
function recordBlueprintCreated(uint64 blueprintId, address developer) externalRecord blueprint creation
Parameters
| Name | Type | Description |
|---|---|---|
| blueprintId | uint64 | The blueprint ID |
| developer | address | The developer address |
recordBlueprintRegistration
function recordBlueprintRegistration(uint64 blueprintId, address operator) externalRecord operator registration to a blueprint
Parameters
| Name | Type | Description |
|---|---|---|
| blueprintId | uint64 | The blueprint ID |
| operator | address | The operator address |