function withdraw () public OnlyOwner {
       for (uint i = 0 ; i<= funders.length ; i++) {
           address funder = funders[i];
           addresstoFund[funder] = 0 ;

       funders = new address[](0); // Syntax for reseting the array 
       payable (msg.sender).transfer(address(this).balance);


My error is this :

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted
"originalError": {
"code": 3,
"data": "0x4e487b710000000000000000000000000000000000000000000000000000000000000032",
"message": "execution reverted"

Can somebody help me

2 Answers 2


There is a small error in your for loop. You are trying to loop it from 0 till funders.length. But the loop should have been executed till funders.length - 1 since the length of an array is 1 more than the index of the last element added to an array. Try it with this:

for (uint i = 0 ; i < funders.length ; i++) 

send and transfer functions has 2300 limit of gas. You might be passing that limit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.