0

I want to set my price of token sale in ICO as 1 ether=0.0111111111. Since, solidity doesn't support decimals, what is suggested way to do that?

0

Add zeros and converts your decimal to an integer. all calculation will be done outside of the smart contract. like if 1 ether = 4.589 token; multiply the token value by 1000 and it would become an integer 4589. that's why we always multiply the total token amount with the number of decimal points we want to put inside smart contract

0

Assuming that you are deploying an ERC20 token, you can achieve your goal by setting decimal. Let's say you have 100 merbles which do not exist expect yours in the world, and you want to sell each merble as bonds to 1000 people. If you set decimal to 3, 100 * 10^3(Corresponding 1000 people) supply is required for your token sale. The smallest unit of your token will be 0.001. In crowdsale, you can announce 0.001 MerbleCoin(MRB) will be 1 ether. Ethereum support up to 18 decimals, but in our case you do not need more than 3. If you want to achieve 0.0111111111, you are required to set decimals as 10.

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.