Hyperlane Warp Routes (HWR) implement the ITokenBridge interface.
interface ITokenBridge {
/**
* @notice Transfers tokens to the specified recipient on a remote chain
* @param _destination The domain ID of the destination chain
* @param _recipient The address of the recipient, encoded as bytes32
* @param _amount The amount of tokens the recipient should receive
*/
function transferRemote(
uint32 _destination,
bytes32 _recipient,
uint256 _amount
) external payable;
struct Quote {
address token; // Token address (address(0) for native token)
uint256 amount; // Fee amount in the specified token
}
/**
* @notice Quotes the fees required for a remote transfer
* @param _destination The domain ID of the destination chain
* @param _recipient The address of the recipient, encoded as bytes32
* @param _amount The amount of tokens to transfer
* @return quotes An array of Quote structs representing fees in different tokens
*/
function quoteTransferRemote(
uint32 _destination,
bytes32 _recipient,
uint256 _amount
) external view returns (Quote[] memory quotes);
}
Fee Quoting Interface
New in version 10.0.0: The quoteTransferRemote function provides a standardized way to quote fees for warp route transfers.
Only applicable to routes that return >= 10.0.0 from PACKAGE_VERSION().
Quote Structure
The quoteTransferRemote function returns an array of Quote structs with the following convention:
-
Index 0: Native Fees
- Token:
address(0) (native token like ETH, MATIC, etc.)
- Amount: Fees charged by the mailbox for dispatching the message
- This must be sent as
msg.value when calling transferRemote
-
Index 1: Token Fees
- Token: The ERC20 token being bridged.
- Amount:
_amount + internalFeeAmount
- This is the total amount of tokens that must be sent/approved, including any internal fees charged by the warp route
Exact Amount Out Semantics
Warp routes use “exact amount out” semantics, meaning:
- The
_amount parameter in transferRemote specifies the exact amount the recipient receives
- Fees are charged on top of this amount from the sender
- Total tokens required =
_amount + internalFeeAmount + externalFeeAmount
Example:
// Get fee quote
Quote[] memory quotes = warpRoute.quoteTransferRemote(
destinationDomain,
recipientAddress,
1000e18 // Recipient will receive exactly 1000 tokens
);
// quotes[0]: Native fee (e.g., 0.00001 ETH)
uint256 nativeFee = quotes[0].amount;
// quotes[1]: Token amount (e.g., 1001e18 = 1000 + 1 fee)
uint256 tokenFee = quotes[1].amount;
// Approve warp route for token transfer
IERC20(quotes[1].token).approve(
address(warpRoute),
tokenFee // 1001e18 total
);
// Transfer with native fee
warpRoute.transferRemote{value: nativeFee}(
destinationDomain,
recipientAddress,
1000e18 // Recipient receives exactly 1000 tokens
);
Important: Always query fees immediately before the transfer with the consistent parameters, as fees may change based on destination, recipient, amount, gas prices, exchange rates, or warp route configuration.
Deploy your HWR
Ready to deploy your HWR? It’s easy, follow the step-by-step guide.