I have made this smart contract test, but I need to add the function to prevent any wallet to transfer token until the first of January of 2018.
What would be the code needed to achieve this?
Thanks
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityI have made this smart contract test, but I need to add the function to prevent any wallet to transfer token until the first of January of 2018.
What would be the code needed to achieve this?
Thanks
To prevent token transfer you have to add online of code in transfer and transferfrom function. require(now > 1514764800) This will check either the time was greater than Jan 01 2018 00:00:00 GMT or not, If it was greater than the specified time it will enable the function else it won't.
The disadvantage of adding a timestamp in the conditional statement is miners can fork the time. So if you are more concern about security add block number instead of timestamp.
function transfer( address _to, uint _value) public {
require( now > 1514764800 );
/* Rest of Function */
}
You can convert timestamp here.