This contract is a simple contract that let other people send eth to the holder of the contract. The sender should send minimum of 50$ in form of eths. But every time I get this error enter image description here

This is my code

enter image description here

2 Answers 2


If you're trying to fund your contract, you need to divide $50 by the current price of Ethereum. Let say the current price of Ethereum is $3000, you need to do $50/$3000 = 0.0167 ether. I would suggest use 0.02 ether so you have enough gas. Then you need to convert 0.02 ether to wei, which is approximately 20000000000000000 wei. You enter this amount of wei into the value as wei in Remix and click on the "fund" button again.

For conversion, see: https://eth-converter.com/


Before sending the transaction, your code is being ran virtually to calculate how much gas it will need. If this virtual run returns an error (this might be from the require function or from any another not caught error), it can't estimate the required gas.

In your case, there is two option:

  1. Your require condition is not met, and it throws an error.
  2. There is another error in getConversionRate or priceFeed.

I recommend you to check ethPrice and ethAmountInUsd variables. Those variables might be the cause of the error. Because decimal numbers are not supported in Solidity. You shouldn't divide to 1000000000000000000 anytime. Keep working with wei.

Edit: I just read Yongijan's answer. To add to him, this could be your solution:

    uint requiredValue = (50 / getPrice()) ether
    require(msg.Value > requiredValue, "Not enough funding");

ether keyword simply converting the number to wei, you can also use:

    uint requiredValue = (50 / getPrice()) * 1000000000000000000
    require(msg.Value > requiredValue, "Not enough funding");

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.