Liquidator: round up when paying back borrows to close token pos
This commit is contained in:
parent
19153b8874
commit
38f5502dc7
|
@ -97,7 +97,7 @@ pub fn zero_all_non_quote(
|
|||
);
|
||||
txsigs.push(txsig);
|
||||
} else if token_state.native_position < 0 {
|
||||
let amount = -token_state.native_position;
|
||||
let amount = (-token_state.native_position).ceil();
|
||||
let txsig = mango_client.jupiter_swap(
|
||||
quote_token.mint_info.mint,
|
||||
token.mint_info.mint,
|
||||
|
|
|
@ -44,7 +44,7 @@ async function main() {
|
|||
const amount = token.native(bank).toNumber();
|
||||
if (amount < 0) {
|
||||
try {
|
||||
await client.tokenDepositNative(group, account, bank.name, amount);
|
||||
await client.tokenDepositNative(group, account, bank.name, Math.ceil(-amount));
|
||||
await account.reload(client, group);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
|
|
Loading…
Reference in New Issue