2

My function needs gas to fulfill a transaction, but I don't want people accidentally sending Ether to it.

2

No.

The gas amount and ether sent don't mix.

Generally, all available gas forwarded with messages to other contracts (functions) but this can be controlled by specifying gas in Solidity. address.send() in particular sends only 2,300 gas (at time of writing), known as the "stipend". The low budget allows a very simplistic fallback function to execute.

No one can accidentally send Ether to function if it isn't marked "payable", however they can high gas for execution. Unspent gas is returned after successful execution.

Hope it helps.

  • Ok great, good to know I can stop using the noEther modifier. – ethereal Feb 24 '17 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.