0

I have a problem like this. I am very new to solidity. I have tried an example that I was found by a Google Search in the remix editor. But I was unable to get any output like in the example.This is the tutorial that I followed

According to the tutorial, I create a two solidity file called Callee.sol and caller.sol. Here I am providing that callee.sol contract.

contract Callee {
    uint[] public values;

    function getValue(uint initial) returns(uint) {
        return initial + 150;
    }
    function storeValue(uint value) {
        values.push(value);
    }
    function getValues() returns(uint) {
        return values.length;
    }
}

And my caller.sol is looked like this.

pragma solidity ^0.4.6;

contract Caller {
    function someAction(address addr) returns(uint) {
        Callee c = Callee(addr);
        return c.getValue(100);
    }

    function storeAction(address addr) returns(uint) {
        Callee c = Callee(addr);
        c.storeValue(100);
        return c.getValues();
    }

    function someUnsafeAction(address addr) {
        addr.call(bytes4(keccak256("storeValue(uint256)")), 100);
    }
}

contract Callee {
    function getValue(uint initialValue) returns(uint);
    function storeValue(uint value);
    function getValues() returns(uint);
}

Firstly I deployed The callee.sol contract When I deployed it this the way it looks

Then I deployed the contract call caller.sol.

after the deployment of the second contract

Then I copy the address of callee contract and call the function of caller contract like this but it gave a nothing as output.

when function calling

enter image description here

Can someone help me to make this work? Thank you very much.

2
  • Could you make a proper screen shot or copy/paste for the function call? Do you put the address between quotes? Sep 19 '18 at 7:22
  • works as expected, it does return it internally. I think you are expecting some value to be seen. You can assign a public variable to see what was returned.
    – rstormsf
    Sep 19 '18 at 7:23
0

if you click on that green tick mark in left side of the console it will open a table that all the information for the transaction is inside it and you can read it, as you can see in this image " https://imgur.com/a/wt2bYmF " . it's transaction information for "someaction" function.

0

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.