[Ethereum] Can i freeze portion of ERC20 tokens via smart-contract

erc-20

The Freezing functionality is to impose the restrictions on sales of some portion of ERC20 tokens for certain time periods in Admin Dashboard when transferring the ERC20 tokens to buyers. The Admin can randomly specify the freezing portion and freezing period in Admin Dashboard. For example, we must transfer 10,000 ERC20 tokens to a buyer. We transfer 1000 tokens with no restriction, 4000 tokens with 3 months freezing, and 5000 tokens with 5 months freezing. This Freezing functionality is applicable to all phases of ICO (pre-sale, ICO, and post-sale).

Can i have this kind of functionality via smart contract for ERC20 tokens?
Please suggest me even if the functionality can be done without smart-contract.

Thank you in advance.

Best Answer

I believe @shane's answer is a bit misleading. Yes, you can add freezing functionality in your token contract, as mentioned in the comments.

If you are worried whether this gives "too much power" to the token contract owner, it's just an issue about how the freezing functionality is coded. If you add a generic possibility to freeze whatever transfers whenever the owner wants then I agree that it might not be a good idea business-wise.

However, nothing stops you from implementing the freezing functionality so that (certain) transfers can be frozen only during some time (or other criteria) and after that the freezing functionality would not work anymore and it would be useless.

So your transfer function could have something like this:

pragma solidity ^0.4.25;
contract TokenContract { 
    uint256 freezingPossible = 1539060104; // decides by you
    address oneFrozen = 0x123;


    function transfer(address to, uint tokens) public returns (bool success) {
        if (now < freezingPossible) {
            require(to != oneFrozen, "The account should not be frozen");
        }
        // normal transfer logic
    }
}

The above code actually prevents transferring tokens to the frozen account, not from it as is required, but hopefully you get the idea.

Remember to implement similar functionality also for transferFrom.

Related Topic