feat: Add getUserPositionInPool and getAllPools external view functions with full Natspec documentation #121
Merged
Neros0 merged 5 commits intoArenium-Social:mainfrom Oct 6, 2025
Merged
Conversation
added 5 commits
October 5, 2025 13:09
Neros0
approved these changes
Oct 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces two new external view functions —
getUserPositionInPoolandgetAllPools— to theTest_AMMContractfor improved transparency, analytics, and compatibility with frontends and off-chain monitoring tools.Both functions include comprehensive Natspec comments to ensure clarity, maintainability, and adherence to Solidity documentation standards.
Changes Overview
🧩 New External View Functions
1.
getUserPositionInPool(address _user, bytes32 _marketId)Returns detailed information about a user’s liquidity position within a given market pool.
This function mirrors the structure of Uniswap V3–style position data, while simplifying some parameters for test and analytics environments.
Returns:
operator: Contract address managing the positiontoken0,token1: Token pair addresses for the poolfee: Fixed at3000(representing 0.3%) for compatibilityliquidity: User’s current liquidity contributiontickLower,tickUpper: Fixed at0for simplified implementationtokensOwed0,tokensOwed1: Fixed to0(no fee tracking)amount0,amount1: Simplified token amount estimates (half of user liquidity each)Purpose:
2.
getAllPools()Returns a full array of all pools managed by this contract.
Returns:
PoolData[]: Array containing every pool’s configuration and reserve state.Purpose:
Motivation
These enhancements significantly improve observability and testability of the AMM simulation contract (
Test_AMMContract).By exposing well-documented view functions, developers and analytics systems can now:
Implementation Notes
forge fmt).Next Steps
getUserPositionInPoolandgetAllPools.PoolDatastruct to include volume and fee metrics for richer analytics.Result:
These additions strengthen the observability layer of the Arenium test AMM contract, improving both developer ergonomics and data accessibility.