3

we deployed (via remix) the code below where one contract can influence a state variable in the other. For some reason if I deploy the contracts on Ropsten it doesn't work and if I deploy them on Kovan, this works just fine. Anyone any idea?

pragma solidity ^0.4.13;

contract A {

    uint public counter ; 
    function increment(uint add) {
       counter = counter + add;
    }
}

contract B {

    function delegateIncrement(uint add) {
        A("here the address for contract A").increment(add) ; 
    }
}
  • I get the error running out of gas, I even upped the gaslimit significantly, but that didn't work. Why is it running out of gas in Ropsten and not Kovan? – Olivier Rikken Sep 22 '17 at 19:13
  • Since you mention that you are deploying via Remix: Any chance that you forgot to recompile B with the new address of A, as deployed on Ropsten? "Out of gas" is what you see in some interfaces for an invalid opcode, which seems more likely than a failure to send enough gas. – carver Sep 22 '17 at 20:08
1

If you're having trouble deploying the contract, it's probably because Ropsten blocks are very full right now. Try using a gas price greater than 56 gwei.

Kovan is also running on Homestead, while Ropsten is on Byzantium. I don't know why that would make a difference though.

| improve this answer | |
  • What do you mean by "blocks are very full?" – Achala Dissanayake Sep 21 '17 at 1:08
  • Deployingnis nog problem. It is the interaction that doesn't work in ropsten. If I use the function in contract A, the counter works fine. If I use the function in contract B, the counter doesn't chage value. I don't run into this problem on Kovan.... – Olivier Rikken Sep 21 '17 at 14: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.