EVM smart contract interfaces
Last updated
Last updated
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.
The method accepts the following parameters:
Parameter Name | Type | Description |
---|---|---|
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
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:
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
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.
Parameter Name | Type | Description |
---|---|---|
Flag Name | Value | Description |
---|---|---|
_tokenAddress
address
Address of the token being sent (address(0)
for chain base assets like ETH)
_amount
uint256
Token amount to be transferred
_chainIdTo
uint256
Id of the receiving chain
_receiver
bytes
Address of the receiver
_permit
bytes
In case the token being passed supports EIP-2612, signed permits can be used instead of allowance approvals
_useAssetFee
bool
Should also be set to False
. (Reserved for future use by governance to accept fees in the form of the transferred token)
_referralCode
uint32
Your generated referral code
_autoParams
bytes
Structure that enables passing arbitrary messages and call data
executionFee
uint256
Suggested reward (in Tokens) paid to anyone who will execute transaction on the destination chain
flags
uint256
Flags set specific flows for call data execution
fallbackAddress
bytes
In case execution of call data fails, all tokens will be transferred to the fallback address
data
bytes
Message/Call data to be passed to the receiver on the destination chain during the external call execution
UNWRAP_ETH
0
Automatically unwrap blockchain base asset
REVERT_IF_EXTERNAL_FAIL
1
Revert transaction if external call was not completed
PROXY_WITH_SENDER
2
Set in case receiving smart contract should validate sending chain id and address
SEND_HASHED_DATA
3
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.
SEND_EXTERNAL_CALL_GAS_LIMIT
4
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
MULTI_SEND
5
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