Sorry if questions are not very smart ))) I really need clarifications on some of this questions . Please answer directly if possible I have read tons of documentations .)) Let's say I want to have a token NOT ICO .

Just a token which I can sell in exchange(let's say in my exchange website)

1) . The point is I am not sure if my token has to be sellable (smart contract needs to have feature for that) or it can be simple contract with setting initial supply and transfer method and after I will implement selling feature on top of the smart contract not within it ?

I tried to find smart contract source codes of some of the tokens listed in coinmarketcap but I couldn't

So my question is is it mandatory to have selling feature in smart contract ?(can u kindly link an example ) ? or I can implement it in my exchange logic ?

EDIT1 I found this url - link to contract source here github And basically payable method is sending back all the ether sent to contract . Does it mean they get paid not through contract but on top of that ?

In the second scenario Am I the one who decides the price ??

Thanks for reading :)


I may be misunderstanding your question, but I believe it boils down to "Does my smart contract need to have a selling function in order for my token to traded on an exchange?"

The answer to this questions is not necessarily needed.

An exchange allows for fiat currencies or other crpytocurrencies to be traded for each other at an agreed upon price then act as the middle man for the transferring of those currencies.

Buy and Sell functions can be found in advance coins such as with this example from ethereum's website.

contract MyAdvancedToken is owned, TokenERC20 {

uint256 public sellPrice;
uint256 public buyPrice;

mapping (address => bool) public frozenAccount;

/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);

/* Initializes contract with initial supply tokens to the creator of the contract */
function MyAdvancedToken(
    uint256 initialSupply,
    string tokenName,
    string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}

/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
    require (_to != 0x0);                               // Prevent transfer to 0x0 address. Use burn() instead
    require (balanceOf[_from] >= _value);               // Check if the sender has enough
    require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
    require(!frozenAccount[_from]);                     // Check if sender is frozen
    require(!frozenAccount[_to]);                       // Check if recipient is frozen
    balanceOf[_from] -= _value;                         // Subtract from the sender
    balanceOf[_to] += _value;                           // Add the same to the recipient
    Transfer(_from, _to, _value);

/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
    balanceOf[target] += mintedAmount;
    totalSupply += mintedAmount;
    Transfer(0, this, mintedAmount);
    Transfer(this, target, mintedAmount);

/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
    frozenAccount[target] = freeze;
    FrozenFunds(target, freeze);

/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
    sellPrice = newSellPrice;
    buyPrice = newBuyPrice;

/// @notice Buy tokens from contract by sending ether
function buy() payable public {
    uint amount = msg.value / buyPrice;               // calculates the amount
    _transfer(this, msg.sender, amount);              // makes the transfers

/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
    require(this.balance >= amount * sellPrice);      // checks if the contract has enough ether to buy
    _transfer(msg.sender, this, amount);              // makes the transfers
    msg.sender.transfer(amount * sellPrice);          // sends ether to the seller. It's important to do this last to avoid recursion attacks
  • but still I cna sell coins without having featuer in contract and it will be fine? does any ofthe tokens d othat? May 8 '18 at 9:50
  • @KarenStepanyan yes you can sell the coin without the feature in that contract. "So far, you've relied on utility and trust to value your token. But if you want you can make the token's value be backed by Ether (or other tokens) by creating a fund that automatically sells and buys them at market value." is the introduction to the code I gave you. If you plan on selling tokens I ask you to please do more research and understand the purpose of these tokens.
    – CJ Jacobs
    May 10 '18 at 7:35
  • Thank you very much Jacobs . Does that mean if there is no feature in contract only my service will be able to sell or buy it . Is there suck kind of tokens listed in coinmarketcap ? in that scenario other exchanges will be able to sell or buy token? May 10 '18 at 10:55
  • @KarenStepanyan that is correct, you do not need that feature to sell on an exchange. An exchange of an ERC 20 token that is exchange ready can be found here : github.com/o0ragman0o/ITT/blob/master/ERC20.sol if this finalizes an answer for you, it would much appreciated for you to accept my answer and close this question.
    – CJ Jacobs
    May 11 '18 at 9:30
  • Honestly not but I am accepting, it seems weird question as there are no more replies May 11 '18 at 17:05

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.