disabled fees by default; chart order placement working!

This commit is contained in:
Tim
2024-03-23 19:39:34 -04:00
parent 0d0200009e
commit 6ee442d7ec
2 changed files with 6 additions and 3 deletions

View File

@@ -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,

View File

@@ -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)