Skip to content

Commit

Permalink
Added get_vaults view to marketmaker and removed no_batch error on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
glottologist committed Nov 13, 2023
1 parent a1e350a commit ac2dcb9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 26 deletions.
8 changes: 1 addition & 7 deletions batcher-ui/src/actions/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof updatePriceStrategy>
Expand All @@ -131,5 +126,4 @@ export type ExchangeActions =
| ReturnType<typeof getOraclePrice>
| ReturnType<typeof updateOraclePrice>
| ReturnType<typeof getVolumes>
| ReturnType<typeof updateVolumes>
| ReturnType<typeof noBatchError>;
| ReturnType<typeof updateVolumes>;
2 changes: 1 addition & 1 deletion batcher-ui/src/commands/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const fetchCurrentBatchNumberCmd = (pair: SwapNames) =>
},
{
successActionCreator: updateBatchNumber,
failActionCreator: (e: string) => noBatchError(e),
//failActionCreator: (e: string) => noBatchError(e),
}
);

Expand Down
2 changes: 1 addition & 1 deletion batcher-ui/src/components/batcher/Exchange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ const Exchange = () => {

<Form.Submit asChild>
<button
disabled={!userAddress || batcherStatus !== BatcherStatus.OPEN}
disabled={!userAddress || batcherStatus === BatcherStatus.CLOSED}
className="text-white h-10 disabled:cursor-not-allowed cursor-pointer disabled:bg-lightgray items-center justify-center rounded bg-primary px-4 mt-8 text-xl self-center">
Swap
</button>
Expand Down
14 changes: 0 additions & 14 deletions batcher-ui/src/reducers/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions batcher/marketmaker.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 18 additions & 1 deletion batcher/michelson/marketmaker-ghostnet.tz
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }

4 changes: 2 additions & 2 deletions tick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ tick_mm(){
post_op (){

tick_ticker
sleep $FREQ
tick_mm

sleep $FREQ
}



while true
do
post_op
sleep $FREQ
done

0 comments on commit ac2dcb9

Please sign in to comment.