0

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

How do I declare a fallback function in my contract ?

  • @Ismael it doesn’t describe how to declare such function but explain what it does. – user2284570 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 { }". – Richard Horrocks May 27 '18 at 20:45
  • Documentation is here: solidity.readthedocs.io/en/latest/… – Richard Horrocks May 27 '18 at 20:47
0

Is easy.

function () payable public{
}

Hope it helps

  • so it's about using thepayablekeyword, isn’t it ? – user2284570 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.