EVM smart contract interfaces

Interaction with the deBridge infrastructure is as simple as calling the send method of debridgeGate smart-contract deployed on all supported blockchains. The method can be called by any arbitrary address — either EOA or smart contracts.

function send(
    address _tokenAddress,
    uint256 _amount,
    uint256 _chainIdTo,
    bytes memory _receiver,
    bytes memory _permit,
    bool _useAssetFee,
    uint32 _referralCode,
    bytes calldata _autoParams
) external payable;

The method accepts the following parameters:

Parameter NameTypeDescription



Address of the token being sent (address(0) for chain base assets like ETH)



Token amount to be transferred



Id of the receiving chain



Address of the receiver



In case the token being passed supports EIP-2612, signed permits can be used instead of allowance approvals



Should also be set to False. (Reserved for future use by governance to accept fees in the form of the transferred token)



Your generated referral code



Structure that enables passing arbitrary messages and call data

If you integrate with or build applications on top of the deBridge infrastructure, make sure you specify your referral code that can be generated by pressing the INVITE FRIENDS button at https://app.debridge.finance/. Governance may thank you later for being an early builder.

AutoParams structure

_autoParams is a structure that allows passing arbitrary messages and call data to be executed as an external call to the receiver address on the destination chain. This structure also enables setting an executionFee, a reward suggested to any wallet or keeper that will complete the transaction on the target (destination) chain. It enables a crypto-economic design where gas fees are paid from the blockchain where the transaction is initiated. The _autoParams field has the following structure:

struct SubmissionAutoParamsTo {
    uint256 executionFee;
    uint256 flags;
    bytes fallbackAddress;
    bytes data;
Parameter NameTypeDescription



Suggested reward (in Tokens) paid to anyone who will execute transaction on the destination chain



Flags set specific flows for call data execution



In case execution of call data fails, all tokens will be transferred to the fallback address



Message/Call data to be passed to the receiver on the destination chain during the external call execution


Flags are a bit mask that allows customizing the transaction execution flow on the destination chain. The bit mask means you can set several flags simultaneously by setting the corresponding bit of flags variable to 1

library Flags {
    /// @dev Flag to unwrap ETH
    uint256 public constant UNWRAP_ETH = 0;
    /// @dev Flag to revert if external call fails
    uint256 public constant REVERT_IF_EXTERNAL_FAIL = 1;
    /// @dev Flag to call proxy with a sender contract
    uint256 public constant PROXY_WITH_SENDER = 2;
    /// @dev Data is hash in DeBridgeGate send method
    uint256 public constant SEND_HASHED_DATA = 3;
    /// @dev First 24 bytes from data is gas limit for external call
    uint256 public constant SEND_EXTERNAL_CALL_GAS_LIMIT = 4;
    /// @dev Support tx bundling (multi-send) for externall call
    uint256 public constant MULTI_SEND = 5;
Flag NameValueDescription



Automatically unwrap blockchain base asset



Revert transaction if external call was not completed



Set in case receiving smart contract should validate sending chain id and address



Pass hash of the call data instead of data itself. Only those who know the original call data will be able to claim the transaction on the target chain. If this flag is set, transaction won't be automatically claimed by external keepers.



Specify minimal gas limit to be passed to external call during the transaction claim. Gas limit should be passed in the first 4 bytes of the data



With this flag passed call data will be executed through Gnosis multisend implementation embedded into deBridge callProxy. (Receiver address is not used in this case). Use https://github.com/gnosis/ethers-multisend to properly configure data for multisend

PROXY_WITH_SENDER should be set whenever the receiving smart contract should check whether the message sender is trusted or not. If the flag was set during the claim transaction on the destination chain, the deBridge protocol will automatically store the submissionNativeSender address and submissionChainIdFrom, so that the receiving smart contract can read the properties and validate if the sender is trusted.

The receiving smart contract should retrieve the address of callProxy from the debridgeGate smart contract. You can use onlyControllingAddress modifier or inherit it from BridgeAppBase.sol to properly implement this validation logic.

Last updated