mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Documentation.
This commit is contained in:
parent
546aca2a3e
commit
eb241ff1b3
@ -447,6 +447,11 @@ In particular, the following operations will consume more gas than the stipend p
|
|||||||
|
|
||||||
Please ensure you test your fallback function thoroughly to ensure the execution cost is less than 2300 gas before deploying a contract.
|
Please ensure you test your fallback function thoroughly to ensure the execution cost is less than 2300 gas before deploying a contract.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
The default fallback function will throw an exception (this was different
|
||||||
|
before Solidity v0.4.0), so if you want your contract to receive Ether,
|
||||||
|
you have to implement a fallback function.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
contract Test {
|
contract Test {
|
||||||
|
@ -103,7 +103,9 @@ and stall those. Please be explicit about such cases in the documentation of you
|
|||||||
Sending and Receiving Ether
|
Sending and Receiving Ether
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
- If a contract receives Ether (without a function being called), the fallback function is executed. The contract can only rely
|
- If a contract receives Ether (without a function being called), the fallback function is executed.
|
||||||
|
If it does not have a fallback function, the Ether will be rejected (by throwing an exception).
|
||||||
|
During the execution of the fallback function, the contract can only rely
|
||||||
on the "gas stipend" (2300 gas) being available to it at that time. This stipend is not enough to access storage in any way.
|
on the "gas stipend" (2300 gas) being available to it at that time. This stipend is not enough to access storage in any way.
|
||||||
To be sure that your contract can receive Ether in that way, check the gas requirements of the fallback function
|
To be sure that your contract can receive Ether in that way, check the gas requirements of the fallback function
|
||||||
(for example in the "details" section in browser-solidity).
|
(for example in the "details" section in browser-solidity).
|
||||||
|
Loading…
Reference in New Issue
Block a user