filled amount fix

This commit is contained in:
Tim Olson
2023-12-08 17:40:10 -04:00
parent 46a78285f3
commit 97aa965cd9
3 changed files with 4 additions and 3 deletions

View File

@@ -1,12 +1,13 @@
import {queryHelperContract} from "@/blockchain/contract.js"; import {queryHelperContract} from "@/blockchain/contract.js";
import {Exchange} from "@/blockchain/orderlib.js"; import {Exchange} from "@/blockchain/orderlib.js";
import {useStore} from "@/store/store.js";
export async function findRoute(chainId, tokenA, tokenB) { export async function findRoute(chainId, tokenA, tokenB) {
// console.log('getting query helper')
const helper = await queryHelperContract() const helper = await queryHelperContract()
if (!helper) if (!helper)
throw Error('no helper') throw Error('no helper')
console.log('getting raw routes', tokenA.address, tokenB.address)
const rawRoutes = await helper.getRoutes(tokenA.address, tokenB.address) const rawRoutes = await helper.getRoutes(tokenA.address, tokenB.address)
// todo expose all available pools // todo expose all available pools
console.log('raw routes', rawRoutes) console.log('raw routes', rawRoutes)

View File

@@ -176,7 +176,7 @@ const orders = computed(()=>{
}) })
st.start = dateString(st.start) st.start = dateString(st.start)
const fmtX18 = {decimals: 18, width: 256, signed: false}; const fmtX18 = {decimals: 18, width: 256, signed: false};
st.filled = st.amountIsInput ? st.filledIn : st.filledOut st.filled = o.amountIsInput ? st.filledIn : st.filledOut
st.avg = BigInt(st.filled) === 0n ? null : st.avg = BigInt(st.filled) === 0n ? null :
FixedNumber.fromValue(status.filledOut, 0, fmtX18) FixedNumber.fromValue(status.filledOut, 0, fmtX18)
.div(FixedNumber.fromValue(status.filledIn, 0, fmtX18)) .div(FixedNumber.fromValue(status.filledIn, 0, fmtX18))

View File

@@ -77,10 +77,10 @@ const routes = computed({
async function componentFindRoute() { async function componentFindRoute() {
const tokenA = os.tokenA const tokenA = os.tokenA
const tokenB = os.tokenB const tokenB = os.tokenB
// console.log('finding route', tokenA, tokenB)
os.routes = [] os.routes = []
if (!tokenA || !tokenB) if (!tokenA || !tokenB)
return return
console.log('finding route', tokenA, tokenB)
os.routesPending = true os.routesPending = true
try { try {
const result = await findRoute(s.chainId.value, tokenA, tokenB) const result = await findRoute(s.chainId.value, tokenA, tokenB)