Repository navigation
Conversation
…Interactive#402) - Add reusable Soroban smart contract in contracts/points_ledger - Implement points balance and full historical ledger structure - Support authorized caller access control (admin and whitelisted game contracts) - Implement earn function recording amount, player, caller, reason code, and timestamp - Ensure strict invariant: balance strictly equals sum of all history entries - Expose read functions for get_balance and get_history - Emit standard Soroban events on earn operations - Support secure admin transfer via transfer_admin - Add comprehensive unit test suite in src/test.rs - Add detailed README.md documentation and workspace entry in Cargo.toml Closes MindFlowInteractive#402
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This pull request implements the Achievement Points Ledger module for the Quest Contract ecosystem as requested in #402.
Key Features & Architecture
contracts/points_ledgerauthorize_caller/deauthorize_calleradmin-gated functions allow whitelisting specific game engines or verified contracts to award points.PlayerLedgerpersistently tracks both the aggregated balance and a full historical log (Vec<PointsEntry>) recording the player, awarded amount, reason code (Symbol), block timestamp, and caller address.balancestrictly reflects the sum of all historical earn entries.earn(caller, player, amount, reason_code)verifies caller authorization and records points atomically.get_balance(player)andget_history(player).topic: (earn, player), data: (amount, reason_code, caller).transfer_admin.contracts/points_ledger/src/test.rsverifying initialization, direct admin awards, authorized caller awards, rejection of unauthorized callers, balance-history equality invariant, and admin transfers.README.mdwith architecture, interface specifications, and integration examples.Verification
cargo check --package points_ledgerpassed with 0 errors.Cargo.tomlworkspace members.Closes #402