Skip to main content
Version: pre-release (v0.78)

ERC20 Bridge Logic Interface (IERC20_Bridge_Logic.sol)

View Source: contracts/IERC20_Bridge_Logic.sol

↘ Derived Contracts: ERC20_Bridge_Logic

IERC20_Bridge_Logic_Restricted

Implementations of this interface are used to deposit and withdraw ERC20 tokens.

Asset_Withdrawn

Parameters

NameTypeDescription
user_addressaddress
asset_sourceaddress
amountuint256
nonceuint256

Asset_Deposited

Parameters

NameTypeDescription
user_addressaddress
asset_sourceaddress
amountuint256
vega_public_keybytes32

Asset_Listed

Parameters

NameTypeDescription
asset_sourceaddress
vega_asset_idbytes32
nonceuint256

Asset_Removed

Parameters

NameTypeDescription
asset_sourceaddress
nonceuint256

Asset_Limits_Updated

Parameters

NameTypeDescription
asset_sourceaddress
lifetime_limituint256
withdraw_thresholduint256

Bridge_Withdraw_Delay_Set

Parameters

NameTypeDescription
withdraw_delayuint256

Bridge_Stopped

Parameters

NameTypeDescription

Bridge_Resumed

Parameters

NameTypeDescription

Depositor_Exempted

Parameters

NameTypeDescription
depositoraddress

Depositor_Exemption_Revoked

Parameters

NameTypeDescription
depositoraddress

Functions

list_asset

This function lists the given ERC20 token contract as valid for deposit to this bridgeMUST emit Asset_Listed if successful

function list_asset(address asset_source, bytes32 vega_asset_id, uint256 lifetime_limit, uint256 withdraw_threshold, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token
vega_asset_idbytes32Vega-generated asset ID for internal use in Vega Core
lifetime_limituint256Initial lifetime deposit limit RESTRICTION FEATURE
withdraw_thresholduint256Amount at which the withdraw delay goes into effect RESTRICTION FEATURE
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

remove_asset

This function removes from listing the given ERC20 token contract. This marks the token as invalid for deposit to this bridgeMUST emit Asset_Removed if successful

function remove_asset(address asset_source, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

set_asset_limits

This function sets the lifetime maximum deposit for a given assetasset must first be listed

function set_asset_limits(address asset_source, uint256 lifetime_limit, uint256 threshold, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token
lifetime_limituint256Deposit limit for a given ethereum address
thresholduint256
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

set_withdraw_delay

This function sets the withdraw delay for withdrawals over the per-asset set thresholds

function set_withdraw_delay(uint256 delay, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
delayuint256Amount of time to delay a withdrawal
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

global_stop

This function triggers the global bridge stop that halts all withdrawals and deposits until it is resumedbridge must not be stopped already

function global_stop(uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

global_resume

This function resumes bridge operations from the stopped statebridge must be stopped

function global_resume(uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

exempt_depositor

this function allows the exemption_lister to exempt a depositor from the deposit limitsMUST emit Depositor_Exempted if successful

function exempt_depositor() public nonpayable

Arguments

NameTypeDescription

revoke_exempt_depositor

this function allows the exemption_lister to revoke a depositor's exemption from deposit limitsMUST emit Depositor_Exemption_Revoked if successful

function revoke_exempt_depositor() public nonpayable

Arguments

NameTypeDescription

withdraw_asset

This function withdrawals assets to the target Ethereum addressMUST emit Asset_Withdrawn if successful

function withdraw_asset(address asset_source, uint256 amount, address target, uint256 creation, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token
amountuint256Amount of ERC20 tokens to withdraw
targetaddressTarget Ethereum address to receive withdrawn ERC20 tokens
creationuint256Timestamp of when requestion was created RESTRICTION FEATURE
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

is_exempt_depositor

this view returns true if the given despoitor address has been exempted from deposit limits

function is_exempt_depositor(address depositor) public view
returns(bool)

Returns

true if depositor is exempt

Arguments

NameTypeDescription
depositoraddressThe depositor to check

deposit_asset

This function allows a user to deposit given ERC20 tokens into VegaMUST emit Asset_Deposited if successful

function deposit_asset(address asset_source, uint256 amount, bytes32 vega_public_key) public nonpayable

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token
amountuint256Amount of tokens to be deposited into Vega
vega_public_keybytes32Target Vega public key to be credited with this deposit

is_asset_listed

This view returns true if the given ERC20 token contract has been listed valid for deposit

function is_asset_listed(address asset_source) public view
returns(bool)

Returns

True if asset is listed

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token

get_asset_deposit_lifetime_limit

This view returns the lifetime deposit limit for the given asset

function get_asset_deposit_lifetime_limit(address asset_source) public view
returns(uint256)

Returns

Lifetime limit for the given asset

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token

get_withdraw_threshold

This view returns the given token's withdraw threshold above which the withdraw delay goes into effect

function get_withdraw_threshold(address asset_source) public view
returns(uint256)

Returns

Withdraw threshold

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token

get_multisig_control_address

function get_multisig_control_address() public view
returns(address)

Returns

current multisig_control_address

Arguments

NameTypeDescription

get_vega_asset_id

function get_vega_asset_id(address asset_source) public view
returns(bytes32)

Returns

The assigned Vega Asset ID for given ERC20 token

Arguments

NameTypeDescription
asset_sourceaddressContract address for given ERC20 token

get_asset_source

function get_asset_source(bytes32 vega_asset_id) public view
returns(address)

Returns

The ERC20 token contract address for a given Vega Asset ID

Arguments

NameTypeDescription
vega_asset_idbytes32Vega-assigned asset ID for which you want the ERC20 token address