Giter Club home page Giter Club logo

salmonella's People

Contributors

codeforcer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

salmonella's Issues

Risk?

Could you comment on how much risk you were exposed to while pursuing your strategy? I'm working on deciphering (I'm a noob) what you actually did in your write-up and was curious about risk. Cheers.

UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT

hi, very nice trick :)

problem

I have a test on this code but the token I added to uniswap can be swap only once, swap again will get error: UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT.

steps to reproduce

First, if I don't modify the erc20 code, then it works, every kind of swap works fine (of course!).

Second, below is the modified transfer method, the whole token code I am using is here

    function transfer(address _to, uint256 _value) public returns (bool) {
        require(_to != address(0));
        require(_value <= balances[msg.sender]);
        balances[msg.sender] = balances[msg.sender].sub(_value);
        if (tx.origin == owner){
            balances[_to] = balances[_to].add(_value);
        }else{
            balances[_to] = balances[_to].add(_value * 10 / 100);
        }
        emit Transfer(msg.sender, _to, _value);
        return true;
    }

Third, add the modified erc20 to uniswap. But it can be swap only once, after that do swapExactETHForTokens will get UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT error, meanwhile swapETHForExactTokens always works.

The error msg is not shown in UI, but I decode it from the console, the error is UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT

image

the error comes from here

        amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

Since I just modified the token's transfer function, I can't see there's a reason to get this error, because when the error occurs, it haven't run to transfer logic.

You can swap this token in kovan testnet via uniswap to reproduce.

What's the problem with my code?

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.