BridgeValidator

Git Source

Inherits: IBridgeValidator

Author: Zeropoint Labs

To be inherited by specific bridge handlers to verify the calldata being sent

State Variables

superRegistry

ISuperRegistry public immutable superRegistry;

NATIVE

address constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

Functions

constructor

constructor(address superRegistry_);

validateLiqDstChainId

validates the destination chainId of the liquidity request

function validateLiqDstChainId(
    bytes calldata txData_,
    uint64 liqDstChainId_
)
    external
    pure
    virtual
    override
    returns (bool);

Parameters

NameTypeDescription
txData_bytesthe txData of the deposit
liqDstChainId_uint64the chainId of the destination chain for liquidity

validateReceiver

decoded txData and returns the receiver address

function validateReceiver(
    bytes calldata txData_,
    address receiver_
)
    external
    pure
    virtual
    override
    returns (bool valid_);

Parameters

NameTypeDescription
txData_bytesis the txData of the cross chain deposit
receiver_addressis the address of the receiver to validate

Returns

NameTypeDescription
valid_boolif the address is valid

validateTxData

validates the txData of a cross chain deposit

function validateTxData(ValidateTxDataArgs calldata args_) external view virtual override;

Parameters

NameTypeDescription
args_ValidateTxDataArgsthe txData arguments to validate in txData

decodeMinAmountOut

decodes the txData and returns the minimum amount expected to receive on the destination

function decodeMinAmountOut(
    bytes calldata txData_,
    bool genericSwapDisallowed_
)
    external
    view
    virtual
    override
    returns (uint256 amount_);

Parameters

NameTypeDescription
txData_bytesis the txData of the cross chain deposit
genericSwapDisallowed_booltrue if generic swaps are disallowed

Returns

NameTypeDescription
amount_uint256the amount expected

decodeAmountIn

decodes the txData and returns the amount of external token on source

function decodeAmountIn(
    bytes calldata txData_,
    bool genericSwapDisallowed_
)
    external
    view
    virtual
    override
    returns (uint256 amount_);

Parameters

NameTypeDescription
txData_bytesis the txData of the cross chain deposit
genericSwapDisallowed_booltrue if generic swaps are disallowed

Returns

NameTypeDescription
amount_uint256the amount expected

decodeDstSwap

decodes the amount in from the txData that just involves a swap

function decodeDstSwap(bytes calldata txData_)
    external
    pure
    virtual
    override
    returns (address token_, uint256 amount_);

Parameters

NameTypeDescription
txData_bytesis the txData to be decoded