Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
4.7 KiB
Deposit
The Vega network has no native assets. All settlement assets exist on another chain and are "bridged" to Vega in one way or another.
In the case of ERC20 tokens there is a smart contract on the Ethereum network that acts as a vault (aka bridge) for the tokens that are deposited to Vega. The Vega network then reads the information from this vault about what Vega key to credit these tokens to. While in the Vault the Vega key that owns them (and consequently the ethereum key) may change. The vault then manages how much each ethereum key is able to withdraw from the vault given then changes in ownership that may have happened on Vega. The keys to this vault and managed by the different nodes that make up the Vega network. They verify the the appropriate amounts can be withdrawn by each Ethereum key. At time of writing only ERC20 tokens have been implemented but the pattern is likely the same for other assets/networks.
ERC20 deposits
Note: ERC20 assets require an approval transaction to be finalised before funds can be credited to another key. Read more about approvals link 1, link 2.
When making to deposit ERC20 assets to an Vega key, I...
- should be able to follow a link from an asset (e.g. on a market page) to the deposit form pre-populated with the given asset
- must see a link to connect an ethereum wallet that I want to deposit from (1001-DEPO-001)
- must select the asset that I want to deposit (1001-DEPO-002)
- should easily see the assets that I have a non-zero balance for (in the connected eth wallet)
- should see the ERC20 token address of the asset
- should see the Vega asset symbol
- should see the Vega asset name
- must select the amount of the asset that I want to deposit (1001-DEPO-003)
- should see an ability to populate the input with the full balance in the connected wallet
- must be warned if the amount being deposited is greater than the balance of the token in the connected Eth wallet (1001-DEPO-004)
- must select the Vega key that I wish to deposit to (1001-DEPO-005)
- should be able to connect to a Vega wallet and select a key
- should be easily (if not automatically) pre-populated with a currently connected and active Vega key
- should be able to input a Vega key other than one I am connected with (even without being connected)
- if approved amount is less than deposit:
- must see that an approval is needed and be prompted to approve more (1001-DEPO-006)
- should see the approved asset amount
- should be able to input an amount to approve
- must submit eth transaction to approve (1001-DEPO-007)
- must see feedback for the approve transaction
- if approved amount is more than deposit amount:
- could see the approved asset amount
- could set a submit a new eth transaction to approve more or less
- must submit the Deposit eth transaction (1001-DEPO-008)
- must see feedback on the deposit ETH transaction (1001-DEPO-009)
- must see feedback that the deposit has or has not been credited to the Vega key (1001-DEPO-010)
...so that my Vega key can use these assets on Vega
Deposit page
- Visiting the page with a query param
?assetId=XYZ
should load the page with that asset selected if that asset exists (1001-DEPO-011)