From 65d8e5446c6e762b596ec1ffd66a580f90d72149 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 30 Apr 2018 16:21:36 +0200 Subject: Update some examples to remove warnings. --- docs/solidity-by-example.rst | 12 ++++++------ 1 file 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); } } -- cgit