pub fn set_hook(
hook: HookPoint,
contract: AccountId,
selector: u32,
gas_limit: u64
)
Expand description
Sets a hook receiver for a given hook point.
A hook is a mechanism that allows certain actions to be triggered when a specific situation arises. When the situation corresponding to the hook point occurs, the runtime will call the receiver contract using the specified selector.
§Supported Hook Points
OnBlockEnd
: The receiver contract will be invoked once all events in a Phala chain block have been processed.
§Arguments
hook
: The hook point for which the receiver is set.contract
: The AccountId of the contract to be called when the hook is triggered.selector
: The function selector to be used when calling the receiver contract.gas_limit
: The maximum amount of gas that can be used when calling the receiver contract.
Note: The cost of the execution would be charged to the contract itself.
This api is only available for the system contract. User contracts should use System::set_hook
instead.