0

The line highlighted in the error is require(bid2 > highestBid2);

The code:

pragma solidity ^0.4.22;

contract SimpleAuction {

    address public beneficiary;
    uint public auctionEnd;

    address public highestBidder1;
    uint public highestBid1;

    address public highestBidder2;
    uint public highestBid2;

    uint public proportion;
    uint public bid1;
    uint public bid2;

    mapping(address => uint) pendingReturns;

    bool ended;


    constructor (uint _biddingTime) public {
        beneficiary = msg.sender;
        auctionEnd = now + _biddingTime;
    }

    function () public payable{
        makebid(proportion);
    }


    function makebid(uint var1) public payable {

        proportion = var1;
        bid1 = var1 * msg.value;
        bid2 = 1 - var1 * msg.value;
        require(now <= auctionEnd);

        require(bid1 > highestBid1);

        if (highestBid1 != 0) {
            pendingReturns[highestBidder1] += highestBid1;
        }
        highestBidder1 = msg.sender;
        highestBid1 = bid1;

    }

        require(bid2 > highestBid2);

        if (highestBid2 != 0) {
            pendingReturns[highestBidder2] += highestBid2;
        }
        highestBidder2 = msg.sender;
        highestBid2 = bid2;

    }

}

Thank you in advance!

1 Answer 1

0

Before line require(bid2 > highestBid2); you have an extra }. Just remove that and it at least compiles.

If you had correct indentation you'd notice this problem immediately. I suggest you use some editor which fixes indentation for you.

1
  • Thank you! I'm new to this so it's not immediately obvious Jan 2, 2020 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.