diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-30 09:31:54 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-02 02:16:52 +0800 |
commit | 88bce877c467982be049b4f6515974cec3ebd89e (patch) | |
tree | 4cd867591c7bcfa361d7c54f15f6bca449391168 /docs/frequently-asked-questions.rst | |
parent | cbd729957b60599f55dfd1f3c7b64a7e4540c6ce (diff) | |
download | dexon-solidity-88bce877c467982be049b4f6515974cec3ebd89e.tar.gz dexon-solidity-88bce877c467982be049b4f6515974cec3ebd89e.tar.zst dexon-solidity-88bce877c467982be049b4f6515974cec3ebd89e.zip |
Clarify some subtleties of the fallback function
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index c4de60cd..9edfb4fb 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -137,37 +137,6 @@ Enums are not supported by the ABI, they are just supported by Solidity. You have to do the mapping yourself for now, we might provide some help later. -What is the deal with ``function () { ... }`` inside Solidity contracts? How can a function not have a name? -============================================================================================================ - -This function is called "fallback function" and it -is called when someone just sent Ether to the contract without -providing any data or if someone messed up the types so that they tried to -call a function that does not exist. - -The default behaviour (if no fallback function is explicitly given) in -these situations is to throw an exception. - -If the contract is meant to receive Ether with simple transfers, you -should implement the fallback function as - -``function() payable { }`` - -Another use of the fallback function is to e.g. register that your -contract received ether by using an event. - -*Attention*: If you implement the fallback function take care that it uses as -little gas as possible, because ``send()`` will only supply a limited amount. - -Is it possible to pass arguments to the fallback function? -========================================================== - -The fallback function cannot take parameters. - -Under special circumstances, you can send data. If you take care -that none of the other functions is invoked, you can access the data -by ``msg.data``. - Can state variables be initialized in-line? =========================================== |