chart-based route finding

This commit is contained in:
Tim
2024-02-27 22:20:23 -04:00
parent fc126955b6
commit 9a5d7a1ce5
12 changed files with 126 additions and 46 deletions

View File

@@ -93,7 +93,7 @@ export function applyLine(tranche, intercept, slope, isMinimum = null) {
const os = useOrderStore()
const route = os.route
const inverted = routeInverted(route)
const scale = 10 ** (os.tokenA.decimals - os.tokenB.decimals)
const scale = 10 ** (os.tokenA.d - os.tokenB.d)
let m = inverted ? -scale / slope : slope / scale
let b = inverted ? scale / intercept : intercept / scale
const cur = b + timestamp() * m