diff options
author | chriseth <c@ethdev.com> | 2016-09-05 22:29:08 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-09-07 01:11:41 +0800 |
commit | 4f5a95d569408e6a0a94c54b1eb39ea62b873c5e (patch) | |
tree | e0624ae19d837fb8e2acf9f828c4464e9e788c60 /docs/frequently-asked-questions.rst | |
parent | fbe0edb32c973166efbd5c0ac556f37fd38584d6 (diff) | |
download | dexon-solidity-4f5a95d569408e6a0a94c54b1eb39ea62b873c5e.tar.gz dexon-solidity-4f5a95d569408e6a0a94c54b1eb39ea62b873c5e.tar.zst dexon-solidity-4f5a95d569408e6a0a94c54b1eb39ea62b873c5e.zip |
Update documentation to version 0.4.0.
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index 7e69093f..acc0c106 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -317,17 +317,12 @@ 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 just accept the call and do nothing. -This is desireable in many cases, but should only be used if there is -a way to pull out Ether from a contract. +these situations is to throw an exception. -If the contract is not meant to receive Ether with simple transfers, you +If the contract is meant to receive Ether with simple transfers, you should implement the fallback function as -``function() { throw; }`` - -this will cause all transactions to this contract that do not call an -existing function to be reverted, so that all Ether is sent back. +``function() payable { }`` Another use of the fallback function is to e.g. register that your contract received ether by using an event. @@ -488,6 +483,8 @@ What happens if you send ether along with a function call to a contract? ======================================================================== It gets added to the total balance of the contract, just like when you send ether when creating a contract. +You can only send ether along to a function that has the ``payable`` modifier, +otherwise an exception is thrown. Is it possible to get a tx receipt for a transaction executed contract-to-contract? =================================================================================== |