On this page

Optional hooks

Programmatic Omnigas requests can include one destination call. The Bridge gas modal intentionally exposes only plain funding; removing its hook fields did not remove contract support.

Hook fields

FieldTypeRule
targetaddressDestination contract to call; may differ from recipient
databytesABI-encoded calldata, at most 4,096 bytes
valueuint128Native amount passed to target, no greater than request amount
gasLimituint3225,000–5,000,000 for a nonzero target

For no hook use the zero address, 0x, zero value and zero gas. API requests omit hook entirely for plain delivery. A configured hook uses the recipient only for the remainder or fallback; the target sees Omnigas as msg.sender, not the source wallet.

Encode a call

Starting from the direct funding example, replace the hook before quoting:

import { Interface, parseEther } from "ethers";

// Example interface for a contract YOU deploy and review on the destination.
const targetAbi = new Interface(["function depositFor(address beneficiary) payable"]);
request.hook = {
  target: reviewedDestinationContract,
  value: parseEther("0.0005"),
  gasLimit: 200000,
  data: targetAbi.encodeFunctionData("depositFor", [request.recipient]),
};
// Re-quote the full request after changing any hook field.

This is not a reference to an existing Omnisea deposit contract. Deploy and test the target independently. It must enforce its own authorization, minimum output and deadline, and explicitly direct any tokens or positions to the intended beneficiary.

Settlement outcomes

Outcome in GasDeliveredMeaning
0No hook; full amount delivered or credited
1Call did not revert; remainder and native value returned during the hook go to recipient
2Hook reverted, exhausted its call gas, lacked code, or targeted a forbidden transport; full amount goes to recipient
3Hook deadline expired; skip it and deliver the full amount

A successful EVM call is not proof of a successful business action. A target can return false without reverting and still count as outcome 1. Reverted hook state and its value transfer are rolled back. If the outer compose lacks enough gas, it reverts and stays retryable rather than pretending the hook failed safely.

Plain funding can still settle after the request deadline; the deadline prevents a new source send and skips an expired hook, not a delayed plain payout. Any recipient payout that fails becomes a credit. Omnigas cannot recover arbitrary ERC-20s sent to it: do not call a swap or trade contract that sends purchased tokens back to its caller. Direct Omnipad Router hooks are therefore not a safe bridge-and-buy integration.

Introducing Omnipad-Launch tokens between chains