1

I want to create a token is not sellable or transferable until a specific date (so that only initial buyers can buy tokens, but they should not sell tokens until ICO is completed), what would be the best way to do this?

For example, if I was to implement something like

if(msg.sender != owner){
   require(now >= endOfICO);
}

inside of the transfer function would that be acceptable, or even usable?

Thanks a lot for any help or advice, or even links to other discussions as I cannot find information on how to incorporate time-based locks on transfers.

4 Answers 4

0

Yes you can do. But you have to get approval from exchange, If exchange likes your whitepaper/idea. Then exchange will list your token. Before deploy on main net. Better consult some exchange and tell the same thing(can buy tokens, but they should sell tokens until ICO completed). I guess most of the tokens are doing the same. But better to get the confirm from exchange.

But I'll suggest you to use modifier for condition checking. Because it will give you more readability and reusability.

I am attaching some sample code snippet for the same:

modifier isICOCompleted() {
    require(now >= endOfICO);
    _;
}

modifier isContractOwner() {
    require(msg.sender == owner);
    _;
}

function transfer(address _to, uint _amount) isICOCompleted public {
    //Implement your logic
}
1
  • It's really rare for a token to get listed on an exchange right after their ICO. Typically it goes the other way around: a token ICO is organized, it succeeds and after a long time of growth and attention, it might get accepted into an exchange. Commented Feb 13, 2018 at 11:22
1

1) Your idea is correct - just require the current timestamp to be after the desired time

2) Create a modifier which does the checking

3) Use the modifier in the send/transfer functions to restrict their usage

There's nothing fancy or secret in dealing with time constraints as far as I know. It just needs to be coded.

Maybe you even want the desired time to be changeable? Add a function for owner which changes the variable.

0
  1. is there a way for contract owner to move tokens - keep them unfrozen at all times to share with team members, airdrops, etc

    a. have airdropped tokens frozen until end of ICO (let's say March 30, 2018)... meanwhile
    b. team members frozen until a certain date, say 730 days after ICO ends
    c. have advisors frozen for 180 days after ICO ends

  2. have public sale tokens frozen until the same date as the airdropped tokens...

  3. so where do i add the time stamp? did i do this correct?

My code :

modifier isICOCompleted() {
  require(now >= March 30, 2018);
  _;
}

modifier isContractOwner() {
  require(msg.sender == owner);
  _;
}

function transfer(address _to, uint _amount) isICOCompleted public {
  //Implement your logic
}
0

I would add this logic inside the _transfer function override, to make sure no transfers are possible (with adding the logic to transfer only, still transferFrom is possible).

something like this:

function _transfer(address from, address to, uint256 value) internal override {
       if(msg.sender != owner)
            require(block.timestamp >= endOfICO);
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.