I am working on basic ERC20 token smart contract and i would like to add some conditions in token transfer

Suppose, I transfer 100 tokens to receiver on 2018-03-01 then receiver can't sent that 100 tokens before 2018-03-15 and If i transfer another 100 tokens to same receiver on 2018-03-05 then another 100 tokens can't be sent before 2018-03-20

What would be the code for that scenario, Thanks.


The simplest, but not the most efficient way, might be to just keep a mapping of each transfers value and timestamp and loop through that to see what balance should still be held based off the timestamp.

Once you get that balance, one of your requires in your internal transfer method would change from require(balanceOf[_from] >= _value) to require(balanceOf[_from] - timeLockedBalance >= _value)

The problem with this method though is dealing with this on exchanges. With the timelock, your token literally becomes untradable.

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.