1

This SC compiles but fails to produce expected results when deployed and having a transaction sent to it.

I was expecting the line: "owner.transfer(tokensIssued/1000 szabo);" to produce a send of 0.00333 Ethers, but produced nothing.

Other parts of smart contract performing as expected.

When I hard code the line in question as: "owner.transfer(0.00333 ethers);" it works as expected.

Any tips/guidance appreciated.

here the snippet from smart contract

  • 1
    Please, the next time paste your code as text for easier review. – Ismael Jul 14 '17 at 3:44
1

Stumbled upon the answer myself!

I was incorrect in stating that the line of code in question had "worked" when values were hard coded as

"owner.transfer(0.00333 ethers);"

When tested further I read the error message stating that conversion from "implicit rational" to integer data type was the problem.

The value to be transferred has to be expressed as integer. So converted to "wei" by multiplying variable by 10^9 and then stating the units as "wei" at the end. The following now works.

owner.transfer(tokensIssued*1000000000 wei);
| improve this answer | |

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.