New to Solidity...
When deploying a contract on a private blockchain using Remix, I am unable to execute payable functions. When executing these functions, the following error message displays: gas required exceeds allowance or always failing transaction.
The code was obtained from here and modified for the purpose of study.
pragma solidity ^0.4.17;
contract depositTest {
uint256 public fee = 2000000000000000000 wei;
function depositUsingParameter(uint256 deposit) public payable { //deposit ETH using a parameter
require(msg.value == deposit);
deposit = msg.value;
}
function depositUsingVariable() public payable { //deposit ETH using a variable
require(msg.value == fee);
fee = msg.value;
}
function getContractBalance() public view returns (uint256) { //view amount of ETH the contract contains
return address(this).balance;
}
function withdraw() public { //withdraw all ETH previously sent to this contract
msg.sender.transfer(address(this).balance);
}
function() public payable {
// this function enables the contract to receive funds
}
}