0

I have sent ropsten ETH to my newly created contract address (still on test mode on the Ropsten Test net). Unfortunately it kept "failing". The blockchain reports: Warning! Error encountered during contract execution [Reverted]

Please see my contract address and transaction failures here: https://ropsten.etherscan.io/address/0xe7a6fbf8a93e6c879907e0404881840a05978745

I have employed myetherwallet interaction functions, interacted and queried my smart contract for the totalSupply, CurrentDistribPublicSupply, OwnerDistribSupply_ and others. Everything seems to be in order and tallies. So am super confused and quite worried. Please someone help and explain what I am doing wrongly? All sort of help and correction would be appreciated. Thank you.A pictorial description of my already deployed contract on read mode

  • 1
    It seems it is running out of gas. Did you try sending more gas with your transaction? Gas of 90k is not very much if your contract is complex. – Ismael Jun 14 '18 at 17:05
  • Thank you Ismael for your interest in my problem. Yes I have deployed the same contract with another contract address. I used 250k gas, still failed. Please help review my contract code, all errors on solidity have already been solved, contract deployment was successful. My contract is designed to give out tokens for Eth. – fiftystacks Jun 14 '18 at 17:09
0

It's most likely you run into one revert() of your fallback function. Debug it with Remix. It's recommended to use require() instead, as this will revert the change of the state automatically, if the condition inside it does not turn out true.

So to make sure a condition is met, you can do require ( 2 == 2) and if that fails, it's way easier to discover when going through the execution steps with Remix's debugger than watching at which if condition it jumped to a revert.

  • 1
    Nikita thank you, actually remix suggested that, I just found a way to bypass. I will surely try this and give u an immediiate feedback. Lots ov thanks. – fiftystacks Jun 14 '18 at 18:24
  • Hi Nikita, I applied ur suggestion and the contract now receives ETH on ropsten test. I really appreciate the help. Thanks alot – fiftystacks Jun 15 '18 at 21:52
  • thanks, you're welcome to mark my answer as the accepted solution, please ! ;) – Nikita Fuchs Jun 16 '18 at 12:52
1

The fallback function is only suitable for basic operations. https://solidity.readthedocs.io/en/v0.4.24/contracts.html?#fallback-function

  • Thank you Siid for that. Frankly am no super programmer, at least not yet. But after going through the doc, my intuitive reasoning understands that you advice me to removing the fallback function? Finally I dunno, would u suggest that by including data when trying to send ETH to the contract, that the revert function can be bypassed? Especially with the presence of a fallback function in my code. Thanks for your diligence – fiftystacks Jun 14 '18 at 17:24

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.