pragma solidity ^0.4.24;
contract XXXX{
    address  owner;
        owner=msg.sender;//To store address of contract deployer

        struct Project//struct to store project details

            string  proName;
            string  proDetails;
            uint  proPrice;
            address  proOwner;

        Project [] public  pros;//Dynamic array of strut to store project details
        mapping (address => Project) public enrolled;

    function ProjectDetails(uint _price, string _name,string _projectDetails) public 
    //fucntion to accept project details

        Project memory newPro = Project// stores data in the struct




I am getting the error that the called function should be payable even though I am using the above function just to enter data

  • What version of Solidity are you using? Also, can you share more of your code, like the definition of the Project struct, and where you are calling it from? It's hard to reproduce without more information.
    – Ann Kilzer
    Nov 24, 2019 at 12:30
  • 1
    I copied your code and tested with versions 0.4.24, 0.5.0 and the latest current one 0.5.13. It works without any warnings or errors. The error you get might be on some other method, I advise you to start debugging by removing variables and methods one by one until you locate the error. Nov 24, 2019 at 17:40
  • Same, I'm unable to reproduce.
    – Ann Kilzer
    Nov 25, 2019 at 11:55


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.