Skip to content

Commit

Permalink
chore: update NatSpec, remove unused imports in ConstantSumSolver
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlak committed Apr 26, 2024
1 parent b7b827d commit 16b0e1d
Showing 1 changed file with 52 additions and 52 deletions.
104 changes: 52 additions & 52 deletions src/ConstantSum/ConstantSumSolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ import {
encodeFeeUpdate,
encodeControllerUpdate
} from "./ConstantSumUtils.sol";
import {
computeAllocationGivenX,
computeAllocationGivenY
} from "src/lib/StrategyLib.sol";
import {
ONE,
computeInitialPoolData,
FixedPointMathLib,
computeSwapDeltaLiquidity,
computeDeltaLiquidityRoundDown
} from "./ConstantSumMath.sol";
import {
Expand Down Expand Up @@ -141,42 +136,6 @@ contract ConstantSumSolver is ISolver {
return (valid, amountOut, swapData);
}

/// @notice Prepares the data for updating the price
/// @dev Used by the kit to update the price
/// @param newPrice The new price to set
/// @return The encoded data for updating the price
function preparePriceUpdate(uint256 newPrice)
public
pure
returns (bytes memory)
{
return encodePriceUpdate(newPrice);
}

/// @notice Prepares the data for updating the swap fee
/// @dev Used by the kit to update the swap fee
/// @param newSwapFee The new swap fee to set
/// @return The encoded data for updating the swap fee
function prepareSwapFeeUpdate(uint256 newSwapFee)
public
pure
returns (bytes memory)
{
return encodeFeeUpdate(newSwapFee);
}

/// @notice Prepares the data for updating the controller address
/// @dev Used by the kit to update the controller
/// @param newController The address of the new controller
/// @return The encoded data for updating the controller
function prepareControllerUpdate(address newController)
public
pure
returns (bytes memory)
{
return encodeControllerUpdate(newController);
}

/// @inheritdoc ISolver
function getReservesAndLiquidity(uint256 poolId)
public
Expand All @@ -188,17 +147,6 @@ contract ConstantSumSolver is ISolver {
return (pool.reserves, pool.totalLiquidity);
}

/// @dev gets the pool params
/// @param poolId The pool id
/// @return params The pool params
function getPoolParams(uint256 poolId)
public
view
returns (ConstantSumParams memory)
{
return abi.decode(strategy.getPoolParams(poolId), (ConstantSumParams));
}

/// @inheritdoc ISolver
function getEstimatedPrice(
uint256 poolId,
Expand All @@ -218,4 +166,56 @@ contract ConstantSumSolver is ISolver {
return ONE.divWadDown(getPoolParams(poolId).price);
}
}

/**
* @notice Returns the parameters of the pool `poolId`.
* @param poolId Id of the target pool.
* @return Parameters as defined by the ConstantSum strategy.
*/
function getPoolParams(uint256 poolId)
public
view
returns (ConstantSumParams memory)
{
return abi.decode(strategy.getPoolParams(poolId), (ConstantSumParams));
}

/**
* @notice Prepares the data for updating the price.
* @param newPrice New price to set for the pool.
* @return Encoded data for updating the price.
*/
function preparePriceUpdate(uint256 newPrice)
public
pure
returns (bytes memory)
{
return encodePriceUpdate(newPrice);
}

/**
* @notice Prepares the data for updating the swap fee.
* @param newSwapFee New swap fee to set.
* @return Encoded data for updating the swap fee.
*/
function prepareSwapFeeUpdate(uint256 newSwapFee)
public
pure
returns (bytes memory)
{
return encodeFeeUpdate(newSwapFee);
}

/**
* @notice Prepares the data for updating the controller address.
* @param newController Address of the new controller.
* @return Encoded data for updating the controller.
*/
function prepareControllerUpdate(address newController)
public
pure
returns (bytes memory)
{
return encodeControllerUpdate(newController);
}
}

0 comments on commit 16b0e1d

Please sign in to comment.