DeBridgeGate

Constants

BPS_DENOMINATOR

uint256 public constant BPS_DENOMINATOR = 10000;

Returns Basis Points (BPS). Set to 10000.

Variables

chainId

uint256 public chainId;

Returns current chain id.

signatureVerifier

address public signatureVerifier;

Returns current signature verifier address to verify signatures.

confirmationAggregator

address public confirmationAggregator;

Returns current aggregator address to verify by oracles confirmations.

callProxy

address public callProxy;

Returns address of the proxy to execute user's calls.

supportedChainIds

uint256[] public supportedChainIds;

Returns the supported chain at the specific index.

defiController

IDefiController public defiController;

Return DefiController that can supply liquidity to staking strategies (AAVE, Compound, etc.)

feeProxy

IFeeProxy public feeProxy;

Returns proxy to convert the collected fees and transfer to Ethereum network to treasury

weth

IWETH public weth;

Returns contract for wrapped native token.

Read-Only Functions

getDebridge

function getDebridge(bytes32 _debridgeId)
external view returns (DebridgeInfo memory);

Returns bridge-specific information.

Parameter

Type

Description

_debridgeId

bytes32

Bridge identifier

isSubmissionUsed

function isSubmissionUsed(bytes32 _submissionId)
external view returns (bool);

Returns whether the transfer with the identifier was executed.

Parameter

Type

Description

_submissionId

bytes32

Transfer identifier

getUserNonce

function getUserNonce(address _owner) external view returns (uint256);

Returns user's transactions count.

Parameter

Type

Description

_owner

address

User's address

getBalance

function getBalance(address _tokenAddress) external view returns (uint256);

Returns the contract's balance of the specific ERC20 token.

Parameter

Type

Description

_tokenAddress

address

Address of the ERC20 token

getDebridgeId

function getDebridgeId(uint256 _chainId, address _tokenAddress)
public
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(_chainId, _tokenAddress));
}

Returns asset identifier.

Parameter

Type

Description

_chainId

uint256

Original chain id

_tokenAddress

address

Address of the asset on the other chain

getSubmisionId

function getSubmisionId(
bytes32 _debridgeId,
uint256 _chainIdFrom,
uint256 _chainIdTo,
uint256 _amount,
address _receiver,
uint256 _nonce
) public pure returns (bytes32) {
return
keccak256(
abi.encodePacked(
_debridgeId,
_chainIdFrom,
_chainIdTo,
_amount,
_receiver,
_nonce
)
);
}

Returns transfer identifier.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdFrom

uint256

Chain identifier of the chain where tokens are sent from

_chainIdTo

uint256

Chain identifier of the chain where tokens are sent to

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_nonce

uint256

Count of the user's transfers to other chains

getAutoSubmisionId

function getAutoSubmisionId(
bytes32 _debridgeId,
uint256 _chainIdFrom,
uint256 _chainIdTo,
uint256 _amount,
address _receiver,
uint256 _nonce,
address _fallbackAddress,
uint256 _executionFee,
bytes memory _data)
external pure returns (bytes32);

Returns transfer identifier for transfers that should be executed by workers.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdFrom

uint256

Chain identifier of the chain where tokens are sent from

_chainIdTo

uint256

Chain identifier of the chain where tokens are sent to

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_nonce

uint256

Count of the user's transfers to other chains

_fallbackAddress

address

Receiver of the tokens if the call fails

_executionFee

uint256

Fees paid to the transaction executor

_data

bytes

Data for the call

getChainSupport

function getChainSupport(uint256 _chainId)
external pure returns (ChainSupportInfo memory);

Returns information for transfer to the chain.

Parameter

Type

Description

isSupported

bool

Is supported transfer to chain

fixedNativeFee

uint256

transfer fixed fee

transferFeeBps

uint256

transfer fee rate nominated in basis points of transferred amount

State-Changing Functions

send

function send(
bytes32 _debridgeId,
address _receiver,
uint256 _amount,
uint256 _chainIdTo
) external payable;

This method is used for the transfer of assets from the native chain. It locks an asset in the smart contract in the native chain and enables minting of deAsset on the secondary chain.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdTo

uint256

Chain identifier of the chain where tokens are sent to

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

mint

function mint(
bytes32 _debridgeId,
uint256 _chainIdFrom,
address _receiver,
uint256 _amount,
uint256 _nonce,
bytes[] calldata _signatures
) external;

Mints wrapped asset in the current (secondary) chain and transfers the asset to the receiver. Can be called by any arbitrary wallet or by the receiver itself.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdFrom

uint256

Chain identifier of the chain where tokens are sent from

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_nonce

uint256

User's transfer count

_signatures

bytes[] calldata

Array of oracles signatures

burn

function burn(
bytes32 _debridgeId,
address _receiver,
uint256 _amount,
uint256 _chainIdTo,
uint256 _deadline,
bytes memory _signature
) external;

