recently I met a very strange problem, when I deployed a ERC20 ICO contract to Repsten network through truffle and MetaMask.Then I send some ETHs to my ERC20 contract address, I expected is that when contract deadline is up or received ETHs amount is more than funding goal, I can withdraw ETHs in the contract.
Actually it worked well as I expected when contract received ETHs amount is Integer number.
But when contract received ETHs amount includes float number, such as 0.1,0.2,1.1, then it will happen 'VM Exception while processing transaction: revert' as the title described. Anyone met this problem before? The detail information is as follows, PLS help me to resolve this problem.
Thanks in advance.
first I deployed a ERC20 contract to Ropsten network. The fallback function like following.
I send 0.5 ETH to my contract address and contract received 0.5 ETH. as deadline is up, I send 0 ETH to my contract address to trigger contract's fallback function transfer ETH balance to beneficiary. But it's failed. And in ropsten.etherscan.io it prompts 'transaction revert' . contract link: https://ropsten.etherscan.io/address/0x611d807ea4c3fa9bfb5c7765642fc8be534c9f3e
I deployed another contract with same code, I send 1 ETH to contract address, as deadline is up, I send 0 ETH to my contract address to trigger contract's fallback. Beneficiary can receive ETH successfully.