The Product storage Product=stores [productIdInStore [_productId]] [_productId];
Require (now> product. AuctionEndTime);
Bytes32 sealedBid=keccak256 (abi) encodePacked (_amount _secret));
The Bid the memory bidInfo=product. Bids [MSG. Sender] [sealedBid];
Require (bidInfo. Bidder> address (0));
Require (bidInfo. Revealed==false);
Uint refund;
Uint amount=stringToUint (_amount);
If (bidInfo. Value {
If (product. HighestBidder==address (0)) {
Product. HighestBidder=MSG. Sender;
Product. HighestBid=amount;
Product. SecondHighestBid=product. StartPrice;
Refund=bidInfo. Value - the amount;
} else {
If (amount> product. HighestBid) {
Product. SecondHighestBid=product. HighestBid;
Product. HighestBidder. Transfer (product. HighestBid);
Product. HighestBidder=MSG. Sender;
Product. HighestBid=amount;
Refund=bidInfo. Value - the amount;
} else if (amount> product. SecondHighestBid) {
Product. SecondHighestBid=amount;
Refund=amount;
} else {
Refund=amount;
}
}
}
Product. Bids [MSG. Sender] [sealedBid] revealed=true;
If (refund> 0) {
MSG. Sender. Transfer (refund);
}
}