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.

4
  • Please share your Rinkeby transaction details and how you are testing it. Oct 8 '18 at 11:42
  • when I call Send() of Contract Attacker it shows Gas Estimation Failed error. Oct 8 '18 at 12:07
  • Simply you have too much elaboration in your fallback function. See my answer in: ethereum.stackexchange.com/questions/60079/…
    – Rick Park
    Oct 8 '18 at 13:12
  • @LauriPeltonen It is working when I use Javascript VM but transaction fails on Rinkeby. TxId: 0x7e4ef5707ffe11b8a04dcc85e8be7057c92bb56c957243736af5c9998b80302 Oct 9 '18 at 5:17

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.