mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update documentation.
This commit is contained in:
parent
0011f8aef9
commit
cf69433f23
@ -406,7 +406,8 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
|||||||
/// The `return 7` statement assigns 7 to the return value but still
|
/// The `return 7` statement assigns 7 to the return value but still
|
||||||
/// executes the statement `locked = false` in the modifier.
|
/// executes the statement `locked = false` in the modifier.
|
||||||
function f() public noReentrancy returns (uint) {
|
function f() public noReentrancy returns (uint) {
|
||||||
require(msg.sender.call(""));
|
(bool success,) = msg.sender.call("");
|
||||||
|
require(success);
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -645,7 +646,8 @@ Like any function, the fallback function can execute complex operations as long
|
|||||||
|
|
||||||
contract Caller {
|
contract Caller {
|
||||||
function callTest(Test test) public returns (bool) {
|
function callTest(Test test) public returns (bool) {
|
||||||
require(address(test).call(abi.encodeWithSignature("nonExistingFunction()")));
|
(bool success,) = address(test).call(abi.encodeWithSignature("nonExistingFunction()"));
|
||||||
|
require(success);
|
||||||
// results in test.x becoming == 1.
|
// results in test.x becoming == 1.
|
||||||
|
|
||||||
// If someone sends ether to that contract,
|
// If someone sends ether to that contract,
|
||||||
|
@ -86,7 +86,8 @@ as it uses ``call`` which forwards all remaining gas by default:
|
|||||||
mapping(address => uint) shares;
|
mapping(address => uint) shares;
|
||||||
/// Withdraw your share.
|
/// Withdraw your share.
|
||||||
function withdraw() public {
|
function withdraw() public {
|
||||||
if (msg.sender.call.value(shares[msg.sender])(""))
|
(bool success,) = msg.sender.call.value(shares[msg.sender])("");
|
||||||
|
if (success)
|
||||||
shares[msg.sender] = 0;
|
shares[msg.sender] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user