Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/onchain/TestAMMContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,39 @@ contract Test_AMMContract is Ownable {
function getPoolUsingMarketId(bytes32 marketId) external view returns (PoolData memory) {
return marketIdToPool[marketId];
}

function getUserPositionInPool(address _user, bytes32 _marketId)
external
view
returns (
address operator,
address token0,
address token1,
uint24 fee,
uint128 liquidity,
int24 tickLower,
int24 tickUpper,
uint128 tokensOwed0,
uint128 tokensOwed1,
uint256 amount0,
uint256 amount1
)
{
PoolData memory pool = marketIdToPool[_marketId];
uint256 userLiq = userLiquidity[_user][_marketId];

return (
address(this), // operator - this contract manages all positions
pool.tokenA, // token0 - first token address
pool.tokenB, // token1 - second token address
3000, // fee - fixed at 0.3% for compatibility
uint128(userLiq), // liquidity - user's liquidity amount
0, // tickLower - not used in simplified version
0, // tickUpper - not used in simplified version
0, // tokensOwed0 - no separate fee tracking
0, // tokensOwed1 - no separate fee tracking
userLiq / 2, // amount0 - simplified estimation
userLiq / 2 // amount1 - simplified estimation
);
}
}
Loading