Skip to content

Commit

Permalink
use AccountFetcherDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Oct 19, 2023
1 parent a250788 commit ca3b6ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions bin/service-mango-pnl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ use jsonrpsee::http_server::HttpServerHandle;
use mango_feeds_connector::{
grpc_plugin_source, metrics, EntityFilter, FilterConfig, MetricsConfig, SourceConfig,
};
use mango_feeds_connector::feeds_chain_data_fetcher::FeedsAccountFetcher;
use mango_v4_client::chain_data_fetcher::AccountFetcherDelegate;

fn start_jsonrpc_server(
config: JsonRpcConfig,
Expand Down Expand Up @@ -272,8 +274,8 @@ async fn main() -> anyhow::Result<()> {
.await?,
);
let chain_data = Arc::new(RwLock::new(chain_data::ChainData::new()));
let account_fetcher = Arc::new(chain_data_fetcher::AccountFetcherDelegate {
chain_data: chain_data.clone(),
let account_fetcher = Arc::new(AccountFetcherDelegate {
base_fetcher: FeedsAccountFetcher { chain_data: chain_data.clone() },
rpc: client.rpc_async(),
});

Expand Down
8 changes: 6 additions & 2 deletions bin/settler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use itertools::Itertools;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use std::collections::HashSet;
use mango_v4_client::chain_data::FeedsAccountFetcher;
use mango_v4_client::chain_data_fetcher::AccountFetcherDelegate;

pub mod metrics;
pub mod settle;
Expand Down Expand Up @@ -110,8 +112,10 @@ async fn main() -> anyhow::Result<()> {
// The representation of current on-chain account data
let chain_data = Arc::new(RwLock::new(chain_data::ChainData::new()));
// Reading accounts from chain_data
let account_fetcher = Arc::new(chain_data_fetcher::AccountFetcherDelegate {
chain_data: chain_data.clone(),
let account_fetcher = Arc::new(AccountFetcherDelegate {
base_fetcher: FeedsAccountFetcher {
chain_data: chain_data.clone()
},
rpc: client.rpc_async(),
});

Expand Down

0 comments on commit ca3b6ca

Please sign in to comment.