This method is used for the transfer of deAssets from the secondary chain. It burns the wrapped asset in the secondary chain and allows to claim/mint asset in another native/secondary chain.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdTo

uint256

Chain identifier of the chain where tokens are sent to

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_deadline

uint256

Permit valid until

_signature

bytes memory

Permit signature

claim

function claim(
bytes32 _debridgeId,
uint256 _chainIdFrom,
address _receiver,
uint256 _amount,
uint256 _nonce,
bytes[] calldata _signatures
) external;

Is used for transfers into the native chain to unlock the designated amount of asset from collateral and transfer it to the receiver.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdFrom

uint256

Chain identifier of the chain where tokens are sent from

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_nonce

uint256

User's transfer count

_signatures

bytes[] calldata

Array of oracles signatures

autoSend

function autoSend(
bytes32 _debridgeId,
address _receiver,
uint256 _amount,
uint256 _chainIdTo,
address _fallbackAddress,
uint256 _executionFee,
bytes memory _data
) external;

This method is used for transfers from the native chain when in addition to the bridging of liquidity, deBridge cross-chain interoperability feature is used. User or smart contract can specify an arbitrary _data of the transaction to be executed in the target blockchain. With this type of transfer, autoMint transaction supposed to be executed by the Keeper in the target blockchain for small _executionFeereward

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdTo

uint256

Chain identifier of the chain where tokens are sent to

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_fallbackAddress

address

Receiver of the tokens if the call fails

_executionFee

uint256

Fees paid to the transaction executor

_data

bytes

Data for the call

autoMint

function autoMint(
bytes32 _debridgeId,
uint256 _chainIdFrom,
address _receiver,
uint256 _amount,
uint256 _nonce,
bytes[] calldata _signatures,
address _fallbackAddress,
uint256 _executionFee,
bytes memory _data
) external;

Mints wrapped asset on the secondary chain; is expected to be called by the Keeper who earns the execution fee for the claim and execution of the transaction _data for the user.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdFrom

uint256

Chain identifier of the chain where tokens are sent from

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_nonce

uint256

User's transfer count

_signatures

bytes[] calldata

Array of oracles signatures

_fallbackAddress

address

Receiver of the tokens if the call fails

_executionFee

uint256

Fees paid to the transaction executor

_data

bytes

Data for the call

autoBurn

function autoBurn(
bytes32 _debridgeId,
address _receiver,
uint256 _amount,
uint256 _chainIdTo,
address _fallbackAddress,
uint256 _executionFee,
bytes memory _data,
uint256 _deadline,
bytes memory _signature
) external;

Used for auto transfers of assets from the secondary chain. Burns the wrapped asset and allows to claim it on the other chain by the Keeper.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdTo

uint256

Chain identifier of the chain where tokens are sent to

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_fallbackAddress

address

Receiver of the tokens if the call fails

_executionFee

uint256

Fees paid to the transaction executor

_data

bytes

Data for the call

_deadline

uint256

Permit valid until

_signature

bytes memory

Permit signature

autoClaim

function autoClaim(
bytes32 _debridgeId,
uint256 _chainIdFrom,
address _receiver,
uint256 _amount,
uint256 _nonce,
bytes[] calldata _signatures,
address _fallbackAddress,
uint256 _executionFee,
bytes memory _data
) external;

Unlock the asset in the native chain and transfer the asset to the receiver; is expected to be called by the worker/keeper that earns execution fee.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainIdFrom

uint256

Chain identifier of the chain where tokens are sent from

_amount

uint256

Amount of the transferred asset

_receiver

address

Receiver address

_nonce

uint256

User's transfer count

_signatures

bytes[] calldata

Array of oracles signatures

_fallbackAddress

address

Receiver of the tokens if the call fails

_executionFee

uint256

Fees paid to the transaction executor

_data

bytes

Data for the call

setFeeProxy

function setFeeProxy(IFeeProxy _feeProxy) external onlyAdmin;

Set fee converter proxy.

Parameter

Type

Description

_feeProxy

IFeeProxy

Fee proxy

setWeth

function setWeth(IWETH _weth) external onlyAdmin;

‌Set wrapped native asset address.

Parameter

Type

Description

_weth

IWETH

Wrapped native token address

setChainIdSupport

function setChainSupport(
uint256 _chainId,
bool _isSupported
) external onlyAdmin;

Add/remove support for the chain where an arbitrary asset can be transferred.

Parameter

Type

Description

_chainId

uint256

Chain identifier of the chain where tokens can be sent to

_isSupported

bool

Whether the chain id is supported

setCallProxy

function setCallProxy(address _callProxy) external onlyAdmin;

Set address of the call proxy.

Parameter

Type

Description

_callProxy

address

Address of the proxy that executes external calls

updateAsset

