For the complete documentation index, see llms.txt. This page is also available as Markdown.

CrosschainLib

CrosschainLib

Provides utilities for validating bridgeable token pairs, handling BSC decimal conversions, and resolving Across handler addresses.

Used by cross-chain adapters to ensure token compatibility and proper decimal handling.

UnsupportedCrossChainToken

error UnsupportedCrossChainToken()

WrongDestinationToken

error WrongDestinationToken()

DEFAULT_MULTICALL_HANDLER

address DEFAULT_MULTICALL_HANDLER

Across MulticallHandler addresses

BSC_MULTICALL_HANDLER

address BSC_MULTICALL_HANDLER

isAllowedCrosschainToken

function isAllowedCrosschainToken(address token) internal view returns (bool)

Check if a token is allowed for cross-chain operations on the current chain.

Parameters

Name
Type
Description

token

address

The token address to check.

Return Values

Name
Type
Description

[0]

bool

True if the token is allowed for cross-chain operations.

applyBscDecimalConversion

Applies BSC decimal conversion for USDC/USDT (18 decimals on BSC vs 6 on other chains).

Handles bidirectional conversion to ensure exact cross-chain value calculation.

Parameters

Name
Type
Description

inputToken

address

Source token address.

outputToken

address

Destination token address.

amount

uint256

Original amount in source chain decimals.

Return Values

Name
Type
Description

[0]

uint256

Normalized amount for correct cross-chain virtual supply calculation.

getAcrossHandler

Get the appropriate Across MulticallHandler address for a given chain.

BSC (chain ID 56) uses a different handler than other chains.

Parameters

Name
Type
Description

chainId

uint256

The destination chain ID.

Return Values

Name
Type
Description

handler

address

The MulticallHandler address for the specified chain.

validateBridgeableTokenPair

Validates that input and output tokens are compatible for cross-chain bridging.

Only allows bridging between tokens of the same type (USDC↔USDC, USDT↔USDT, etc.).

Parameters

Name
Type
Description

inputToken

address

Source token address.

outputToken

address

Destination token address.

Last updated