-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a789f4
commit ddfb6d9
Showing
11 changed files
with
583 additions
and
177 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//! Reclaims rent from TDAs and Claim Status accounts. | ||
use { | ||
clap::Parser, | ||
log::*, | ||
solana_client::nonblocking::rpc_client::RpcClient, | ||
solana_sdk::{ | ||
commitment_config::CommitmentConfig, pubkey::Pubkey, signature::read_keypair_file, | ||
}, | ||
solana_tip_distributor::reclaim_rent_workflow::reclaim_rent, | ||
std::{path::PathBuf, str::FromStr, time::Duration}, | ||
tokio::runtime::Runtime, | ||
}; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(author, version, about, long_about = None)] | ||
struct Args { | ||
/// RPC to send transactions through. | ||
/// NOTE: This script uses getProgramAccounts, make sure you have added an account index | ||
/// for the tip_distribution_program_id on the RPC node. | ||
#[arg(long, env)] | ||
rpc_url: String, | ||
|
||
/// Tip distribution program ID. | ||
#[arg(long, env, value_parser = Pubkey::from_str)] | ||
tip_distribution_program_id: Pubkey, | ||
|
||
/// The keypair signing and paying for transactions. | ||
#[arg(long, env)] | ||
keypair_path: PathBuf, | ||
|
||
/// Specifies whether to reclaim rent on behalf of validators from respective TDAs. | ||
#[arg(long, env)] | ||
should_reclaim_tdas: bool, | ||
} | ||
|
||
fn main() { | ||
env_logger::init(); | ||
|
||
info!("Starting to claim mev tips..."); | ||
let args: Args = Args::parse(); | ||
|
||
let runtime = Runtime::new().unwrap(); | ||
if let Err(e) = runtime.block_on(reclaim_rent( | ||
RpcClient::new_with_timeout_and_commitment( | ||
args.rpc_url, | ||
// High timeout b/c of get_program_accounts call | ||
Duration::from_secs(60), | ||
CommitmentConfig::confirmed(), | ||
), | ||
args.tip_distribution_program_id, | ||
read_keypair_file(&args.keypair_path).expect("read keypair file"), | ||
args.should_reclaim_tdas, | ||
)) { | ||
panic!("error reclaiming rent: {e:?}"); | ||
} | ||
|
||
info!("done reclaiming all rent",); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.