Repository navigation
feat(vault): add get_config and get_cycle_claimed_total views - #37
Closed
IG-ABHINAV wants to merge 1 commit into
Closed
IG-ABHINAV wants to merge 1 commit into
IG-ABHINAV wants to merge 1 commit into
Conversation
Expose the bound admin, oracle and token as Option<VaultConfig>, and the per-cycle claimed total, as read-only contract methods with no auth and no TTL bump. Fixes SplitStream-Labs#30
Oyinkans0la12
approved these changes
Nov 22, 2026
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.
Description
The vault stores
admin,oracleandtokenin instance storage, but no read-only function returned them. The per-cycleCycleClaimedTotalentry written bycredit_claimwas also only reachable through events.This adds two read-only views, as requested in #30:
get_config() -> Option<VaultConfig>returnsadmin,oracleandtoken, orNonebeforeinitialize.get_cycle_claimed_total(cycle_id) -> i128returns the cumulative claimed amount, or0if the cycle has never been claimed.Both take no auth and do not bump any TTL.
VaultConfigis a#[contracttype]struct intypes.rs.Fixes #30
How
The views sit with the existing read-only methods in
lib.rsand reuse the storage helpers already used byinitializeandcredit_claim.docs/contract-reference.mdanddocs/SUMMARY.mdnow list 24 public functions (14 state-changing, 10 read-only views).Non-negotiables checklist
sha256(contributor.to_xdr(env) ++ amount.to_xdr(env))), or the change is coordinated with splitstream-actions and the golden fixtures.unwrap()/expect()outside#[cfg(test)]code.storage::bump_persistent); every admin-gated call bumps the instance TTL (storage::bump_instance). (These views do not write and do not bump TTL.)require_auth()targets the correct role (admin vs oracle vs contributor). (No auth on these views.)Verification
cargo test --workspacepasses cleanlycargo clippy --all-targets -- -D warningspasses cleanlystellar contract build --package splitstream-vaultsucceeds (not run here;stellar-cliwas not used)Judgment calls
The historical paragraph in
docs/contract-reference.mdabout the earlier Testnet deployment still describes that revision as 22 functions. I left it unchanged so it stays a record of that deploy; the live function count at the top of the page is 24.