0

I have a contract where some calculations are done and ether has to be transfered.

js file

 for(i=0;i<l;i++){  //'l' represents count of addresses to which ether has to be transfered.

 bal(a,b,c);

    }

function bal(a,b,c){

  Balcontract.deployed().then(function(instance){

    var registerInstance = instance;
    return registerInstance.InReturn(a,b,c,{from: iswallet,gas: 4000000,value:web3.toWei(0.006,'ether')});

    });
    }

contract file

 uint256 bal;

 function InReturn(uint256 a,uint256 b,uint256 c) public payable { 

   // iwallet holds the address

   //bal = (1000*5300*10^14)/1000; Need to send 0.53 ether
    bal = (a*c*100000000000000)/b;

    iwallet.transfer(bal);


}

But contract is reverted with error :

Error: invalid argument 0: json: cannot unmarshal hex string of odd length into Go value of type common

When I tried

bal = (1000*5300*10^12)/1000; //0.0053 ether was transfered

Even inwallet.transfer(530000000000000000); //53 * 10^16 is showing error.

Thanks in advance.Help will be appreciated :)

  • This is not a solidity error. You need to post more information about how you are calling this contract. – Tjaden Hess May 19 '18 at 17:34
  • I tried in ropsten..Still not working – angelmaria May 21 '18 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.