0

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

How do I declare a fallback function in my contract ?

user2284570
  • 1,008
  • 1
  • 12
  • 30
  • @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: https://solidity.readthedocs.io/en/latest/contracts.html?highlight=fallback#fallback-function – Richard Horrocks May 27 '18 at 20:47

1 Answers1

0

Is easy.

function () payable public{
}

Hope it helps

Jaime
  • 8,340
  • 1
  • 12
  • 20