Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fallback oracles in Rust client #838

Merged
merged 25 commits into from
Jan 23, 2024
Merged

Conversation

Lou-Kamades
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the program On-chain program changes label Jan 4, 2024
@Lou-Kamades Lou-Kamades changed the title WIP: Use fallback oracles in Rust client Use fallback oracles in Rust client Jan 10, 2024
lib/client/src/context.rs Outdated Show resolved Hide resolved
lib/client/src/client.rs Outdated Show resolved Hide resolved
bin/keeper/src/main.rs Outdated Show resolved Hide resolved
bin/liquidator/src/liquidate.rs Outdated Show resolved Hide resolved
lib/client/src/account_fetcher.rs Outdated Show resolved Hide resolved
let oracle_acc = &KeyedAccountSharedData::new(bank.oracle, oracle.into());
let price = bank.oracle_price(&OracleAccountInfos::from_reader(oracle_acc), None)?;
let oracle_data = self.fetch_raw(&bank.oracle)?;
let oracle = &KeyedAccountSharedData::new(bank.oracle, oracle_data.into());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like oracle could also be fetched with the new helper?

lib/client/src/client.rs Outdated Show resolved Hide resolved
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracles-client branch 2 times, most recently from e73d551 to fbb0c84 Compare January 11, 2024 21:14
lib/client/src/account_fetcher.rs Outdated Show resolved Hide resolved
lib/client/src/chain_data_fetcher.rs Outdated Show resolved Hide resolved
lib/client/src/client.rs Outdated Show resolved Hide resolved
@Lou-Kamades Lou-Kamades merged commit db98ba5 into dev Jan 23, 2024
13 checks passed
@Lou-Kamades Lou-Kamades deleted the lou/fallback-oracles-client branch January 23, 2024 16:26
Lou-Kamades added a commit that referenced this pull request Jan 24, 2024
* rename usd_opt to usdc_opt in OracleAccountInfos

* use fallbacks when fetching bank+ price in AccountFetcher struct

* feat: add derive_fallback_oracle_keys to MangoGroupContext

* test: properly assert failure CU in test_health_compute_tokens_fallback_oracles

* provide fallback oracle accounts in the rust client

* liquidator: update for fallback oracles

* set fallback config in mango services

* support fallback oracles in rust settler + keeper

* fix send error related to fetching fallbacks dynamically in tcs_start

* drop derive_fallback_oracle_keys_sync

* add fetch_multiple_accounts to AccountFetcher trait

* revert client::new() api

* deriving oracle keys uses account_fetcher

* use client helpers for deriving health_check account_metas

* add health_cache helper to mango client

* add get_slot to account_fetcher

* lint

* cached account fetcher only fetches uncached accounts

* ensure keeper client does not use cached oracles for staleness checks

* address minor review comments

* create unique job keys for CachedAccountFetcher.fetch_multiple_accounts

* fmt

* improve hashing in CachedAccountFetcher.fetch_multiple_accounts

---------

Co-authored-by: Christian Kamm <mail@ckamm.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
program On-chain program changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants