I build a basic reverse auction you see here using Solidity and the ethereum remix IDE. In addition to the functionalities already implemented I would like to add a "SafetyLimit" amounting to half the "WTP". So possible bidders have to pay the SafetyLimit into the account BEFORE being able to actually take part in the bid. Is there a way I could add some sort of "Bidding right" into this account? I am quit lost in how I should add this functionality.

Help would be much appreciated. Thanks.

address payable public Auctioneer;
address payable LowestBidder;
uint public AuctionEndTime;
uint public WTP;
uint public LowestBid;
uint public SafetyLimit;
bool Ended;

mapping(address => uint) PendingReturns;

constructor(uint BiddingTime) public payable {
    Auctioneer = msg.sender;
    AuctionEndTime = now + BiddingTime;
    WTP = msg.value;
    LowestBid = WTP;
    Ended = false;

function Bid() public payable {                                         ///insurance deposit (linking with tracking contract!)
    require(now <= AuctionEndTime,"Auction already ended.");
    require(msg.value < WTP,"Bid exceeds willingness to pay.");
    require(msg.value < LowestBid,"There already is a lower bid.");
    PendingReturns[LowestBidder] += LowestBid;
    LowestBidder = msg.sender;
    LowestBid = msg.value;

function AuctionEnd() public {
    require(msg.sender == Auctioneer,"Insufficient permission.");
    require(now >= AuctionEndTime, "Auction not yet ended.");
    require(Ended == false, "AuctionEnd has already been called.");
    LowestBidder.transfer(LowestBid*2);                                 ///paying back safety deposit + actual payment (so 2 times lowest bid)
    Auctioneer.transfer(address(this).balance);                         ///rest of the contract balance (WTP-lowest bid) should go back to the auctioneer
    Ended = true;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.