diff --git a/bin/keeper/src/crank.rs b/bin/keeper/src/crank.rs index a485d761c..3c8e75310 100644 --- a/bin/keeper/src/crank.rs +++ b/bin/keeper/src/crank.rs @@ -106,7 +106,9 @@ pub async fn runner( let handles1 = mango_client .context .tokens - .keys() + .values() + .filter(|t| !t.closed) + .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 // from cargo test-bpf local tests diff --git a/lib/client/src/context.rs b/lib/client/src/context.rs index 365dc47f7..d8f4c5d3f 100644 --- a/lib/client/src/context.rs +++ b/lib/client/src/context.rs @@ -28,6 +28,7 @@ use solana_sdk::pubkey::Pubkey; pub struct TokenContext { pub group: Pubkey, pub token_index: TokenIndex, + pub closed: bool, pub name: String, pub mint: Pubkey, pub oracle: Pubkey, @@ -271,6 +272,7 @@ impl MangoGroupContext { name: String::new(), mint_info_address: *pk, decimals: u8::MAX, + closed: true, banks: mi.banks, vaults: mi.vaults, oracle: mi.oracle, @@ -297,6 +299,8 @@ 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 &= + bank.native_deposits() == 0 && bank.native_borrows() == 0 && bank.reduce_only == 1; token.name = bank.name().into(); token.decimals = bank.mint_decimals; token.oracle_config = bank.oracle_config;