Created
April 3, 2021 00:39
-
-
Save yuyasugano/c827a405d2620d48b6a2dc11fbce712d to your computer and use it in GitHub Desktop.
Flash Swaps arbitrage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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