BuildapireferencegeneratedIBlueprintHook

IBlueprintHook

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

IBlueprintHook

Simplified hook interface for basic blueprint customization

_For full control, implement IBlueprintServiceManager directly. This interface provides a simpler subset for common use cases.

Migration path:

  • Simple blueprints: Use IBlueprintHook / BlueprintHookBase
  • Full-featured blueprints: Use IBlueprintServiceManager / BlueprintServiceManagerBase_

Functions

onBlueprintCreated

function onBlueprintCreated(uint64 blueprintId, address owner) external

Called when blueprint is created

onOperatorRegister

function onOperatorRegister(uint64 blueprintId, address operator, bytes data) external returns (bool accept)

Called when an operator registers

Return Values
NameTypeDescription
acceptboolTrue to accept registration

onOperatorUnregister

function onOperatorUnregister(uint64 blueprintId, address operator) external

Called when an operator unregisters

onServiceRequest

function onServiceRequest(uint64 requestId, uint64 blueprintId, address requester, address[] operators, bytes config) external payable returns (bool accept)

Called when a service is requested

Return Values
NameTypeDescription
acceptboolTrue to accept request

onServiceApprove

function onServiceApprove(uint64 requestId, address operator, uint8 stakingPercent) external

Called when an operator approves a service request

onServiceReject

function onServiceReject(uint64 requestId, address operator) external

Called when an operator rejects a service request

onServiceActivated

function onServiceActivated(uint64 serviceId, uint64 requestId, address owner, address[] operators) external

Called when service becomes active

onServiceTerminated

function onServiceTerminated(uint64 serviceId, address owner) external

Called when service is terminated

canJoin

function canJoin(uint64 serviceId, address operator, uint16 exposureBps) external view returns (bool)

Check if operator can join a dynamic service

canLeave

function canLeave(uint64 serviceId, address operator) external view returns (bool)

Check if operator can leave a dynamic service

onJobSubmitted

function onJobSubmitted(uint64 serviceId, uint64 callId, uint8 jobIndex, address caller, bytes inputs) external payable returns (bool accept)

Called when a job is submitted

Return Values
NameTypeDescription
acceptboolTrue to accept job

onJobResult

function onJobResult(uint64 serviceId, uint64 callId, address operator, bytes result) external returns (bool accept)

Called when an operator submits a result

Return Values
NameTypeDescription
acceptboolTrue to accept result

onJobCompleted

function onJobCompleted(uint64 serviceId, uint64 callId, uint32 resultCount) external

Called when a job is marked complete

onSlashProposed

function onSlashProposed(uint64 serviceId, address operator, uint256 amount, bytes32 evidence) external returns (bool approve)

Called before a slash is applied

Return Values
NameTypeDescription
approveboolTrue to approve slash

onSlashApplied

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

Called after a slash is applied

getDeveloperPaymentAddress

function getDeveloperPaymentAddress(uint64 serviceId) external view returns (address payable)

Get the developer payment address

isPaymentTokenAllowed

function isPaymentTokenAllowed(address token) external view returns (bool)

Check if a payment token is allowed

getRequiredResultCount

function getRequiredResultCount(uint64 serviceId, uint8 jobIndex) external view returns (uint32)

Get the number of results required for job completion

requiresAggregation

function requiresAggregation(uint64 serviceId, uint8 jobIndex) external view returns (bool)

Check if a job requires BLS aggregated results

getAggregationThreshold

function getAggregationThreshold(uint64 serviceId, uint8 jobIndex) external view returns (uint16 thresholdBps, uint8 thresholdType)

Get the aggregation threshold configuration for a job

Return Values
NameTypeDescription
thresholdBpsuint16Threshold in basis points (6700 = 67%)
thresholdTypeuint80 = CountBased (% of operators), 1 = StakeWeighted (% of total stake)

onAggregatedResult

function onAggregatedResult(uint64 serviceId, uint64 callId, uint256 signerBitmap, bytes output) external

Called when an aggregated result is submitted