0

I have created ERC20 based token.I fixed 1 token value equal to 0.01 eth. One question arise in my mind.Is it possible to fixed conversion rate of own Ethereum cryptocurrency ??

2
  • 2
    Didn't you say you just fixed your token ratio to Ethers. I don't understand the question. – Lauri Peltonen Jun 4 '18 at 7:39
  • My question is regarding currency conversion.Suppose I want to sell 10 tokens and I belongs to U.S & U.S currency is dollar($).You belongs to Europe and it's currency in Euro.So, in this case Can we fix conversion rate or not.Is it possible?? – Anupam Jain Jun 4 '18 at 9:03
1

You can fix the rate per token easily if your questions is in regards to carrying out an initial crowd offering or similar. Simply create a smart contract which contains a variable defining the rate of tokens per 1 ETH (Wei/finney or any other conversion) and when investors or contributors call the fallback function or whichever payable function distributing tokens, make sure to multiply the msg.value with the defined token rate.

If your question is in regards to fixing the token to a fixed value, then you would have to create functionality which allows you to increase/decrease the supply to match the 1:1 ratio following demand this would also not comply with the ERC20Standard.

1

No you can't fix the rate between your tokens and a fiat currency (euros or dollars or so) in any automatic sense. You can fix the ratio between Ethers and tokens, but the value of Ether/fiat is based purely on market supply & demand.

If you want to do the trading outside the blockchain and outside of exchanges, then in theory you can fix the ratio. So, you can for example say that anyone who gives you $10 gets 10 tokens. But the difference is that such transaction cannot be automated and you have to handle it at least partially manually (you check your bank account and if you have received $10 you send some tokens to the buyer).

1

As the others said, inside the blockchain you can't actually fix the token/fiat rate. However, you can have a variable like eth_per_fiat that you update every X time and your calculate_tokens function could be similar to tokens_asigned = eth_payed * eth_per_fiat or something like that. You'd have to be careful as to the security concerns (who updates the var) and as to if is this convenient, because, if you have any lateness to update the price, an evil actor could take advantage and buy at a deflated price. Check this contract we made where i work and check the calculateTokenAmount function to get an idea of how it works.

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.