Skip to main content

across

Across Bridge

OperationsExternal Call OperationsBridge Operations → Across Bridge (Call Forwarder)

Across is a cross-chain bridge protocol optimized for fast and efficient asset transfers.

Parameters

OffsetLength (bytes)Description
020spokePool
2020depositor
4020inputTokenAddress
6032receivingAssetId
9216amount
10816FixedFee
1244FeePercentage
1284destinationChainId
13232receiver
1642message.length: msgLen
166msgLenmessage

Parameter Details

  • spokePool: Across spoke pool contract address (20 bytes)
  • depositor: Address making the deposit (20 bytes)
  • inputTokenAddress: Address of the input token (20 bytes)
  • receivingAssetId: Asset ID on destination chain (32 bytes)
  • amount: Amount to bridge (16 bytes). High bit flag indicates using contract balance if amount = 0
  • FixedFee: Fixed fee for the bridge (16 bytes)
  • FeePercentage: Fee percentage in basis points (4 bytes)
  • destinationChainId: Destination chain ID (4 bytes)
  • receiver: Receiver address on destination chain (32 bytes)
  • message: Optional message to include with the bridge (variable length)

Encoding Example

bytes memory acrossBridge = abi.encodePacked(
uint8(ComposerCommands.BRIDGING),
uint8(BridgeIds.ACROSS),
address(spokePool), // Across spoke pool
address(depositor), // depositor address
address(inputToken), // input token address
bytes32(receivingAssetId), // destination asset ID
uint128(amount), // amount to bridge
uint128(fixedFee), // fixed fee
uint32(feePercentage), // fee percentage
uint32(destinationChainId), // destination chain
bytes32(abi.encodePacked(receiver)), // receiver address
uint16(message.length), // message length
message // message bytes
);

Complete Usage Example

Important: Across bridge operations must be executed through the Call Forwarder. Here's the complete calling structure:

// 1. Create Across bridge operation for Call Forwarder
bytes memory acrossOp = abi.encodePacked(
uint8(ComposerCommands.BRIDGING),
uint8(BridgeIds.ACROSS),
address(acrossSpokePool), // Across spoke pool contract
address(msg.sender), // depositor address
address(USDC), // input token (USDC)
bytes32(destinationAssetId), // destination asset ID
uint128(amountToBridge), // amount to bridge
uint128(fixedBridgeFee), // fixed fee for bridging
uint32(fee), // fee percentage
uint32(destinationChainId), // destination chain ID
bytes32(abi.encodePacked(receiver)), // receiver address
uint16(message.length), // message length
message // optional message bytes
);

// 2. Wrap in EXT_CALL to Call Forwarder
bytes memory callForwarderOp = abi.encodePacked(
uint8(ComposerCommands.EXT_CALL),
address(callForwarder), // Call Forwarder address
uint128(0), // No native fee needed for Across
uint16(acrossOp.length), // Bridge operation length
acrossOp // Bridge operation data
);

// 3. Execute on main composer
composer.deltaCompose(callForwarderOp);