1

I am trying to add liquidity (1 dai) to a the curve aave pool, but it gives me this error Fail with error 'Slippage screwed you' https://polygonscan.com/tx/0xbd9017f7d8827c31a1fb1761ffef9975a350c49fd373ec30cdbf9eb9a2634220

Here is the code that I am using

interface:

function add_liquidity(uint256[3] memory _amounts, uint256 _min_mint_amount, bool _use_underlying) external returns (uint256);

main:

ICurve cpool = ICurve(0x445FE580eF8d70FF569aB36e80c647af338db351);


function cputIn() external {
    uint256[3] memory coins;
    // dai
    coins[0] = 1 ether;
    // usdc
    coins[1] = 0;
    //usdt
    coins[2] = 0;
    
    cpool.add_liquidity(coins, 1 ether, false);
}

Why is it giving me this error?

Here is the curve contract that I am interacting with: https://github.com/curvefi/curve-contract-polygon/blob/master/contracts/pools/aave/StableSwapAave.vy

Thanks!

1 Answer 1

2

Hope you've found your answer by now, but if not, here's my understanding:

In the addLiquidity() function, the second parameter(min_mint_amount) is for the minimum amount of LP token minted for you in return for depositing funds.

This is really only relevant if you're getting a price quote from the contract before depositing funds. If you just want to deposit at whatever the current rate is, just leave the 2nd parameter at "0".

Also, you may be misunderstanding what is intended to be input into this function. It takes stablecoins(specifically DAI, USDC, and/or USDT). The first parameter(uint256[3] memory _amounts) takes an array of each stablecoin that you'll be depositing, in the order I just stated. No Ether should be sent to this function.

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.