Carbon Cargo Decoder
Rust decoder for the Star Atlas Cargo program on Solana, generated using Carbon CLI.
Program Information
- Program ID:
Cargo2VNTPPTi9c1vq1Jw5d3BWUNr18MjRtSupAghKEk - Network: Solana Mainnet
- Description: Star Atlas Cargo program for managing resource containers (pods) with dynamic stat tracking, cargo types, and token-based resource management.
Features
- Decodes all Cargo account types
- Full instruction parsing support
- Integration with Carbon indexing framework
- Permission bitflags support for cargo operations
- Support for dynamic cargo stats and pod management
Usage
Add this crate to your Cargo.toml:
[]
= "0.12.0"
Decoding Accounts
use ;
use AccountDecoder;
let decoder = CargoDecoder;
let decoded_account = decoder.decode_account;
if let Some = decoded_account
Working with Permissions
The decoder includes ergonomic permission handling with bitflags:
use CargoPermissions;
// Create permissions from u64 or bytes
let perms = from_u64;
// Check individual permissions
if perms.contains
if perms.contains
if perms.contains
// Combine permissions
let admin_perms = MANAGE_DEFINITION
| CREATE_CARGO_TYPE
| MANAGE_CARGO_TYPE;
// Convert to/from bytes for storage
let bytes = admin_perms.to_le_bytes;
let restored = from_le_bytes;
Account Types
This decoder supports all Cargo account types:
CargoPod- Container for resources with dynamic stat tracking- Contains
cargo_contents: Vec<u64>with the pod's cargo values
- Contains
CargoType- Definition of a specific cargo type with associated stats- Contains
cargo_stats: Vec<u64>with stat values (length =stats_count)
- Contains
CargoStatsDefinition- Global configuration for cargo stat definitions
Permission Flags
The CargoPermissions bitflags type includes:
MANAGE_DEFINITION- Can initialize and update cargo definitionsCREATE_CARGO_TYPE- Can create new cargo typesMANAGE_CARGO_TYPE- Can update existing cargo types
Documentation
Full documentation is available at docs.rs.
Repository
See the main repository for build instructions and contribution guidelines.
License
Licensed under the Apache-2.0 license.