DeBridgeGate

WhiteDebridge for chains with high fees

Read-Only Functions

BPS_DENOMINATOR

function BPS_DENOMINATOR() external view returns (uint256);

Returns Basis Points (BPS). Set to 10000.

chainId

function chainId() external view returns (uint256);

Returns current chain id.

aggregator

function aggregator() external view returns (address);

Returns current chainlink aggregator address.

callProxy

function callProxy() external view returns (address);

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

aggregatorVersion

function aggregatorVersion() external view returns (uint8);

Returns aggregators count.

chainIds

function chainIds(uint256 _count) external view returns (uint256);

Returns the supported chain at the specific index.

Parameter

Type

Description

_count

uint256

Index in the array

defiController

function defiController() external view returns (IDefiController);

Returns proxy to use the locked assets in Defi protocols.

feeProxy

function feeProxy() external view returns (IFeeProxy);

Returns proxy to convert the collected fees into LINK token.

weth

function weth() external view returns (IWETH);

Returns contract for wrapped native token.

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

getOldAggregator

function getOldAggregator(uint8 _aggregatorVersion) external view returns (AggregatorInfo memory);

Returns old aggregator information.

Parameter

Type

Description

_aggregatorVersion

uint8

Aggregator's version

splitSignature

function splitSignature(bytes memory _signature) external pure returns (bytes32 r, bytes32 s, uint8 v);

Returns signature bytes as separate r, s, v components.

Parameter

Type

Description

_signature

bytes

Signature bytes in format r+s+v

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) external pure returns (bytes32);

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) external pure returns (bytes32);

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

getChainIdSupport

function getChainIdSupport(bytes32 _debridgeId, uint256 _chainId) external pure returns (ChainSupportInfo memory);

Returns whether transfer to the chain is supported.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainId

uint256

Chain identifier

State-Changing Functions

send

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

Locks asset on 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

burn

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

Burns the wrapped asset and allows to claim it on the other 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

autoSend

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

Locks asset on the chain and enables minting on the other chain; is expected to be executed by the worker.

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

autoBurn

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

Burns the wrapped asset and allows to claim it on the other chain by the worker.

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

mint

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

Mints wrapped asset on the current chain; is expected to be ca by the user who receives the transferred amount.

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

mintWithOldAggregator

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

Mints wrapped asset on the current chain using confirmations from old aggregator; is expected to be called by the user who receives the transferred amount.

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

_aggregatorVersion

uint8

Aggregator version

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 current chain; is expected to be called by the worked who earns the 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

autoMintWithOldAggregator

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

Mints wrapped asset on the current chain using the confirmations from old aggregator; is expected to be called by the worked who earns the 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

_aggregatorVersion

uint8

Aggregator version

claim

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

Unlock the asset on the current chain and transfer 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

claimWithOldAggregator

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

Unlock the asset on the current chain and transfer to the receiver using the confirmations from the old aggregator.

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

_aggregatorVersion

uint8

Aggregator version

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 on the current chain and transfer to the receiver; is expected to be called by the worker 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

autoClaimWithOldAggregator

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

Unlock the asset on the current chain and transfer to the receiver using the confirmations from the old aggregator; is expected to be called by the worker that earns the 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

_aggregatorVersion

uint8

Aggregator version

fundTreasury

function fundTreasury(bytes32 _debridgeId, uint256 _amount) external;

Fund treasury.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_amount

uint256

Amount of the transferred asset

setFeeProxy

function setFeeProxy(IFeeProxy _feeProxy) external;

Set fee converter proxy.

Parameter

Type

Description

_feeProxy

IFeeProxy

Fee proxy

setWeth

function setWeth(IWETH _weth) external;

Set wrapped native asset address.

Parameter

Type

Description

_weth

IWETH

Wrapped native token address

addNativeAsset

function addNativeAsset(
address _tokenAddress,
uint256 _minAmount,
uint256 _maxAmount,
uint256 _minReserves,
uint256[] memory _supportedChainIds,
ChainSupportInfo[] memory _chainSupportInfo
) external;

Add support for the asset on the current chain.

Parameter

Type

Description

_tokenAddress

address

Address of the asset on the current chain

_minAmount

uint256

Minimal amount of current chain token to be wrapped

_maxAmount

uint256

Maximum amount of current chain token to be wrapped.

_minReserves

uint256

