I have this warning in Remix Analysis tab for a basic send funds function:

function sendFunds(address receiver, uint amount) onlyOwner {
    if (this.balance < amount) throw;

Remix warning: Gas requirement of function () unknown or not constant.

I don't see why the gas cost would be unknown.

Can you help me out? Is there really a problem?

There is also this error which I think has no place there:

Error: Type "address" not supported for state variable.

address public owner;
  • please provide the whole contract if it is possible – Badr Bellaj May 21 '17 at 14:48
  • Sure, it's on github. But you can get the same result with a simple contract containing just what I mentioned in the question. – Rideron85 May 21 '17 at 15:27
  • The link to github doesn't work. – Jakub Wojciechowski Jul 17 '17 at 20:29

The warning about Gas requirements is correct! If receiver is an ordinary address, the Gas usage is known. But if receiver is the address of a (payable) contract, the Gas requirements depend on the complexity of the contract code that is dealing with the incoming transaction.

  • OK, it makes sense. Thanks! Any idea about the error below? And I have also the warning for this code: arr.push(1); where uint[] public arr;. Can't think of anything that would justify a warning for this. – Rideron85 May 21 '17 at 18:53
  • 2
    I have the same problem. How does one fix this error/warning? Why is it warning us about something we cant influence? Why is it saying that MyContract.someVariable() unknown or not constant? how can a class field be constant or known more that it is? – John Little Nov 14 '17 at 17:11

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.