Skip to content

Commit

Permalink
reduce settle lp noise
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Feb 22, 2024
1 parent e795133 commit e6a4505
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/bots/filler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const SIM_CU_ESTIMATE_MULTIPLIER = 1.15;

const errorCodesToSuppress = [
6004, // 0x1774 Error Number: 6004. Error Message: SufficientCollateral.
6010, // 0x177a Error Number: 6010. Error Message: User Has No Position In Market.
6081, // 0x17c1 Error Number: 6081. Error Message: MarketWrongMutability.
// 6078, // 0x17BE Error Number: 6078. Error Message: PerpMarketNotFound
// 6087, // 0x17c7 Error Number: 6087. Error Message: SpotMarketNotFound.
Expand Down
18 changes: 15 additions & 3 deletions src/bots/userLpSettler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export class UserLpSettlerBot implements Bot {
if (!success) {
const slice = users.length / 2;
if (slice < 1) {
await webhookMessage(
logger.error(
`[${this.name}]: :x: Failed to settle LPs, reduced until 0 ixs...`
);
return;
Expand Down Expand Up @@ -413,8 +413,20 @@ export class UserLpSettlerBot implements Bot {
);
success = true;
}
} catch (err) {
console.error(err);
} catch (e) {
const err = e as Error;
if (err.message.includes('Transaction was not confirmed')) {
logger.error(
`Transaction was not confirmed, but we'll assume it's fine`
);
success = true;
} else {
logger.error(
`Other error while settling LPs: ${err.message}\n${
err.stack ? err.stack : 'no stack'
}`
);
}
}
return success;
}
Expand Down

0 comments on commit e6a4505

Please sign in to comment.