Skip to content

Commit

Permalink
Cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Garfield committed Mar 1, 2022
1 parent 55116c2 commit 63406dd
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 62 deletions.
9 changes: 0 additions & 9 deletions bot/sql/create_tables.sql

This file was deleted.

11 changes: 7 additions & 4 deletions bot/src/bucket.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::collections::HashMap;
use std::sync::{Arc, Mutex};

use solana_sdk::pubkey::Pubkey;
use {
solana_sdk::pubkey::Pubkey,
std::{
collections::HashMap,
sync::{Arc, Mutex},
},
};

pub struct Bucket {
locks: HashMap<(Pubkey, i64), Arc<Mutex<()>>>,
Expand Down
9 changes: 5 additions & 4 deletions bot/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::{HashMap, HashSet};

use cronos_sdk::account::Task;
use solana_sdk::pubkey::Pubkey;
use {
cronos_sdk::account::Task,
solana_sdk::pubkey::Pubkey,
std::collections::{HashMap, HashSet},
};

pub struct TaskCache {
pub data: HashMap<Pubkey, Task>,
Expand Down
25 changes: 14 additions & 11 deletions bot/src/exec.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
use cronos_sdk::account::*;
use solana_client_helpers::Client;
use solana_sdk::instruction::AccountMeta;
use solana_sdk::pubkey::Pubkey;

use std::sync::{Arc, Mutex, RwLock};
use std::thread::{self, JoinHandle};

use crate::bucket::Bucket;
use crate::utils::sign_and_submit;
use crate::{cache::TaskCache, utils::monitor_blocktime};
use {
crate::{
bucket::Bucket,
cache::TaskCache,
utils::{monitor_blocktime, sign_and_submit},
},
cronos_sdk::account::*,
solana_client_helpers::Client,
solana_sdk::{instruction::AccountMeta, pubkey::Pubkey},
std::{
sync::{Arc, Mutex, RwLock},
thread::{self, JoinHandle},
},
};

const LOOKBACK_WINDOW: i64 = 120; // Number of seconds to lookback

Expand Down
29 changes: 14 additions & 15 deletions bot/src/replicate.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// use anchor_lang::prelude::Pubkey;

use cronos_sdk::account::*;
use solana_account_decoder::UiAccountEncoding;
use solana_client::{
pubsub_client::PubsubClient,
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
};
use solana_sdk::{account::Account, commitment_config::CommitmentConfig, pubkey::Pubkey};
use std::{
str::FromStr,
sync::{Arc, RwLock},
thread,
use {
crate::{cache::TaskCache, env},
cronos_sdk::account::*,
solana_account_decoder::UiAccountEncoding,
solana_client::{
pubsub_client::PubsubClient,
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
},
solana_sdk::{account::Account, commitment_config::CommitmentConfig, pubkey::Pubkey},
std::{
str::FromStr,
sync::{Arc, RwLock},
thread,
},
};

use crate::{cache::TaskCache, env};

pub fn replicate_tasks(cache: Arc<RwLock<TaskCache>>) {
thread::spawn(move || {
// Websocket client
Expand Down
24 changes: 10 additions & 14 deletions bot/src/utils/monitor_blocktime.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
use {
solana_client::pubsub_client::PubsubClient,
crate::env,
solana_account_decoder::UiAccountEncoding,
solana_client::{pubsub_client::PubsubClient, rpc_config::RpcAccountInfoConfig},
solana_sdk::{
account::Account,
clock::{Clock, Epoch, Slot, UnixTimestamp},
commitment_config::CommitmentConfig,
pubkey::Pubkey,
},
std::{
str::FromStr,
sync::mpsc::{self, Receiver},
thread,
},
};

use std::str::FromStr;

use solana_account_decoder::UiAccountEncoding;
use solana_client::{rpc_config::RpcAccountInfoConfig};
use solana_sdk::{
account::Account,
clock::{Clock, Epoch, Slot, UnixTimestamp},
commitment_config::CommitmentConfig,
pubkey::Pubkey,
};

use crate::env;

pub fn monitor_blocktime() -> Receiver<i64> {
let (blocktime_sender, blocktime_receiver) = mpsc::channel::<i64>();
thread::spawn(move || {
Expand Down
7 changes: 2 additions & 5 deletions bot/src/utils/sign_and_submit.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use solana_client_helpers::ClientResult;
use solana_sdk::signature::Signature;

use {
solana_client_helpers::Client,
solana_sdk::{instruction::Instruction, transaction::Transaction},
solana_client_helpers::{Client, ClientResult},
solana_sdk::{instruction::Instruction, signature::Signature, transaction::Transaction},
};

pub fn sign_and_submit(
Expand Down

0 comments on commit 63406dd

Please sign in to comment.