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
Name | Type | Description |
---|---|---|
user_address | address | |
asset_source | address | |
amount | uint256 | |
nonce | uint256 |
Asset_Deposited
Parameters
Name | Type | Description |
---|---|---|
user_address | address | |
asset_source | address | |
amount | uint256 | |
vega_public_key | bytes32 |
Asset_Listed
Parameters
Name | Type | Description |
---|---|---|
asset_source | address | |
vega_asset_id | bytes32 | |
nonce | uint256 |
Asset_Removed
Parameters
Name | Type | Description |
---|---|---|
asset_source | address | |
nonce | uint256 |
Asset_Limits_Updated
Parameters
Name | Type | Description |
---|---|---|
asset_source | address | |
lifetime_limit | uint256 | |
withdraw_threshold | uint256 |
Bridge_Withdraw_Delay_Set
Parameters
Name | Type | Description |
---|---|---|
withdraw_delay | uint256 |
Bridge_Stopped
Parameters
Name | Type | Description |
---|
Bridge_Resumed
Parameters
Name | Type | Description |
---|
Depositor_Exempted
Parameters
Name | Type | Description |
---|---|---|
depositor | address |
Depositor_Exemption_Revoked
Parameters
Name | Type | Description |
---|---|---|
depositor | address |
Functions
- ERC20 Bridge Logic Interface (IERC20_Bridge_Logic.sol)
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
Name | Type | Description |
---|---|---|
asset_source | address | Contract address for given ERC20 token |
vega_asset_id | bytes32 | Vega-generated asset ID for internal use in Vega Core |
lifetime_limit | uint256 | Initial lifetime deposit limit RESTRICTION FEATURE |
withdraw_threshold | uint256 | Amount at which the withdraw delay goes into effect RESTRICTION FEATURE |
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|---|---|
asset_source | address | Contract address for given ERC20 token |
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|---|---|
asset_source | address | Contract address for given ERC20 token |
lifetime_limit | uint256 | Deposit limit for a given ethereum address |
threshold | uint256 | |
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|---|---|
delay | uint256 | Amount of time to delay a withdrawal |
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|---|---|
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|---|---|
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|
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
Name | Type | Description |
---|
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
Name | Type | Description |
---|---|---|
asset_source | address | Contract address for given ERC20 token |
amount | uint256 | Amount of ERC20 tokens to withdraw |
target | address | Target Ethereum address to receive withdrawn ERC20 tokens |
creation | uint256 | Timestamp of when requestion was created RESTRICTION FEATURE |
nonce | uint256 | Vega-assigned single-use number that provides replay attack protection |
signatures | bytes | Vega-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
Name | Type | Description |
---|---|---|
depositor | address | The 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
Name | Type | Description |
---|---|---|
asset_source | address | Contract address for given ERC20 token |
amount | uint256 | Amount of tokens to be deposited into Vega |
vega_public_key | bytes32 | Target 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
Name | Type | Description |
---|---|---|
asset_source | address | Contract 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
Name | Type | Description |
---|---|---|
asset_source | address | Contract 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
Name | Type | Description |
---|---|---|
asset_source | address | Contract address for given ERC20 token |
get_multisig_control_address
function get_multisig_control_address() public view
returns(address)
Returns
current multisig_control_address
Arguments
Name | Type | Description |
---|
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
Name | Type | Description |
---|---|---|
asset_source | address | Contract 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
Name | Type | Description |
---|---|---|
vega_asset_id | bytes32 | Vega-assigned asset ID for which you want the ERC20 token address |