Your task is to implement a basic Auction
using a smart contract which grants its creator the ability to initiate and manage a public auction.
Auction
constructor:
- should set
seller
field to contract creator, - should set
latestBid
field to thestartingPrice
(in Wei).
- Payable
bid
function:
- is used to place a new bid,
- should
revert
if auction is already finished, - should return previous bid to the bidder.
finishAuction
function:
- is used to manually finish the auction,
- should
revert
if auction is already finished, - should withdraw winning bid to the seller,
- should be callable only by the auction owner.
You should not change public contract interfaces, i.e. seller
, latestBid
, latestBidder
fields and bid
, finishAuction
methods should remain accessible by external components and tests.