Skip to content

Commit

Permalink
add memo
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Oct 29, 2024
1 parent e8e0666 commit b5348a7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/experimental-bots/filler/fillerMultithreaded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import {
// getStaleOracleMarketIndexes,
handleSimResultError,
logMessageForNodeToFill,
MEMO_PROGRAM_ID,
removePythIxs,
simulateAndGetTxWithCUs,
SimulateAndGetTxWithCUsResponse,
Expand Down Expand Up @@ -1680,6 +1681,13 @@ export class FillerMultithreaded {
ixs = removePythIxs(ixs);
}

ixs.push(
new TransactionInstruction({
programId: MEMO_PROGRAM_ID,
keys: [],
data: Buffer.from(`mm-perp ${fillTxId} ${makers.length}`, 'utf-8'),
})
);
const simResult = await simulateAndGetTxWithCUs({
ixs,
connection: this.driftClient.connection,
Expand Down Expand Up @@ -1893,6 +1901,14 @@ export class FillerMultithreaded {
ixs = removePythIxs(ixs);
}

ixs.push(
new TransactionInstruction({
programId: MEMO_PROGRAM_ID,
keys: [],
data: Buffer.from(`ff-perp ${fillTxId}`, 'utf-8'),
})
);

const simResult = await simulateAndGetTxWithCUs({
ixs,
connection: this.driftClient.connection,
Expand Down
19 changes: 19 additions & 0 deletions src/experimental-bots/spotFiller/spotFillerMultithreaded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
RuntimeSpec,
} from '../../metrics';
import {
MEMO_PROGRAM_ID,
SimulateAndGetTxWithCUsResponse,
getAllPythOracleUpdateIxs,
getFillSignatureFromUserAccountAndOrderId,
Expand Down Expand Up @@ -1023,6 +1024,15 @@ export class SpotFillerMultithreaded {
await this.driftClient.getRevertFillIx(user.userAccountPublicKey)
);
}

ixs.push(
new TransactionInstruction({
programId: MEMO_PROGRAM_ID,
keys: [],
data: Buffer.from(`mm-spot ${fillTxId} ${makers.length}`, 'utf-8'),
})
);

const simResult = await simulateAndGetTxWithCUs({
ixs,
connection: this.driftClient.connection,
Expand Down Expand Up @@ -1254,6 +1264,15 @@ export class SpotFillerMultithreaded {
await this.driftClient.getRevertFillIx(user.userAccountPublicKey)
);
}

ixs.push(
new TransactionInstruction({
programId: MEMO_PROGRAM_ID,
keys: [],
data: Buffer.from(`ff-spot ${fillTxId}`, 'utf-8'),
})
);

const simResult = await simulateAndGetTxWithCUs({
ixs,
connection: this.driftClient.connection,
Expand Down
4 changes: 4 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export const TOKEN_FAUCET_PROGRAM_ID = new PublicKey(
'V4v1mQiAdLz4qwckEb45WqHYceYizoib39cDBHSWfaB'
);

export const MEMO_PROGRAM_ID = new PublicKey(
'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'
);

const JUPITER_SLIPPAGE_BPS = 100;
export const PRIORITY_FEE_SERVER_RATE_LIMIT_PER_MIN = 300;

Expand Down

0 comments on commit b5348a7

Please sign in to comment.