1
  • Parity version: 1.6.8
  • Operating system: MacOS
  • And installed: docker

start on

--chain dev

here's test contract A

contract A {
    mapping (address => uint256) balances;
    function testFunc1(address _to, uint256 _value) {
        balances[_to] += _value;
    }
    function testFunc2(address _to, uint256 _value) {
        balances[_to] += 1;
        balances[_to] += 1;
    }
    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }
}

here's invoker contract B

contract B {
    function testSend1(address _contract, address _to, uint256 _value) {
        _contract.call.gas(400000)(bytes4(keccak256("testFunc1(address,uint256)")), _to, _value);
    }
    function testSend2(address _contract, address _to, uint256 _value) {
        _contract.call.gas(400000)(bytes4(keccak256("testFunc2(address,uint256)")), _to, _value);
    }
}
  • excute A's testFunc1 & testFunc2 is work
  • excute B's testSend1 is work
  • why excute B's testSend2 happened nothing ?【actually, the selected address should +2 on balances】

What's wrong with my contract code?

1

oh,I got it.

contract_A_address.call

should to be:

A a = A(contract_A_address);

a.testFunc2(_to, _value);

  • Don't forget to mark your question accepted. – Afr Aug 29 '17 at 9:12

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.