disabled fees by default; chart order placement working!
This commit is contained in:
@@ -24,10 +24,13 @@ export const DISTANT_FUTURE = uint32max
|
|||||||
// }
|
// }
|
||||||
export function newOrder(tokenIn, tokenOut, exchange, fee, amount, amountIsInput, tranches,
|
export function newOrder(tokenIn, tokenOut, exchange, fee, amount, amountIsInput, tranches,
|
||||||
minFillAmount=null, outputDirectlyToOwner = false, chainOrder = NO_CHAIN) {
|
minFillAmount=null, outputDirectlyToOwner = false, chainOrder = NO_CHAIN) {
|
||||||
|
amountIsInput = !!amountIsInput // force convert to bool
|
||||||
|
outputDirectlyToOwner = !!outputDirectlyToOwner // force convert to bool
|
||||||
|
amount = BigInt(amount)
|
||||||
if (!tranches)
|
if (!tranches)
|
||||||
tranches = [newTranche({marketOrder: true})] // todo this is just a swap: issue warning?
|
tranches = [newTranche({marketOrder: true})] // todo this is just a swap: issue warning?
|
||||||
if( minFillAmount === null )
|
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 {
|
return {
|
||||||
tokenIn, tokenOut, route:{exchange, fee},
|
tokenIn, tokenOut, route:{exchange, fee},
|
||||||
amount, minFillAmount, amountIsInput,
|
amount, minFillAmount, amountIsInput,
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ async function placeOrder() {
|
|||||||
const fee = co.selectedPool[1]
|
const fee = co.selectedPool[1]
|
||||||
const tokenIn = chartOrder.buy ^ symbol.inverted ? symbol.quote : symbol.base
|
const tokenIn = chartOrder.buy ^ symbol.inverted ? symbol.quote : symbol.base
|
||||||
const tokenOut = chartOrder.buy ^ symbol.inverted ? symbol.base : symbol.quote
|
const tokenOut = chartOrder.buy ^ symbol.inverted ? symbol.base : symbol.quote
|
||||||
const amountDec = chartOrder.amountIsTokenA ? tokenIn.d : tokenOut.d
|
const amountDec = chartOrder.amountIsTokenA ? symbol.base.d : symbol.quote.d
|
||||||
const amount = Math.trunc(chartOrder.amount * 10 ** amountDec)
|
const amount = BigInt(Math.trunc(chartOrder.amount * 10 ** amountDec))
|
||||||
const amountIsInput = !!(chartOrder.amountIsTokenA ^ chartOrder.buy)
|
const amountIsInput = !!(chartOrder.amountIsTokenA ^ chartOrder.buy)
|
||||||
const order = newOrder(tokenIn.a, tokenOut.a, Exchange.UniswapV3, fee, amount, amountIsInput, tranches)
|
const order = newOrder(tokenIn.a, tokenOut.a, Exchange.UniswapV3, fee, amount, amountIsInput, tranches)
|
||||||
built.push(order)
|
built.push(order)
|
||||||
|
|||||||
Reference in New Issue
Block a user