| Crates.io | carbon-points-store-decoder |
| lib.rs | carbon-points-store-decoder |
| version | 0.12.1 |
| created_at | 2025-11-05 15:19:53.563138+00 |
| updated_at | 2026-01-21 23:33:23.649533+00 |
| description | Rust decoder for Star Atlas Points Store program on Solana |
| homepage | https://github.com/staratlasmeta/star-atlas-decoders |
| repository | https://github.com/staratlasmeta/star-atlas-decoders |
| max_upload_size | |
| id | 1918142 |
| size | 177,517 |
Rust decoder for the Star Atlas Points Store program on Solana, generated using Carbon CLI.
PsToRxhEPScGt1Bxpm7zNDRzaMk31t8Aox7fyewoVseAdd this crate to your Cargo.toml:
[dependencies]
carbon-points-store-decoder = "0.12.0"
use carbon_points_store_decoder::{PointsStoreDecoder, PointsStoreAccount};
use carbon_core::account::AccountDecoder;
let decoder = PointsStoreDecoder;
let decoded_account = decoder.decode_account(&account);
if let Some(decoded) = decoded_account {
match decoded.data {
PointsStoreAccount::PointsStore(store) => {
println!("Points Store: {:?}", store);
println!("Point Category: {}", store.point_category);
println!("Profile: {}", store.profile);
println!("Bank: {}", store.bank);
println!("Price (points per token): {}", store.price);
println!("Signer Bump: {}", store.signer_bump);
}
PointsStoreAccount::RedemptionConfig(config) => {
println!("Redemption Config: {:?}", config);
println!("Point Category: {}", config.point_category);
println!("Profile: {}", config.profile);
println!("Faction: {}", config.faction);
println!("Bank: {}", config.bank);
println!("Allow Only Current Epoch: {}", config.allow_only_current_epoch != 0);
// Access the redemption_epochs array (deserialized from remaining data)
println!("Number of redemption epochs: {}", config.redemption_epochs.len());
for epoch in &config.redemption_epochs {
println!(" Day {}: {} total points, {} total tokens",
epoch.day_index, epoch.total_points, epoch.total_tokens);
println!(" Redeemed: {} points, {} tokens",
epoch.redeemed_points, epoch.redeemed_tokens);
if epoch.total_points > 0 {
let tokens_remaining = epoch.total_tokens - epoch.redeemed_tokens;
println!(" Tokens remaining: {}", tokens_remaining);
}
}
}
PointsStoreAccount::UserRedemption(redemption) => {
println!("User Redemption: {:?}", redemption);
println!("Profile: {}", redemption.profile);
println!("Point Category: {}", redemption.point_category);
println!("User Points Account: {}", redemption.user_points_account);
println!("Config: {}", redemption.config);
println!("Points: {}", redemption.points);
println!("Day Index: {}", redemption.day_index);
}
}
}
The RedemptionConfig.faction field is stored as a u8. Map values to factions:
// Faction values (from profile-faction program)
const FACTION_UNALIGNED: u8 = 0;
const FACTION_MUD: u8 = 1;
const FACTION_ONI: u8 = 2;
const FACTION_USTUR: u8 = 3;
let faction_name = match config.faction {
0 => "Unaligned",
1 => "MUD",
2 => "ONI",
3 => "Ustur",
_ => "Unknown",
};
println!("Redemption config is for faction: {}", faction_name);
The Points Store program uses u8 fields for boolean flags. Check them like this:
// Check if redemptions are limited to current epoch only
if config.allow_only_current_epoch != 0 {
println!("Only the current epoch can be redeemed");
} else {
println!("Past epochs can also be redeemed");
}
This decoder supports all Points Store account types:
PointsStore - A store where tokens can be purchased directly with points at a fixed price
RedemptionConfig - Configuration for epoch-based token redemptions
redemption_epochs array from remaining data (each epoch tracks total/redeemed points and tokens for a specific day)UserRedemption - Tracks a user's points contribution for a specific redemption epoch
The Points Store program provides two mechanisms for exchanging points for tokens:
Example: If 1000 tokens are available for an epoch, and you contributed 100 points out of a total 1000 points submitted, you can claim 100 tokens (10% of the pool).
Full documentation is available at docs.rs.
See the main repository for build instructions and contribution guidelines.
Licensed under the Apache-2.0 license.