A crowdfunding variant with a resumable, gas-guarded refund loop that persists its progress, so a large refund can complete across multiple transactions.
Key Facts
Description
Deployed October 30, 2016 by Vitalik Buterin (0x1db3439a22ee7c4d034e9b26437d3960b5af0517). A variant of the CrowdFunding family (0x2a345bb2) deployed the same day, with renamed functions and a resumable refund. contribute() records the caller and their sent value as a Funder but throws if the deadline has already passed. refund() returns contributions when the balance is below the goal after the deadline, using a loop guarded by msg.gas > 100000 that persists its progress in numRefunded, so a large refund can be finished across several transactions. payout() sends the whole balance to the beneficiary if the goal was met. The 867-byte runtime reproduces byte-for-byte from the reconstructed source using solc 0.4.2 with the optimizer off (also byte-identical under 0.4.0); this compiler predates swarm metadata, so the match is complete. runtime sha256 95d4dcc29ad0ab125b8f09ccb8f2c9408fa57bf451379c2b621e2bb0b60cb2e2.
Source Verified
Runtime (867 bytes) reproduces byte-for-byte from the reconstructed source using solc 0.4.2, optimizer off (predates swarm metadata; 0.4.0 also matches). runtime sha256 95d4dcc29ad0ab125b8f09ccb8f2c9408fa57bf451379c2b621e2bb0b60cb2e2.
Tangerine Whistle Era
Emergency fork to address DoS attacks. Repriced IO-heavy opcodes.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Verified by EthereumHistory (ethereumhistory.com)
contract CrowdFunding {
struct Funder { address addr; uint amount; }
address beneficiary;
uint goal;
uint deadline;
uint numRefunded;
Funder[] funders;
function contribute() {
if (now > deadline) throw;
funders.push(Funder(msg.sender, msg.value));
}
function refund() {
if (now > deadline && this.balance < goal) {
uint j = numRefunded;
while (j < funders.length && msg.gas > 100000) {
funders[j].addr.send(funders[j].amount);
j++;
}
numRefunded = j;
}
}
function payout() {
if (now > deadline && this.balance >= goal)
beneficiary.send(this.balance);
}
}External Links
Related contracts
SerpentGamble
Same deployerProvably-fair betting game where players choose their own odds. The owner settles bets with a commit-reveal random seed. Includes a 2-day emergency refund.
0x034df8...200e2fSeptember 20, 2015SerpentGamble
Same deployerSibling of 0x034dF870 (SerpentGamble). Provably-fair Serpent betting game; players choose their own odds, owner settles via commit-reveal seed, 2-day refund.
0x9ca7e9...fa8bb4September 21, 2015SerpentGamble
Same deployerSibling of 0x034dF870 (SerpentGamble). Provably-fair Serpent betting game; players choose their own odds, owner settles via commit-reveal seed, 2-day refund.
0x75649a...176028September 21, 2015SerpentGamble
Same deployerIntermediate build of serpent_gamble, a provably-fair betting dapp (Bet/Win/Loss/NewSeed), related to verified sibling 0x59375871. Source not yet reconstructed.
0xe1a99f...0d2457September 21, 2015SerpentGamble
Same deployerIntermediate build of serpent_gamble, a provably-fair betting dapp (Bet/Win/Loss/NewSeed), related to verified sibling 0x59375871. Source not yet reconstructed.
0xdc00a9...15861fSeptember 21, 2015SerpentGamble
Same deployerIntermediate build of serpent_gamble, a provably-fair betting dapp (Bet/Win/Loss/NewSeed), related to verified sibling 0x59375871. Source not yet reconstructed.
0xd0ed09...300b48September 21, 2015