1

I have deployed a very basic solidity contract (pragma solidity^0.4.0) to Rinkeby. When I call the getters on my state variables, nothing is returned and I do not understand why. To compile the contract I'm using "solc": "^0.4.25"

Using Remix to test, the call to the getter works locally without issue. However, the call doesn't work on my contract on Rinkeby.

Here is my solidity code...

pragma solidity^0.4.0;

contract Contest {
    address public manager;
    uint public submissionCost;
    uint public votesPerSubmission;

    constructor (uint _submissionCost, uint _votesPerSubmission) public {
        manager = msg.sender;
        submissionCost = _submissionCost;
        votesPerSubmission = _votesPerSubmission;
    }

    modifier restricted() {
        require(msg.sender == manager, "Not authorized.");
        _;
    }

    function adjustSubmissionCost(uint newCost) public restricted {
        submissionCost = newCost;
    }

    function adjustVotesPerSubmission(uint newVotes) public {
        votesPerSubmission = newVotes;
    }

    function getManager() public view returns (address) {
        return manager;
    }
}

The address of the deployed contract on Rinkeby is

0x0f1828ED7Be0232fd153218EFb2fA78A09c09b53 https://rinkeby.etherscan.io/address/0x0f1828ED7Be0232fd153218EFb2fA78A09c09b53

When calling any of the public variables from Remix, I expect a return value, however I only receive the message call to Contest.manager in the Remix console and nothing more.

I get the same behavior in my web3 dapp, with zero return when I try...

await Contest.methods.manager().call()

When I submit a transaction on Remix this also hangs on pending... Is it a versioning issue? Can't figure it out...

enter image description here

6
  • How do you initialize the variable Contest in your dapp code? Feb 5, 2019 at 16:48
  • adjustSubmissionCost() has a uint32 arguments which is implicitly casted to a uint256... what is the reason for this?
    – Rick Park
    Feb 5, 2019 at 21:52
  • @RickPark I've updated my code to remove this casting. still run into the same issue. Feb 6, 2019 at 10:15
  • I did not say it was “the” problem...
    – Rick Park
    Feb 6, 2019 at 10:16
  • @RickPark ahh gotcha. I initially did that to just put some constraints on what values can be inputted. Feb 6, 2019 at 10:18

2 Answers 2

1

I have finally solved this mystery.

The cause was my metamask chrome extension being out of sync. Therefore, my dapp and remix wouldn't actually make the call to Rinkeby because metamask was blocking it. The fix was simply to reinstall the metamask extension!

0

I quickly tested and complied your code on remix, at 0xacBd19113e0D8122E18DF48A320b635fB5D7Cdd0, I was going to make a transaction, but looks like I'm unauthorized. On a unrelated note, somehow all my rinkeby eth is gone :(.

Perhaps you are looking in the wrong location

As for your other behaviour that you are seeing in your dapp, it's hard to know what the reason is. I assume that if you were to console.log the return value, you should end up with some value and that should be enough for you to either ask more questions and/or debug your code.

2
  • That is interesting that you actually get return values... I've updated the question and deployed a new contract removing some casting and restriction on a function that i thought might be causing this. I've also added my own explicit getter... and a screen shot of how my remix gets no return value..... Feb 6, 2019 at 10:16
  • I complied the code with v0.4.24
    – GrandFleet
    Feb 6, 2019 at 15:29

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.