-2

I'm getting this error when trying to compile a contract using cmd on windows:

Error parsing C:/Users/alexa/Desktop/contracts/contracts/ApprovalContract.sol: ParsedContract.sol:6:37: ParserError: Expected primary expression.

address public constant approver = ;

            ^ Compilation failed. See above.

Truffle v5.0.0 (core: 5.0.0)

Node v10.15.0


Here's the contract

pragma solidity ^0.4.18;


contract ApprovalContract {

    address public sender;
    address public receiver;
    address public constant approver = ;

    function deposit(address_receiver) external payable {
        require(msg.value > 0);
        sender = msg.sender;
        receiver = _receiver;
        }

    function viewApprover() external pure returns(address) {
        return(approver);
        }

    function approve() external {
        require(msg.sender == approver);
        receiver.transfer(address(this).balance);
        }
}
  • I'm voting to close this question as off-topic because it looks like a deliberate syntax error, followed by "what's wrong with this code?". – goodvibration Dec 31 '18 at 8:05
0

This line is invalid

address public constant approver = ;

Try replacing it with something like this:

address public approver;
  • Thank you abed, I've noticed that I was missing the actual 0x address after the equal sign. Also on: function deposit(address_receiver) external payable { where it should be function deposit(address _receiver) external payable { missing a space there. – Arturo Heredia Dec 30 '18 at 23:37

Your Answer

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

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