Program instructions
Every instruction of the shader program, with who signs it, its arguments, its accounts, what it emits and what makes it fail.
The shader program is an Anchor program at 7zWT5PFYqHPiztwzvkDAANq7JdsLsV1MaLjFJeTLux22. It holds credit balances, agent keys, the burn queue, the fee share and the Earn pool. Amounts in credits are in credit base units (1,000 per credit); one base unit is one USDC atom. SHDR and NVDAx amounts are in their mints' atoms.
Every instruction that emits an event uses emit_cpi!, so its accounts end with event_authority and program, and an indexer reads events from the program's inner instructions rather than from logs. Errors are listed with their codes on Errors.
Accounts are on Program accounts and events on Events.
#Constants
| Name | Value | Meaning |
|---|---|---|
BPS_DENOMINATOR | 10_000 | Basis points in a whole: fee share is fee_share_bps / 10,000 of used USDC-backed credits. |
REWARD_SCALE | 1_000_000_000_000 | Scale of the Earn accumulator acc_reward_per_share. |
SECONDS_PER_DAY | 86_400 | Length of an agent key's daily window. Days are counted from the Unix epoch, so a window starts at 00:00 UTC. |
NO_AGENT | u8::MAX | The agent value of a settlement line that no agent key spent. |
MAX_LABEL_BYTES | 32 | Longest agent key label, in UTF-8 bytes. |
MAX_SETTLEMENT_LINES | 16 | Most lines one settle instruction accepts. The settler sends fewer: at most 8 lines, and 2 when the lines carry meter seals, to fit the 1,232-byte transaction limit. |
#Credits
#deposit_usdc(amount)
Creates the wallet's CreditAccount on first use, moves amount USDC atoms from the wallet to the treasury, and credits what actually arrived, one base unit per atom. A SOL or xStock deposit is a Jupiter swap to USDC followed by this instruction in the same transaction.
Signed by: The depositing wallet.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | USDC atoms to deposit. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
config | yes | PDA "config" | Config. | |
credit_account | yes | PDA "credit", wallet | The wallet's CreditAccount. | |
usdc_mint | USDC mint. | |||
wallet_usdc | yes | The wallet's USDC token account. | ||
usdc_treasury | yes | associated token account | USDC token account owned by Config. | |
usdc_token_program | Token program that owns the USDC mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
system_program | 11111111111111111111111111111111 | System program. | ||
rent | SysvarRent111111111111111111111111111111111 | Rent sysvar. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits UsdcDeposited.
Can fail with CreditAccountWrongWallet, InvalidMint, MathOverflow, NoTokensReceived, TokenProgramMismatch, TreasuryBalanceDecreased, ZeroAmount.
#deposit_shdr(shdr_amount, credits, expires_at)
Moves SHDR from the wallet into escrow and books the quoted credits as SHDR-backed, with the SHDR atoms that arrived tied to them. Fails once expires_at has passed.
Signed by: The depositing wallet, then the price signer, which co-signs after the wallet to attest the quote.
| Argument | Type | Meaning |
|---|---|---|
shdr_amount | u64 | SHDR atoms to deposit. |
credits | u64 | Credits the quote gives, in base units. |
expires_at | i64 | Unix time the quote expires. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
price_signer | yes | The price signer in Config. | ||
config | yes | PDA "config" | Config. | |
credit_account | yes | PDA "credit", wallet | The wallet's CreditAccount. | |
shdr_mint | SHDR mint. | |||
wallet_shdr | yes | The wallet's SHDR token account. | ||
shdr_escrow | yes | associated token account | SHDR token account owned by Config. | |
shdr_token_program | Token program that owns the SHDR mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
system_program | 11111111111111111111111111111111 | System program. | ||
rent | SysvarRent111111111111111111111111111111111 | Rent sysvar. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ShdrDeposited.
Can fail with CreditAccountWrongWallet, EscrowBalanceDecreased, InvalidMint, MathOverflow, NoTokensReceived, QuoteExpired, ShdrMintNotSet, TokenProgramMismatch, Unauthorized, ZeroAmount, ZeroCredits.
#Agent keys
#create_agent_key(key_id, label, per_request_cap, per_day_cap)
Creates an AgentKey with its caps. The API token bound to it is returned once, after this transaction confirms.
Signed by: The wallet giving the key.
| Argument | Type | Meaning |
|---|---|---|
key_id | [u8; 32] | Token identifier, 32 bytes; also a PDA seed. |
label | string | Name, at most 32 bytes. |
per_request_cap | u64 | Per-request cap, base units. |
per_day_cap | u64 | Per-day cap, base units. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
agent_key | yes | PDA "agent_key", wallet, key_id | The AgentKey. | |
system_program | 11111111111111111111111111111111 | System program. | ||
rent | SysvarRent111111111111111111111111111111111 | Rent sysvar. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits AgentKeyCreated.
Can fail with InvalidLabel.
#update_agent_key(per_request_cap, per_day_cap)
Replaces both caps of an active key.
Signed by: The key's wallet.
| Argument | Type | Meaning |
|---|---|---|
per_request_cap | u64 | New per-request cap, base units. |
per_day_cap | u64 | New per-day cap, base units. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
agent_key | yes | PDA "agent_key", wallet, key_id | The AgentKey. | |
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits AgentKeyUpdated.
Can fail with AgentKeyRevoked, AgentKeyWrongWallet.
#revoke_agent_key()
Marks the key revoked for good. Settlement refuses every later line that names it.
Signed by: The key's wallet.
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
agent_key | yes | PDA "agent_key", wallet, key_id | The AgentKey. | |
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits AgentKeyRevokedEvent.
Can fail with AgentKeyRevoked, AgentKeyWrongWallet.
#Settlement
#settle(expected_nonce, lines)
Debits one CreditAccount for up to 16 lines and emits one Receipt per line. A metered rental line carries its MeterProof, and the transaction must carry one Ed25519 instruction ahead of settle with the seal for each such line, rebuilt from the line and the job's RentalMeter (passed in the remaining accounts) and signed by the pinned meter key. The program reads it through the Instructions sysvar, and requires units no more than the seal's count and minutes that strictly increase. With require_meter on, a rental line without a seal is refused. Each line is charged what it asks for or, if the balance is lower, the whole balance. SHDR-backed credits are spent first, and the SHDR tied to them moves to the burn queue. A line with an agent key must not ask for more than the key's per-request cap, and the amount charged must keep the key inside its per-day cap.
Signed by: The configured settler.
| Argument | Type | Meaning |
|---|---|---|
expected_nonce | u64 | The credit account's current settle_nonce. A replayed or reordered settlement fails. |
lines | Vec<SettlementLine> | The lines, 1 to 16. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
settler | yes | yes | The settler in Config. | |
config | yes | PDA "config" | Config. | |
credit_account | yes | PDA "credit", wallet | The wallet's CreditAccount. | |
instructions | Sysvar1nstructions1111111111111111111111111 | The Instructions sysvar, to read the Ed25519 seal checks. | ||
system_program | 11111111111111111111111111111111 | System program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits Receipt.
Can fail with AgentKeyIndexOutOfBounds, AgentKeyNotWritable, AgentKeyRevoked, AgentKeyWrongWallet, CreditAccountNotInitialized, EmptySettlement, InvalidAgentKey, InvalidSettlementKind, MathOverflow, MathUnderflow, MeterAccountMissing, MeterAlreadyClosed, MeterRentalOnly, MeterRequired, NonceMismatch, PerDayCapExceeded, PerRequestCapExceeded, TooManySettlementLines, Unauthorized.
#Fee share and burn
#record_x402_revenue(amount, reference)
Records USDC that x402 payments brought into the treasury, generation payments and rental charges alike, so it counts toward the fee share the same way used USDC-backed credits do. Refused if the treasury could not then cover outstanding credits and the fee share.
Signed by: The configured settler.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | USDC atoms received. |
reference | [u8; 32] | A 32-byte id of the payment it records. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
settler | yes | The settler in Config. | ||
config | yes | PDA "config" | Config. | |
usdc_mint | USDC mint. | |||
usdc_treasury | associated token account | USDC token account owned by Config. | ||
usdc_token_program | Token program that owns the USDC mint. | |||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits X402RevenueRecorded.
Can fail with InvalidMint, MathOverflow, MathUnderflow, TokenProgramMismatch, Unauthorized, X402RevenueExceedsTreasury, ZeroAmount.
#sweep_fee_share()
Pays floor(used_usdc_unswept × fee_share_bps / 10,000) USDC from the treasury to the launch wallet's USDC account and clears used_usdc_unswept.
Signed by: Anyone; the hourly crank in practice.
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
cranker | yes | Any signer. | ||
config | yes | PDA "config" | Config. | |
usdc_mint | USDC mint. | |||
usdc_treasury | yes | associated token account | USDC token account owned by Config. | |
launch_wallet | The launch wallet in Config. | |||
launch_usdc_ata | yes | associated token account | The launch wallet's USDC associated token account. | |
usdc_token_program | Token program that owns the USDC mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits FeeSwept.
Can fail with InvalidLaunchWallet, InvalidMint, MathOverflow, MathUnderflow, TokenProgramMismatch.
#burn_used()
Burns every SHDR atom in shdr_atoms_pending_burn from escrow. Fails until the SHDR mint is set.
Signed by: Anyone; the hourly crank in practice.
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
cranker | yes | Any signer. | ||
config | yes | PDA "config" | Config. | |
shdr_mint | yes | SHDR mint. | ||
shdr_escrow | yes | associated token account | SHDR token account owned by Config. | |
shdr_token_program | Token program that owns the SHDR mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ShdrBurned.
Can fail with InvalidMint, MathOverflow, ShdrMintNotSet, TokenProgramMismatch.
#Earn
#stake(amount)
Creates the wallet's EarnStake on first use, accrues what it has earned so far, and moves SHDR into the stake vault.
Signed by: The staking wallet.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | SHDR atoms to stake. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
config | PDA "config" | Config. | ||
earn_pool | yes | PDA "earn" | EarnPool. | |
earn_stake | yes | PDA "stake", wallet | The wallet's EarnStake. | |
shdr_mint | SHDR mint. | |||
wallet_shdr | yes | The wallet's SHDR token account. | ||
shdr_stake_vault | yes | associated token account | SHDR token account owned by EarnPool. | |
shdr_token_program | Token program that owns the SHDR mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
system_program | 11111111111111111111111111111111 | System program. | ||
rent | SysvarRent111111111111111111111111111111111 | Rent sysvar. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits Staked.
Can fail with InvalidMint, MathOverflow, MathUnderflow, NoTokensReceived, ShdrMintNotSet, StakeVaultBalanceDecreased, StakeWrongWallet, TokenProgramMismatch, ZeroAmount.
#unstake(amount)
Accrues earnings, then sends amount SHDR back to the wallet. Accrued NVDAx stays pending until claimed.
Signed by: The staking wallet.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | SHDR atoms to withdraw. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
config | PDA "config" | Config. | ||
earn_pool | yes | PDA "earn" | EarnPool. | |
earn_stake | yes | PDA "stake", wallet | The wallet's EarnStake. | |
shdr_mint | SHDR mint. | |||
wallet_shdr | yes | The wallet's SHDR token account. | ||
shdr_stake_vault | yes | associated token account | SHDR token account owned by EarnPool. | |
shdr_token_program | Token program that owns the SHDR mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits Unstaked.
Can fail with InsufficientStake, InvalidMint, MathOverflow, MathUnderflow, ShdrMintNotSet, StakeWrongWallet, TokenProgramMismatch, ZeroAmount.
#claim()
Accrues earnings and sends every pending NVDAx atom to the wallet.
Signed by: The staking wallet.
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
wallet | yes | yes | The wallet acting. | |
config | PDA "config" | Config. | ||
earn_pool | yes | PDA "earn" | EarnPool. | |
earn_stake | yes | PDA "stake", wallet | The wallet's EarnStake. | |
nvdax_mint | NVDAx mint. | |||
nvdax_reward_vault | yes | associated token account | NVDAx token account owned by EarnPool. | |
wallet_nvdax | yes | The wallet's NVDAx token account. | ||
nvdax_token_program | Token program that owns the NVDAx mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits Claimed.
Can fail with InvalidMint, MathOverflow, MathUnderflow, ShdrMintNotSet, StakeWrongWallet, TokenProgramMismatch.
#fund_earn(amount)
Moves NVDAx into the reward vault and shares what arrived, plus anything undistributed, across all stakes pro rata. With nothing staked, it waits in undistributed.
Signed by: The funding wallet; the hourly crank signs as the launch wallet after buying NVDAx.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | NVDAx atoms to add. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
funder | yes | yes | The wallet adding NVDAx. | |
config | PDA "config" | Config. | ||
earn_pool | yes | PDA "earn" | EarnPool. | |
nvdax_mint | NVDAx mint. | |||
funder_nvdax | yes | The funder's NVDAx token account. | ||
nvdax_reward_vault | yes | associated token account | NVDAx token account owned by EarnPool. | |
nvdax_token_program | Token program that owns the NVDAx mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits EarnFunded.
Can fail with InvalidMint, MathOverflow, MathUnderflow, NoTokensReceived, RewardVaultBalanceDecreased, ShdrMintNotSet, TokenProgramMismatch, ZeroAmount.
#Administration
#initialize(args)
Creates Config and the USDC treasury.
Signed by: The admin.
| Argument | Type | Meaning |
|---|---|---|
args | InitializeArgs | See InitializeArgs. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | yes | PDA "config" | Config. | |
usdc_mint | USDC mint. | |||
nvdax_mint | NVDAx mint. | |||
usdc_treasury | yes | associated token account | USDC token account owned by Config. | |
usdc_token_program | Token program that owns the USDC mint. | |||
nvdax_token_program | Token program that owns the NVDAx mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
system_program | 11111111111111111111111111111111 | System program. | ||
rent | SysvarRent111111111111111111111111111111111 | Rent sysvar. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ConfigInitialized.
Can fail with CreditAccountWrongWallet, InvalidAuthority, InvalidFeeShareBps, InvalidMint, TokenProgramMismatch.
#update_config(args)
Changes any of the admin, settler, price signer, launch wallet or fee share rate.
Signed by: The current admin.
| Argument | Type | Meaning |
|---|---|---|
args | UpdateConfigArgs | See UpdateConfigArgs. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | yes | PDA "config" | Config. | |
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ConfigUpdated.
Can fail with InvalidAuthority, InvalidFeeShareBps, Unauthorized.
#set_require_meter(require_meter)
Turns require_meter on or off. Off in production until the meter template is live; the API refuses to turn it on while an unmetered rental runs.
Signed by: The admin.
| Argument | Type | Meaning |
|---|---|---|
require_meter | bool | The new setting. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | The admin in Config. | ||
config | yes | PDA "config" | Config. |
Can fail with Unauthorized.
#migrate_config()
Grows Config by one byte to the layout with require_meter, paying any extra rent. Runs once on a Config written by an earlier program version.
Signed by: The admin.
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | yes | PDA "config" | Config. | |
system_program | 11111111111111111111111111111111 | System program. |
Can fail with ConfigLayoutNotMigratable, Unauthorized.
#set_shdr_mint()
Runs once, after SHDR exists: records the mint and creates the SHDR escrow, the EarnPool, the SHDR stake vault and the NVDAx reward vault.
Signed by: The admin.
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | yes | PDA "config" | Config. | |
shdr_mint | SHDR mint. | |||
nvdax_mint | NVDAx mint. | |||
earn_pool | yes | PDA "earn" | EarnPool. | |
shdr_escrow | yes | associated token account | SHDR token account owned by Config. | |
shdr_stake_vault | yes | associated token account | SHDR token account owned by EarnPool. | |
nvdax_reward_vault | yes | associated token account | NVDAx token account owned by EarnPool. | |
shdr_token_program | Token program that owns the SHDR mint. | |||
nvdax_token_program | Token program that owns the NVDAx mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
system_program | 11111111111111111111111111111111 | System program. | ||
rent | SysvarRent111111111111111111111111111111111 | Rent sysvar. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ShdrMintSet.
Can fail with InvalidMint, ShdrMintAlreadySet, TokenProgramMismatch, Unauthorized.
#withdraw_revenue(amount)
Moves USDC out of the treasury, never more than the treasury holds beyond outstanding USDC-backed credits and the unswept fee share.
Signed by: The admin.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | USDC atoms. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | yes | PDA "config" | Config. | |
usdc_mint | USDC mint. | |||
usdc_treasury | yes | associated token account | USDC token account owned by Config. | |
destination | yes | Admin-chosen token account that receives the withdrawal. | ||
usdc_token_program | Token program that owns the USDC mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits RevenueWithdrawn.
Can fail with InvalidMint, MathOverflow, MathUnderflow, TokenProgramMismatch, Unauthorized, WithdrawExceedsRevenue, ZeroAmount.
#withdraw_excess_shdr(amount)
Recovers SHDR sent to the escrow directly, only once no SHDR-backed credits or pending burns remain.
Signed by: The admin.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | SHDR atoms. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | PDA "config" | Config. | ||
shdr_mint | SHDR mint. | |||
shdr_escrow | yes | associated token account | SHDR token account owned by Config. | |
destination | yes | Admin-chosen token account that receives the withdrawal. | ||
shdr_token_program | Token program that owns the SHDR mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ExcessShdrWithdrawn.
Can fail with ExcessWithdrawalExceedsAvailable, InvalidMint, ShdrEscrowStillOwed, ShdrMintNotSet, TokenProgramMismatch, Unauthorized, ZeroAmount.
#withdraw_excess_stake(amount)
Recovers SHDR in the stake vault above total_staked.
Signed by: The admin.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | SHDR atoms. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | PDA "config" | Config. | ||
earn_pool | PDA "earn" | EarnPool. | ||
shdr_mint | SHDR mint. | |||
shdr_stake_vault | yes | associated token account | SHDR token account owned by EarnPool. | |
destination | yes | Admin-chosen token account that receives the withdrawal. | ||
shdr_token_program | Token program that owns the SHDR mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ExcessStakeWithdrawn.
Can fail with ExcessWithdrawalExceedsAvailable, InvalidMint, ShdrMintNotSet, TokenProgramMismatch, Unauthorized, ZeroAmount.
#withdraw_excess_rewards(amount)
Recovers NVDAx in the reward vault above what is funded and unclaimed.
Signed by: The admin.
| Argument | Type | Meaning |
|---|---|---|
amount | u64 | NVDAx atoms. |
| Account | Signer | Writable | Address | Meaning |
|---|---|---|---|---|
admin | yes | yes | The admin in Config. | |
config | PDA "config" | Config. | ||
earn_pool | PDA "earn" | EarnPool. | ||
nvdax_mint | NVDAx mint. | |||
nvdax_reward_vault | yes | associated token account | NVDAx token account owned by EarnPool. | |
destination | yes | Admin-chosen token account that receives the withdrawal. | ||
nvdax_token_program | Token program that owns the NVDAx mint. | |||
associated_token_program | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL | Associated Token Account program. | ||
event_authority | PDA "__event_authority" | Anchor event authority PDA, ["__event_authority"]. | ||
program | The shader program itself, for emit_cpi!. |
Emits ExcessRewardsWithdrawn.
Can fail with ExcessWithdrawalExceedsAvailable, InvalidMint, MathUnderflow, ShdrMintNotSet, TokenProgramMismatch, Unauthorized, ZeroAmount.
#Types
#SettlementLine
One job's charge inside a settle instruction.
| Field | Type | Meaning |
|---|---|---|
job_id | [u8; 16] | Job identifier, 16 bytes. |
kind | u8 | 0 rental, 1 generation. |
units | u64 | Seconds for a rental, the job's unit count for a generation. |
credits | u64 | Credits asked for, in base units. |
agent | u8 | Index into the instruction's remaining accounts of the AgentKey that spent, or 255 (NO_AGENT). |
meter | Option<MeterProof> | For a metered rental line, its MeterProof; absent on generation lines and unmetered rental lines. |
#MeterProof
The meter evidence for one rental line: the sealed minute it charges.
| Field | Type | Meaning |
|---|---|---|
minute | u32 | The minute index the line charges. |
count | u32 | Signed seconds in that minute, as sealed; the line's units must not exceed it. |
digest | [u8; 32] | The minute digest the seal covers. |
meter_key | Option<pubkey> | The meter key, on the job's first metered line only, to create RentalMeter. |
gpu_uuid_hash | Option<[u8; 32]> | SHA-256 of the GPU UUID, on the first line only. |
last | bool | True on the job's final line, which closes RentalMeter. |
#InitializeArgs
Arguments of initialize.
| Field | Type | Meaning |
|---|---|---|
settler | pubkey | Key allowed to sign settle. |
price_signer | pubkey | Key that attests SHDR quotes. |
launch_wallet | pubkey | Fee share recipient. |
usdc_mint | pubkey | USDC mint. |
nvdax_mint | pubkey | NVDAx mint. |
fee_share_bps | u16 | Fee share rate, at most 10,000. |
#UpdateConfigArgs
Arguments of update_config. Each field left empty keeps its value.
| Field | Type | Meaning |
|---|---|---|
admin | Option<pubkey> | New admin. |
settler | Option<pubkey> | New settler. |
price_signer | Option<pubkey> | New price signer. |
launch_wallet | Option<pubkey> | New launch wallet. |
fee_share_bps | Option<u16> | New fee share rate, at most 10,000. |