IBridgeValidator

Git Source

Author: Zeropoint Labs

Functions

validateLiqDstChainId

validates the destination chainId of the liquidity request

function validateLiqDstChainId(bytes calldata txData_, uint64 liqDstChainId_) external pure 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 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;

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
    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 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 returns (address token_, uint256 amount_);

Parameters

NameTypeDescription
txData_bytesis the txData to be decoded

Structs

ValidateTxDataArgs

struct ValidateTxDataArgs {
    bytes txData;
    uint64 srcChainId;
    uint64 dstChainId;
    uint64 liqDstChainId;
    bool deposit;
    address superform;
    address srcSender;
    address liqDataToken;
}