Token deposits can be made on any supported chains (list here)
To create a deposit request, users can follow the following steps:
1
Approve spending of the token by the Vault smart contract
Get Vault & USDC deposit address from here.
All our smart contracts are verified, so you can get Vault & USDC ABI files via explorer, e.g. on Arbitrum Sepolia you can copy Vault ABI from here.
Copy
String usdcAddress = "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d";String vaultAddress = "0x0EaC556c0C2321BA25b9DC01e4e3c95aD5CDCd2f";Dotenv dotenv = Dotenv.load();String pk = dotenv.get("PRIVATE_KEY");Credentials credentials = Credentials.create(ECKeyPair.create(Hex.decodeHex(pk)));Web3j web3j = Web3j.build(new HttpService("https://arbitrum-sepolia.publicnode.com"));DefaultGasProvider gasProvider = new DefaultGasProvider();NativeUSDC USDC = new NativeUSDC(usdcAddress, web3j, credentials, gasProvider);BigInteger depositAmount = new BigInteger("10000000");// approve USDC ERC-20 to be transferred to Vault contractUSDC.approve(vaultAddress, depositAmount).send();
2
Determine necessary deposit fee in WEI
Copy
String brokerId = "woofi_pro";String tokenId = "USDC";String orderlyAccountId = "0x...";Vault vault = new Vault(vaultAddress, web3j, credentials, gasProvider);Keccak.Digest256 brokerHash = new Keccak.Digest256();byte[] brokerIdBytes = brokerId.getBytes("UTF-8");brokerHash.update(brokerIdBytes, 0, brokerIdBytes.length);Keccak.Digest256 tokenHash = new Keccak.Digest256();byte[] usdcBytes = tokenId.getBytes("UTF-8");tokenHash.update(usdcBytes, 0, usdcBytes.length);Vault.VaultDepositFE depositInput = new Vault.VaultDepositFE(Hex.decodeHex(orderlyAccountId.substring(2)),brokerHash.digest(),tokenHash.digest(),depositAmount);// get wei deposit fee for `deposit` callBigInteger depositFee = vault.getDepositFee(credentials.getAddress(), depositInput).send();
The keccak256 hash of the builder id (eg “woofi_dex”)
tokenHash
bytes
Y
The keccak256 hash of the token string (eg “USDC“)
tokenAmount
int
Y
Amount of tokens to be deposited
Copy
// deposit USDC into Vault contractvault.deposit( depositInput, depositFee).send();
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.
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.