Debridge Hooks can turn cross-chain swaps into lending deposits for a specified beneficiary

Debridge Hooks attach destination actions to cross-chain orders, allowing swap proceeds to fund a compatible lending deposit. The lending function must accept funds from a contract caller and credit the intended beneficiary. Hook configuration determines whether the deposit executes with fulfillment or can run later. A filled swap therefore needs the corresponding lending result before it counts as a completed deposit. The destination asset, encoded supply amount and beneficiary must match the receiving protocol's requirements.

DLN Liquidity and Lending Calls

DLN provides the destination tokens, while the hook directs those tokens into a lending function that accepts a specified beneficiary. DLN means Debridge Liquidity Network; its solvers fulfill orders using destination-chain liquidity. The attached action operates on the output asset. This combines asset acquisition with a protocol interaction without requiring a separate destination-wallet deposit. The lending application defines the credited position, and the hook carries the call that requests it. Cross-chain messaging supports DLN settlement, while the deposit itself follows the destination hook's execution rules.

Beneficiary Support Before Order Creation

A direct lending integration needs a function that distinguishes the account providing funds from the account receiving deposit credit. Matching the destination network and accepted asset is necessary, but caller identity also affects ownership. The function's actual arguments determine who receives the position.

Contract Caller

The destination execution contract calls the lending function; the wallet that created the source order does not become its immediate caller. A function that credits only msg.sender would credit that execution contract. Simply inserting the user's address into another order field does not change this behavior.

Source-wallet approval and destination lending authorization also concern different balances. An approval that permits order creation does not authorize the lending contract to spend tokens from the destination executor. The hook implementation must provide the permissions that the lending call actually needs.

Credited Beneficiary

A beneficiary parameter such as onBehalfOf lets a compatible supply function assign deposit credit to the intended account. That beneficiary can differ from the destination fallback address and cancellation authority. The DLN API accepts hook instructions through dlnHook and checks their simulated execution when constructing an order transaction. Compatibility must hold for the selected lending deployment, not merely another deployment with the same protocol name.

Does a Filled Order Confirm a Lending Deposit?

A filled order does not independently confirm a lending deposit when its hook permits delayed execution or allows failure. Confirmation also requires successful hook execution and the intended lending credit.

Debridge - Does a Filled Order Confirm a Lending Deposit?

View image file

The external-call tracking data provides execution steps associated with the order ID. For an EVM call, an execution event can include a success flag; the event name alone does not prove success. Lending confirmation then concerns the intended beneficiary's supply record or receipt-token balance. Tokens held for a pending hook, or tokens delivered to a fallback address, describe different outcomes. Neither state by itself establishes that the lending protocol accepted a deposit.

EVM Atomicity and Failure Handling

EVM hooks configure execution timing and required success separately, which changes whether lending failure also prevents order fulfillment. Atomic execution keeps fulfillment and the hook within the same destination transaction. When success is required, a failed hook reverts that transaction, leaving the order unfulfilled.

Optional-success execution can let the order finish when the target call fails. The output then follows the configured fallback handling. This can preserve token delivery while leaving the intended lending position unchanged. The interface must distinguish that fallback outcome from a successful deposit.

Non-atomic execution allows a solver to defer the hook, although the solver can also execute it during fulfillment. If deferred, the intermediary contract holds the output pending execution. A later success-required failure reverts that execution attempt; it does not undo an earlier completed fulfillment. While the call remains pending, the configured destination authority can cancel it and receive the held output. This differs from cancelling an unfulfilled source-funded order.

The Universal Hook and Token Allowances

The Universal Hook can call an existing lending contract using encoded arguments, avoiding a custom executor where the lending interface already fits. Its payload identifies the called contract and the function arguments.

ERC-20 Token Pulling

The Universal Hook gives the called contract an allowance to spend the ERC-20 tokens supplied for that call. A compatible lending function pulls those tokens from the executor. Passing the protocol address as the target does not itself perform the deposit; the call must invoke the correct supply function with valid arguments.

The executor forwards any unconsumed output tokens to the fallback address. A successful call can therefore consume less than the available output. Deposit accounting should use the amount that the lending protocol accepted, rather than treating the entire swap output as deposited automatically.

Custom Hook Targets

A custom EVM target receives tokens and handles the callback through IExternalCallExecutor. This interface differs from an ordinary lending function. The adapter delivers tokens to the custom target before invoking its ERC-20 callback, whereas the Universal Hook grants the called lending contract an allowance. A custom implementation must define its own handling of beneficiary credit and unused funds. Arbitrary-call support does not supply those application rules automatically.

Deposit Amounts and Changing Protocol Limits

The amount encoded in a lending call must fit the assets available to the executor when the hook runs. A fixed-input market quote calculates destination output; a reverse market quote specifies destination output and calculates required input. A fixed deposit amount must remain consistent with whichever quoting strategy constructs the order.

Debridge - Deposit Amounts and Changing Protocol Limits - illustration

View image file

