title: Why can't I use this transferEther function to send Ether to the smart contract?
body: <p>I have this code I have entered into Remix IDE, as ReceivedEther.sol, a standalone smart contract.</p>
  <p>I've transferred 0.02 Ether to the smart contract, using MetaMask.</p>
  <p>When I checked the smart contract's balance, it returns 200000000000000000, as expected.</p>
  <p>If I try to use the transferEther function, however, and enter a number smaller than this - say, 0.005 ETH, or 50000000000000000 as the amount - it doesn't work using MetaMask.</p>
  <p>When MetaMask prompts me it's never for that amount. It's for 0 ETH and 0.00322 gas fee (or whatever the gas is). Basically it always set the amount of ETH at 0 and only charges the fee.</p>
  <p>Why can't I transfer an amount of ETH using this function in the Remix IDE with MetaMask?</p>
  <pre><code>pragma solidity ^0.8.0;
  
  
  contract ReceivedEther {
  
      function transferEther(address payable _recipient, uint _amount) external returns (bool) {
          require(address(this).balance &gt;= _amount, 'Not enough Ether in contract!');
          _recipient.transfer(_amount);
          return true;
      }
      
      /**
      * @return contract balance
      */
      function contractBalance() external view returns (uint) {
          return address(this).balance;
      }
  }
  </code></pre>