Skip to content

Commit

Permalink
debugger-ui (#64)
Browse files Browse the repository at this point in the history
* initial commit

* setup txs fixed along with fill formatting

* make rando bot env vars optional

* PR changes

* run build in parent directory after install and when building locally

* rename debugger ui to debug ui where necessary

* add tests and remove unused property 'initialized' from client

* test on CI...

* increase timeout in test to allow for state to catch up

* use explicit async await in tests

* remove 'only' from createClient describe block

* different routes, additional info on fills and orderbook

* add static method for listing market public keys

* fix offset

* list markets on homepage

* create-market route and route restriction based on env vars

* add mint functionality to ui

* add mint to section and cleanup

* correct data layouts

* clearly state that .env and .env.local are different

* add TODO

* remove debug logs

* deduplicate some code via wrapper account fetcher function

* linting fixes

* add TODO

---------

Co-authored-by: DonDuala <[email protected]>
  • Loading branch information
TovarishFin and DonDuala authored Sep 17, 2024
1 parent be46aec commit 46f7a39
Show file tree
Hide file tree
Showing 45 changed files with 10,857 additions and 49 deletions.
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# ![Logo](assets/brown-contrast-split.png)

# <span style="font-family: 'Vollkorn', serif;">MANIFEST</span>

*The Unlimited Orderbook.*


[![codecov](https://codecov.io/gh/CKS-Systems/manifest/graph/badge.svg?token=PJ3Y2BVMM8)](https://codecov.io/gh/CKS-Systems/manifest)
[![Code Review - Rust](https://github.com/CKS-Systems/manifest/actions/workflows/ci-code-review-rust.yml/badge.svg)](https://github.com/CKS-Systems/manifest/actions/workflows/ci-code-review-rust.yml)
[![Code Review - Typescript](https://github.com/CKS-Systems/manifest/actions/workflows/ci-code-review-ts.yml/badge.svg)](https://github.com/CKS-Systems/manifest/actions/workflows/ci-code-review-ts.yml)
[![Build Docs](https://github.com/CKS-Systems/manifest/actions/workflows/ci-docs.yml/badge.svg)](https://github.com/CKS-Systems/manifest/actions/workflows/ci-docs.yml)
[![Benchmarking](https://github.com/CKS-Systems/manifest/actions/workflows/ci-benchmark.yml/badge.svg)](https://github.com/CKS-Systems/manifest/actions/workflows/ci-benchmark.yml)


Manifest is the next generation liquidity primitive on Solana.
No more permissioned markets.
No more trading fees.
No more permissioned markets.
No more trading fees.
No more expensive rent to start a market.
Capital efficiency built-in.
Capital efficiency built-in.
Maximal freedom to exchange risk.

## Whitepaper
Expand All @@ -22,7 +24,6 @@ Read [The Orderbook Manifesto](https://manifest.trade/whitepaper.pdf)

## Comparison


| | Openbook | Phoenix |Manifest |
|--|----------------|-------------------|----------------------|
| Crankless |No |Yes |Yes |
Expand All @@ -34,12 +35,13 @@ Read [The Orderbook Manifesto](https://manifest.trade/whitepaper.pdf)
| Read optimized| Yes | No | Yes |
| Swap accounts| 16 | 8 | 7 |
| [CU](https://cks-systems.github.io/manifest/dev/bench/) | :white_check_mark: | :white_check_mark: | :white_check_mark: :white_check_mark: |
| Silent failures | Yes| Yes| No|
| Token 22 | No| No| Yes|
| Composable wrapper| No| No| Yes|
| Capital Efficient | No| No| Yes|
| Silent failures | Yes | Yes | No |
| Token 22 | No | No | Yes |
| Composable wrapper | No | No | Yes |
| Capital Efficient | No | No | Yes |

### Details:

- Cranks were originally used in serum to address the need for solana programs to identify all accounts before landing on chain. This has become obsolete now that orderbooks pack all data into a predictable account.
- No trading fees forever on Manifest.
- Lot sizes restrict expressable prices. This meaningfully matters to orderflow through routers that have non-standard sizes. Manifest reduces the min trade size to atomic and increases the the range of expressable prices to cover all that are needed.
Expand All @@ -55,6 +57,7 @@ Read [The Orderbook Manifesto](https://manifest.trade/whitepaper.pdf)
- Capital efficient order type that allows market making on multiple markets while reusing capital across them.

## Design Overview

### Data Structure

The innovation that allows this next leap in onchain trading is the [`hypertree`](https://github.com/CKS-Systems/manifest/tree/main/lib). All data in the market account fits into graph nodes of the same size (80 bytes), which lets independent data structures grow without being fully initialized from the start by interleaving
Expand All @@ -63,15 +66,16 @@ The market account holds all relevant information. It begins with a header that
byte array after the header. There are 3 RedBlack trees for Bids, Asks,
ClaimedSeats and 1 LinkedList for FreeListNodes, overlapping across each other. All are graphs where each vertex along with adjacency list fits in 80 bytes, allowing them to use the same blocks.

<pre>
--------------------------------------------------------------------------------------------------------
| Header | Dynamic |
--------------------------------------------------------------------------------------------------------
| BaseMint, QuoteMint, BidsRootIndex, ... | Bid | Ask | FreeListNode | Seat | Seat | Bid | Bid | Ask|
--------------------------------------------------------------------------------------------------------
## <pre>

## | Header | Dynamic |

## | BaseMint, QuoteMint, BidsRootIndex, ... | Bid | Ask | FreeListNode | Seat | Seat | Bid | Bid | Ask|

</pre>

### Core vs Wrapper

Manifest implements the orderbook as an infrastructure layer primitive and creates the purest form of risk exchange possible. Other orderbooks get bogged down by special feature requests from trading teams that ultimately make the program bloated and confusing. Manifest strives to only include features that are absolutely necessary to be in the base layer. Anything that can be handled at layers above on the stack will not be done in manifest. This simplification makes formal verification of the program feasible.

Manifest should be interacted with though a wrapper program. Features like ClientOrderId, FillOrKill, PostOnlySlide, adjusting orders for insufficient funds, can and should be in a separate program that does a CPI into Manifest. A reference implementation and deployment of a wrapper are provided, showing what can be done outside the core of an orderbook without needing to be in the orderbook itself.
Expand All @@ -89,12 +93,13 @@ cargo build-sbf
### Testing

#### Program Test

```
cargo test-sbf
```

#### Typescript client test

```
sh local-validator-test.sh
```

Loading

0 comments on commit 46f7a39

Please sign in to comment.