defi-cartel / salmonella Goto Github PK
View Code? Open in Web Editor NEWWrecking sandwich traders for fun and profit
Wrecking sandwich traders for fun and profit
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.
hi, very nice trick :)
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.
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
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?
Is sandwitch attack use the amount at event as attack judgement?
Hey, this article told a quite funny story, could I translate it to Chinese?
I take it off for you sir, magnificent
The mempool balancer!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.