Hello :) I'm really interested in knowing how crowdsale contracts with tiers are made. ICOs these days have crowdsale for different tiers with different prices for each.. Like PreICO, Round 1, round 2, round 3 etc. I'm curious to know how that is achieved. Do they create and compile different crowdsale contracts for each tier or is there another way it's being done?
1 Answer
You'd have to take a look at a specific contract to see how it was done for that ICO, but both are certainly possible. now
is a globally-available variable that gives the current time, so a contract can easily check which "tier" it's in based on hardcoded timestamps or durations.
E.g.:
if (now < phase1End) {
price = 1;
} else if (now < phase2End) {
price = 2;
} else if (now < phase3End) {
price = 3;
}