mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Documentation.
This commit is contained in:
@@ -25,7 +25,7 @@ to receive their money - contracts cannot activate themselves.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract SimpleAuction {
|
||||
// Parameters of the auction. Times are either
|
||||
@@ -60,7 +60,7 @@ to receive their money - contracts cannot activate themselves.
|
||||
constructor(
|
||||
uint _biddingTime,
|
||||
address payable _beneficiary
|
||||
) public {
|
||||
) {
|
||||
beneficiary = _beneficiary;
|
||||
auctionEndTime = block.timestamp + _biddingTime;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ invalid bids.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract BlindAuction {
|
||||
struct Bid {
|
||||
@@ -220,7 +220,7 @@ invalid bids.
|
||||
uint _biddingTime,
|
||||
uint _revealTime,
|
||||
address payable _beneficiary
|
||||
) public {
|
||||
) {
|
||||
beneficiary = _beneficiary;
|
||||
biddingEnd = block.timestamp + _biddingTime;
|
||||
revealEnd = biddingEnd + _revealTime;
|
||||
|
||||
@@ -143,14 +143,14 @@ The full contract
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.24 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract ReceiverPays {
|
||||
address owner = msg.sender;
|
||||
|
||||
mapping(uint256 => bool) usedNonces;
|
||||
|
||||
constructor() public payable {}
|
||||
constructor() payable {}
|
||||
|
||||
function claimPayment(uint256 amount, uint256 nonce, bytes memory signature) public {
|
||||
require(!usedNonces[nonce]);
|
||||
@@ -340,7 +340,7 @@ The full contract
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract SimplePaymentChannel {
|
||||
address payable public sender; // The account sending payments.
|
||||
@@ -348,7 +348,6 @@ The full contract
|
||||
uint256 public expiration; // Timeout in case the recipient never closes.
|
||||
|
||||
constructor (address payable _recipient, uint256 duration)
|
||||
public
|
||||
payable
|
||||
{
|
||||
sender = msg.sender;
|
||||
|
||||
@@ -26,7 +26,7 @@ you can use state machine-like constructs inside a contract.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract Purchase {
|
||||
uint public value;
|
||||
@@ -74,7 +74,7 @@ you can use state machine-like constructs inside a contract.
|
||||
// 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.
|
||||
constructor() public payable {
|
||||
constructor() payable {
|
||||
seller = msg.sender;
|
||||
value = msg.value / 2;
|
||||
require((2 * value) == msg.value, "Value has to be even.");
|
||||
|
||||
@@ -33,7 +33,7 @@ of votes.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
/// @title Voting with delegation.
|
||||
contract Ballot {
|
||||
@@ -63,7 +63,7 @@ of votes.
|
||||
Proposal[] public proposals;
|
||||
|
||||
/// Create a new ballot to choose one of `proposalNames`.
|
||||
constructor(bytes32[] memory proposalNames) public {
|
||||
constructor(bytes32[] memory proposalNames) {
|
||||
chairperson = msg.sender;
|
||||
voters[chairperson].weight = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user