mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update some examples to remove warnings.
This commit is contained in:
parent
9e61b25dc4
commit
65d8e5446c
@ -66,7 +66,7 @@ of votes.
|
|||||||
Proposal[] public proposals;
|
Proposal[] public proposals;
|
||||||
|
|
||||||
/// Create a new ballot to choose one of `proposalNames`.
|
/// Create a new ballot to choose one of `proposalNames`.
|
||||||
function Ballot(bytes32[] proposalNames) public {
|
constructor(bytes32[] proposalNames) public {
|
||||||
chairperson = msg.sender;
|
chairperson = msg.sender;
|
||||||
voters[chairperson].weight = 1;
|
voters[chairperson].weight = 1;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ activate themselves.
|
|||||||
/// Create a simple auction with `_biddingTime`
|
/// Create a simple auction with `_biddingTime`
|
||||||
/// seconds bidding time on behalf of the
|
/// seconds bidding time on behalf of the
|
||||||
/// beneficiary address `_beneficiary`.
|
/// beneficiary address `_beneficiary`.
|
||||||
function SimpleAuction(
|
constructor(
|
||||||
uint _biddingTime,
|
uint _biddingTime,
|
||||||
address _beneficiary
|
address _beneficiary
|
||||||
) public {
|
) public {
|
||||||
@ -418,7 +418,7 @@ high or low invalid bids.
|
|||||||
modifier onlyBefore(uint _time) { require(now < _time); _; }
|
modifier onlyBefore(uint _time) { require(now < _time); _; }
|
||||||
modifier onlyAfter(uint _time) { require(now > _time); _; }
|
modifier onlyAfter(uint _time) { require(now > _time); _; }
|
||||||
|
|
||||||
function BlindAuction(
|
constructor(
|
||||||
uint _biddingTime,
|
uint _biddingTime,
|
||||||
uint _revealTime,
|
uint _revealTime,
|
||||||
address _beneficiary
|
address _beneficiary
|
||||||
@ -553,7 +553,7 @@ Safe Remote Purchase
|
|||||||
// Ensure that `msg.value` is an even number.
|
// Ensure that `msg.value` is an even number.
|
||||||
// Division will truncate if it is an odd number.
|
// Division will truncate if it is an odd number.
|
||||||
// Check via multiplication that it wasn't an odd number.
|
// Check via multiplication that it wasn't an odd number.
|
||||||
function Purchase() public payable {
|
constructor() public payable {
|
||||||
seller = msg.sender;
|
seller = msg.sender;
|
||||||
value = msg.value / 2;
|
value = msg.value / 2;
|
||||||
require((2 * value) == msg.value, "Value has to be even.");
|
require((2 * value) == msg.value, "Value has to be even.");
|
||||||
@ -602,7 +602,7 @@ Safe Remote Purchase
|
|||||||
{
|
{
|
||||||
emit Aborted();
|
emit Aborted();
|
||||||
state = State.Inactive;
|
state = State.Inactive;
|
||||||
seller.transfer(this.balance);
|
seller.transfer(address(this).balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Confirm the purchase as buyer.
|
/// Confirm the purchase as buyer.
|
||||||
@ -637,7 +637,7 @@ Safe Remote Purchase
|
|||||||
// block the refund - the withdraw pattern should be used.
|
// block the refund - the withdraw pattern should be used.
|
||||||
|
|
||||||
buyer.transfer(value);
|
buyer.transfer(value);
|
||||||
seller.transfer(this.balance);
|
seller.transfer(address(this).balance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user