[Ethereum] Smartcontract: Warning! contract execution experienced an error and gets [Reverted]

contract-developmentrevert-opcodesoliditytransactions

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

Best Answer

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.

Related Topic