An explicit EVM execution reward, when configured, comes out of the order output before the executor receives its funds. The encoded deposit amount must fit the net output delivered to the executor. Lending acceptance adds separate live conditions, such as whether the selected reserve permits supply and has capacity under its configured cap. A beneficiary argument is a durable interface requirement; reserve status, remaining capacity and gas estimates can change between preparation and execution.

Solana Instructions and Execution Authority

Solana hooks use serialized destination instructions and support non-atomic success-required execution, so they need different preparation from EVM transaction calls. The destination program deserializes those instructions and invokes other programs through cross-program invocation, or CPI.

The external-call authority signs the invoked instructions. The hook cannot attach arbitrary additional wallet signatures to that CPI. A lending instruction that requires the beneficiary's separate signature therefore needs an integration design that satisfies its authorization requirements. Merely naming that beneficiary does not provide the signature. The instruction accounts must also identify the correct token wallet and deposit owner.

Account placeholders and substitutions let the payload refer to accounts that depend on the order. Amount substitution can read a designated token account balance, subtract a specified amount and insert the result into instruction data. These facilities adapt concrete account and amount fields; they do not bypass the lending program's checks or imply that every lending instruction supports third-party funding.

A Filled Swap With a Pending Deposit

In this hypothetical example, an order shows Fulfilled while the intended beneficiary has no lending credit. It uses a supported EVM destination, an ERC-20 output and a non-atomic success-required hook. Assume a beneficiary-aware lending function and reserve conditions that allow the chosen output amount. A completed deposit would show successful hook execution and supply credit for that beneficiary. A read-only inspection of the order and adapter records instead finds a registered pending call. There is no successful deposit record.

The prepared execution transaction can be simulated without broadcasting it. That check uses the same payload, actual executor and available token amount against the lending contract's present state. In this example, the reserve still accepts the deposit and the simulation succeeds. The beneficiary requirement stays unchanged even though reserve availability is a live condition.

An executor then submits the pending hook, and the successful transaction records supply for the intended beneficiary. If the live check had rejected supply, a third party could execute the pending call once the reserve accepts the deposit. Its configured authority could instead cancel the call to recover the held output. Creating another transfer would not complete the existing hook.

Hook Integrity and Application Permissions

The hook payload is bound to the order, preventing a solver from substituting different instructions while fulfilling that same order. The deterministic DLN order ID includes a hash of the hook data. A changed beneficiary or changed call alters that commitment. This binds the selected action without establishing that its lending logic is correct.

Hook data does not authenticate the original sender by default. A contract must not grant privileged access solely because a trusted DLN intermediary called it; arbitrary participants can create orders with arbitrary hooks. An application that needs user authentication can verify an authenticated signature carried in the payload. Authenticating a source smart contract as the sender requires the Debridge Messaging Protocol. These requirements matter when a lending integration adds position controls beyond accepting funds.

Debridge - Hook Integrity and Application Permissions
Hook Integrity and Application Permissions - diagram

View image file

Supply Credit and Subsequent Position Control

A successful lending deposit gives the beneficiary the credit defined by the receiving protocol, without fixing future interest rates or withdrawal availability. A receipt-token balance or protocol position represents that credit. Its withdrawal rules belong to the lending deployment, including available liquidity and any restrictions that protect an outstanding borrowing position.

Collateral treatment also follows the lending protocol's asset and account configuration. Supplied funds need not produce the same borrowing capacity across assets or positions. The hook's execution settings establish how the deposit runs; they do not change those lending terms. A beneficiary-aware supply function places the credit under the designated account through an argument such as onBehalfOf.

Debridge: what people ask

Can I Use the EVM transaction-call Shortcut for a Delayed Lending Deposit?

The evm_transaction_call shortcut creates an atomic success-required hook, so it does not select delayed execution. The evm_hook_data_v1 template exposes the separate execution-timing and success settings. A deposit that needs non-atomic behavior must use a compatible configuration, with its own pending-call handling.

Why Does the Hook API Return HOOK_FAILED Before I Submit an Order?

HOOK_FAILED means the API's simulated fulfillment encountered a hook error and did not return the order-creation transaction. The error details describe the simulated transaction and execution failure. A malformed call, incompatible lending function or rejected deposit can cause that result; the precise cause comes from the returned failure data.

Will a Lending Hook Hide My Beneficiary Address?

A lending hook does not make the beneficiary address private. The encoded destination call and on-chain execution can expose the credited address alongside contract interactions. Using a beneficiary that differs from the source wallet does not create a confidentiality guarantee for the relationship between those addresses.

May the Universal Hook Call ERC-20 Transfer or Approval Methods Directly?

The default EVM executor rejects payloads whose function selectors match approve, transfer, transferFrom or increaseAllowance. This restriction applies to that executor's direct external call. It can still grant the lending contract an allowance internally, letting a valid supply function pull the tokens needed for the deposit.

Can Native Currency Fund a Lending Deposit Through a Hook?

A native-currency output can fund a compatible payable destination call. The lending interface must accept native value or use a gateway that wraps it before supply. Sending native currency to a function that expects an ERC-20 balance does not perform that conversion, so the asset-handling path must match.

Updated