Skip to content

Fix: [CONTRACT] Implement Common Types Module#337

Merged
truthixify merged 1 commit intoDistinctCodes:mainfrom
Georgechisom:fix-244-contract-implement-common-types-module
Oct 3, 2025
Merged

Fix: [CONTRACT] Implement Common Types Module#337
truthixify merged 1 commit intoDistinctCodes:mainfrom
Georgechisom:fix-244-contract-implement-common-types-module

Conversation

@Georgechisom
Copy link
Contributor

The fix implements a comprehensive shared types system for the AssetsUp contracts, providing consistent and reusable enums across all contract modules with proper Soroban serialization support.

Features Added

New Shared Enums

  • AssetType - Distinguishes between Physical and Digital assets
  • AssetStatus - Tracks asset lifecycle (Active, InMaintenance, Disposed)
  • ActionType - Audit trail actions (Procured, Transferred, Maintained, Disposed, CheckedIn, CheckedOut)
  • PlanType - Subscription tiers (Basic, Pro, Enterprise)
  • SubscriptionStatus - Subscription states (Active, Expired, Cancelled)

Technical Implementation

  • All enums use #[contracttype] for Soroban serialization
  • Proper #[derive(Clone, Debug, Eq, PartialEq)] traits
  • Comprehensive documentation with /// comments
  • Public exports via pub use types::* in lib.rs
  • Full test coverage for all enum variants and functionality

Breaking Changes

  • Updated AssetType from specific variants (IT, Furniture) to generic (Physical, Digital)
  • Existing tests updated to use new enum variants

Testing

  • Added comprehensive unit tests for all enum types
  • Verified enum equality, cloning, and function parameter usage
  • All existing tests updated and passing
  • Zero compiler warnings or clippy issues
assetUp-test

Files Modified

  • src/types.rs - Enhanced with all required enums and documentation
  • src/lib.rs - Added public re-export of types
  • src/tests/types.rs - Comprehensive test coverage
  • src/tests/mod.rs - Added types test module
  • src/tests/asset.rs - Updated for new AssetType variants

Verification

  • cargo build - Clean compilation
  • cargo test - All tests passing (10/10)
  • cargo clippy - No linting issues
  • Types accessible across contract modules
  • Soroban serialization compatibility verified

Benefits

  • Consistency: Shared types ensure uniform data structures across contracts
  • Type Safety: Strong typing prevents runtime errors
  • Maintainability: Centralized type definitions reduce duplication
  • Extensibility: Easy to add new variants as requirements evolve
  • Documentation: Well-documented enums improve developer experience

Closes #244

@vercel
Copy link

vercel bot commented Oct 2, 2025

@Georgechisom is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@truthixify truthixify merged commit f09b95e into DistinctCodes:main Oct 3, 2025
4 of 5 checks passed
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.

[CONTRACT] Implement Common Types Module

2 participants