Skip to content

Commit

Permalink
foce close serum markets, add force close oo, and improve logging
Browse files Browse the repository at this point in the history
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
  • Loading branch information
microwavedcola1 committed Sep 2, 2024
1 parent 3f367be commit b16d611
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ts/client/scripts/force-close-serum3-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,37 @@ async function forceCloseSerum3Market(): Promise<void> {
);

for (let a of mangoAccounts) {
console.log(`mango account ${a.publicKey}`);
// Cancel all orders and confirm that all have been cancelled
for (const _ of range(0, 10)) {
console.log(a.getSerum3OoAccount(MARKET_INDEX).freeSlotBits.zeroBits());
const sig = await client.serum3LiqForceCancelOrders(
group,
a,
serum3Market.serumMarketExternal,
10,
);
console.log(
` serum3LiqForceCancelOrders for ${
a.publicKey
}, sig https://explorer.solana.com/tx/${sig.signature}?cluster=${
` - serum3LiqForceCancelOrders https://explorer.solana.com/tx/${sig.signature}?cluster=${
CLUSTER == 'devnet' ? 'devnet' : ''
}`,
);

a = await a.reload(client);
if (a.getSerum3OoAccount(MARKET_INDEX).freeSlotBits.zeroBits() === 0) {
break;
}
}

const sig2 = await client.serum3CloseOpenOrders(
group,
a,
serum3Market.serumMarketExternal,
);
console.log(
` - serum3CloseOpenOrders https://explorer.solana.com/tx/${sig2.signature}?cluster=${
CLUSTER == 'devnet' ? 'devnet' : ''
}`,
);
}
}

Expand Down

0 comments on commit b16d611

Please sign in to comment.