Skip to content

Commit

Permalink
userPnlSettler: use slot from build account loader
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Jan 15, 2024
1 parent ae198f0 commit a6e74d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bots/userPnlSettler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class UserPnlSettlerBot implements Bot {
private driftClient: DriftClient;
private lookupTableAccount?: AddressLookupTableAccount;
private intervalIds: Array<NodeJS.Timer> = [];
private bulkAccountLoader: BulkAccountLoader;
private userMap: UserMap;
private priorityFeeSubscriber?: PriorityFeeSubscriber;

Expand All @@ -87,6 +88,7 @@ export class UserPnlSettlerBot implements Bot {
driftClientConfigs.connection.commitment || 'processed',
0
);
this.bulkAccountLoader = bulkAccountLoader;
this.driftClient = new DriftClient(
Object.assign({}, driftClientConfigs, {
accountSubscription: {
Expand Down Expand Up @@ -208,7 +210,7 @@ export class UserPnlSettlerBot implements Bot {
};
}

const slot = await this.driftClient.connection.getSlot();
const slot = (await this.bulkAccountLoader.mostRecentSlot) ?? 0;

const validOracleMarketMap = new Map<number, boolean>();
for (const market of this.driftClient.getPerpMarketAccounts()) {
Expand Down

0 comments on commit a6e74d9

Please sign in to comment.