0

Simple question but I couldn’t find the answer in the documentation.

How do I declare a fallback function in my contract ?

3
  • @Ismael it doesn’t describe how to declare such function but explain what it does. May 27 '18 at 19:52
  • The top (only) answer states, with reference to the relevant documentation: "If the contract is meant to receive Ether with simple transfers, you should implement the fallback function as: function() payable { }". May 27 '18 at 20:45
  • Documentation is here: solidity.readthedocs.io/en/latest/… May 27 '18 at 20:47
0

Is easy.

function () payable public{
}

Hope it helps

2
  • so it's about using thepayablekeyword, isn’t it ? May 27 '18 at 17:02
  • The payable keyword allows the function to receive ether.
    – Jaime
    May 27 '18 at 17:10

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