How nikkkitosss/solana-cossack-game works
Cossack Business is a six-program Solana game economy. Players register and search for resources; crafting consumes recipe inputs to create item NFTs; marketplace listings escrow NFTs and purchases burn the NFT while rewarding the seller with MAGIC. Resource management owns resource-token configuration and authorized mint/burn. Edges follow README-described flows and excerpted handlers; unsampled listing, registration, and burn implementation details are not inferred.
Main entry points: search_resources.rs Search Resources · craft_item.rs Craft Item · buy_item.rs Buy Item · mint_item_nft.rs Mint Item NFT
Components 22
Player Activity
- Register Player
programs/search/src/instructions/register_player.rs - Search Resources
programs/search/src/instructions/search_resources.rs - Resource Selection
programs/search/src/utils/randomness.rs - Player Account
programs/search/src/state/player_account.rs
Crafting and Items
- Craft Item
programs/crafting/src/instructions/craft_item.rs - Item Recipes
programs/crafting/src/constants/recipes.rs - Mint Item NFT
programs/item_nft/src/instructions/mint_item_nft.rs - Burn Item NFT
programs/item_nft/src/instructions/burn_item_nft.rs - Item Metadata
programs/item_nft/src/state/item_metadata.rs - NFT Metadata CPI
programs/item_nft/src/utils/metaplex.rs
Marketplace
- Listing Lifecycle
programs/marketplace/src/instructions/list_item.rs - Cancel Listing
programs/marketplace/src/instructions/cancel_listing.rs - Buy Item
programs/marketplace/src/instructions/buy_item.rs - Listing State
programs/marketplace/src/state/listing.rs - NFT Escrow
programs/marketplace/src/utils/cpi_item_nft.rs - Marketplace Config
programs/marketplace/src/state/marketplace_config.rs
Token Programs
- Resource Manager
programs/resource_manager/src/instructions/mint_resource.rs - Burn Resources
programs/resource_manager/src/instructions/burn_resource.rs - Game Configuration
programs/resource_manager/src/state/game_config.rs - MAGIC Token
programs/magic_token/src/instructions/mint_magic.rs
Other components
- Player
- Player
Connections 21
- Player → Register Player: registers
- Player → Search Resources: searches
- Search Resources → Player Account: checks cooldown
programs/search/src/instructions/search_resources.rs - Search Resources → Resource Selection: selects resources
programs/search/src/instructions/search_resources.rs - Search Resources → Resource Manager: mints via CPI
- Player → Craft Item: crafts item
- Craft Item → Item Recipes: validates recipe
programs/crafting/src/instructions/craft_item.rs - Craft Item → Burn Resources: burns inputs
- Craft Item → Mint Item NFT: mints via CPI
- Mint Item NFT → Item Metadata: stores record
programs/item_nft/src/instructions/mint_item_nft.rs - Mint Item NFT → NFT Metadata CPI: creates NFT metadata
programs/item_nft/src/instructions/mint_item_nft.rs - Player → Listing Lifecycle: lists NFT
- Listing Lifecycle → Listing State: records listing
- Listing Lifecycle → NFT Escrow: escrows NFT
- Player → Cancel Listing: cancels listing
- Cancel Listing → NFT Escrow: returns NFT
- Player → Buy Item: buys listing
- Buy Item → Listing State: checks and updates
programs/marketplace/src/instructions/buy_item.rs - Buy Item → Burn Item NFT: burns escrow NFT
- Buy Item → MAGIC Token: mints seller reward
programs/marketplace/src/instructions/buy_item.rs - MAGIC Token → Game Configuration: uses configured mint