From eeef82b2d77c6f956039c57b0598e684254ee6dd Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 28 Jun 2018 18:08:45 +0200 Subject: Fallback function has to be external: backwards-compatible changes. --- docs/contracts.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/contracts.rst') diff --git a/docs/contracts.rst b/docs/contracts.rst index 19eba047..5cfa7805 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -543,7 +543,7 @@ Fallback Function ================= A contract can have exactly one unnamed function. This function cannot have -arguments and cannot return anything. +arguments, cannot return anything and has to have ``external`` visibility. It is executed on a call to the contract if none of the other functions match the given function identifier (or if no data was supplied at all). @@ -591,7 +591,7 @@ Like any function, the fallback function can execute complex operations as long // Sending Ether to this contract will cause an exception, // because the fallback function does not have the `payable` // modifier. - function() public { x = 1; } + function() external { x = 1; } uint x; } @@ -599,7 +599,7 @@ Like any function, the fallback function can execute complex operations as long // This contract keeps all Ether sent to it with no way // to get it back. contract Sink { - function() public payable { } + function() external payable { } } contract Caller { -- cgit