Skip to content

Fix: Refactor contracts into smaller, focused modules with clear responsibilites.#152

Merged
LaGodxy merged 1 commit intoMettaChain:mainfrom
Lansa-18:fix/insufficient-modularization
Mar 30, 2026
Merged

Fix: Refactor contracts into smaller, focused modules with clear responsibilites.#152
LaGodxy merged 1 commit intoMettaChain:mainfrom
Lansa-18:fix/insufficient-modularization

Conversation

@Lansa-18
Copy link
Copy Markdown
Contributor

Closes #101 — Modularization Summary

All 12 contracts have been refactored from monolithic lib.rs files into focused modules following the established property-token pattern.


Pattern Applied

Each contract was split into:

  • errors.rs — Error enum + Display + ContractError trait implementation
  • types.rs — Data structs and enums (with SCALE + StorageLayout derives)
  • tests.rs#[cfg(test)] mod tests { ... } with #[ink::test] functions
  • lib.rs — Retains storage, constructor, messages, events; uses include!() to pull in sub-files

Contracts Modularized

Contract errors.rs types.rs tests.rs Notes
insurance ✅ Created ✅ Already existed ✅ Created Tests at crate root
metadata ✅ Created ✅ Created ✅ Created
proxy ✅ Created ✅ Created ✅ Created
database ✅ Created ✅ Created ✅ Created
third-party ✅ Created ✅ Created ✅ Created
dex ✅ Created N/A ✅ Created All types in propchain_traits
oracle N/A ✅ Created ✅ Created Error re-exported from propchain_traits
escrow ✅ Created ✅ Created ✅ Already existed Used pub mod tests pattern
fees ✅ Created ✅ Created ✅ Created
bridge ✅ Created N/A ✅ Created All types in propchain_traits
governance ✅ Created ✅ Created ✅ Created
staking ✅ Created ✅ Created ✅ Created LockPeriod impl block extracted with type

Verification

cargo check --workspace

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@Lansa-18 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Lansa-18
Copy link
Copy Markdown
Contributor Author

@LaGodxy Kindly go through chief

@LaGodxy LaGodxy merged commit df83942 into MettaChain:main Mar 30, 2026
15 of 16 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.

Insufficient Modularization

2 participants