Compare commits

..

1 Commits

Author SHA1 Message Date
microwavedcola1 21fee28519
Merge f80b72d9e0 into 88451debed 2024-04-24 10:38:40 +02:00
4 changed files with 14 additions and 8 deletions

View File

@ -107,7 +107,7 @@ pub async fn runner(
.context
.tokens
.values()
.filter(|t| !t.closed)
.filter(|t| t.closed == false)
.map(|t| &t.token_index)
// TODO: grouping tokens whose oracle might have less confidencen e.g. ORCA with the rest, fails whole ix
// TokenUpdateIndexAndRate is known to take max 71k cu

View File

@ -272,7 +272,7 @@ impl MangoGroupContext {
name: String::new(),
mint_info_address: *pk,
decimals: u8::MAX,
closed: true,
closed: false,
banks: mi.banks,
vaults: mi.vaults,
oracle: mi.oracle,
@ -299,7 +299,7 @@ impl MangoGroupContext {
let fallback_oracle_accounts = fetch_multiple_accounts(rpc, &fallback_keys[..]).await?;
for (index, (_, bank)) in bank_tuples.iter().enumerate() {
let token = tokens.get_mut(&bank.token_index).unwrap();
token.closed &=
token.closed =
bank.native_deposits() == 0 && bank.native_borrows() == 0 && bank.reduce_only == 1;
token.name = bank.name().into();
token.decimals = bank.mint_decimals;

View File

@ -38,6 +38,16 @@ async function forceWithdrawTokens(): Promise<void> {
const group = await client.getGroup(new PublicKey(GROUP_PK));
const forceWithdrawBank = group.getFirstBankByTokenIndex(TOKEN_INDEX);
if (forceWithdrawBank.reduceOnly != 2) {
throw new Error(
`Unexpected reduce only state ${forceWithdrawBank.reduceOnly}`,
);
}
if (!forceWithdrawBank.forceWithdraw) {
throw new Error(
`Unexpected force withdraw state ${forceWithdrawBank.forceWithdraw}`,
);
}
// Get all mango accounts with deposits for given token
const mangoAccountsWithDeposits = (

View File

@ -725,11 +725,7 @@ export class MangoClient {
vault: bank.vault,
oracle: bank.oracle,
ownerAtaTokenAccount,
alternateOwnerTokenAccount: alternateOwnerTokenAccount.equals(
PublicKey.default,
)
? ownerAtaTokenAccount
: alternateOwnerTokenAccount,
alternateOwnerTokenAccount,
})
.instruction();
return await this.sendAndConfirmTransactionForGroup(group, [