Skip to main content
[!TIP] Deposit Method Selection: This page explains Standard Vault Deposit, where the user connects their wallet and invokes the smart contract deposit function. If your users are depositing from a Centralized Exchange (CEX) or using a custodial wallet that does not support DApps, refer to the Deposit by Transfer guide.

Deposit

Token deposits can be made on any supported chains (list here) To create a deposit request:
1

Approve spending of the token by the Vault smart contract

Get Vault & USDC contract addresses from the Smart Contract Addresses page. All our smart contracts are verified, meaning you can retrieve the Vault & Token ABIs from the block explorers of any supported mainnets or testnets.
[!IMPORTANT] The addresses and RPC nodes used in the following examples are for Arbitrum Sepolia testnet. Since Orderly is an omnichain protocol, when deploying to production, replace these with the correct contract addresses and RPC endpoints for your target chain.
2

Determine necessary deposit fee in WEI

3

Call the `deposit` function of the smart contract

Contains the following structured data:
where:
Deposits will take some time to reflect depending on the origin chain, to allow for finalizing of the cross-chain transaction involved in the deposit. Once the deposit is credited, the balance will update and the transaction can be seen on the Get asset history API.

Full example

Code generation via ABI file

  • install Web3j CLI
  • web3j generate solidity -a <./path/to/Vault.json> -o <./out-path/to/Vault.java> -p <package-name>

Withdrawal

[!WARNING] PnL Settlement Requirement: Any realized profit from open or recently closed positions must be settled via the Settle PnL flow before it can be added to your withdrawable_balance. If you attempt to withdraw without settling your PnL, the withdrawal amount may exceed your available balance and fail. See Settle PnL for details.
To withdraw tokens from Orderly:
1

Choose a valid chain to withdraw your funds to

A list of supported chains can be found on our Smart Contract Addresses page.
2

Check if the chain has sufficient liquidity

Since Orderly is an omnichain trading infrastructure, the liquidity of withdrawn assets might need to move across chains. If there is not enough liquidity of the withdrawn asset on the target chain, then an additional cross-chain transaction fee will be deducted from the user’s account.
3

Obtain a withdrawal nonce

Get a nonce from Get Withdrawal Nonce API.
4

Obtain a signature from EIP-712

Sign an EIP-712 message of message type Withdraw:
Example:
where:
5

Make a withdraw request

Full Example

Unlike key registration which uses the off-chain domain, a withdrawal signature requires the on-chain domain targeting the Orderly Ledger contract. Furthermore, note the type formatting difference:
  • In the EIP-712 cryptography signature message, amount must be represented as a numeric value (uint256/BigInt).
  • In the final REST API JSON payload, the amount field must be serialized as a String.