Skip to content

feat: implement Flexi-Save deposit/withdraw and unit tests#26

Merged
Devsol-01 merged 1 commit intoDevsol-01:mainfrom
Folex1275:main
Jan 24, 2026
Merged

feat: implement Flexi-Save deposit/withdraw and unit tests#26
Devsol-01 merged 1 commit intoDevsol-01:mainfrom
Folex1275:main

Conversation

@Folex1275
Copy link
Copy Markdown
Contributor

Description

This PR implements the core Flexi-Save functionality for the Nestera savings contract. This includes the logic for deposits and withdrawals, state synchronization with user records, and a comprehensive test suite to ensure financial accuracy and security.

Closes #7

🚀 Key Features Implemented

  • Flexi-Save Module: Created the logic for users to deposit and withdraw funds with real-time balance updates.
  • Dual-State Synchronization: Implemented a system to update both the specific FlexiBalance vault and the global User total balance record simultaneously.
  • Security Checkpoints: Integrated require_auth to ensure only account owners can move their funds.
  • Financial Validation: Added logic to prevent zero/negative deposits and block withdrawals that exceed the current balance.

🛠️ Technical Refactors (Fixes)

  • Resolved naming collisions in lib.rs regarding the get_user function.
  • Restored and standardized the User struct in storage_types.rs.
  • Corrected module imports and crate scoping to support the new flexi and users modules.

🧪 Quality Assurance

  • Total Tests: 36
  • Result: All Passed ✅
  • Focus: Specifically verified the Flexi-Save flow, ensuring that deposit_flexi and withdraw_flexi correctly modify the on-chain state and handle InsufficientBalance errors as expected.

@Devsol-01 Devsol-01 merged commit 5ce6ea2 into Devsol-01:main Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Flexi Save Function

2 participants