Giter Site home page Giter Site logo

I cannot AddLiquidity in the StableSwap3Pool.vy Smart Contract through a middle Operator Solidity Smart Contract. about curve-contract HOT 5 CLOSED

curvefi avatar curvefi commented on August 16, 2024
I cannot AddLiquidity in the StableSwap3Pool.vy Smart Contract through a middle Operator Solidity Smart Contract.

from curve-contract.

Comments (5)

benber86 avatar benber86 commented on August 16, 2024 2

Are you sure your approvals are correct?

                IERC20Modified(currentCoin).approve(address(this), _amountTIndexes[i]);
                IERC20Modified(currentCoin).transferFrom(msg.sender, address(this), _amountTIndexes[i]);

the caller should be allowing your contract to spend the tokens. here on the first line your contract is approving itself.
then your contract needs to approve the pool's contract for spending each of the token you'll deposit before it can deposit there.

from curve-contract.

michwill avatar michwill commented on August 16, 2024 1

My guess is that you need

IERC20Modified(currentCoin).approve(curveFiPool, _amountTIndexes[i]);

from curve-contract.

Nachoxt17 avatar Nachoxt17 commented on August 16, 2024

@benber86 Yes, I tested the Deposit of ERC-20 Tokens from the Wallet to my Operator S.C. (That Uses address(this)) in an Isolated way and it worked:

    /// @param _amountTIndexes: List of Amounts of Different Coins to Deposit. Ex: [2 DAI, 4 USDC, 3 USDT].
    function depositLiquidityInOperator(address curveFiPool, uint256[3] memory _amountTIndexes) external {
        for (uint256 i = 0; i < 3; i++) {
            if (_amountTIndexes[i] > 0) {
                address currentCoin = ICurveFiPool(curveFiPool).coins(i);
                IERC20Modified(currentCoin).approve(address(this), _amountTIndexes[i]);
                IERC20Modified(currentCoin).transferFrom(msg.sender, address(this), _amountTIndexes[i]);
            }
        }
    }

from curve-contract.

Nachoxt17 avatar Nachoxt17 commented on August 16, 2024

My guess is that you need

IERC20Modified(currentCoin).approve(curveFiPool, _amountTIndexes[i]);

Thanks, I will try that...

from curve-contract.

Nachoxt17 avatar Nachoxt17 commented on August 16, 2024

My guess is that you need

IERC20Modified(currentCoin).approve(curveFiPool, _amountTIndexes[i]);

IT WORKED YOU ARE A DAMN GENIUS I HAVE BEEN STRUGGLING WITH THAT SH*T FOR DAYS THANK YOU VERY MUCH!!! A STRONG HUG!!!

from curve-contract.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.