fixed minNetIndex bug

This commit is contained in:
dd 2021-06-22 09:14:15 -04:00
parent 60ab5d1b03
commit 1050481b74
1 changed files with 21 additions and 17 deletions

View File

@ -326,7 +326,7 @@ async function runPartialLiquidator() {
maxBorrAcc = ma;
}
if (liabsVal < 0.5) {
if (liabsVal < 1) {
// too small of an account; number precision may cause errors
continue;
}
@ -354,6 +354,8 @@ async function runPartialLiquidator() {
`Liquidatable\n${description}\nbeingLiquidated: ${ma.beingLiquidated}`,
);
console.log(markets);
// find the market with the most value in OpenOrdersAccount
let maxMarketIndex = -1;
let maxMarketVal = 0;
@ -447,6 +449,7 @@ async function runPartialLiquidator() {
}
}
if (minNetIndex !== -1) {
transaction.add(
makePartialLiquidateInstruction(
programId,
@ -463,6 +466,7 @@ async function runPartialLiquidator() {
liqorTokenValues[minNetIndex],
),
);
}
await client.sendTransaction(connection, transaction, payer, []);
await sleep(2000);