From 6ee442d7ecf4f3043d50aca87a865adb91aebfe0 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 23 Mar 2024 19:39:34 -0400 Subject: [PATCH] disabled fees by default; chart order placement working! --- src/blockchain/orderlib.js | 5 ++++- src/components/chart/ChartOrderPane.vue | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/blockchain/orderlib.js b/src/blockchain/orderlib.js index d01978c..f7e0680 100644 --- a/src/blockchain/orderlib.js +++ b/src/blockchain/orderlib.js @@ -24,10 +24,13 @@ export const DISTANT_FUTURE = uint32max // } export function newOrder(tokenIn, tokenOut, exchange, fee, amount, amountIsInput, tranches, minFillAmount=null, outputDirectlyToOwner = false, chainOrder = NO_CHAIN) { + amountIsInput = !!amountIsInput // force convert to bool + outputDirectlyToOwner = !!outputDirectlyToOwner // force convert to bool + amount = BigInt(amount) if (!tranches) tranches = [newTranche({marketOrder: true})] // todo this is just a swap: issue warning? if( minFillAmount === null ) - minFillAmount = BigInt(amount) / 100n // default to min trade size of 1% + minFillAmount = amount / 100n // default to min trade size of 1% return { tokenIn, tokenOut, route:{exchange, fee}, amount, minFillAmount, amountIsInput, diff --git a/src/components/chart/ChartOrderPane.vue b/src/components/chart/ChartOrderPane.vue index baffdfa..5cb699a 100644 --- a/src/components/chart/ChartOrderPane.vue +++ b/src/components/chart/ChartOrderPane.vue @@ -89,8 +89,8 @@ async function placeOrder() { const fee = co.selectedPool[1] const tokenIn = chartOrder.buy ^ symbol.inverted ? symbol.quote : symbol.base const tokenOut = chartOrder.buy ^ symbol.inverted ? symbol.base : symbol.quote - const amountDec = chartOrder.amountIsTokenA ? tokenIn.d : tokenOut.d - const amount = Math.trunc(chartOrder.amount * 10 ** amountDec) + const amountDec = chartOrder.amountIsTokenA ? symbol.base.d : symbol.quote.d + const amount = BigInt(Math.trunc(chartOrder.amount * 10 ** amountDec)) const amountIsInput = !!(chartOrder.amountIsTokenA ^ chartOrder.buy) const order = newOrder(tokenIn.a, tokenOut.a, Exchange.UniswapV3, fee, amount, amountIsInput, tranches) built.push(order)