feat: Implement core storage data structures for savings contract#19
Merged
Devsol-01 merged 15 commits intoDevsol-01:mainfrom Jan 22, 2026
Merged
Conversation
5 tasks
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
This PR implements the core data structures for the Nestera savings contract as defined in the project requirements. These structures support all four savings plan types and are fully compatible with Soroban XDR types.
Changes Made
New Files
src/storage_types.rs: Core data structure definitionsModified Files
src/lib.rs: Added storage_types module importsrc/test.rs: Comprehensive unit tests for all data structuresData Structures Implemented
1.
PlanTypeEnumFlexi- Instant liquidity savingsLock(u64)- Time-locked savings with unlock timestampGoal(Symbol, i128, u32)- Goal-based savings with category, target amount, and contribution typeGroup(u64, bool, u32, i128)- Group savings with ID, visibility, contribution type, and target2.
SavingsPlanStruct3.
UserStruct4.
DataKeyEnumAdmin- Admin address storageUser(Address)- User data mappingSavingsPlan(Address, u64)- Plan data mappingTesting
Test Coverage
Test Results
Build Status
Technical Decisions
Why
u32instead ofu8for contribution_type?Soroban XDR only supports
u32,u64,u128,i32,i64, andi128. Smaller integer types likeu8are not supported.Why tuple variants instead of named fields in enums?
Soroban's
#[contracttype]macro doesn't support named fields in enum variants. Tuple variants are the standard approach.Definition of Done
#[contracttype]make buildRelated Issues
Closes #2
Checklist
Screenshots/Evidence