Full Withdrawal

In spot trading systems, the only forced action is a withdrawal of all the funds. This guarantees that the L2 application cannot block users from getting their funds.

The general flow of a forced request is described here. This section describes the specific parameters of a Full Withdrawal request.

Full Withdrawal parameters

When Alice wants to perform Full Withdrawal, she calls the fullWithdrawalRequestfunction in StarkEx contract. This function gets two parameters: starkKey and vaultId. The request is valid only if the starkKey parameter is associated with the Ethereum address that initiated the transaction. Otherwise, the request is rejected by the StarkEx smart contract (and won’t be treated by the off-chain application).

The amount is not needed here: Full Withdrawal moves all the funds from the vault to the on-chain contract.

The validity of Full Withdrawal

Full Withdrawal is considered valid (i.e. the money will actually be withdrawn) only if the vaultId in the transaction corresponds to the same starkKey as was sent in the transaction.

If this is not the case - it means that Alice tries to perform Full Withdrawal from a vaultId that doesn’t belong to her - and thus StarkEx will prove the invalidity of the request and will not withdraw the funds.