Compare commits
1 Commits
4841e11b2b
...
21fee28519
Author | SHA1 | Date |
---|---|---|
microwavedcola1 | 21fee28519 |
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 = (
|
||||
|
|
|
@ -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, [
|
||||
|
|
Loading…
Reference in New Issue