Skip to main content

satrush_client/generated/accounts/
satrush_config.rs

1//! This code was AUTOGENERATED using the codama library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun codama to update it.
4//!
5//! <https://github.com/codama-idl/codama>
6//!
7
8use solana_address::Address;
9use borsh::BorshSerialize;
10use borsh::BorshDeserialize;
11
12
13#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
14pub struct SatrushConfig {
15pub discriminator: [u8; 8],
16/// Struct version.
17pub version: u16,
18/// Bump seed for the config account.
19pub bump: u8,
20/// Owner of the program. Can change ownership and set the admin of the program.
21pub owner_authority: Address,
22/// Current update authority address for both Config and other PDAs - can be updated.
23pub admin_authority: Address,
24/// Address of the authority controlling the round flow.
25pub round_authority: Address,
26/// Protocol fees recipient address.
27pub fee_recipient: Address,
28/// USD mint address, initially USDC
29pub usd_mint: Address,
30/// BTC mint address, initially cbBTC
31pub btc_mint: Address,
32/// Strike jackpot fee in basis points.
33pub strike_fee_bps: u32,
34/// Epoch Vault fee in basis points.
35pub epoch_fee_bps: u32,
36/// 1 BTC Vault fee in basis points.
37pub one_btc_fee_bps: u32,
38/// Sats Vault fee in basis points.
39pub sats_vault_round_fee_bps: u32,
40/// Sats Vault claim fee in basis points.
41pub sats_vault_claim_fee_bps: u32,
42/// Protocol fee in basis points.
43pub protocol_fee_bps: u32,
44/// Share of each settled play's hashrate reward deferred until the sats claim in basis points.
45pub unclaimed_hashrate_bps: u32,
46/// Minimum gross deploy size per round, manual or automated, in USD mint (6 decimals).
47pub min_deploy_usd_amount: u64,
48/// Epoch Vault iteration length in slots.
49pub epoch_vault_iteration_duration: u64,
50/// Grace window, in slots after `Round::settled_at_slot`, during which
51/// only the normal settle path applies; afterward stale deployments
52/// become eligible for third-party cleanup
53pub deployment_settle_grace_duration: u64,
54/// Reserved
55pub reserved: [u8; 32],
56}
57
58
59pub const SATRUSH_CONFIG_DISCRIMINATOR: [u8; 8] = [113, 169, 164, 118, 148, 217, 160, 200];
60
61impl SatrushConfig {
62      pub const LEN: usize = 287;
63  
64  
65  
66  #[inline(always)]
67  pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
68    let mut data = data;
69    Self::deserialize(&mut data)
70  }
71}
72
73impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for SatrushConfig {
74  type Error = std::io::Error;
75
76  fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result<Self, Self::Error> {
77      let mut data: &[u8] = &(*account_info.data).borrow();
78      Self::deserialize(&mut data)
79  }
80}
81
82#[cfg(feature = "fetch")]
83pub fn fetch_satrush_config(
84  rpc: &solana_rpc_client::rpc_client::RpcClient,
85  address: &solana_address::Address,
86) -> Result<crate::shared::DecodedAccount<SatrushConfig>, std::io::Error> {
87  let accounts = fetch_all_satrush_config(rpc, &[*address])?;
88  Ok(accounts[0].clone())
89}
90
91#[cfg(feature = "fetch")]
92pub fn fetch_all_satrush_config(
93  rpc: &solana_rpc_client::rpc_client::RpcClient,
94  addresses: &[solana_address::Address],
95) -> Result<Vec<crate::shared::DecodedAccount<SatrushConfig>>, std::io::Error> {
96    let accounts = rpc.get_multiple_accounts(addresses)
97      .map_err(|e| std::io::Error::other(e.to_string()))?;
98    let mut decoded_accounts: Vec<crate::shared::DecodedAccount<SatrushConfig>> = Vec::new();
99    for i in 0..addresses.len() {
100      let address = addresses[i];
101      let account = accounts[i].as_ref()
102        .ok_or(std::io::Error::other(format!("Account not found: {address}")))?;
103      let data = SatrushConfig::from_bytes(&account.data)?;
104      decoded_accounts.push(crate::shared::DecodedAccount { address, account: account.clone(), data });
105    }
106    Ok(decoded_accounts)
107}
108
109#[cfg(feature = "fetch")]
110pub fn fetch_maybe_satrush_config(
111  rpc: &solana_rpc_client::rpc_client::RpcClient,
112  address: &solana_address::Address,
113) -> Result<crate::shared::MaybeAccount<SatrushConfig>, std::io::Error> {
114    let accounts = fetch_all_maybe_satrush_config(rpc, &[*address])?;
115    Ok(accounts[0].clone())
116}
117
118#[cfg(feature = "fetch")]
119pub fn fetch_all_maybe_satrush_config(
120  rpc: &solana_rpc_client::rpc_client::RpcClient,
121  addresses: &[solana_address::Address],
122) -> Result<Vec<crate::shared::MaybeAccount<SatrushConfig>>, std::io::Error> {
123    let accounts = rpc.get_multiple_accounts(addresses)
124      .map_err(|e| std::io::Error::other(e.to_string()))?;
125    let mut decoded_accounts: Vec<crate::shared::MaybeAccount<SatrushConfig>> = Vec::new();
126    for i in 0..addresses.len() {
127      let address = addresses[i];
128      if let Some(account) = accounts[i].as_ref() {
129        let data = SatrushConfig::from_bytes(&account.data)?;
130        decoded_accounts.push(crate::shared::MaybeAccount::Exists(crate::shared::DecodedAccount { address, account: account.clone(), data }));
131      } else {
132        decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address));
133      }
134    }
135  Ok(decoded_accounts)
136}
137
138  #[cfg(feature = "anchor")]
139  impl anchor_lang::AccountDeserialize for SatrushConfig {
140      fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
141        Ok(Self::deserialize(buf)?)
142      }
143  }
144
145  #[cfg(feature = "anchor")]
146  impl anchor_lang::AccountSerialize for SatrushConfig {}
147
148  #[cfg(feature = "anchor")]
149  impl anchor_lang::Owner for SatrushConfig {
150      fn owner() -> anchor_lang::solana_program::pubkey::Pubkey {
151        anchor_lang::solana_program::pubkey::Pubkey::from(
152          crate::SATRUSH_ID.to_bytes()
153        )
154      }
155  }
156
157  #[cfg(feature = "anchor-idl-build")]
158  impl anchor_lang::IdlBuild for SatrushConfig {}
159
160  
161  #[cfg(feature = "anchor-idl-build")]
162  impl anchor_lang::Discriminator for SatrushConfig {
163    const DISCRIMINATOR: &[u8] = &[0; 8];
164  }
165