1
contract A {

uint public u;
event abc(address);

constructor() payable{
    u=100;
}

function () payable{
    emit abc(msg.sender);
    u = 25;
}

function setu(uint i) {
    u = i;
}

function getBalance() view returns(uint){
    return address(this).balance;    
}

}

contract B {

uint public a;
A ac;

function(){
    a= 20;
}
constructor() payable {
    a=10;
}

function send(A b){
    b.call.gas(210000).value(100 wei)();    
} 

function getBalance() view returns(uint){
    return address(this).balance;    
}

}

I have updated the code. Now, I am passing gas along with the call to avoid gas estimation failure.

I am trying to trigger contract A's fallback function by sending some ether by calling send function from contract Attacker.

This works fine in Remix using javascript VM but getting failed in Rinkeby.

rohit_sethi
  • 108
  • 7
  • Please share your Rinkeby transaction details and how you are testing it. – Lauri Peltonen Oct 08 '18 at 11:42
  • when I call Send() of Contract Attacker it shows Gas Estimation Failed error. – rohit_sethi Oct 08 '18 at 12:07
  • @LauriPeltonen It is working when I use Javascript VM but transaction fails on Rinkeby. TxId: 0x7e4ef5707ffe11b8a04dcc85e8be7057c92bb56c957243736af5c9998b80302 – rohit_sethi Oct 09 '18 at 05:17
  • Simply you have too much elaboration in your fallback function. See my answer in: https://ethereum.stackexchange.com/questions/60079/what-is-wrong-with-this-code-deployed-but-showing-error-while-sending-ether/60087#60087 – Rick Park Oct 08 '18 at 13:12

0 Answers0