Created
May 24, 2021 16:16
-
-
Save nikaluka/f5ed2d27db256995680fdf414c503669 to your computer and use it in GitHub Desktop.
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 execute(address _tokenBorrow, uint _amount, address _tokenPay, uint _amountToRepay, address[] memory _userData) internal { | |
//swap tokeni 1/3, 3,5, 5,7 | |
address token1=_userData[1]; //oxae | |
address token3=_userData[3]; //0x11 | |
address token5=_userData[5]; //0x2dd | |
address[] memory path1 = new address[](2); | |
path1[0] =token1; //weth | |
path1[1] =token3; //baga | |
IPancakeRouter01(router).swapExactETHForTokens.value(_amount)(1,path1,to,deadline); | |
address[] memory path2 = new address[](2); | |
path2[0] =token3; //baga | |
path2[1] =token5; //gaga | |
uint gaga_amount = IERC20(token3).balanceOf(address(this)); | |
IPancakeRouter01(pancake_router).swapExactTokensForTokens(gaga_amount,1,path2,to,deadline); | |
address[] memory path3 = new address[](2); | |
path3[0] =token5;// baga | |
path3[1] =token1;// weth | |
uint baga_amount = IERC20(token5).balanceOf(swaper); | |
IPancakeRouter01(pancake_router).swapExactTokensForEth(baga_amount,1,path3,to,deadline); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment