详细内容
本文由 威-kaifa873 整理发布,仅作为项目开发需求参考!飞机@sleu88
There are many situations where smart contracts can be applied,and many companies have already done so.For example,Slock.it helps its users automatically share,pay and rent through smart contracts.Fizzy AXA uses blockchain automation flight insurance compensation.Populous uses smart contracts and many other ways to alleviate the problem of purchasing and selling open invoices.
#Open Auction
#Auction params
#Beneficiary receives money from the highest bidder
beneficiary:public(address)
auctionStart:public(uint256)
auctionEnd:public(uint256)
#Current state of auction
highestBidder:public(address)
highestBid:public(uint256)
#Set to true at the end,disallows any change
ended:public(bool)
#Keep track of refunded bids so we can follow the withdraw pattern
pendingReturns:public(HashMap[address,uint256])
external
def __init__(_beneficiary:address,_bidding_time:uint256):
self.beneficiary=_beneficiary
self.auctionStart=block.timestamp
self.auctionEnd=self.auctionStart+_bidding_time
#Bid on the auction with the value sent
#together with this transaction.
#The value will only be refunded if the
#auction is not won.
external
payable
def bid():
#Check if bidding period is over.