function updateAsset(
bytes32 _debridgeId,
uint256 _maxAmount,
uint256 _minReservesBps,
uint256 _amountThreshold
) external onlyAdmin;

Update specific asset's bridge parameters.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_maxAmount

uint256

The maximum amount of current chain token to be transferred in one transaction

_minReservesBps

uint256

Minimal reserve ratio in BPS - limits the maximal amount of the asset that can be supplied into DefiController strategies

_amountThreshold

uint256

Transfer of amount greater than this param will require extra confirmations from oracles

updateAssetFixedFees

function updateAssetFixedFees(
bytes32 _debridgeId,
uint256[] memory _supportedChainIds,
uint256[] memory _fixedFee
) external onlyAdmin;

Update asset's transfer parameters in order to allow the protocol to charge a fixed fee in the transferred asset itself instead of the native blockchain asset

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_supportedChainIds

uint256[] memory

Chain ids to which the fixed fee will be overrided

_fixedFee

uint256[] memory

Fixed amount of fee to be charged by the protocol for each transfer

setAggregator

function setAggregator(address _aggregator) external onlyAdmin;

Set aggregator address

Parameter

Type

Description

_aggregator

address

Confirmation aggregator address

setSignatureVerifier

function setSignatureVerifier(address _verifier) external onlyAdmin;

Parameter

Type

Description

_verifier

address

Verifier address

setDefiController

function setDefiController(IDefiController _defiController) external onlyAdmin;

Set DeFi controller.

Parameter

Type

Description

_defiController

IDefiController

Defi controller address address

pause

function pause() external onlyAdmin;

Disable transfers

unpause

function unpause() external onlyAdmin;

Allow transfers.

withdrawFee

function withdrawFee(
bytes32 _debridgeId
) external onlyWorker;

Withdraw collected fees.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

requestReserves

function requestReserves(address _tokenAddress, uint256 _amount)
external onlyDefiController;

Request the assets to be used in DeFi protocol.

Parameter

Type

Description

_tokenAddress

bytes32

Asset address

_amount

uint256

Amount of tokens requested by DefiController

returnReserves

function returnReserves(address _tokenAddress, uint256 _amount)
external onlyDefiController;

Called to return the assets that were used in DeFi protocol.

Parameter

Type

Description

_tokenAddress

bytes32

Asset address

_amount

uint256

Amount of tokens to return from DefiController

Events

Sent

event Sent(
bytes32 submissionId,
bytes32 debridgeId,
uint256 amount,
address receiver,
uint256 nonce,
uint256 chainIdTo
);

Emits once the tokens are sent from the original chain to the other chain; the transfer tokens are expected to be claimed by the users.

AutoSent

event AutoSent(
bytes32 submissionId,
bytes32 debridgeId,
uint256 amount,
address receiver,
uint256 nonce,
uint256 chainIdTo,
uint256 claimFee,
bytes data
);

Emits once the tokens are sent from the original chain to the other chain; the transfered tokens are expected to be claimed by the worker.

Minted

event Minted(
bytes32 submissionId,
uint256 amount,
address receiver,
bytes32 debridgeId
);

Emits once the wrapped tokens are claimed and minted on the chain.

Burnt

event Burnt(
bytes32 submissionId,
bytes32 debridgeId,
uint256 amount,
address receiver,
uint256 nonce,
uint256 chainIdTo
);

Emits once the wrapped tokens are sent to the other chain; the asset is expected to be claimed by the user on the other chain.

AutoBurnt

event AutoBurnt(
bytes32 submissionId,
bytes32 debridgeId,
uint256 amount,
address receiver,
uint256 nonce,
uint256 chainIdTo,
uint256 claimFee,
bytes data
);

Emits once the wrapped tokens are sent to the other chain; the asset is expected to be claimed by the worker on the other chain.

Claimed

event Claimed(
bytes32 submissionId,
uint256 amount,
address receiver,
bytes32 debridgeId
);

Emits once the tokens are transferred and withdrawn on the original chain.

PairAdded

event PairAdded(
bytes32 indexed debridgeId,
address indexed tokenAddress,
uint256 indexed chainId,
uint256 minAmount,
uint256 minReserves
);

Emits when new asset support is added.

ChainSupportUpdated

event ChainSupportUpdated(
uint256 chainId,
bool isEnabled
);

Emits when the asset is allowed/disallowed to be transferred to the chain.

ChainsSupportUpdated

event ChainsSupportUpdated(uint256[] chainIds);

Emits when the supported chains are updated.

CallProxyUpdated

event CallProxyUpdated(address callProxy);

Emits when the new call proxy is set.

AutoRequestExecuted

event AutoRequestExecuted(bytes32 submissionId, bool success);

Emits when the transfer request is executed by the worker.

Modifiers

onlyDefiController

modifier onlyDefiController();

Throws if called by any account other than the defi controller contract.

onlyAdmin

modifier onlyAdmin();

Throws if called by any account other than the admin.