The user submits a withdrawal signed request to the off-chain application, in order to ensure a malicious operator can’t use this flow in order to steal the maintenance margin.
The off-chain app checks the validity of the withdrawal request according to its business logic and the relevant
positionId state. If it is valid, it sends the off-chain withdrawal transaction to the StarkEx service.
StarkEx verifies that the withdrawal request is valid, according to the relevant business logic statement to be proved, and the relevant
positionId state. If the withdrawal is valid, it is aggregated to a batch to be submitted on-chain along with a validity proof.
state update, the StarkEx smart contract moves the relevant funds to the withdrawal area, under the user identity that appears in the withdrawn L2 position.