order execution bugfixes

This commit is contained in:
Tim Olson
2023-10-20 22:53:31 -04:00
parent 6c268bba97
commit 8a46552bbf

View File

@@ -96,7 +96,7 @@ import {FixedNumber} from "ethers";
import {pendOrder} from "@/blockchain/wallet.js";
const s = useStore()
const buy = ref(true)
const buy = ref(false)
let _tokenA = ref(s.tokens && s.tokens.length >= 1 ? s.tokens[0] : null)
let _tokenB = ref(s.tokens && s.tokens.length >= 2 ? s.tokens[1] : null)
const tokenA = computed({
@@ -140,10 +140,10 @@ const inverted = ref(false)
const minPrice = ref(null)
const maxPrice = ref(null)
const limitPrice = ref(null)
const interval = ref(10)
const interval = ref(1)
const intervalIsTotal = ref(true)
const timeUnits = ['minutes', 'hours', 'days']
const timeUnitIndex = ref(1)
const timeUnitIndex = ref(0)
const limitIsMinimum = computed(() => !(buy.value ^ inverted.value))
const validOrder = computed(()=>amount.value > 0 && routes.value.length > 0 )
@@ -246,7 +246,7 @@ async function placeOrder() {
const route = routes.value[0];
const amountToken = amountIsTokenA ? ta : tb
const amt = FixedNumber.fromString(amount.value.toString(), {decimals: amountToken.decimals}).value
const amountIsInput = amountIsTokenA.value === buy.value
const amountIsInput = amountIsTokenA.value !== buy.value
// build tranches
const n = tranches.value // num tranches