aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-30 22:58:24 +0800
committerGitHub <noreply@github.com>2018-04-30 22:58:24 +0800
commitede6ee8776ee2917b0d2a988a5e86b192e9d7c0f (patch)
treefae542a3b606d3af32e3c3b1fc85db8b3252b415 /docs
parent565b4a0f113f997e8ea576f7539ca0ed23102d55 (diff)
parent65d8e5446c6e762b596ec1ffd66a580f90d72149 (diff)
downloaddexon-solidity-ede6ee8776ee2917b0d2a988a5e86b192e9d7c0f.tar.gz
dexon-solidity-ede6ee8776ee2917b0d2a988a5e86b192e9d7c0f.tar.zst
dexon-solidity-ede6ee8776ee2917b0d2a988a5e86b192e9d7c0f.zip
Merge pull request #4023 from ethereum/exampledocs
Update some examples to remove warnings.
Diffstat (limited to 'docs')
-rw-r--r--docs/solidity-by-example.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 546767e4..f6038f7d 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -66,7 +66,7 @@ of votes.
Proposal[] public proposals;
/// Create a new ballot to choose one of `proposalNames`.
- function Ballot(bytes32[] proposalNames) public {
+ constructor(bytes32[] proposalNames) public {
chairperson = msg.sender;
voters[chairperson].weight = 1;
@@ -256,7 +256,7 @@ activate themselves.
/// Create a simple auction with `_biddingTime`
/// seconds bidding time on behalf of the
/// beneficiary address `_beneficiary`.
- function SimpleAuction(
+ constructor(
uint _biddingTime,
address _beneficiary
) public {
@@ -418,7 +418,7 @@ high or low invalid bids.
modifier onlyBefore(uint _time) { require(now < _time); _; }
modifier onlyAfter(uint _time) { require(now > _time); _; }
- function BlindAuction(
+ constructor(
uint _biddingTime,
uint _revealTime,
address _beneficiary
@@ -553,7 +553,7 @@ Safe Remote Purchase
// Ensure that `msg.value` is an even number.
// Division will truncate if it is an odd number.
// Check via multiplication that it wasn't an odd number.
- function Purchase() public payable {
+ constructor() public payable {
seller = msg.sender;
value = msg.value / 2;
require((2 * value) == msg.value, "Value has to be even.");
@@ -602,7 +602,7 @@ Safe Remote Purchase
{
emit Aborted();
state = State.Inactive;
- seller.transfer(this.balance);
+ seller.transfer(address(this).balance);
}
/// Confirm the purchase as buyer.
@@ -637,7 +637,7 @@ Safe Remote Purchase
// block the refund - the withdraw pattern should be used.
buyer.transfer(value);
- seller.transfer(this.balance);
+ seller.transfer(address(this).balance);
}
}