Skip to content

Commit

Permalink
clean up liquidator errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Oct 26, 2023
1 parent b5d3a6b commit be1f196
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/bots/liquidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1996,24 +1996,26 @@ tx: ${tx} `
`Error liquidating auth: ${auth}, user: ${userKey} on market ${liquidateePosition.marketIndex} `
);
console.error(e);
webhookMessage(
`[${
this.name
}]: :x: Error liquidating auth: ${auth}, user: ${userKey} on market ${
liquidateePosition.marketIndex
} \n${e.logs ? (e.logs as Array<string>).join('\n') : ''} \n${
e.stack || e
} `
);

const errorCode = getErrorCode(e);
if (errorCode && !errorCodesToSuppress.includes(errorCode)) {
webhookMessage(
`[${
this.name
}]: :x: Error liquidatePerp'ing auth: ${auth}, user: ${userKey} on market ${
liquidateePosition.marketIndex
} \n${
e.logs ? (e.logs as Array<string>).join('\n') : ''
} \n${e.stack || e} `
);
}
})
.finally(() => {
this.sdkCallDurationHistogram!.record(Date.now() - start, {
method: 'liquidatePerp',
});
});
}

if (liquidateeHasLpPos) {
} else if (liquidateeHasLpPos) {
logger.info(
`liquidatePerp ${auth}-${user.userAccountPublicKey.toBase58()} on market ${
liquidateePosition.marketIndex
Expand All @@ -2037,6 +2039,18 @@ tx: ${tx} `
logger.error(
`Error liquidating auth: ${auth}, user: ${userKey} on market ${liquidateePosition.marketIndex}\n${e}`
);
const errorCode = getErrorCode(e);
if (errorCode && !errorCodesToSuppress.includes(errorCode)) {
webhookMessage(
`[${
this.name
}]: :x: Error liquidatePerp'ing auth (with no pos, but has lp shares): ${auth}, user: ${userKey} on market ${
liquidateePosition.marketIndex
} \n${
e.logs ? (e.logs as Array<string>).join('\n') : ''
} \n${e.stack || e} `
);
}
});
}
}
Expand Down

0 comments on commit be1f196

Please sign in to comment.