Gridsteal
Smart Contract

Program Reference

Program ID, all 9 instructions, PDA seeds, account layouts, and fee constants for the Gridsteal Anchor program.

Program Details

On-chain identity and network.

Deployment Info
Program IDAWNUk1NmmNkaQvjFyrmKcS7Y13mD2PjWVWiiV4tRwrKW
NetworkSolana Mainnet-beta
FrameworkAnchor v0.30
LanguageRust
Module namegridsteal
Upgradeable — deployer holds authority

The program is upgradeable. The deployer holds the upgrade authority. A future audit will precede any upgrade authority burn.

No admin-only instructions

There is no admin instruction. The GlobalConfig stores the treasury wallet address, but no instruction changes program logic after deployment.

All state is on-chain

GridState and TileState are the canonical source of truth. No off-chain database is authoritative. The frontend reads directly from program accounts via getProgramAccounts.

Instructions

All 9 callable instructions and their purpose.

Discriminators use the seed pattern "global:instruction_name" — the first 8 bytes of SHA-256 of that string.

initialize(treasury: Pubkey)

One-time setup. Creates the GlobalConfig PDA and sets the treasury wallet. Called once by the deployer at program deployment.

launch_coin(name, symbol, uri, starting_price)

Creates a GridState PDA and Vault PDA for a given SPL mint. The caller becomes the grid creator permanently. The grid is immediately live and tiles are claimable.

acquire_tile(seat_index: u8, new_price: u64)

Claims an empty tile OR buys out an existing holder. The buyer sets their own listed price at claim time. First claim: grid starting price + 5% of new_price as deposit (no fee). Buyout: existing price + 20% fee + 5% of new_price as deposit. Seller receives 100% of their listed price + their deposit back atomically.

set_price(new_price: u64)

Updates the holder's listed tile price. Subject to 20-minute cooldown. Tax is accrued at the old price before the new price takes effect.

add_deposit(amount: u64)

Transfers SOL from holder's wallet to vault, increasing deposit balance. Tax is accrued first, then reward_debt is reset to reflect the new deposit level.

withdraw_deposit(amount: u64)

Pulls excess deposit back to the holder's wallet. Cannot reduce deposit below 5% of listed price. Tax is accrued first.

abandon_seat()

Holder voluntarily gives up their tile. Remaining deposit is refunded. Tile resets to unowned state at the grid's starting_price.

claim_reward()

Transfers accumulated rewards (Harberger tax share + buyout fee share) from vault to holder. Amount is proportional to deposit weight in the grid.

inject_rewards(amount: u64)

Anyone can inject SOL directly into the grid's reward accumulator. Useful for creator incentive campaigns, partnerships, or bootstrapping a new grid.

PDA Seeds

Deterministic account addresses for all program accounts.

All accounts are Program Derived Addresses. The frontend derives these off-chain before submitting transactions. Seeds must match the program exactly.

PDA Seed Table
GlobalConfig["global-config-v3"]
GridState["grid", mint_pubkey]
TileState["tile", mint_pubkey, seat_index_byte]
Vault["vault", mint_pubkey]
// TypeScript — derive TileState for seat index 7 const [tileState] = PublicKey.findProgramAddressSync( [Buffer.from("tile"), mint.toBuffer(), Buffer.from([7])], PROGRAM_ID ) // Vault for a given mint const [vault] = PublicKey.findProgramAddressSync( [Buffer.from("vault"), mint.toBuffer()], PROGRAM_ID )
⚠ seat_index is a single byte (u8), valid range 0–99. Passing a value outside that range succeeds at the PDA derivation level but will be rejected by the program at runtime.

Fee Constants

All hardcoded rates in the program.

Program Constants (lib.rs)
TAX_RATE_BPS500 → 5% monthly Harberger tax
BUYOUT_FEE_BPS2000 → 20% total buyout fee
TILE_HOLDER_FEE_BPS1000 → 10% of price → accumulator
CREATOR_FEE_BPS500 → 5% of price → creator wallet
TREASURY_FEE_BPS500 → 5% of price → treasury wallet
MIN_DEPOSIT_BPS500 → 5% of price = minimum deposit
COOLDOWN_SECS1200 → 20 minutes between price changes
ONE_MONTH_SECS2,592,000 → seconds per month (tax proration)
PRECISION1,000,000,000,000 → fixed-point for accumulator
ℹ️ TAX_RATE_BPS is 5% monthly. At a 1.00 SOL listed price, monthly tax = 0.05 SOL (~0.00167 SOL/day). A 5% minimum deposit of 0.05 SOL gives roughly 30 days of runway.
GridState Layout (359 bytes + 8 discriminator)
mintPubkey — 32 bytes
creatorPubkey — 32 bytes
starting_priceu64 — 8 bytes
total_depositedu64 — 8 bytes
nameString max 32 — 36 bytes
symbolString max 10 — 14 bytes
uriString max 200 — 204 bytes
total_feesu64 — 8 bytes
reward_accumulatoru128 — 16 bytes
bumpu8 — 1 byte
TileState Layout (114 bytes + 8 discriminator)
mintPubkey — 32 bytes
holderPubkey — 32 bytes (default = empty tile)
seat_indexu8 — 1 byte
priceu64 — 8 bytes
depositu64 — 8 bytes
last_tax_timei64 — 8 bytes
last_price_change_timei64 — 8 bytes
reward_debtu128 — 16 bytes
bumpu8 — 1 byte