Skip to content

Commit e9872e1

Browse files
committed
fix: linting errors
1 parent 782dc44 commit e9872e1

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

sdk/scripts/compare-user-parity.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,23 @@ async function main(): Promise<void> {
164164
)
165165
: Array.from(userMap.entries());
166166

167+
function noteMismatch(functionName: string, userPubkey): void {
168+
mismatchesByFunction[functionName] =
169+
(mismatchesByFunction[functionName] ?? 0) + 1;
170+
usersWithDiscrepancies.add(userPubkey.toBase58());
171+
mismatches += 1;
172+
}
173+
167174
for (const [userKey, currUser] of usersFilterd) {
168175
usersChecked += 1;
169176
const userPubkey = new PublicKey(userKey);
170-
171-
function noteMismatch(functionName: string): void {
172-
mismatchesByFunction[functionName] =
173-
(mismatchesByFunction[functionName] ?? 0) + 1;
174-
usersWithDiscrepancies.add(userPubkey.toBase58());
175-
mismatches += 1;
176-
}
177-
178177
// clean curr User position flags to be all 0
179178

180179
currUser.getActivePerpPositions().forEach((position) => {
181180
position.positionFlag = 0;
182181
});
183182

184-
const oldUser = buildOldUserFromSnapshot(driftClient, currUser, COMMITMENT);
183+
const oldUser = buildOldUserFromSnapshot(driftClient, currUser);
185184

186185
try {
187186
// Cross-account level comparisons
@@ -202,7 +201,7 @@ async function main(): Promise<void> {
202201
vNew_fc,
203202
vOld_fc
204203
);
205-
noteMismatch('getFreeCollateral');
204+
noteMismatch('getFreeCollateral', userPubkey);
206205
}
207206

208207
// only do free collateral for now
@@ -219,7 +218,7 @@ async function main(): Promise<void> {
219218
vNew_tc,
220219
vOld_tc
221220
);
222-
noteMismatch('getTotalCollateral');
221+
noteMismatch('getTotalCollateral', userPubkey);
223222
}
224223

225224
// getMarginRequirement (strict=true, includeOpenOrders=true)
@@ -243,7 +242,7 @@ async function main(): Promise<void> {
243242
vNew_mr,
244243
vOld_mr
245244
);
246-
noteMismatch('getMarginRequirement');
245+
noteMismatch('getMarginRequirement', userPubkey);
247246
}
248247
}
249248
// continue;
@@ -264,7 +263,7 @@ async function main(): Promise<void> {
264263
vNew_pbp,
265264
vOld_pbp
266265
);
267-
noteMismatch('getPerpBuyingPower');
266+
noteMismatch('getPerpBuyingPower', userPubkey);
268267
}
269268

270269
// liquidationPrice (defaults)
@@ -278,7 +277,7 @@ async function main(): Promise<void> {
278277
vNew_lp,
279278
vOld_lp
280279
);
281-
noteMismatch('liquidationPrice');
280+
noteMismatch('liquidationPrice', userPubkey);
282281
}
283282

284283
// liquidationPriceAfterClose with 10% of current quote as close amount (skip if zero/absent)
@@ -303,7 +302,7 @@ async function main(): Promise<void> {
303302
vNew_lpac,
304303
vOld_lpac
305304
);
306-
noteMismatch('liquidationPriceAfterClose');
305+
noteMismatch('liquidationPriceAfterClose', userPubkey);
307306
}
308307
}
309308
}

sdk/src/user.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4212,8 +4212,6 @@ export class User {
42124212
const marginBuffer = opts?.liquidationBuffer; // treat as MARGIN_BUFFER ratio if provided
42134213
const marginRatioOverride = opts?.marginRatioOverride;
42144214

4215-
let totalUnrealizedPnl = ZERO;
4216-
42174215
// Equivalent to on-chain user_custom_margin_ratio
42184216
let userCustomMarginRatio =
42194217
marginCategory === 'Initial' ? this.getUserAccount().maxMarginRatio : 0;
@@ -4293,7 +4291,6 @@ export class User {
42934291
tokenAmount: worstCaseTokenAmount,
42944292
ordersValue: worstCaseOrdersValue,
42954293
tokenValue: worstCaseTokenValue,
4296-
weightedTokenValue: worstCaseWeightedTokenValue,
42974294
} = getWorstCaseTokenAmounts(
42984295
spotPosition,
42994296
spotMarket,

0 commit comments

Comments
 (0)