Skip to content

Commit

Permalink
Merge pull request #23 from oraichain/hotfix/whitelist-liquidate-trader
Browse files Browse the repository at this point in the history
hotfix: whitelist liquidate trader
  • Loading branch information
trung2891 authored Apr 14, 2024
2 parents baa6a3e + 3449082 commit d67029e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/tp_sl_lq/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ export class EngineHandler {
}

async triggerLiquidate(vamm: Addr, side: Side): Promise<String[]> {
let whitelistedTrader = process.env.WHITELIST_TRADER?.split(",") || [];

const vammClient = new MarginedVammQueryClient(this.sender.client, vamm);
const engineConfig = await this.engineClient.config();
const isOverSpreadLimit = await vammClient.isOverSpreadLimit();
Expand All @@ -270,6 +272,9 @@ export class EngineHandler {
let result: String[] = [];
const positions = await this.queryPositions(vamm, side);
for (const position of positions) {
if (whitelistedTrader.includes(position.trader)) {
continue;
}
let marginRatio = Number(
await this.engineClient.marginRatio({
positionId: position.position_id,
Expand Down

0 comments on commit d67029e

Please sign in to comment.