Skip to content

pokeballtech/wrap-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wrap-engine

Solana Anchor license

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).

How it works

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.

The custody trick

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.

Files

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

License

MIT © pokeballtech

About

POKEBALL wrap engine: wrap $POKEBALL into pokeballs with vault custody; exit any time.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages