Skip to content

fixed - #486

Merged
abayomicornelius merged 1 commit into
SO4-Markets:mainfrom
Open-works-and-jobs:fix/reader-impl-functions
Jul 24, 2026
Merged

fixed#486
abayomicornelius merged 1 commit into
SO4-Markets:mainfrom
Open-works-and-jobs:fix/reader-impl-functions

Conversation

@Akatenvictor

Copy link
Copy Markdown
Contributor

Here's a good PR message:


Title: fix: move get_adl_eligible_positions and estimate_swap_output into impl Reader

Body:

Summary

  • get_adl_eligible_positions and estimate_swap_output were declared inside #[cfg(test)] mod tests instead of inside impl Reader, meaning they were never compiled into the deployed WASM and Self::get_market(...) would fail to resolve (E0433) outside the impl context. Both functions are now proper #[contractimpl] view methods on the Reader contract.
  • Fixed get_funding_rate_info indentation (was 8-space indented instead of 4-space like every other method).
  • Added test coverage for both functions: profitable-position ADL candidate inclusion, losing-position exclusion, and empty-swap-path edge case.

Changes

  • contracts/reader/src/lib.rs
    • Moved get_adl_eligible_positions from mod testsimpl Reader
    • Moved estimate_swap_output from mod testsimpl Reader
    • Fixed get_funding_rate_info block indentation (8-space → 4-space)
    • Added get_adl_eligible_positions_returns_profitable test
    • Added get_adl_eligible_positions_excludes_losing test
    • Added estimate_swap_output_empty_path test

Why

Frontend/integrator code expects these methods to be callable on the deployed contract. With the functions inside #[cfg(test)], they were excluded from the release build entirely, and any cargo test reaching this crate hit a hard compile error on Self.


Note: I couldn't run cargo check due to disk space (No space left on device), so you'll want to verify compilation locally before merging.

Closes #395
Closes #403
Closes #404
Closes #396

@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

@Akatenvictor 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

@abayomicornelius
abayomicornelius merged commit 4a6cbf8 into SO4-Markets:main Jul 24, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment