1

Why does Remix fail to deploy the simple contract (simplified from the Mastering Ethereum book https://github.com/ethereumbook/ethereumbook/blob/develop/code/Solidity/Faucet2.sol )? --

pragma solidity ^0.4.19; contract Faucet { function withdraw(uint withdraw_amount) public { require(withdraw_amount <= 100000000000000000); msg.sender.transfer(withdraw_amount); } function () external payable {} } 

No matter how I raise gasLimit and/or gasPrice

enter image description here

1 Answer 1

2

Your code is fine (I have also tried it myself). From what I see above you are also sending a value along with the deploy. Since you have not defined a constructor yourself the default one is being called which is not payable. If you want to send ether when you deploy the contract you should also define a payable constructor.

Sign up to request clarification or add additional context in comments.

3 Comments

So were you able to deploy the exact code with Remix? If you had to make modification for it to be deploy-able, what did you change?
Yes, the exact same code. As I said you must set the value to 0 ether when you deploy since you do not have a payable constructor.
You right. I totally confused the "Value" on the Remix interface with gasPrice.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.