The first step taken by the user who wishes to trade is to deposit her funds into StarkEx. This is done by first depositing the funds to the on-chain StarkEx contract. A corresponding off-chain deposit transaction then updates the off-chain state.
Alice makes an on-chain transaction to deposit funds. The deposit operation supports deposits of ETH, ERC20 and ERC721.
The deposit function gets the following parameters:
starkKey - The
starkKey corresponding to the
assetType - The asset identifier of the token to be deposited. For more information, see here.
vaultId - The recipient L2 account.
quantizedAmount - For ERC20 and ERC721, the amount to be deposited.
For more information, see the smart contract documentation.
The off-chain app sends a deposit transaction to the StarkEx gateway.
The StarkEx service verifies that there are indeed enough funds in the pending deposits area in the StarkEx smart contract to complete the off-chain deposit.
If the deposit is valid, it is included in a batch to be submitted on-chain along with a validity proof.
As part of the
state update, the smart contract deduces the relevant amount of funds from the pending deposits area.