Skip to content

Commit

Permalink
chore(mantis): update order contract dep and added human docs (#4341)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda authored Nov 24, 2023
1 parent 1833259 commit e8d424d
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 6 deletions.
67 changes: 67 additions & 0 deletions docs/docs/technology/mantis/degen-math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Why solvers will not rug you?

**Let us have 4 orders:**

1. 100pica=10atom
2. 100pica=1010atom
3. 20atom=100pica
4. 20atom=100pica

Read it 100 pica for minumum for 10 atom and other direction.

**"Fair" solution is:**

1. 20atom
2. 20atom
3. 100pica
4. 100pica

So read it `order number 1 got 20atom as he wanted`

Let look different cases of "unfair".


**Limits**

1. 9atom
...

So nobody will get less than limited, liked in FIFO Order Book.

**Not maximal volume**

1. 10atom
2. 10atom
3. 100pica
4. 100pica

So as you can see solver favored 3 and 4 solutions, but underfilled 1 and 2.

Solution will be rejected. Why?

Volume of `fair` solution is `40*200`.
Volume of this solution is `20*200`.

Solution with larger volume accepted.


**Not fair price**


1. 10atom
2. 30atom
3. 100pica
4. 100pica

In this case volume is good, but settling price for order 2 was better than order 3.

This solution will be rejected, because all orders will be compare to same single accepted price.
1 and 2 violate one accepted price rule, so solution will be rejected.


**Market mechanics**

Like with FIFO Order Book like we all know, when Batch auctions has many solvers and many orders, limit difference narrows down and more solvers compete for being accepted, so larger volume.

That leads to optimal spot price.

7 changes: 4 additions & 3 deletions docs/docs/technology/mantis/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ This tutorial describes part of MANTIS describing running solver node and user t

| chain | stage | id |
| ---------- | ------- | ------------------------------------------------------------------- |
| centauri-1 | mainnet | centauri1cpcyl3nhp74vux7h9ux7egwm3gpy8tk3p556v90tt8le30z2qmvsft5ftk |
| centauri-1 | mainnet | centauri1nmrz67mprlngt2tx4qnm0seufsvtjc6v5qzx7jlf7dwlwrxpyc9sp0wxw3 |
| osmosis-1 | mainnet | |
| neutron-1 | mainnet | |

## User posts problems

Expand Down Expand Up @@ -48,9 +49,9 @@ You can try live code with https://github.com/ComposableFi/composable/blob/main/
## Deploy your own contracts

```sh
$BINARY tx wasm store $ORDER_WASM_FILE --from dz --gas=auto
$BINARY tx wasm store $ORDER_WASM_FILE --from dz --gas=auto -y

$BINARY tx wasm instantiate 19 '{"admin": "centauri1u2sr0p2j75fuezu92nfxg5wm46gu22ywfgul6k", "cvm_address" : "centauri1wpf2szs4uazej8pe7g8vlck34u24cvxx7ys0esfq6tuw8yxygzuqpjsn0d"}' --label "mantis_order_2" --admin centauri1u2sr0p2j75fuezu92nfxg5wm46gu22ywfgul6k --gas=auto --from=dz
$BINARY tx wasm instantiate 30 '{"admin": "centauri1u2sr0p2j75fuezu92nfxg5wm46gu22ywfgul6k", "cvm_address" : "centauri1wpf2szs4uazej8pe7g8vlck34u24cvxx7ys0esfq6tuw8yxygzuqpjsn0d"}' --label "mantis_order_7s" --admin centauri1u2sr0p2j75fuezu92nfxg5wm46gu22ywfgul6k --gas=auto --from=dz -y
```

## Solver node
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8d424d

Please sign in to comment.