feat(onchain): add get_distributor_list accessor for indexers (#232)#417
Open
Moonwalker-rgb wants to merge 4 commits into
Open
feat(onchain): add get_distributor_list accessor for indexers (#232)#417Moonwalker-rgb wants to merge 4 commits into
Moonwalker-rgb wants to merge 4 commits into
Conversation
…orgee#232) Add a public view function get_distributor_list that returns a sorted Vec<Address> of currently registered distributor addresses. This provides a source-of-truth accessor for off-chain indexers and audit dashboards, eliminating the need to maintain parallel distributor lists. Changes: - src/lib.rs: add get_distributor_list view function - tests: 6 test cases covering empty, single, multiple, removal, duplicate idempotency, and sorted ordering - README.md: document the new function - docs/onchain/api.md: new high-level API reference Closes ChainForgee#232
soroban_sdk::Vec does not provide a sort() method. Replace with a manual bubble sort which is acceptable for the small expected distributor list size.
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
Closes #232
Adds a public view function
get_distributor_listto the AidEscrow contract that returns a sortedVec<Address>of currently registered distributor addresses.Problem
Distributor list is stored in
Map<Address, bool>but there is no view function to retrieve it. Off-chain indexers and dashboards must maintain a parallel list, which can grow stale and reduce audit accuracy.Solution
get_distributor_list(env) -> Vec<Address>reads fromKEY_DISTRIBUTORSstorage and returns keys sorted for deterministic orderingget_admin,get_config)Changes
src/lib.rsget_distributor_listfunction afterremove_distributortests/aid_escrow_tests.rsget_distributor_listmoduleREADME.mddocs/onchain/api.mdTest Coverage
add_distributorcallsAcceptance Criteria (from #232)