Bridge Validators
Introduction
BridgeValidator
is an abstract contract with transaction verification logic that specific validator contracts must inherit to move liquidity on Superform. It ensures that submitted transaction data has the intended bridging outcome and was not corrupted in generation or in the process of transmitting through the Superform API. Superform's ProtocolAdmin
may add more bridge validators to allow for more sources of liquidity.
Core Concepts
There are two core validation mechanisms all bridge validators must implement:
validateReceiver
: Where TxData is validated to the intended receivervalidateTxData
: Where TxData is validated to against the amount of input token, destination chain, and receiver
Along with three core decoding mechanisms:
decodeAmountIn
: WhereTxData
is decoded to return the amount of the input token for both direct and cross chain actionsdecodeDstSwap
: Where same-chain swapTxData
is decoded to return the input token and amountdecodeSwapOutputToken:
Where same-chain swapTxData
is decoded to return the output token
validateReceiver
This function validates the receiver's address based on the provided transaction data and intended receiver.
validateTxData
This function performs multiple checks on the transaction data provided to ensure proper behavior. These checks are implemented on a case-by-case basis depending on the bridge infrastructure being integrated.
decodeAmountIn
This function returns the decoded minAmount
expected to be received post bridging/swapping actions. This is used in multiple places in core contracts, notably in Router implementations.
decodeDstSwap
This function returns the necessary information for processing swaps on the destination chain, the amount of the expected output token and address. This is used in DstSwapper.
decodeSwapOutputToken
This function returns the neccessary information for figuring out the final token address to be received after a swap. This is used in direct action validation in ERC4626Form.
Last updated