orderbuilding fixes for new line price semantics

This commit is contained in:
tim
2024-09-04 02:47:39 -04:00
parent 5afdc83957
commit 93dfb8bdcd
6 changed files with 29 additions and 43 deletions

View File

@@ -151,10 +151,12 @@ export function parseOrderStatus(chainId, status) {
filledIn = BigInt(filledIn)
filledOut = BigInt(filledOut)
trancheStatus = trancheStatus.map((obj)=>parseTrancheStatus(obj))
return {
const result = {
chainId, order, fillFeeHalfBps, state, startTime, startPrice, ocoGroup,
filledIn, filledOut, trancheStatus,
}
};
console.log('SwapOrderStatus', result)
return result
}
function parseTrancheStatus(obj) {
@@ -205,20 +207,18 @@ export function parseTranche(tranche) {
rateLimitPeriod,
startTime,
endTime,
minIntercept,
minSlope,
maxIntercept,
maxSlope,
minLine,
maxLine,
] = tranche
minIntercept = decodeIEE754(minIntercept)
minSlope = decodeIEE754(minSlope)
maxIntercept = decodeIEE754(maxIntercept)
maxSlope = decodeIEE754(maxSlope)
return {
minLine = {intercept: minLine.intercept, slope: minLine.slope }
maxLine = {intercept: maxLine.intercept, slope: maxLine.slope }
const result = {
fraction, startTimeIsRelative, endTimeIsRelative, minIsBarrier, maxIsBarrier, marketOrder,
minIsRatio, maxIsRatio, rateLimitFraction, rateLimitPeriod,
startTime, endTime, minIntercept, minSlope, maxIntercept, maxSlope,
startTime, endTime, minLine, maxLine,
}
console.log('parseTranche', tranche, result)
return result
}