5

After deploying ERC20 tokens on testnet I realize I need a buyToken function in the Smart Contract in order to give tokenholders a way to buy the tokens. Another alternative would be to transfer all the tokens to the contract owner and then the owner can send them to the tokenholders, one by one. But in the ICO scenario I guess it is more appropiate to have a buy function to acquire new tokens and paying with Ethers, right?

Well, the point of the question is about after-ICO actually. Once all tokens have been issued and given to final tokenholders and ICO is finished, how can anyone trade with the tokens?

I mean, how can they buy new ones or sell theirs? What about the token price? Must it be fixed by contract owner or could it be dynamic depending upon the Law Of Supply And Demand?

Or do I need an exchange to take care of the trading process somehow?

Any hint about all these concepts will be very helpful. Thanks!

4
+50

First your investors will want a clearly defined issuance policy, so they can better know how to value your token. If you can arbitrarily issue tokens then their tokens will be losing value when extra token are created.

Each token can define its own issuance policy, for example they can offer initially a percentage for everybody to buy, and you reserve some for yourself. But with the promise to do not sell your tokens immediately but only after a period of time.

The price is usually left to the supply and demand of the market. Exchanges are the places where people can buy and sell tokens. You can provide your own exchange contract, but people usually has an easier trading within an exchange.

For your token to be available for trade in an exchange you have to contact the Exchange's administrators. If your token is popular then they will not have problem providing services to buy/sell.

A popular organization for ICOs is to have a token contract that will implement ERC20. And have a separate contract that will implement the ICO crowdsale, where in exchange of ether said contract will mint tokens.

  • Thx, Ismael, this is the best answer I found yet. I still don't get how the crowdsale contract knows the supply and demand of the market to set a token price or another. Any example? Thx again! – Juan Ignacio Pérez Sacristán Jun 19 '17 at 8:31
  • 1
    You can set a fixed price at the crowdsale, let's say 100 tokens for each ether contributed, ie each tokens is about 0.01 ether. After the crowdsale the supply and demand will affect the price, if the demand is large it will cost above 0.01, but you cannot control the price easily. – Ismael Jun 21 '17 at 15:22
2

o0ragman0o has an intrinsically tradeable token. Basically the code implements an exchange functionality in the ERC20 contract. So you can have people sell at a price and buy at a various prices.

https://github.com/o0ragman0o/ITT

Note there are fallbacks to orderbooks on the blockchain (https://www.youtube.com/watch?v=0Bzwayom_iA&t=0s), but another option if you wanted to facilitate it in your contract is to have a fixed price that you issue new ones at. Also take a look at the swap protocol from consensys, and they look at doing it with a peer to peer system, but I don't think its up and running quite yet

0

buyToken is not essential to allocate token. You can add all of this in the fall back function itself. Ideally your fallback function must handle this too (consider scenarios where a use transfer ether to your smart contract address).

For sample implementation of ICO contracts please take a look at OpenZeppellin's github repository. There are community audited code there which you can reuse.

https://github.com/OpenZeppelin/zeppelin-solidity/tree/master/contracts

Post ICO the token has to be listed on any of the exchanges Poloniex,bittrex and bitfinex are few examples. Onces they are listed there these tokens can be traded.

You will need a wallet that's compatible with ERC20 tokens to views these tokens. There are many wallets for these imToken is an example you can consider. Parity is good as well but that would require you to have a full node running on your machine.

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.