The ethereum.org crowdsale tutorial: contributions run to a deadline against a goal, pay out a separate reward token, and are refunded if the goal is missed.
Historical Significance
This is what a token sale looked like before ERC-20 existed: a fixed price, a deadline, a threshold, an automatic refund if the threshold is missed, and the tokens themselves held in a separate contract addressed through sendCoin rather than transfer. The all-or-nothing goal it implements is the pattern token sales kept using for years after this code was replaced.
Context
Ethereum's Frontier network went live on 30 July 2015 and the ethereum.org tutorials were the main worked examples anyone had. This crowdsale predates ERC-20, which is why the token it pays out is addressed through sendCoin and coinBalanceOf rather than transfer and balanceOf.
Key Facts
Description
A crowdfunding contract from the 2015 ethereum.org tutorial. Its constructor fixes five things that can never be changed afterwards: who receives the money, the funding goal, how many minutes the campaign runs, the price of one reward token, and the address of the token contract that pays contributors.
Contributions arrive through the fallback function. Each sender is appended to a public funders array along with the amount, the running total goes up, and the reward token is asked to send that contributor the amount divided by the price. Once the deadline has passed anyone may call checkGoalReached(): if the total met the goal the balance goes to the beneficiary, otherwise the contract walks the funders array and refunds each one in turn. Either way it then self-destructs to the beneficiary.
The reward tokens have to be sitting in this contract before the sale opens and nothing here checks that they are. The refund loop is unbounded, so a campaign with enough contributors cannot be closed inside a block's gas limit, and neither the refunds nor the payout check whether send() succeeded.
Its own funding parameters were fixed at deployment and can be read from the contract: the beneficiary, the goal, the deadline, the price and the reward token are all public.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
External Links
Related contracts
Greeter
Same deployerA Frontier-era Greeter contract with the message: 'Hello Middle Earth!'
0x3d26e1...816e5eAugust 9, 2015token
Same deployerTutorial-derived coin contract (Solidity v0.1.1), deployed Aug 9, 2015 during the Frontier era.
0xb49180...1fd8ceAugust 9, 2015Forwarder
Same deployerA minimal ETH forwarding contract that sends funds to a hardcoded address, deployed on Frontier Day 1.
0x44bc65...358d61August 9, 2015Forwarder (optimized)
Same deployerOptimized version of the ETH Forwarder - same source compiled with soljson optimizer ON, producing 133 bytes vs 241.
0xabff46...85f029August 9, 2015Greeter
Same eraA HelloWorld greeter deployed at block 51,909 on 8 August 2015, one of a run of contracts from the same account that week.
0x412fda...7267edAugust 8, 2015Greeter
Same eraA Greeter with the message 'Ethereum will change the world smarter' - deployed Aug 8, 2015 by a developer connected to the Tokyo Smart Contract meetup.
0xda0c1c...7a68ebAugust 8, 2015