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 game flow.
25pub game_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/// DEPRECATED — the fixed Sats Vault round budget is gone; the swap
39/// budget is now derived per round (`Round::swap_budget`). Unread; kept
40/// only to preserve the live account layout.
41pub sats_vault_round_fee_bps: u32,
42/// Sats Vault claim fee in basis points.
43pub sats_vault_claim_fee_bps: u32,
44/// Protocol fee in basis points.
45pub protocol_fee_bps: u32,
46/// Share of each settled play's hashrate reward deferred until the sats claim in basis points.
47pub unclaimed_hashrate_bps: u32,
48/// Minimum gross deploy size per round, manual or automated, in USD mint (6 decimals).
49pub min_deploy_usd_amount: u64,
50/// Epoch Vault iteration length in slots.
51pub epoch_vault_iteration_duration: u64,
52/// Grace window, in slots after `Round::settled_at_slot`, during which
53/// only the normal settle path applies; afterward stale deployments
54/// become eligible for third-party cleanup
55pub deployment_settle_grace_duration: u64,
56/// Sat Strike odds: the jackpot fires when `rng % strike_trigger_modulus == 0`
57/// (seeded at 1_440 for ~1/1440 odds; 1 = every round triggers).
58pub strike_trigger_modulus: u16,
59/// Buybacks fee in basis points. Carved out of `reserved`, so
60/// pre-existing accounts read 0 until `update_deploy_fees` sets it.
61pub buybacks_fee_bps: u32,
62/// Reserved
63pub reserved: [u8; 26],
64}
65
66
67pub const SATRUSH_CONFIG_DISCRIMINATOR: [u8; 8] = [113, 169, 164, 118, 148, 217, 160, 200];
68
69impl SatrushConfig {
70      pub const LEN: usize = 287;
71  
72  
73  
74  #[inline(always)]
75  pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
76    let mut data = data;
77    Self::deserialize(&mut data)
78  }
79}
80
81impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for SatrushConfig {
82  type Error = std::io::Error;
83
84  fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result<Self, Self::Error> {
85      let mut data: &[u8] = &(*account_info.data).borrow();
86      Self::deserialize(&mut data)
87  }
88}
89
90#[cfg(feature = "fetch")]
91pub fn fetch_satrush_config(
92  rpc: &solana_rpc_client::rpc_client::RpcClient,
93  address: &solana_address::Address,
94) -> Result<crate::shared::DecodedAccount<SatrushConfig>, std::io::Error> {
95  let accounts = fetch_all_satrush_config(rpc, &[*address])?;
96  Ok(accounts[0].clone())
97}
98
99#[cfg(feature = "fetch")]
100pub fn fetch_all_satrush_config(
101  rpc: &solana_rpc_client::rpc_client::RpcClient,
102  addresses: &[solana_address::Address],
103) -> Result<Vec<crate::shared::DecodedAccount<SatrushConfig>>, std::io::Error> {
104    let accounts = rpc.get_multiple_accounts(addresses)
105      .map_err(|e| std::io::Error::other(e.to_string()))?;
106    let mut decoded_accounts: Vec<crate::shared::DecodedAccount<SatrushConfig>> = Vec::new();
107    for i in 0..addresses.len() {
108      let address = addresses[i];
109      let account = accounts[i].as_ref()
110        .ok_or(std::io::Error::other(format!("Account not found: {address}")))?;
111      let data = SatrushConfig::from_bytes(&account.data)?;
112      decoded_accounts.push(crate::shared::DecodedAccount { address, account: account.clone(), data });
113    }
114    Ok(decoded_accounts)
115}
116
117#[cfg(feature = "fetch")]
118pub fn fetch_maybe_satrush_config(
119  rpc: &solana_rpc_client::rpc_client::RpcClient,
120  address: &solana_address::Address,
121) -> Result<crate::shared::MaybeAccount<SatrushConfig>, std::io::Error> {
122    let accounts = fetch_all_maybe_satrush_config(rpc, &[*address])?;
123    Ok(accounts[0].clone())
124}
125
126#[cfg(feature = "fetch")]
127pub fn fetch_all_maybe_satrush_config(
128  rpc: &solana_rpc_client::rpc_client::RpcClient,
129  addresses: &[solana_address::Address],
130) -> Result<Vec<crate::shared::MaybeAccount<SatrushConfig>>, std::io::Error> {
131    let accounts = rpc.get_multiple_accounts(addresses)
132      .map_err(|e| std::io::Error::other(e.to_string()))?;
133    let mut decoded_accounts: Vec<crate::shared::MaybeAccount<SatrushConfig>> = Vec::new();
134    for i in 0..addresses.len() {
135      let address = addresses[i];
136      if let Some(account) = accounts[i].as_ref() {
137        let data = SatrushConfig::from_bytes(&account.data)?;
138        decoded_accounts.push(crate::shared::MaybeAccount::Exists(crate::shared::DecodedAccount { address, account: account.clone(), data }));
139      } else {
140        decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address));
141      }
142    }
143  Ok(decoded_accounts)
144}
145
146  #[cfg(feature = "anchor")]
147  impl anchor_lang::AccountDeserialize for SatrushConfig {
148      fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
149        Ok(Self::deserialize(buf)?)
150      }
151  }
152
153  #[cfg(feature = "anchor")]
154  impl anchor_lang::AccountSerialize for SatrushConfig {}
155
156  #[cfg(feature = "anchor")]
157  impl anchor_lang::Owner for SatrushConfig {
158      fn owner() -> anchor_lang::solana_program::pubkey::Pubkey {
159        anchor_lang::solana_program::pubkey::Pubkey::from(
160          crate::SATRUSH_ID.to_bytes()
161        )
162      }
163  }
164
165  #[cfg(feature = "anchor-idl-build")]
166  impl anchor_lang::IdlBuild for SatrushConfig {}
167
168  
169  #[cfg(feature = "anchor-idl-build")]
170  impl anchor_lang::Discriminator for SatrushConfig {
171    const DISCRIMINATOR: &[u8] = &[0; 8];
172  }
173