Skip to main content
This guide walks you through withdrawing from an Amplify account by calling the WithdrawQueue smart contract directly. It covers every contract method you need to call, in order, including fee calculation, share conversion, and order status polling.

How Withdrawals Work

Unlike deposits, withdrawals are not instant. They use a queue-based model:
1

Approve account shares

Grant the WithdrawQueue permission to transfer your account shares by calling approve() on the BoringVault (share token) contract.
2

Submit a withdrawal order

Call submitOrder() on the WithdrawQueue. Your shares are locked and a withdrawal order is created.
3

Account operator fulfills the order

The account operator processes the queue (typically within 24 hours) and transfers the want asset (e.g., USDC) to your receiver address.
Why can’t I withdraw instantly? Account assets may be deployed in DeFi strategies. The account operator needs time to unwind positions and source liquidity. This is standard across DeFi account protocols.

What You’ll Need


ABI Reference

WithdrawQueue ABI

FeeModule ABI

BoringVault ABI (ERC-20 for share approval)

Accountant ABI (for share conversion)


Contract Method Reference

submitOrder(params)

Empty Signature Params

When you’ve already called approve(), pass empty signature params to indicate standard ERC-20 approval:

Order Statuses


Withdrawal Fees

The WithdrawQueue charges a fee on withdrawal orders via its FeeModule. You should check the fee before submitting to display accurate amounts to your users. The fee is deducted from your amountOffer in account shares — meaning you receive the want asset equivalent of amountOffer - feeAmount.

How to read the fee

This requires two contract reads: Step 1 — Get the FeeModule address from the WithdrawQueue:
Step 2 — Calculate the fee for your specific withdrawal:
The feeAmount is in account shares (18 decimals). To get the fee percentage:
The returned value uses 18-decimal precision (e.g., 5000000000000000 = 0.5%).
The fee is subtracted from the account shares you offer. If you offer 100 shares and the fee is 0.5 shares, only 99.5 shares worth of the want asset will be sent to the receiver. Account for this when displaying withdrawal amounts to users.

Converting Withdrawal Amount to Shares

Users typically think in terms of the want asset (e.g., “I want to withdraw 1,000 USDC”), but amountOffer is denominated in account shares. Use the Accountant’s exchange rate to convert.

Contract call

rateInQuote represents the amount of the want asset per 1e18 account shares. Pass the want asset (withdrawal token) address as the quote parameter.

Conversion formula

To withdraw a specific amount of the want asset:
For example, to withdraw 1,000 USDC (6 decimals):
Don’t forget to account for withdrawal fees when calculating the share amount. If there’s a 0.5% fee, you’ll need to offer slightly more shares: sharesNeeded / (1 - feePercentage).

Minimum Order Size

Each WithdrawQueue enforces a minimum order size. Check it before submitting:
If your amountOffer is below this threshold, the transaction will revert with AmountBelowMinimum.

Withdrawal Walkthrough

1

Check your share balance (read)

Confirm you hold enough account shares to withdraw.
2

Convert want amount to shares (read)

If you know the want asset amount, convert it to shares.
Then calculate: sharesNeeded = (wantAmount × 1e18) / rateInQuoteIf you already know the share amount you want to offer, skip this step.
3

Check the withdrawal fee (read)

Get the FeeModule address and calculate the fee that will be deducted.
The net shares applied to the withdrawal = sharesNeeded - feeAmount. Display this to the user so they know the effective withdrawal amount.
4

Check the minimum order size (read)

Ensure your order meets the minimum.
If sharesNeeded < minimumShares, the order will be rejected.
5

Check existing allowance (read)

See if the WithdrawQueue already has permission to transfer your shares.
If the returned value is ≥ your sharesNeeded, skip to Step 7.
6

Approve account shares to the WithdrawQueue (transaction)

Grant the WithdrawQueue permission to transfer your account shares.
Wait for the transaction to be mined before proceeding.
7

Submit the withdrawal order (transaction)

Call submitOrder() on the WithdrawQueue with empty signature params (since you used ERC-20 approval in Step 6).
The return value orderIndex uniquely identifies your order. Save it to check status or cancel later.You can also extract orderIndex from the OrderSubmitted event in the transaction receipt logs.
8

Poll for order completion (read)

The account operator typically fulfills orders within 24 hours. Check the status:
Poll periodically (e.g., every 60 seconds) until status ≥ 2:
  • 2 (COMPLETE) — Want asset has been sent to your receiver address
  • 5 (COMPLETE_REFUNDED) — Order was cancelled, shares returned
  • 6 (FAILED_TRANSFER_REFUNDED) — Transfer failed, shares returned

Example values (withdrawing ~1,000 USDC worth of shares on Ethereum mainnet)


Troubleshooting

Your amountOffer is below the queue’s minimum order size. Call minimumOrderSize() to check the threshold, and increase your amount.
The intendedDepositor field doesn’t match the transaction sender. Set it to the wallet address that’s sending the transaction.
The wantAsset address isn’t enabled for this account. Query the account config to find supported withdrawal assets.
Account shares haven’t been approved to the WithdrawQueue. Call BoringVault.approve() first.
Account operations are temporarily paused by the operator. Wait and retry later. You can check programmatically with Teller.isPaused() — see Pause State.

Next Steps