This commit is contained in:
microwavedcola1 2024-04-24 12:18:10 +00:00 committed by GitHub
commit 4841e11b2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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;