Skip to content

Commit

Permalink
Merge branch 'mainnet-beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Dec 23, 2023
2 parents de98bcd + d48f9ef commit 93cc271
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/bots/uncrossArbBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,9 @@ export class UncrossArbBot implements Bot {
continue;
}
try {
const fee = this.priorityFeeSubscriber.avgPriorityFee * 1.1 || 1;
const fee = Number(
Math.floor(this.priorityFeeSubscriber.avgPriorityFee * 1.1 || 1)
);
const txResult =
await this.driftClient.txSender.sendVersionedTransaction(
await this.driftClient.txSender.getVersionedTransaction(
Expand Down Expand Up @@ -528,6 +530,7 @@ export class UncrossArbBot implements Bot {
`Potential arb with sig: ${txResult.txSig}. Check the blockchain for confirmation.`
);
} catch (e) {
logger.error('Failed to send tx', e);
try {
const simError = e as SendTransactionError;
const errorCode = getErrorCode(simError);
Expand Down Expand Up @@ -659,11 +662,15 @@ export class UncrossArbBot implements Bot {
console.error(err);
}
}
const txs = await Promise.all(settlePnlPromises);
for (const tx of txs) {
logger.info(
`Settle positive PNLs tx: https://solscan/io/tx/${tx.txSig}`
);
try {
const txs = await Promise.all(settlePnlPromises);
for (const tx of txs) {
logger.info(
`Settle positive PNLs tx: https://solscan/io/tx/${tx.txSig}`
);
}
} catch (e) {
logger.error('Error settling pnls: ', e);
}
this.lastSettlePnl = now;
}
Expand Down
2 changes: 1 addition & 1 deletion src/bots/userPnlSettler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type SettlePnlIxParams = {

const MIN_PNL_TO_SETTLE = new BN(-10).mul(QUOTE_PRECISION);
const SETTLE_USER_CHUNKS = 4;
const CU_PER_SETTLE_PNL = 300_000; // annecdotal: https://explorer.solana.com/tx/fLoSxBpBkowozkPMem9s3KLGQYt3KDHemTRzZPWFe48sZc1VJsgRTiYJUGXZGYRWQTwF42PjpgFLe6fpH9aCLh1#ix-1
const CU_PER_SETTLE_PNL = 500_000; // annecdotal: https://explorer.solana.com/tx/fLoSxBpBkowozkPMem9s3KLGQYt3KDHemTRzZPWFe48sZc1VJsgRTiYJUGXZGYRWQTwF42PjpgFLe6fpH9aCLh1#ix-1
const SLEEP_MS = 500;
const PRIORITY_FEE_SUBSCRIBER_FREQ_MS = 1000;
const MAX_COMPUTE_UNIT_PRICE_MICRO_LAMPORTS = 50000; // cap the computeUnitPrice to pay for settlePnl txs
Expand Down

0 comments on commit 93cc271

Please sign in to comment.