This article is compiled and released by WeChaT: kaifa873, which is only for reference of project development requirements! telegram @ 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.