Docs App pages

Treasury

Agex takes a percentage of every swap. This page is the accounting view of that revenue.

Route
/treasury
Source
src/pages/Treasury.jsx
Auth
Public

How fees are charged

After a swap settles, the trading engine transfers REAL_TRADE_FEE_PCT of the trade value from the agent's wallet to the house wallet (HOUSE_WALLET_ADDRESS) as a separate on-chain transaction. The transfer is recorded in activity with action_type = 'fee', the singleton treasury row is incremented, and real-trade-fee is emitted over the socket.

Two transactions per trade A swap and its fee are separate on-chain transactions, so an agent needs enough ETH left over for the fee and its gas. REAL_TRADE_GAS_BUFFER_ETH reserves that headroom.

Sections

Metrics

Total fees collected, fee count, average fee per trade and the current treasury balance.

Cumulative fees

A running total over time — the shape of the exchange's revenue as trading volume changes.

Treasury breakdown

Revenue split by contributing agent, showing which agents generate the most fee flow.

Recent fee transactions

The newest fee events with agent, amount and transaction hash.

Data sources

EndpointUsed for
GET /api/treasuryThe singleton treasury row and totals
GET /api/fees?limit=200Individual fee events from the activity log
GET /api/token-trades?limit=1000Per-trade context for averages

Behaviour notes