← Projects

Building a liquidity pool simulator to understand my own DeFi positions

Why I added liquidity pool research and a Uniswap V3 range simulator to Satzo, kept it research only, and moved the liquidation warning earlier.

On this page
  1. What I built
  2. Research only
  3. What I got wrong
  4. What's next

My own liquidity pool and DeFi positions confused me. I couldn't separate the fees I'd earned from the change in token prices. I didn't notice when a concentrated position went out of range and stopped earning. I couldn't tell whether providing liquidity had beaten just holding the two tokens. And on the borrowing side, I didn't know how close a position was to liquidation.

Satzo, the crypto app I'm building, already combines my wallets and DeFi positions into one total. A total doesn't answer any of those questions, so I built the next part around them.

What I built

First, Satzo now explains DeFi positions in plain words, so I can see what a position is doing as well as what it's worth.

Then there's a liquidity pool research page for logged-in users. It compares the direct DEX pools Satzo supports. You can filter by chain, protocol and token pair, sort by APY, TVL (total value locked) and 24-hour activity, and save pools as favourites.

From a pool you can open a Uniswap V3 range simulator. Uniswap V3 lets you provide liquidity within a price range, and you only earn fees while the price stays inside it. The simulator shows how a deposit would be split between the two tokens for the range you pick, and compares the result with simply holding them. I kept the pool comparison in place while the simulator is open, so I don't lose where I was.

I also added a public directory of 40 DeFi protocols. For borrowing positions on Aave and Morpho, Satzo flags a position when its health factor drops below 1.2. The health factor is how far a loan is from being liquidated, and 1.0 is the point where liquidation can happen.

Research only

There's no wallet connection and no transactions. You can't deposit into a pool from Satzo. I want Satzo to help me understand positions, not trade them.

The estimates are a rough guide. Historical fee and APR estimates use the daily closing price and the active liquidity in the pool for that day. The page says it's an approximation and lists the costs it leaves out. When a period has incomplete data, the page shows it as unavailable instead of guessing, and that includes the charts.

What I got wrong

The first version only flagged a borrowing position once its health factor was at or below 1.0. That's already the liquidation point.

I moved it to 1.2, the same point where the health badge turns red.

What's next

Simulation only covers Ethereum, Base and Arbitrum for now. The next thing I want is to run the simulator against the positions I actually hold.

Get notified when I ship something new.

A weekly newsletter on React, Next.js, AI-assisted development, and engineering. No spam, unsubscribe any time.