Hi Roy!
Thanks for the question. Happy to help.
I updated the said article and wrote a new one which focuses on real world aspects like presale, discounts, distribution of tokens etc. You can read it here. It answers your first and last question.
The associated code for the above article is on GitHub. Let me mention the line numbers so that you can easily find it and understand the process.
(2) You can add a 2-week lock-up period to the token contract itself. The following code will give you the basic idea:
address owner;
//With this modifier, only the owner can call the transfer function
//Others can transfer only when the current timestamp is more than certain timestamp.
modifier notPaused{
require(now > <SOME FUTURE TIMESTAMP> || msg.sender == owner);
_;
}
function ERC20Token() {
owner = msg.sender;
}
// Not the usage of `notPaused` modifier
function transfer(address to, uint256 amount) public notPaused returns (bool) {
//rest of function
}
So, until your token sale is over (or certain vesting period is reached), no one can transfer their tokens.
(3) Presale discount
I hope this helps! :)