Documentation

How settlement works

Contracts, oracle, keeper and indexer: the four pieces, and which one owns your money.

win-trader is a set of Soroban contracts on Stellar with four things around them: oracle publishers that supply the mark prices, a keeper that liquidates and settles queued vault requests, an indexer that reads the chain into a database, and this app. The contracts hold the money and decide everything.

This app is one of those services, and the least important one: it draws pictures of state it does not own.

The pieces

Contracts
The pool, the markets and the positions. They hold the money and enforce the rules. Everything below is downstream of them.
Oracle publishers
Publish the mark prices the contracts settle against. Their own deployment, deliberately not this one.
Keeper
Watches for positions that have crossed a line and submits the liquidation or the trigger, and settles queued Vault deposits and withdrawals. It cannot open anything and cannot touch a healthy position.
Indexer
Reads the chain into a database so a leaderboard, a history table and a chart can be drawn without asking a node a thousand questions. The API serves what it indexes.

What the app can and cannot do

It reads indexed state and it builds transactions for your wallet to sign. It never holds a key and never writes protocol data. If it went offline your positions would sit exactly where they are, and the keeper would go on liquidating and triggering them without it.