orders submitting but breaking due to fee send
This commit is contained in:
@@ -25,10 +25,15 @@ const Order = {
|
||||
}
|
||||
|
||||
|
||||
// the key is order.builder.id and the value is a function() that returns an array of tranches
|
||||
export const builderFuncs = {}
|
||||
|
||||
|
||||
export const useChartOrderStore = defineStore('chart_orders', () => {
|
||||
const chartReady = ref(false)
|
||||
|
||||
const orders = ref([])
|
||||
const orders = ref([]) // order models in UI format
|
||||
const built = ref([]) // orders in blockchain format, ready to send
|
||||
const selectedOrder = ref(null)
|
||||
const selectedSymbol = ref(null)
|
||||
const selectedPool = ref(null)
|
||||
@@ -38,8 +43,9 @@ export const useChartOrderStore = defineStore('chart_orders', () => {
|
||||
|
||||
function newOrder() {
|
||||
console.log('cos new order')
|
||||
const order = {id:uuid(), amount:1, amountIsTokenA: true, buy: true, builders:[], }
|
||||
const order = {id:uuid(), amount:1, amountIsTokenA: true, buy: true, builders:[newBuilder('MarketBuilder', {slippage:0.1})], }
|
||||
orders.value.push(order)
|
||||
built.value.push({})
|
||||
selectedOrder.value = order
|
||||
}
|
||||
|
||||
@@ -129,6 +135,28 @@ export function applyLine(tranche, intercept, slope, isMinimum = null) {
|
||||
tranche.marketOrder = false;
|
||||
}
|
||||
|
||||
|
||||
export function applyLine2(tranche, isMinimum, intercept, slope, poolDecimals, inverted) {
|
||||
// console.log('intercept, slope', intercept, slope)
|
||||
// intercept and slope are still in "human" units of decimal-adjusted prices
|
||||
const scale = 10 ** -poolDecimals
|
||||
let m = inverted ? -scale / slope : slope / scale
|
||||
let b = inverted ? scale / intercept : intercept / scale
|
||||
const cur = b + timestamp() * m
|
||||
console.log('inverted b, m, cur', inverted, b, m, cur)
|
||||
m = encodeIEE754(m)
|
||||
b = encodeIEE754(b)
|
||||
if (isMinimum) {
|
||||
tranche.minIntercept = b;
|
||||
tranche.minSlope = m;
|
||||
} else {
|
||||
tranche.maxIntercept = b;
|
||||
tranche.maxSlope = m;
|
||||
}
|
||||
tranche.marketOrder = false;
|
||||
}
|
||||
|
||||
|
||||
export function timesliceTranches() {
|
||||
const ts = []
|
||||
const os = useOrderStore()
|
||||
|
||||
Reference in New Issue
Block a user