From ac2dcb9223cf20e2ed82a4b59333adf607620f56 Mon Sep 17 00:00:00 2001 From: Jason Ridgway-Taylor Date: Mon, 13 Nov 2023 14:10:16 +0800 Subject: [PATCH] Added get_vaults view to marketmaker and removed no_batch error on UI --- batcher-ui/src/actions/exchange.ts | 8 +------- batcher-ui/src/commands/exchange.ts | 2 +- .../src/components/batcher/Exchange.tsx | 2 +- batcher-ui/src/reducers/exchange.ts | 14 -------------- batcher/marketmaker.mligo | 2 ++ batcher/michelson/marketmaker-ghostnet.tz | 19 ++++++++++++++++++- tick.sh | 4 ++-- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/batcher-ui/src/actions/exchange.ts b/batcher-ui/src/actions/exchange.ts index 9cdaeea6..aef4b733 100644 --- a/batcher-ui/src/actions/exchange.ts +++ b/batcher-ui/src/actions/exchange.ts @@ -108,11 +108,6 @@ export const updateVolumes = (volumes: unknown) => payload: { volumes }, } as const); -export const noBatchError = (errorMessage: string) => - ({ - type: 'NO_BATCH_ERROR', - payload: { errorMessage }, - } as const); export type ExchangeActions = | ReturnType @@ -131,5 +126,4 @@ export type ExchangeActions = | ReturnType | ReturnType | ReturnType - | ReturnType - | ReturnType; + | ReturnType; diff --git a/batcher-ui/src/commands/exchange.ts b/batcher-ui/src/commands/exchange.ts index 6865e8a8..d9e48b7f 100644 --- a/batcher-ui/src/commands/exchange.ts +++ b/batcher-ui/src/commands/exchange.ts @@ -40,7 +40,7 @@ const fetchCurrentBatchNumberCmd = (pair: SwapNames) => }, { successActionCreator: updateBatchNumber, - failActionCreator: (e: string) => noBatchError(e), + //failActionCreator: (e: string) => noBatchError(e), } ); diff --git a/batcher-ui/src/components/batcher/Exchange.tsx b/batcher-ui/src/components/batcher/Exchange.tsx index e8a700b6..cf119b66 100644 --- a/batcher-ui/src/components/batcher/Exchange.tsx +++ b/batcher-ui/src/components/batcher/Exchange.tsx @@ -381,7 +381,7 @@ const Exchange = () => { diff --git a/batcher-ui/src/reducers/exchange.ts b/batcher-ui/src/reducers/exchange.ts index 37642e68..f7a51038 100644 --- a/batcher-ui/src/reducers/exchange.ts +++ b/batcher-ui/src/reducers/exchange.ts @@ -196,20 +196,6 @@ const exchangeReducer = ( return loop(state, fetchVolumesCmd(state.batchNumber)); case 'UPDATE_VOLUMES': return { ...state, volumes: action.payload.volumes }; - /* case 'NO_BATCH_ERROR': //TODO - No batch being open isn't an error - the first deposit will open a batch - return loop( - { - ...state, - batcherStatus: { - status: BatcherStatus.NONE, - at: null, - startTime: null, - remainingTime: 0, - }, - batchNumber: 0, - }, - Cmd.action(newError('No batch open for this pair.')) - ); */ default: return state; } diff --git a/batcher/marketmaker.mligo b/batcher/marketmaker.mligo index bcf5bf29..31c51732 100644 --- a/batcher/marketmaker.mligo +++ b/batcher/marketmaker.mligo @@ -165,6 +165,8 @@ let tick end +[@view] +let get_vaults ((), storage : unit * MarketMaker.storage) = Vaults.to_map storage.vaults type entrypoint = | Change_admin_address of address diff --git a/batcher/michelson/marketmaker-ghostnet.tz b/batcher/michelson/marketmaker-ghostnet.tz index 073afa0f..6a340905 100644 --- a/batcher/michelson/marketmaker-ghostnet.tz +++ b/batcher/michelson/marketmaker-ghostnet.tz @@ -1013,5 +1013,22 @@ DIG 5 ; DIG 6 ; DROP 5 ; - PAIR } } } } + PAIR } } } ; + view "get_vaults" + unit + (map string address) + { CDR ; + CDR ; + CDR ; + EMPTY_MAP string address ; + DUP 2 ; + CAR ; + ITER { SWAP ; + DUP 3 ; + CDR ; + DUP 3 ; + GET ; + IF_NONE { SWAP ; DROP } { DIG 2 ; SWAP ; SOME ; SWAP ; UPDATE } } ; + SWAP ; + DROP } } diff --git a/tick.sh b/tick.sh index cdc7f10b..2081390f 100755 --- a/tick.sh +++ b/tick.sh @@ -43,8 +43,9 @@ tick_mm(){ post_op (){ tick_ticker +sleep $FREQ tick_mm - +sleep $FREQ } @@ -52,5 +53,4 @@ tick_mm while true do post_op - sleep $FREQ done