Full withdrawal reference

Function reference

fullWithdrawalRequest

Description

Withdraws all funds from a vault to the on-chain contract, whether the operator services the request or not.

This function ensures users maintain custody of their funds, regardless of the operator’s actions.

Parameters
vaultId

The ID of the vault that holds the funds to withdraw.

ownerKey

The public Stark key associated with the ID of the vault that holds the funds to withdraw and the Ethereum address that initiated the transaction.

If ownerKey does not match vaultId, StarkEx proves the invalidity of the request and does not withdraw the funds.

If ownerKey does not match the Ethereum address, the StarkEx smart contract rejects the request and the off-chain application does not service the request.

freezeRequest

Description

Freezes the exchange, preventing any further state updates. Withdrawals of on-chain funds are still possible.

Any user can call this function if the freeze grace period has passed, and the forced operation is still in the pending forced operations area.

Parameters
vaultId

Any vault ID. This vault ID does not need to be the same vault ID used to call the fullWithdrawalRequest function.

ownerKey

The public Stark key associated with vaultID.

verifyEscape

Description

Verifies that the contents of a vault belong to a certain Merkle commitment.

For more information, see Escape verifier

Parameters
escapeProof

The Merkle proof for the vault to be evicted.

escape

Description

Adds the vault balance to an on-chain pending withdrawals account under the public Stark key of the vault’s owner and the appropriate asset ID,

If the Escape verifier accepted a proof with the same parameters, and no prior escape call was made for the same vault.

Parameters
vaultId

The ID of the vault that holds the funds to withdraw.

ownerKey

The public Stark key associated with vaultID.

assetId

The ID of the asset being withdrawn.

quantizedAmount

The quantized amount of the asset being withdrawn.

Contract

Escapes.sol

Constant reference

FREEZE_GRACE_PERIOD

Description

The maximum period of time that an operator has to service a full withdrawal request before the user that issued the request can freeze the operator’s smart contract.

Contract

LibConstants.sol

Event reference

LogFullWithdrawalRequest

Description

Indicates that a user called the fullWithdrawalRequest function.

Returns
vaultId

The same ID used when calling fullWithdrawalRequest

ownerKey

The same public Stark key used when calling fullWithdrawalRequest

Additional resources