DEX Orders and Token Accounts on Step

How to settle DEX balances and close token accounts on Step.

Within Solana’s growing ecosystem there are several DEXs composed with Serum’s on-chain central limit order book (CLOB) and trading interface. These protocols allow for users’ self custody of funds while trading with limit buy and sell orders directly from their wallet. 

Some users might find themselves trading on multiple DEXs due to unique tokens/memecoins offered, specific features or required liquidity for larger trade size. However, it can often be quite difficult to manage across different token pairs and exchanges, with some DEXs only displaying orders and balances for the currently selected trading pair and lacking an account summary page. 

Step is integrated with all major DEXs, offering the ability to cancel open orders, retrieve unsettled balances and close token accounts within the dashboard. This guide will provide a walkthrough on managing DEX balances through Step to prevent lost track of funds, as well as some insights into Solana’s rent fees and how they can be recovered using Step.

To get started, we’ll head to app.step.finance and connect our wallet.

connecting wallet to Step Dashboard
Connecting wallet to Step Dashboard

In this wallet we can see several open buy/sell orders within Serum DEX order books. It’s possible some users set bids on trading pairs which never get filled, and end up forgotten since they’re trading multiple tokens on several exchanges through just their wallet.

We can cancel an order by hitting the Cancel button, or cancel all orders by hitting Cancel All.

Open DEX orders on Step Dashboard
Open DEX Orders

We’ll choose to cancel the STEP/USDC $.045 limit buy order we had that never got filled by pressing the Cancel button next to it.

This will prompt a wallet transaction to cancel the order. There won’t be a change of balance until we settle funds from the DEX in the next step.

Cancelling DEX order through Step
Cancelling DEX order transaction. No balance changes to wallet

When placing a limit order on a DEX, a user's tokens are removed from their wallet and sent to a smart contract. After the order is either filled, or cancelled, the user must settle the funds from the smart contract back to their wallet.

A common issue with beginner DEX users is they will perform a transaction to cancel a limit order within the DEX they’re using, without understanding that a second, additional  transaction is also required to remove their liquidity from the DEX back to their wallet. This second transaction is referred to as “settling” funds.

We can now see our STEP/USDC order removed from the Open Orders section and is now under Unsettled Balances. In some cases, you may have to refresh the page to see this change.

Settling unsettled DEX balances on Step
STEP/USDC moved from Open Orders to Unsettled Balances

The Step Dashboard can be used to locate any unsettled balances or unfilled orders across DEXs that may have accumulated over multiple trading sessions. In some cases Step might be used to reveal funds a user lost track of during a frenzy of meme and dog coin trading mania.

Next, for the STEP/USDC account we can now hit the Settle All  button to return the funds from the DEX to our wallet.

Approving Settling balances transaction back to wallet
Transaction to settle funds from DEX back to wallet.

Rent Fees

On top of transaction fees, Solana also charges rent fees to accounts for the state data stored by validators in between transactions. Accounts are created for new token balances, open orders on DEXs and other interactions with DeFi protocols. Token accounts containing two years worth of rent are exempt from rent fees, and currently while in Beta, all accounts on Solana are required to be rent-exempt. This means rent fees paid through token accounts are more like deposits, and can be safely withdrawn if the account balance is zero. Step offers a feature to view and reclaim token and open order account rent fees accrued by your wallet and return them in the form of SOL.

A new account's rent value is calculated by the required storage space. So for example, an account for a token balance in your wallet would require a smaller rent deposit rent than an on-chain limit order on a DEX which contains significantly more metadata. 

To access this feature, locate and click the Accounts button under the Tools  heading on the left side of the dashboard. Here you can see empty accounts which are safe to close and reclaim rent fees.

The top section shows the Open Order Accounts  from our earlier STEP/USDC DEX trades.

Closing Solana Token Rent Accounts
Account Tools Page on Step

We can click the Close All  button and close the created accounts to recover the SOL deposits from the placed limit orders.

Approve the wallet transaction to retrieve our rent deposits as SOL.

Closing Solana Token Rent Accounts Transaction
Approving transaction to close token accounts and retrieve SOL deposit

As seen in the transaction above, our limit orders for only two trading pairs required total rent deposits of ~.044 SOL.

That's about .022 SOL per trading pair. So, a user who regularly trades on DEXs, placing several limit orders for different tokens is likely to have a nice sum of rent to recover from empty accounts they might be unaware of.

The same process can be repeated to close accounts for tokens you no longer hold in your wallet under the Close Token Accounts  section.

Keep Learning

Related