Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.Documentation Index
Fetch the complete documentation index at: https://tech.ramses.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Functions
computeSwapStep
amountSpecified is positive
Parameters:
| Name | Type | Description |
|---|---|---|
sqrtRatioCurrentX96 | uint160 | The current sqrt price of the pool |
sqrtRatioTargetX96 | uint160 | The price that cannot be exceeded, from which the direction of the swap is inferred |
liquidity | uint128 | The usable liquidity |
amountRemaining | int256 | How much input or output amount is remaining to be swapped in/out |
feePips | uint24 | The fee taken from the input amount, expressed in hundredths of a bip |
Return Values:
| Name | Type | Description |
|---|---|---|
sqrtRatioNextX96 | uint160 | The price after swapping the amount in/out, not to exceed the price target |
amountIn | uint256 | The amount to be swapped in, of either token0 or token1, based on the direction of the swap |
amountOut | uint256 | The amount to be received, of either token0 or token1, based on the direction of the swap |
feeAmount | uint256 | The amount of input that will be taken as a fee |
