0

Since the Petshop Dapp was updated earlier this week I noticed an error while compiling and and again whilst testing it seems to be on the adoption.sol file - now it could be something I did in rebuilding the file but just want to ask if anyone else has encountered similar - is this a real error or a warning?

I can see it error both when I compile and test it enter image description here

Here is the solidity code within the adoption.sol file

pragma solidity ^0.4.17;

contract Adoption {

    address[16] public adopters;

    function adopt(uint8 petId) public returns (uint8) {
        require(petId >= 0 && petId <= 15);
        adopters[petId] = msg.sender;
        return petId;
    }

    function getAdopters() public returns (address[16]) {
        return adopters;
    }
}
  • 1
    is this a real error or a warning? - the printout says "warning", so it's gotta be a warning, right? BTW, It also tells you what you can do in order to make this warning go away. – goodvibration Nov 11 '18 at 16:49
  • Yeah, probably they just forgot to double-check for warnings before publishing the newest version. You can ignore the warning, it's nothing serious. – Lauri Peltonen Nov 11 '18 at 17:09
1

Don't ignore the warning, its there for a reason. Update your contract to use:

function getAdopters() public view returns (address[16]) {
    return adopters;
  }
  • Thank you Vinne, I have rebuilt the code on two different machines and can see i left out the view on the one that was broken - reset everything and all now working as expected thx – dubirl Nov 11 '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.