Skip to main content
Post-intent hooks enable automated on-chain actions after successful intent fulfillment. This guide covers using existing hooks and creating custom ones.

Overview

A post-intent hook is a smart contract that executes custom logic when an intent is fulfilled. Common use cases:
  • Cross-chain bridging: Automatically bridge USDC to another chain
  • Token swapping: Convert USDC to another token
  • Protocol deposits: Deposit into yield protocols
  • Multi-step workflows: Chain multiple actions together
Hooks are specified at intent creation and executed by the Orchestrator after fees are deducted.

How Hooks Work

Using the Across Bridge Hook

The AcrossBridgeHook automatically bridges USDC to another chain after fulfillment.

Setting Up Bridge Intent

1

Prepare commitment data

Define destination chain parameters at signaling time:
2

Signal intent with hook

Include the hook address and commitment in your intent:
3

Fulfill with bridge data

At fulfillment, provide just-in-time bridge parameters:

Fallback Behavior

The Across hook gracefully handles failures:

Creating Custom Hooks

Hook Interface

Implement the IPostIntentHook interface:

Example: Yield Deposit Hook

Automatically deposit USDC into a yield protocol:

Example: Token Swap Hook

Swap USDC to another token via a DEX:

Hook Registration

Before use, hooks must be whitelisted in the PostIntentHookRegistry:
Only governance can add hooks to the registry. Submit a proposal to get your hook whitelisted.

Testing Hooks

Best Practices

Exact Consumption

Always consume exactly _amountNetFees. Orchestrator enforces this.

Authorization

Only allow orchestrator to call execute(). Revert for other callers.

Graceful Failures

Handle errors gracefully - consider fallback transfers like AcrossBridge.

Gas Efficiency

Optimize gas usage - takers pay for hook execution.

Security Considerations

Hooks are called during fulfillIntent which has reentrancy guards. Additional protection in hooks is optional but recommended.
Reset token allowances to 0 after operations to prevent residual allowance exploits.
Verify exact token consumption with before/after balance snapshots.
Validate all decoded parameters from _intent.data and _fulfillIntentData.

Next Steps

Testing Guide

Learn how to test your custom hooks

Hook Registry

View the PostIntentHookRegistry contract