Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

389 community market maker 1 #409

Merged
merged 130 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
c289b9a
pipelines: commit to trigger cicd
cyrilevos Apr 21, 2023
6ac33cc
Added michelson files to repo for both mainnet and ghostnet
glottologist Apr 21, 2023
eed92a7
Merge branch 'main' of github.com:marigold-dev/batcher
glottologist Apr 21, 2023
f4c6dc5
Added metadata file
glottologist Apr 21, 2023
b797f98
Fixed issue with wallet disconnecting
glottologist Apr 23, 2023
53d4cb8
Correctly assigned wallet after reload
glottologist Apr 23, 2023
61bdc02
Corrected open and closed holdings
glottologist Apr 23, 2023
55a794d
Merge branch 'release-mainnet' into main
glottologist Apr 23, 2023
e9cc614
Corrected Network type and mainnet token hash
glottologist Apr 24, 2023
b461a1f
Merge branch 'release-mainnet' into main
glottologist Apr 24, 2023
c0ff625
Clear active account on disconnect
glottologist Apr 24, 2023
aa5d41d
Merge branch 'main' of github.com:marigold-dev/batcher
glottologist Apr 24, 2023
ef72a0f
Merge branch 'release-ghostnet' into main
glottologist Apr 24, 2023
00622a3
Merge branch 'release-mainnet' into main
glottologist Apr 24, 2023
f5be65b
Added interim connecting captions for wallet loading
glottologist Apr 24, 2023
8099a86
Merge branch 'main' of github.com:marigold-dev/batcher
glottologist Apr 24, 2023
3420f74
Merge branch 'release-mainnet' into main
glottologist Apr 24, 2023
a0d1aff
Merge branch 'release-ghostnet' into main
glottologist Apr 24, 2023
f5ca683
Fixed issue with button showing connecting
glottologist Apr 24, 2023
8144a3a
Fixed NaN issue in Holdings tab
glottologist Apr 24, 2023
23dce33
Merge branch 'release-ghostnet' into main
glottologist Apr 24, 2023
cd9d079
Merge branch 'release-mainnet' into main
glottologist Apr 24, 2023
5cb41a1
Fixed issue with token balances updating
glottologist Apr 25, 2023
1abd899
Merge branch 'release-ghostnet' into main
glottologist Apr 25, 2023
9e869d3
Merge branch 'release-mainnet' into main
glottologist Apr 25, 2023
e74260f
Check for null user address on token update to reduce errors to the c…
glottologist Apr 25, 2023
d08235d
Filtered out 204 responses from tzkt for volumes
glottologist Apr 25, 2023
b8f48bb
Merge branch 'main' of github.com:marigold-dev/batcher
glottologist Apr 25, 2023
64d974c
Updated About page
glottologist Apr 25, 2023
8ab2d38
Updated About page
glottologist Apr 25, 2023
800f583
Added nix flake for project
glottologist Apr 28, 2023
0e0498f
Added skeleton ts project
glottologist Apr 28, 2023
1343a2f
Added initial skeleton for tg bot
glottologist Apr 28, 2023
5ac163f
Added html formatting to rates messages
glottologist Apr 28, 2023
d5ac749
Added raw operation socker sub
glottologist May 1, 2023
8b05402
Added deposit op to bot
glottologist May 1, 2023
64b18ba
Corrected tick filter
glottologist May 1, 2023
711dc87
Corrected deposit format for TG bot
glottologist May 1, 2023
92c0ac5
Corrected deposit amount for TG bot
glottologist May 1, 2023
872fbba
Corrected deposit amount for TG bot
glottologist May 1, 2023
ef910a4
Scaled amount for TG bot
glottologist May 1, 2023
6539f44
Added sedning of raw big map
glottologist May 1, 2023
acc8609
Corrected pair naming
glottologist May 1, 2023
ee93cac
Corrected scaling from rates message
glottologist May 1, 2023
903ad45
Use all socket messages
glottologist May 1, 2023
3ce0d77
PArse non formated big maps to json
glottologist May 1, 2023
1079617
Filtered user_batch_ordertypes from big_map updates
glottologist May 1, 2023
212cda6
Expanded log message
glottologist May 1, 2023
c82a53c
Added additional logging for bot
glottologist May 1, 2023
a9ebc4f
Changed filters on socket messages
glottologist May 1, 2023
ce4c8eb
Changed filters on socket messages
glottologist May 1, 2023
815473c
Changed filters on socket messages
glottologist May 1, 2023
55921b2
Changed filters on socket messages
glottologist May 1, 2023
e9e9aaf
Filter for transaction that are contract calls
glottologist May 1, 2023
089ccc7
Filter for transaction that are contract calls
glottologist May 1, 2023
1664f59
Log ops received from socket
glottologist May 1, 2023
73eeefe
Corrected filter
glottologist May 2, 2023
70eee41
Added skeleton for batch updates
glottologist May 2, 2023
4fd085e
Added batch update formatter showing volumes
glottologist May 2, 2023
2b75fbd
Assisting compiler
glottologist May 2, 2023
bf4f02f
Corrected json path in batch change
glottologist May 2, 2023
ecfe4ea
Corrected html encoding for batch change
glottologist May 2, 2023
305fea7
Tidy up on logging
glottologist May 2, 2023
eb66a18
Corrected object path for cleared message
glottologist May 2, 2023
07f14e3
Added rate name into batch status message
glottologist May 2, 2023
f705816
Corrected closing message detail
glottologist May 2, 2023
706dd9f
Added filter on messages
glottologist May 9, 2023
c06fd21
remove node_modules folder from repo by rewriting history (squash thi…
cyrilevos May 11, 2023
103ecd3
Merge branch 'release-ghostnet' into main
cyrilevos May 11, 2023
557f615
telegram bot for mainnet version (#333)
cyrilevos May 11, 2023
55a425a
Merge branch 'release-mainnet' into main
cyrilevos May 11, 2023
41a7a5e
Corrected mainnet variables
glottologist May 12, 2023
f3aa20b
Merge branch 'release-ghostnet' into main
glottologist May 12, 2023
9adb8cc
Corrections for batcher notifications bot (mainnet) (#335)
glottologist May 12, 2023
296abab
Removed rate notifications from ghostnet nbot
glottologist May 18, 2023
42f35ea
Merge branch 'release-ghostnet' into main
glottologist May 18, 2023
23470b1
325 bot jit liquidity (#337)
glottologist May 19, 2023
69c80b2
pipelines: use more recent versions of action blocks before deprecation
cyrilevos May 22, 2023
39716fe
Disabled swap button if the batch is closed. Additionally added a wa…
glottologist May 24, 2023
f3e101e
Disabled redeem button if there are no cleared holdings (#341)
glottologist May 24, 2023
b747054
Fix merge issues and tidy up
glottologist May 24, 2023
b080a25
Added batch number in info panel (#342)
glottologist May 24, 2023
01f758e
Added current and last to batch prefix
glottologist May 26, 2023
d9cf127
Merge branch 'release-ghostnet' into main
glottologist May 26, 2023
f81e871
Merge branch 'release-mainnet' into main
glottologist May 26, 2023
6173b67
Changed to use a reduced swap structure (name only) to reduce duplica…
glottologist Jun 8, 2023
8495a5d
344 reduce duplication in contract storage (#351)
glottologist Jun 9, 2023
d895076
Fixed merge issues
glottologist Jun 9, 2023
a71b585
346 only open batches on first trade (#371)
glottologist Jun 20, 2023
80eea91
Moved burn from deposit. Allowed redemption to calculate how much of…
glottologist Jun 20, 2023
d6ccd0a
327-move-fees style suggestion (#373)
aguillon Jun 20, 2023
9cba481
345 remove batches from bigmap imp2 (#377)
glottologist Jul 11, 2023
60cf52f
380 add documentation (#381)
glottologist Jul 13, 2023
fa6bd9a
380 add documentation (#382)
glottologist Jul 13, 2023
d1f67d4
Cancellations (#375)
glottologist Jul 17, 2023
f6cc409
Revive tests (#384)
glottologist Aug 8, 2023
fa5ab1d
w
glottologist Aug 9, 2023
612c9b8
[1
glottologist Aug 9, 2023
e24bb8b
Added market maker doc
glottologist Aug 10, 2023
e737e4b
Added market maker doc
glottologist Aug 10, 2023
31d2879
Added Add Liquidity enpoint
glottologist Aug 14, 2023
ea94b98
Added test for adding liquidity
glottologist Aug 14, 2023
ee3d7cf
Add liquidity to market maker and test
glottologist Aug 22, 2023
8e2097b
Added add/remove liquidity and claim rewards tests. Added view for g…
glottologist Aug 30, 2023
43ebce3
Started splitting market maker off into own contract
glottologist Sep 7, 2023
7528a6a
Seperated out tests
glottologist Sep 7, 2023
5a60310
Merged makefile
glottologist Sep 7, 2023
7d5f7c3
Split out mm contract from Batcher and pulled out common code into sh…
glottologist Sep 7, 2023
3480734
Amended tests to work with new split contracts
glottologist Sep 8, 2023
4a8ceda
Populated ghostnet storage for marketmaker
glottologist Sep 12, 2023
71d5b8f
Added get market holdings mechanism
glottologist Sep 12, 2023
4686b2a
Added user holdings display and buttons for MM
glottologist Sep 13, 2023
bf30e3c
Added contract calls
glottologist Sep 14, 2023
85a1330
Added Batcher modifications to handle fee payouts and makring a batch…
glottologist Sep 18, 2023
ec93d7b
Added placeholders for market vault operations against batcher
glottologist Sep 18, 2023
620fe4c
Added rebalancing up to amount exchange
glottologist Sep 21, 2023
f73d70c
Added redemption of holdings
glottologist Sep 21, 2023
248f03d
Added operator and deposit ops to utils
glottologist Sep 22, 2023
655474f
Added approve, deposit and revoke operations to the market maker
glottologist Sep 25, 2023
e7a5f3e
Added liquidity injection for market maker
glottologist Sep 26, 2023
5d7c487
Added additional tokens
glottologist Oct 5, 2023
a9666bd
Set up new pairs in ghostnet storage
glottologist Oct 5, 2023
fe06661
Added new tokens and pairs into market maker
glottologist Oct 5, 2023
e16af2b
Added new ghostnet batcher contract to mm storage
glottologist Oct 5, 2023
d48eb01
Added new ghostnet mm address to batcher ghostnet storage
glottologist Oct 5, 2023
5696905
Added new ghhostnet addresses to the config
glottologist Oct 5, 2023
d6c815f
Fix issue cmm (#407)
quentin-burg Oct 5, 2023
c77cc8a
Added redeem by batch
glottologist Oct 5, 2023
83f7a11
Fix CMM UI (#408)
quentin-burg Oct 5, 2023
9c8c05f
Merge branch 'release-ghostnet-beta' into 389-community-market-maker-1
glottologist Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .ash_history
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
exit
oc --endpoint https://ghostnet.tezos.marigold.dev originate contract batcher_ghost transferring 0 from batcher running batcher/batcher-ghostnet.tz --init "$(cat batcher/batcher-storage-ghostnet.tz)" --burn-cap 8 --force
oc gen keys tzthree --sig p256
ls
oc gen keys --help
oc list keys
oc list known addresses
oc keys
oc export --help
oc list known addresses
oc show address tzthree -S
oc show address tzthree -S --help
oc show address tzthree -S | grep prive
oc show address tzthree -S | grep priv
oc show address tzthree -S | grep Priv
oc show address tzthree -S | grep sec
oc show address tzthree -S
oc show address tzthree -S | grep Secre
oc show address tzthree -S | grep Secre > tz3key.txt
ls
oc --endpoint https://ghostnet.tezos.marigold.dev originate contract batcher_ghost transferring 0 from batcher running batcher/batcher-ghostnet.tz --init "$(cat batcher/batcher-storage-ghostnet.tz)" --burn-cap 8 --force
oc --endpoint "https://mainnet.tezos.marigold.dev" config update
oc --endpoint "https://ghostnet.tezos.marigold.dev" config update
exit
oc --endpoint "https://ghostnet.tezos.marigold.dev" config update
alias oc=octez-client
oc --endpoint "https://ghostnet.tezos.marigold.dev" config update
oc --endpoint https://ghostnet.tezos.marigold.dev originate contract batcher_ghost transferring 0 from batcher running batcher/batcher-ghostnet.tz --init "$(cat batcher/batcher-storage-ghostnet.tz)" --burn-cap 8 --force
27 changes: 27 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
paths:
- docs/**
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook build docs/
- name: store Artefact
uses: actions/upload-artifact@v2
with:
name: "batcher-docs"
path: ./docs/book
retention-days: 1
- name: deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run Ligo Tests

on:
workflow_dispatch: # adding the workflow_dispatch so it can be triggered manually
push:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Ligo version
uses: marigold-dev/[email protected]
with:
ligo_version: 0.69.0
command: version
working_directory: batcher
- name: Install deps
uses: marigold-dev/[email protected]
with:
ligo_version: 0.70.1
command: install
working_directory: batcher
- name: Run batcher test
uses: marigold-dev/[email protected]
with:
ligo_version: 0.70.1
command: run test test/test-batcher.mligo
working_directory: batcher
- name: Run market maker test
uses: marigold-dev/[email protected]
with:
ligo_version: 0.70.1
command: run test test/test-market-maker.mligo
working_directory: batcher
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ node_modules
dist
batcher-bot/notifications/node_modules/
batcher-bot/liquidity/node_modules/
<<<<<<< HEAD

book
=======
>>>>>>> release-ghostnet
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "docs/theme"]
path = docs/theme
url = https://github.com/marigold-dev/marigold-docs-theme.git
branch = main
136 changes: 3 additions & 133 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,5 @@
# Design document for the Batch Clearing DEX POC
# Batcher

The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared.
Batcher is a batch clearing DEX. The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss. To enable this users will deposit tokens during a deposit window; all deposits during this window will be a 'batch'. Once the deposit window is over the 'batch' will be 'locked'. Deposits to the dex will not specify a price for the swap, they will specify an offset to whichever oracle price is received after the 'batch' is 'locked'; those offsets being 0, +10bps, or -10bps. Once the batch is locked there will be a waiting window before the process starts to await an oracle price. Upon receipt of the oracle price, the batch is terminated and the orders are cleared. After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order.

> For V1, the deposit window will be 10 mins and then a wait time of 2 minutes before awaiting the oracle price.
> Only the XTZ/USDT pair will be supported for V1

After the termination of the batch, the users that placed orders can retrieve their funds. Either the user's order did not clear and they retrieve their original funds or the order cleared (totally or partially) and the get an execution of their order.


## Deposit

The deposit window is open for a finite time period. During the time period users can deposit their tokens for a BUY or SELL order on the token pair along with an offset to the future received oracle price.

> For V1, deposit windows won't run sequentially, in that as soon as a deposit window closes another will open straight away. Once the deposit window closes, users will need to wait for that batch to be cleared before another deposit window opens.

## Waiting

Once the deposit window has closed there will be a period of 2 minutes prior to awaiting an oracle price. Once that period has elapsed the first received oracle price will close the batch and clearing will start.

## Clearing

The clearing process is the process of matching the orders to ensure that all users can trade at the fairest possible price. Upon deposit there will be six categories of order.

### Side

Depending on whether you are buying or selling the pair you will either be on the BUY side or the SELL side. For the pair XTZ/USDT, XTZ is the base and USDT is the quote. So if the XTZ/USDT rate was 1.9 you would get 1 unit of XTZ for 1.9 of USDT if I am buying the pair, i.e. on the BUY side. If I am selling the pair, the inverse would be true. The side of the trade is important to understand which token needs to be deposited in a given swap order.


### Tolerance

For any deposit, the user can specify the tolerance to the oracle price that they are willing to trade at. This means that each side can further be segregated into their tolerance levels; $Price_{oracle}-10bps$, $Price_{oracle}$ , $Price_{oracle}+10bps$.


### Clearing Level

Given the three tolerance levels, we need to find the level at which we will clear the most orders; the clearing level.

Considering that the amount of deposits for each category is different then we have six categories with a differing amount of tokens deposited for each tolerance.


| Deposits | P-10bps | P | P+10bps |
|----------|:---------:|----------:|----------:|
| *BUY* | X of USDT | Y of USDT | Z of USDT |
| *SELL* | R of XTZ | S of XTZ | T of XTZ |


An added complexity is that if I am will to buy at $Price_{oracle}+10bps$ then I will also be implicitly interested in buying at $Price_{oracle}$ and $Price_{oracle}-10bps$ as they are both cheaper levels if I am on the BUY side. The converse is true for the sell side in that if I sell for $Price_{oracle}-10bps$, then I would be willing to sell for the higher prices of $Price_{oracle}$ and $Price_{oracle}+10bps$.

#### Determining the clearing level

| Prices | P-10bps | P | P+10bps |
|----------|:----------------:|----------:|-----------------:|
| *BUY* | P / 1.0001 | P | P * 1.0001 |
| *SELL* | 1.0001 / P | 1/P | 1/ (1.0001 * P) |


##### P-10bps level

Lets take the P-10bps sell level first. All of the buy levels would be interested in buying at that price, so the clearing volume at that level would be:

$$ CP_{P-10bps} = \min(X + Y + Z, R * \dfrac{ 1.0001 }{P}) $$


##### P level

Lets take the P sell level first. Only the upper 2 buy levels would be interested in buying at that price, but the lower two SELL levels would be interested in selling so the clearing volume at that level would be:

$$ CP_{P} = \min(Y + Z, (R+S) * \dfrac{1}{P}) $$

##### P+10bps level

Lets take the P+10bps sell level first. All of the sell levels would be interested in selling at that price, but only the upper BUY level would be interested in buying so the clearing volume at that level would be:

$$ CP_{P+10bps} = \min(Z, (R+S+T) * \dfrac{1}{(P * 1.0001)}) $$

#### Illustrative Examples

If the Oracle price for XTZ/USDT is 1.9 and the tolerance is +/- 10 basis points, then the six price levels are:

| Price Levels | BUY | SELL |
|--------------|:------:|:-------:|
|Price + 10bps |1.90019 | 0.52626 |
|Price | 1.9 | 0.52631 |
|Price - 10bps | 1.89981| 0.52636 |

Assuming these levels we can determine some very basic illustrative examples of different market scenarios:


| MARKET | AMOUNTS SKEW | BUY X @ (P-) | BUY Y @ (P) | BUY Z @ (P+) | SELL R @ (P-) | SELL @ S (P) | SELL T @ (P+) | Orders cleared @ P-10bps | Orders cleared @ P | Orders cleared @ P+10bps | Clearance Level |
|---|---|---|---|---|---|---|---|---|---|---|---|
|SELL PRESSUE |CENTERED |55 |100 |45 |1000 |1900 |900 |200 |155 |55 |P-10bps|
|SELL PRESSUE |NEG |100 |55 |45 |1900 |1000 |900 |200 |155 |100 |P-10bps|
|SELL PRESSUE |POS |45 |55 |100 |900 |1000 |1900 |200 |100 |45 |P-10bps|
|BUY PRESSURE |CENTERED |250 |100 |250 |95 |190 |95 |50 |150 |200 |P+10bps|
|BUY PRESSURE |NEG |250 |100 |250 |190 |95 |95 |100 |150 |200 |P+10bps|
|BUY PRESSURE |POS |250 |100 |250 |95 |95 |190 |50 |100 |200 |P+10bps|
|BALANCED |CENTERED |50 |101 |50 |95 |190 |95 |50 |150 |50| P|
|BALANCED |NEG |101| 50| 50| 190|95| 95 |100|150| 101| P|
|BALANCED |POS |50 |50 |101| 95| 95| 190 |50 |100| 50| P|
|BALANCED |OPPOSING (NEG) |50 |50| 101| 190| 95| 95| 100| 100| 50| P-10bps|
|BALANCED |OPPOSING (POS) |101 |50| 50| 95| 95| 190| 50| 100 |101| P+10bps|

Once we know the clearing level and the volume that can be cleared at that level, we will know how many can be matched (some partially) and those will receive pro-rata execution of their orders. For those that bid outside of the clearing level they will receive their deposits back when they claim.

> A Google [Sheet](https://docs.google.com/spreadsheets/d/1tWIQEVi2COW3UOH7BPbcNrqe77SsPqZVFqN7nfLe6mc/edit?usp=sharing) with these calculations in is available.
>
## Claiming

After clearing, users can claim their 'results', whether that be their original deposits, a partially matched order result or a fully filled order for the opposing token.

# Timelines


```mermaid
gantt
dateFormat YYYY-MM-DD
title Timelines for Batcher going to mainnet
excludes weekends

section Development
End of internal audit :ia, 2023-01-09, 4d
Fee Burning :fb, 2023-01-09, 4d
Oracle :or, 2023-01-09, 10d
Multiple Token Pools (incl. contract management and multisig) :mtp, after fb, 3w
Stabilisation / Final Testing :ft, after mtp, 5d
Mainnet launch :mn, after ft, 3d

section Engagement
Blog post for fee burning :bpfb, 2023-01-20, 5d
Blog post for token pools :bptp, 2023-01-27, 5d
Blog post for oracle :bpor, 2023-02-10, 5d
Blog post for mainnet :bpmn, 2023-02-20, 5d

```
Full documentation can be found [here](https://marigold-dev.github.io/batcher/)
1 change: 0 additions & 1 deletion batcher-ui/Dockerfile.ghostnet
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ COPY ./postcss.config.js ./postcss.config.js
COPY ./next.config.js ./next.config.js
COPY ./tailwind.config.js ./tailwind.config.js


RUN npm run build:ghostnet

EXPOSE 80
Expand Down
15 changes: 9 additions & 6 deletions batcher-ui/Dockerfile.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ COPY ./package.json ./

RUN npm install

COPY ./tsconfig.json ./jsconfig.json ./
COPY ./tsconfig.json ./tsconfig.json ./
COPY ./pages ./pages
COPY ./src ./src
COPY ./styles ./styles
COPY ./public ./public
COPY ./img ./img
COPY ./config ./config
COPY ./postcss.config.js ./postcss.config.js
COPY ./next.config.js ./next.config.js
COPY ./tailwind.config.js ./tailwind.config.js

RUN npm run build:mainnet-ci
RUN npm run build

FROM nginx:latest
EXPOSE 80

COPY --from=builder /app/dist /usr/share/nginx/html
CMD [ "npm", "start" ]
10 changes: 4 additions & 6 deletions batcher-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
"prepare": "cd .. && husky install batcher-ui/.husky",
"prettier": "prettier -c --write \"src/**/*\"",
"tsc": "tsc --noEmit",
"dev": "ENV=staging next dev",
"build": "next build",
"start": "next start -p 80",
"dev": "ENV=ghostnet next dev",
"build": "ENV=mainnet next build",
"start": "ENV=mainnet next start -p 80",
"start:ghostnet": "ENV=ghostnet next start -p 80",
"build:ghostnet": "ENV=ghostnet next build",
"start:staging": "ENV=staging next start -p 80",
"build:staging": "ENV=staging next build",
"lint": "next lint"
},
"lint-staged": {
Expand Down Expand Up @@ -80,4 +78,4 @@
"engines": {
"node": ">=16.0.0"
}
}
}
26 changes: 26 additions & 0 deletions batcher-ui/pages/marketmaker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { userAddressSelector } from 'src/reducers';
import { getMarketHoldings as getMarketHoldingsAction } from 'src/actions';
import MMVault from '../src/components/MMVault';

const MarketMakerHoldings = () => {
const contractAddress =
process.env.NEXT_PUBLIC_MARKETMAKER_CONTRACT_HASH || '';

const userAddress = useSelector(userAddressSelector);

const dispatch = useDispatch();

useEffect(() => {
dispatch(getMarketHoldingsAction(contractAddress, userAddress || ''));
}, [userAddress, contractAddress, dispatch]);

return (
<div className="flex flex-col md:mx-[15%] mx-4">
<MMVault />
</div>
);
};

export default MarketMakerHoldings;
Binary file added batcher-ui/public/USDtz-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions batcher-ui/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ import { WalletActions } from './wallet';
import { ExchangeActions } from './exchange';
import { EventActions } from './events';
import { HoldingsActions } from './holdings';
import { MarketHoldingsActions } from './marketholdings';


export * from './wallet';
export * from './exchange';
export * from './events';
export * from './holdings';
export * from './marketholdings';


export type Actions =
| WalletActions
| ExchangeActions
| EventActions
| MarketHoldingsActions
| HoldingsActions;
47 changes: 47 additions & 0 deletions batcher-ui/src/actions/marketholdings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { MarketHoldingsState } from 'src/types';

export const addLiquidity = () =>
({
type: 'ADDLIQUIDITY',
}) as const;

export const removeLiquidity = () =>
({
type: 'REMOVELIQUIDITY',
}) as const;

export const claimRewards = () =>
({
type: 'CLAIMREWARDS',
}) as const;

export const updateMarketHoldings = (
vaults: Partial<Omit<MarketHoldingsState, 'currentVault'>>
) =>
({
type: 'UPDATE_MARKET_HOLDINGS',
payload: { vaults },
} as const);

export const getMarketHoldings = (
contractAddress: string,
userAddress: string
) =>
({
type: 'GET_MARKET_HOLDINGS',
payload: { contractAddress, userAddress },
}) as const;

export const changeVault = (vault: string) =>
({
type: 'CHANGE_VAULT',
payload: { vault },
}) as const;

export type MarketHoldingsActions =
| ReturnType<typeof addLiquidity>
| ReturnType<typeof removeLiquidity>
| ReturnType<typeof claimRewards>
| ReturnType<typeof changeVault>
| ReturnType<typeof getMarketHoldings>
| ReturnType<typeof updateMarketHoldings>;
Loading
Loading