Skip to content

refactor(storage): extract shared check helper - #322

Merged
mikewheeleer merged 1 commit into
StableRoute-Org:mainfrom
JuanVP2:refactor/storage-01-helper
Jul 27, 2026
Merged

refactor(storage): extract shared check helper#322
mikewheeleer merged 1 commit into
StableRoute-Org:mainfrom
JuanVP2:refactor/storage-01-helper

Conversation

@JuanVP2

@JuanVP2 JuanVP2 commented Jul 26, 2026

Copy link
Copy Markdown

Closes #294

Summary

Audited and refactored repeated pair registration storage checks (DataKey::Pair) across contract entrypoints into a shared private helper function (read_pair_registered).

  • Extracted private storage helper read_pair_registered(env: &Env, source: &Symbol, destination: &Symbol) -> bool.
  • Refactored require_pair_registered, quote_route, is_pair_active, get_pair_info, get_pair_info_ext, is_pair_registered, and compute_route_fee to route through the centralized storage helper.
  • Preserved exact rejection behavior, edge case handling, and typed error codes (RouterError::PairNotRegistered).
  • Zero ABI breaking changes.

Verification Results

  • cargo test: 247/247 unit and integration tests passed in green ✅
  • cargo clippy --all-targets -- -D warnings: 0 warnings ✅
  • cargo fmt --all -- --check: Formatting checked cleanly ✅

@mikewheeleer
mikewheeleer merged commit f2a3399 into StableRoute-Org:main Jul 27, 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.

Extract the repeated storage check into a shared helper

2 participants