Minimal reserve ration

_supportedChainIds

uint256[] memory

Chain ids where the original token of the current chain can be wrapped

_chainSupportInfo

ChainSupportInfo[] memory

The info of the chains where asset can be sent.

addExternalAsset

function addExternalAsset(
address _tokenAddress,
address _wrappedAssetAddress,
uint256 _chainId,
uint256 _minAmount,
uint256 _maxAmount,
uint256 _minReserves,
uint256[] memory _supportedChainIds,
ChainSupportInfo[] memory _chainSupportInfo
) external;

Add support for the asset from the other chain.

Parameter

Type

Description

_tokenAddress

address

Address of the asset on the current chain

_wrappedAssetAddress

address

Wrapped asset address

_chainId

uint256

Current chain id

_minAmount

uint256

Minimal amount of current chain token to be wrapped

_maxAmount

uint256

Maximum amount of current chain token to be wrapped.

_minReserves

uint256

Minimal reserve ration

_supportedChainIds

uint256[] memory

Chain ids where the original token of the current chain can be wrapped

_chainSupportInfo

ChainSupportInfo[] memory

The info of the chains where asset can be sent.

setChainIdSupport

function setChainIdSupport(
bytes32 _debridgeId,
uint256 _chainId,
bool _isSupported
) external;

Set support for the chains where the token can be transferred.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_chainId

uint256

Chain identifier of the chain where tokens can be sent to

_isSupported

bool

Whether the chain id is supported

setChainIds

function setChainIds(uint256[] memory _chainIds) external;

Set the list of all supported chain identifiers.

Parameter

Type

Description

_chainIds

uint256[] memory

Supported chains

setCallProxy

function setCallProxy(address _callProxy) external;

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 _minAmount,
uint256 _maxAmount,
uint256 _minReserves
) external;

Update specific asset's bridge parameters.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_minAmount

uint256

Minimal amount of current chain token to be wrapped

_maxAmount

uint256

Maximum amount of current chain token to be wrapped.

_minReserves

uint256

Minimal reserve ration

updateAsset

function updateAsset(
bytes32 _debridgeId,
uint256[] memory _supportedChainIds,
ChainSupportInfo[] memory _chainSupportInfo
) external;

Update asset's transfer parameters.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_supportedChainIds

uint256[] memory

Chain ids where the original token of the current chain can be wrapped

_chainSupportInfo

ChainSupportInfo[] memory

The info of the chains where asset can be sent.

setAggregator

function setAggregator(address _aggregator) external;

Set aggregator address.

Parameter

Type

Description

_aggregator

address

Aggregator address

function manageOldAggregator(uint8 _aggregatorVersion, bool _isValid) external;

Enable/disable confirmations from old aggregator.

Parameter

Type

Description

_aggregatorVersion

uint8

Aggregator's version

_isValid

bool

Is valid

setDefiController

function setDefiController(IDefiController _defiController) external;

Set DeFi controller.

Parameter

Type

Description

_defiController

IDefiController

Defi controller address address

pause

function pause() external;

Disable transfers

unpause

function unpause() external;

Allow transfers.

withdrawFee

function withdrawFee(
bytes32 _debridgeId,
address _receiver,
uint256 _amount
) external;

Withdraw collected fees.

Parameter

Type

Description

_debridgeId

bytes32

Asset identifier

_receiver

address

Receiver address

_amount

uint256

Amount of tokens to withdraw

requestReserves

function requestReserves(address _tokenAddress, uint256 _amount) external;

Request the assets to be used in DeFi protocol.

Parameter

Type

Description

_tokenAddress

bytes32

Asset address

_amount

uint256

Amount of tokens to request

returnReserves

function returnReserves(address _tokenAddress, uint256 _amount) external;

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

Parameter

Type

Description

_tokenAddress

bytes32

Asset address

_amount

uint256

Amount of tokens to request

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.

ChainSupportAdded

event ChainSupportAdded(
bytes32 indexed debridgeId,
uint256 indexed chainId
);

Emits when the asset is allowed to be transferred to the new chain.

ChainSupportRemoved

event ChainSupportRemoved(
bytes32 indexed debridgeId,
uint256 indexed chainId
);

Emits when the asset is disallowed to be spent on 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

onlyAggregator

modifier onlyAggregator();

Throws if called by any account other than the aggregator.

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.