The wrap/unwrap layer of POKEBALL: turn $POKEBALL into pokeballs that hunt for you, and exit any time.
This repo is the wrap module of the POKEBALL protocol (full buildable program: pokeballtech/pokeball-protocol).
load_balls(n)
$POKEBALL ──transfer──▶ program vault (authority = PDA) ← leaves your wallet
hunter.balls += n global.total_balls += n ← you're now hunting
unload_balls(n) ← exit whenever, for unused balls
vault ──PDA-signed transfer──▶ your wallet ← $POKEBALL back 1:1
A "ball" is just a counter in your Hunter account, backed by $POKEBALL custodied in the program vault. Loaded balls auto-enter every round — no clicking.
When you load_balls, the $POKEBALL moves out of your wallet into a program-owned vault (its authority is a PDA). From that moment the program, not you, controls the stake. So when one of your balls wins a catch, the program can burn that ball + its $POKEBALL itself (PDA-signed Burn) — no signature from you needed. The winner only signs to receive the NFT.
If the ball stayed an SPL token in your wallet, the program couldn't touch it without your signature at win time. Custody-on-load removes that whole problem and makes "hold a ball = auto-entered" free.
Losers keep their staked balls and roll again next round; unload_balls returns the locked $POKEBALL 1:1 whenever you want out.
| File | Role |
|---|---|
load_balls.rs |
lock $POKEBALL into the vault, credit balls |
unload_balls.rs |
return locked $POKEBALL, drop lottery weight |
state.rs / constants.rs / errors.rs |
Hunter account, ball price, errors |
MIT © pokeballtech