Invalid type for argument in function call. Invalid implicit conversion from struct storageTank.AddLiquidityParams storage ref to struct LiquidityManagement.AddLiquidityParams memory requested.

AddLiquidityParams params = AddLiquidityParams(0xdAC17F958D2ee523a2206206994597C13D831ec7,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 3, 0x7858E59e0C01EA06Df3aF3D20aC7B0003275D4Bf,34,34,address(this).balance,USDT.balanceOf(address(this)),0,0);

function stakeCombinedLiquidity() public {     
       require(msg.sender == address(this),'');
//This is the function I am trying to pass the struct in
``` function addLiquidity(AddLiquidityParams memory params) public
        returns (
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1,
            IUniswapV3Pool pool
        PoolAddress.PoolKey memory poolKey =
            PoolAddress.PoolKey({token0: params.token0, token1: params.token1, fee: params.fee});

        pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey));

        // compute the liquidity amount
            (uint160 sqrtPriceX96, , , , , , ) = pool.slot0();
            uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(params.tickLower);
            uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(params.tickUpper);

            liquidity = LiquidityAmounts.getLiquidityForAmounts(

        (amount0, amount1) = pool.mint(
            abi.encode(MintCallbackData({poolKey: poolKey, payer: msg.sender}))

        require(amount0 >= params.amount0Min && amount1 >= params.amount1Min, 'Price slippage check');
  • Welcome, @AFDS. You need to provide some context to your question by sharing the code so we could help. Jul 2, 2021 at 9:36
  • Can you share the code and also check this ethereum.stackexchange.com/questions/91173/… Jul 2, 2021 at 9:38
  • Thanks. I already took a look at that. I think my implicit conversion error comes from a data allocation error as I think it needs to be stored in memory but I have it in storage. I'm not sure though. I also have some unneccesary junk seperating some parts so I'm not sure if you want to see that.
    – AFDS
    Jul 2, 2021 at 9:52

1 Answer 1


Also looking at your other question it appears there are several thing going on that complicate thing unnecessarily.

  • There's a library LiquidityManagement that defines a struct AddLiquidityParams, you copied the struct to your contract. Now when the compiler tries to use it they are not the same.

  • The params is created outside a function, so for the compiler it is in storage. If it is a transient value it is better to keep it in memory.

Probably, it is better to write the function this way

function stakeCombinedLiquidity() public {
    LiquidityManagement.AddLiquidityParams memory stakingParam = LiquidityManagement.AddLiquidityParams(0xdAC17F958D2ee523a2206206994597C13D831ec7,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 0.3, 0x7858e59e0c01ea06df3af3d20ac7b0003275d4bf,34,34,address(this).balance,uSDT.balanceOf(address(this)));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.