title: How to send ERC20 token to smart contract balance?
body: <p>I'm trying to build a smart contract and inherit some functions to swap ERC20 tokens,</p>
  <p>Here are my questions?</p>
  <p><strong>Question A:</strong>
  <strong>Is it possible to transfer ERC20 token to smart contract balance?</strong>,
  Please provide an example,
  i.e. We can create a function to send ETH to smart contract</p>
  <pre><code>function contribute() external payable {}
  
  //It will allow us to send ETH to smart contract balance,but how to send,for example, &quot;BAND&quot; token
  //to smart contract balance?
  </code></pre>
  <p><strong>Question B:</strong>
  If A is possible, <strong>how to get contract's token balance?</strong>
  i.e. We can get the contract ETH balance from this function:</p>
  <pre><code>// Get ETH balance
  function getBalance() external view returns(uint) {
      return address(this).balance;    
  }
  
  // How to return contract's BAND balance, if A is possible ...
  </code></pre>
  <p><strong>Question C:</strong></p>
  <p>If &quot;A&quot; is possible, How to make a swap to BAND/ETH liquidity pool, using Uniswap or Sushiswap API,
  Is it better to handle that process on server side proccesses using NodeJS, or implement it in solidity?</p>
  <hr />
  <p>Full smart contract code:</p>
  <pre><code>pragma solidity ^0.5.11; 
  
  contract SwapTest {
      address public manager;
      
      constructor() public {
          manager = msg.sender;
      }
      
      modifier OnlyManager() {
          require(msg.sender == manager);
          _;
      }
      
      // Add funds to contract
      function contribute() external payable {}
      
      
      // Get ETH balance
      function getBalance() external view returns(uint) {
          return address(this).balance;    
      } 
      
      // Send provided amount of WEI to recipient
      function sendEther (address payable recipient, uint weiAmount) external OnlyManager{
          recipient.transfer(weiAmount);    
      }
      
      // Send contract balance to recipient
      function withdrawBalance (address payable recipient) external OnlyManager{
          recipient.transfer(address(this).balance);
      }
  }
  </code></pre>
  <p>Looking forward to hearing back from you guys,
  Thanks in advance.</p>