0

Assuming this contract:

contract getSome {

    finalizeToken token;


    constructor() {
        token = finalizeToken(0xdc0974e65e479fa587118eb7588f426229a39d31);
    }

    function testWrite() public returns (bool) {
        setval();
    }

    function setval()  {
        token.setEpoch(8000);
    }

}

interface fToken {
    function setEpoch(uint _blocks) external ;
}

contract finalizeToken is fToken {
    uint public epochCount;


    constructor() {}

    function setEpoch(uint _blocks) public {
        epochCount = _blocks;
    }


}

For whatever reason the value of epochCount on the finalizeToken is not being updated when called trough the getSome contract.

I've never encountered this before, so i'd appreciate some inputs

EDIT: Issue found, i was using ganache instead of ropsten and it need explicit sendTransaction for making a call. I was using Remix with Ganache as Web3 provider, causing this behaviour.

Thanks!

0

This works, the only issue that you could be having is that you should be careful with the address in the constructor of getSome, deploy first finalizeToken and then update the address in the constructor of getSome.

Hope this helps.

  • Please explain in more detail your found solution about Ganache and Remix. It does not make sense to me, so I suspect something I can learn here...Thank you in advance. – Rick Park Dec 10 '19 at 8:37
  • I am not sure what does not makes sense to you. As I said, this smart contract should work and the OP wrote that he found the issue and was not in the smart contract but in how he was using ganache. – Jaime Dec 11 '19 at 9:03
  • Yes, and I’m curious about the difference found in using ganache. I’d like to have more details about that’s What did not match for you? (BTW: do not downvote if you do not understand... ) – Rick Park Dec 11 '19 at 11:38
  • Rick, why will I downvote you?. what do you mean when you said: "what did not match for you?" My answer says that it should work, as I tested it on Remix and it worked. I have not said that there is something that does not match. Please see the question, the OP marked as solved and he is indicating what was wrong in ganache. I personally have no interest in ganache so I cant help, I was interested in the code. – Jaime Dec 12 '19 at 10:18

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.