TokenMarketNet / smart-contracts

Ethereum smart contracts for security and utility tokens
https://tokenmarket.net/
Other
1.34k stars 563 forks source link

Withdraw tokens functionality #159

Open agnesenvaite opened 5 years ago

agnesenvaite commented 5 years ago

I am analyzing features in publicly available ICO smart contracts as my Bachelor's thesis. In the thesis, I am comparing how features in ICO smart contracts evolve naturally and in ICO libraries.

In my analysis, I selected smart contracts labelled with "token sale" and having more than 700 transactions. Total count of such contracts was 161.

I selected 40 smart contracts which do not have token functionality (thesis scope was ICO smart contracts alone). I used selected smart contracts to create a feature model. Also, I created features model of TokenMarket ICO smart contracts. I compared them. One of the missing features is withdraw tokens.

20% (8 of 40) of ICO smart contracts have withdraw tokens functionality. I suggest adding this feature to CrowdsaleBase smart contract. In this case, other features won't be affected.

Proposed code for withdraw tokens feature:

  function withdrawTokens ( address _token , address to , uint256 amount )
  public
  onlyOwner
  {
    FractionalERC20 token = FractionalERC20(_token);

    if(!token.transfer(to , amount )) throw ;
  }