This code was AUTOGENERATED using the codama library.
Please DO NOT EDIT THIS FILE, instead use visitors
to add features, then rerun codama to update it.
This code was AUTOGENERATED using the codama library.
Please DO NOT EDIT THIS FILE, instead use visitors
to add features, then rerun codama to update it.
This code was AUTOGENERATED using the codama library.
Please DO NOT EDIT THIS FILE, instead use visitors
to add features, then rerun codama to update it.
The reward one settled play would credit, split into its channels for the
emitted event, as computed by hashrate_reward. loyalty_points + skill_points == total by construction.
Affiliate tag rules, mirroring the program’s Affiliate::validate_tag:
3–16 bytes of a-z, 0-9, _ or -. Checking client-side turns an
invalid tag into an error here instead of an on-chain rejection — or, past
the 32-byte seed limit, a panic inside find_program_address.
Cap on the streak multiplier credited toward the hashrate reward, mirroring
the program’s REWARD_MAX_STREAK. The miner’s live streak
(Miner::current_streak_count) is uncapped; only the multiplier frozen
onto a deployment is clamped here.
Virtual share base used by the on-chain vault math (decimal offset of 3):
conversions behave as if SHARE_OFFSET extra shares and 1 extra satoshi
always exist, so an empty vault mints 1_000 shares per satoshi.
Hashrate multiplier during the post-strike boost window, mirroring the
program’s STRIKE_BOOST_HASHRATE_MULTIPLIER. Pass it as
hashrate_reward’s hashrate_multiplier when
Round::is_hashrate_boosted is set; pass 1 otherwise.
Shares minted for depositing btc_amount BTC into a vault holding
vault_amount BTC with vault_shares shares issued
(SatsVault::btc_amount / SatsVault::btc_shares): scaled by the vault’s
virtual (shares + SHARE_OFFSET) / (assets + 1) ratio and floored, so an
empty vault mints SHARE_OFFSET shares per satoshi. Errors when the
result exceeds u64::MAX.
Derive the AffiliateTag registry PDA, which resolves a referral link’s tag
to the claiming authority. Callers should validate_affiliate_tag first:
a tag over the 32-byte seed limit panics inside find_program_address.
cancel_public_automation: refund the full escrow balance and close the
automation and its token account. Unconditional; in-flight deployments
settle to the miner profile later. Grubstake escrows refund into the
miner’s grubstake instead of the wallet.
claim_sats: redeem shares of the miner’s sats vault shares for BTC and,
coupled to it, the same fraction of their token vault shares for SatRush
tokens. The exit fee is withheld in each vault; the net BTC and tokens
transfer to the authority’s token accounts (created if needed).
claim_token: the mirror of claim_sats with the token side exact —
redeem token_shares for SatRush tokens plus the same fraction of the
miner’s sats vault shares for BTC (zero for a miner who never won BTC).
claim_usd: withdraw amount of the miner authority’s unclaimed USD
winnings from the board’s USD pool to the authority’s USD account. No exit
fee — the full amount transfers.
close_round: tear down a Finished round, sweeping a no-winner round’s
orphaned pot (USD and BTC) into the treasury. Signed by the config’s admin
authority, which receives the round account’s rent.
create_grubstake_airdrop: reserve usd_amount of the pool for
airdrop_authority to claim before expiration_timestamp. airdrop is a
fresh keypair’s pubkey and must also sign the transaction. Fee recipient
only.
create_public_automation funded from the miner’s grubstake balance: the
deposit is pulled from the miner PDA’s USD ATA, and every deployment the
automation creates plays as grubstake-funded.
create_public_automation: escrow deposit_usd_amount and configure the
crank to deploy per_round_usd_amount per round with the given strategy.
One automation per authority.
create_public_automation carrying the affiliate account of
affiliate_authority: binds the miner when this creation initializes it.
The deposit itself accrues no points — volume accrues at execution.
deploy_public funded from the miner’s grubstake balance: the stake is
pulled from the miner PDA’s USD ATA and no hashrate is earned; settled USD
winnings return to the grubstake.
Grubstake-funded deploy_public carrying the affiliate account of
affiliate_authority. The affiliate must match the miner’s bound tag;
bonus-funded deploys accrue no points.
deploy_public: stake amount USD (base units; all fees are deducted from
it, so the miner parts with exactly amount) on the tiles
in selection_mask for round round_id, as the miner authority. The round
must be the board’s current one and open for deploys; the miner profile and
deployment record PDAs are created by the instruction.
deploy_public carrying the affiliate account of affiliate_authority:
binds the miner when this deploy creates it, and accrues the affiliate’s
rate share of the deploy’s protocol fee leg
(protocol_fee × rate_bps / 10_000) as points.
exchange_affiliate_points: convert points_amount of the affiliate’s
spendable points into a grubstake credit on the affiliate’s own miner.
Points are USD base units valued at accrual, so the exchange is 1:1.
execute_public_automation: crank-signed per-round deploy funded from
automation_authority’s escrow. selection_mask must be Some for
Discretionary automations and None otherwise.
Format raw hashrate units as the UI points amount with 2 decimals
(HASHRATE_DECIMALS): raw 101 → "1.01". Lossless for the full u64
range, unlike an f64 conversion.
The protocol’s fixed accounts that belong in its lookup table: everything
rotate_round + swap_round_stake reference, plus the static singletons
and programs the crank paths touch.
migrate_miner: extend a 115-byte v1 miner account to the v2 layout
(affiliate Pubkey + reserved tail, version stamped to 2). Signed by the
config’s admin authority, who also funds the rent top-up.
reclaim_grubstake_automation: sweep a grubstake automation’s escrow back
to the treasury once its owner’s spend window has closed, and close the
automation. Fee recipient only.
reclaim_miner_grubstake: sweep miner_authority’s expired grubstake into
the treasury’s withdrawable protocol fees. Sized from the miner’s grubstake
counter, so anything on the ATA above it is deliberately left behind. Fee
recipient only.
rotate_round: reveal current_round_id’s winning tile, sweep the round’s
accumulated fee legs from the board pool to the epoch/1 BTC/treasury pools
(plus, on a strike trigger, the strike skim’s USD and BTC legs to the epoch
vault), and deploy round current_round_id + 1 as the board’s new active
round. Signed by the config’s round authority; valid once the round’s
window elapsed.
The nine remaining accounts rotate_round takes, in order: the board’s
token ATA, the epoch vault’s token ATA, the token mint, then the
satrush-mint program, its config, mine, oracle and authority PDAs, and the
Orca pool it prices the token on.
set_miner_tag: claim tag for authority, creating the wallet’s
affiliate identity automatically. The affiliate PDA is seeded by the
authority, so a wallet can only ever register once; the tag registry PDA
is seeded by the tag, so a taken tag fails at creation.
settle_deploy_public: settle deployment_authority’s deployment in a
Settled round. authority signs (the owner, or the round authority for
automated deployments); rent_recipient must be the round authority for
automated deployments and the owner for manual ones. Deployments carrying
affiliate points (a referred, wallet-funded play) must be settled with
get_settle_deploy_public_with_affiliate_instruction instead.
settle_deploy_public carrying affiliate — the miner’s bound affiliate
account (Miner::affiliate), credited with the points the deployment
froze at deploy. Required for any deployment whose
affiliate_points_usd_amount is non-zero; ignored by the program
otherwise.
swap_round_stake: relay a pre-built aggregator route that converts part of
the revealed round’s USD into BTC. swap_data and route_accounts are the
route’s opaque instruction data and account list; the on-chain handler
enforces the economics against observed balance deltas. Signed by the
config’s round authority.
top_up_public_automation: move amount USD from the authority’s account
into the automation’s escrow. For grubstake automations use
get_top_up_public_automation_grubstake_instruction — the program only
accepts the matching funding source.
update_board_round_duration: overwrite the board’s round_duration (slots).
Applies to future round activations only; the active round keeps its window.
Signed by the config’s admin authority.
update_deploy_fees: atomically overwrite the five deploy-time fee legs.
Each leg must be at least 1 bps and the legs must sum to exactly 600 bps
(6%); the split may vary but the total never changes. Signed by the
config’s admin authority.
update_deployment_settle_grace_duration: admin retunes the settle grace
window (slots after a round settles before stale deployments may be
force-cleaned; 0 disables cleanup).
update_epoch_vault_iteration_duration: overwrite the config’s epoch vault
iteration length (slots). Applies to the currently accumulating iteration
immediately. Signed by the config’s admin authority.
update_min_deploy_usd_amount: overwrite the config’s minimum gross deploy
size (USD mint base units). Applies to every subsequent manual deploy,
automation creation and automation execution. Signed by the config’s admin
authority.
update_unclaimed_hashrate_bps: overwrite the config’s deferred hashrate
bonus ratio (bps of each settled play’s reward). Signed by the config’s
admin authority.
Streak multiplier a deploy into next_round_id would freeze onto its
PublicDeployment, computed from the miner’s live state without
submitting a transaction. Mirrors Miner::record_play followed by
Miner::get_hashrate_streak_multiplier; feed the result into
crate::hashrate_reward to preview the points a deploy would earn.
BTC value of shares against a vault holding vault_amount BTC with
vault_shares shares issued (SatsVault::btc_amount /
SatsVault::btc_shares). claim_fee_bps is
SatrushConfig::vault_exit_fee_bps; pass 0 when only the gross
value matters. Zero shares value to zero without error; shares
exceeding vault_shares is rejected.