DeBridgeGate
Contract for assets transfers. The user can transfer the asset to any of the approved chains. The admin manages the assets, fees and other important protocol parameters.
Variables
BPS_DENOMINATOR
Basis points or bps, set to 10 000 (equal to 1/10000). Used to express relative values (fees)
GOVMONITORING_ROLE
Role allowed to stop transfers
SUBMISSION_PREFIX
prefix to calculation submissionId
DEPLOY_PREFIX
prefix to calculation deployId
deBridgeTokenDeployer
Address of IDeBridgeTokenDeployer contract
signatureVerifier
Current signature verifier address to verify signatures.
excessConfirmations
Minimal required confirmations in case sent amount is big, have no effect if less than SignatureVerifier.minConfirmations
flashFeeBps
Flash loan fee in basis points (1/10000)
nonce
outgoing submissions count
getDebridge
Maps debridgeId (see getDebridgeId) => bridge-specific information.
getDebridgeFeeInfo
Maps debridgeId (see getDebridgeId) => fee information
isSubmissionUsed
Returns whether the transfer with the submissionId was claimed. submissionId is generated in getSubmissionIdFrom
isBlockedSubmission
Returns whether the transfer with the submissionId is blocked.
getAmountThreshold
Maps debridgeId (see getDebridgeId) to threshold amount after which Math.max(excessConfirmations,SignatureVerifier.minConfirmations) is used instead of SignatureVerifier.minConfirmations
getChainToConfig
Whether the chain for the asset is supported to send
getChainFromConfig
Whether the chain for the asset is supported to claim
feeDiscount
Fee discount for address
getNativeInfo
Returns native token info by wrapped token address
defiController
Return DefiController that can supply liquidity to staking strategies (AAVE, Compound, etc.)
feeProxy
Returns proxy to convert the collected fees and transfer to Ethereum network to treasury
callProxy
Returns address of the proxy to execute user's calls.
weth
Returns contract for wrapped native token.
feeContractUpdater
Contract address that can override globalFixedNativeFee
globalFixedNativeFee
Fallback fixed fee in native asset, used if a chain fixed fee is set to 0
globalTransferFeeBps
Fallback transfer fee in BPS, used if a chain transfer fee is set to 0
wethGate
WethGate contract, that is used for weth withdraws affected by EIP1884
lockedClaim
Locker for claim method
Functions
initialize
Constructor that initializes the most important configurations.
Parameters:
Name | Type | Description |
---|---|---|
| uint8 | minimal required confirmations in case of too many confirmations |
| contract IWETH | wrapped native token contract |
send
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.
Parameters:
Name | Type | Description |
---|---|---|
| address | Asset identifier. |
| uint256 | Amount to be transferred (note: the fee can be applied). |
| uint256 | Chain id of the target chain. |
| bytes | Receiver address. |
| bytes | deadline + signature for approving the spender by signature. |
| bool | use assets fee for pay protocol fix (work only for specials token) |
| uint32 | Referral code |
| bytes | Auto params for external call in target network |
claim
Is used for transfers into the native chain to unlock the designated amount of asset from collateral and transfer it to the receiver.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| uint256 | Amount of the transferred asset (note: the fee can be applied). |
| uint256 | Chain where submission was sent |
| address | Receiver address. |
| uint256 | Submission id. |
| bytes | Validators signatures to confirm |
| bytes | Auto params for external call |
flash
Get a flash loan, msg.sender must implement IFlashCallback
Parameters:
Name | Type | Description |
---|---|---|
| address | An asset to loan |
| address | Where funds should be sent |
| uint256 | Amount to loan |
| bytes | Data to pass to sender's flashCallback function |
deployNewAsset
Deploy a deToken(DeBridgeTokenProxy) for an asset
Parameters:
Name | Type | Description |
---|---|---|
| bytes | A token address on a native chain |
| uint256 | The token native chain's id |
| string | The token's name |
| string | The token's symbol |
| uint8 | The token's decimals |
| bytes | Validators' signatures |
autoUpdateFixedNativeFee
Update native fix fee. Called by our fee update contract
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | new value |
updateChainSupport
Update asset's fees.
Parameters:
Name | Type | Description |
---|---|---|
| uint256[] | Chain identifiers. |
| struct IDeBridgeGate.ChainSupportInfo[] | Chain support info. |
| bool | is true for editing getChainFromConfig. |
updateGlobalFee
Update fallbacks for fixed fee in native asset and transfer fee
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | Fallback fixed fee in native asset, used if a chain fixed fee is set to 0 |
| uint16 | Fallback transfer fee in BPS, used if a chain transfer fee is set to 0 |
updateAssetFixedFees
Update asset's fees.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| uint256[] | Chain identifiers. |
| uint256[] | Chain support info. |
updateExcessConfirmations
Update minimal amount of required signatures, must be > SignatureVerifier.minConfirmations to have an effect
Parameters:
Name | Type | Description |
---|---|---|
| uint8 | Minimal amount of required signatures |
setChainSupport
Set support for the chains where the token can be transferred.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | Chain id where tokens are sent. |
| bool | Whether the token is transferable to the other chain. |
| bool | is true for editing getChainFromConfig. |
setCallProxy
Set address of the call proxy.
Parameters:
Name | Type | Description |
---|---|---|
| address | Address of the proxy that executes external calls. |
updateAsset
Update specific asset's bridge parameters.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| uint256 | Maximum amount of current chain token to be wrapped. |
| uint16 | Minimal reserve ration in BPS. |
| uint256 | Threshold amount after which Math.max(excessConfirmations,SignatureVerifier.minConfirmations) is used instead of SignatureVerifier.minConfirmations |
setSignatureVerifier
Set signature verifier address.
Parameters:
Name | Type | Description |
---|---|---|
| address | Signature verifier address. |
setDeBridgeTokenDeployer
Set asset deployer address.
Parameters:
Name | Type | Description |
---|---|---|
| address | Asset deployer address. |
setDefiController
Set defi controller.
Parameters:
Name | Type | Description |
---|---|---|
| address | Defi controller address. |
setFeeContractUpdater
Set fee contract updater, that can update fix native fee
Parameters:
Name | Type | Description |
---|---|---|
| address | new contract address. |
setWethGate
Set wethGate contract, that uses for weth withdraws affected by EIP1884
Parameters:
Name | Type | Description |
---|---|---|
| contract IWethGate | address of new wethGate contract. |
pause
Stop all transfers.
unpause
Allow transfers.
withdrawFee
Withdraw collected fees to feeProxy
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
requestReserves
Request the assets to be used in DeFi protocol.
Parameters:
Name | Type | Description |
---|---|---|
| address | Asset address. |
| uint256 | Amount of tokens to request. |
returnReserves
Return the assets that were used in DeFi protocol.
Parameters:
Name | Type | Description |
---|---|---|
| address | Asset address. |
| uint256 | Amount of tokens to claim. |
setFeeProxy
Set fee converter proxy.
Parameters:
Name | Type | Description |
---|---|---|
| address | Fee proxy address. |
blockSubmission
Block or unblock a list of submissions
Parameters:
Name | Type | Description |
---|---|---|
| bytes32[] | Ids of submissions to block/unblock |
| bool | True to block, false to unblock |
updateFlashFee
Update flash fees.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | new fee in BPS |
updateFeeDiscount
Update discount.
Parameters:
Name | Type | Description |
---|---|---|
| address | customer address |
| uint16 | fix discount in BPS |
| uint16 | transfer % discount in BPS |
receive
_checkConfirmations
_addAsset
Add support for the asset.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| address | Address of the asset on the current chain. |
| bytes | Address of the asset on the native chain. |
| uint256 | Native chain id. |
_send
Locks asset on the chain and enables minting on the other chain.
Parameters:
Name | Type | Description |
---|---|---|
| bytes | Amount to be transferred (note: the fee can be applied). |
| address | Chain id of the target chain. |
| uint256 | deadline + signature for approving the spender by signature. |
_publishSubmission
_applyDiscount
_validateToken
_claim
Unlock the asset on the current chain and transfer to receiver.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| bytes32 | Receiver address. |
| address | Amount of the transfered asset (note: the fee can be applyed). |
_mintOrTransfer
_safeTransferETH
_withdrawWeth
_normalizeTokenAmount
getDefiAvaliableReserves
Get reserves of a token available to use in defi
Parameters:
Name | Type | Description |
---|---|---|
| address | Token address |
getDebridgeId
Calculates asset identifier.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | Current chain id. |
| address | Address of the asset on the other chain. |
getbDebridgeId
Calculates asset identifier.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | Current chain id. |
| bytes | Address of the asset on the other chain. |
getDebridgeChainAssetFixedFee
Returns asset fixed fee value for specified debridge and chainId.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| uint256 | Chain id. |
getSubmissionIdFrom
Calculate submission id for auto claimable transfer.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Asset identifier. |
| uint256 | Chain identifier of the chain where tokens are sent from. |
| uint256 | Amount of the transferred asset (note: the fee can be applied). |
| address | Receiver address. |
| uint256 | Submission id. |
| struct IDeBridgeGate.SubmissionAutoParamsFrom | Auto params for external call |
| bool | True if auto params are provided |
| address | Address that will call claim |
getDeployId
Calculates asset identifier for deployment.
Parameters:
Name | Type | Description |
---|---|---|
| bytes32 | Id of an asset, see getDebridgeId. |
| string | Asset's name. |
| string | Asset's symbol. |
| uint8 | Asset's decimals. |
getChainId
Get current chain id
version
Get this contract's version
Last updated