Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created April 3, 2021 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yuyasugano/c827a405d2620d48b6a2dc11fbce712d to your computer and use it in GitHub Desktop.
Save yuyasugano/c827a405d2620d48b6a2dc11fbce712d to your computer and use it in GitHub Desktop.
Flash Swaps arbitrage
function startArbitrage(
address token0,
address token1,
uint amount0,
uint amount1
) external {
address pairAddress = IUniswapV2Factory(pancakeFactory).getPair(token0, token1);
require(pairAddress != address(0), 'This pool does not exist');
IUniswapV2Pair(pairAddress).swap(
amount0,
amount1,
address(this),
bytes('not empty')
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment