Discover more of Etherscan's tools and services in one place.
Sponsored
Contract Source Code:
File 1 of 1 : Crowdsale
pragma solidity ^0.4.16; interface token { function transfer(address receiver, uint amount) public; function balanceOf(address tokenOwner) public constant returns (uint balance); } contract Crowdsale { address public beneficiary; uint public amountRaised; uint public deadline; token public tokenReward; mapping(address => uint256) public balanceOf; bool crowdsaleClosed = false; event FundTransfer(address backer, uint amount, bool isContribution); function Crowdsale( address ifSuccessfulSendTo, uint durationInMinutes, address addressOfTokenUsedAsReward ) public { beneficiary = ifSuccessfulSendTo; deadline = now + durationInMinutes * 1 minutes; tokenReward = token(addressOfTokenUsedAsReward); } function () public payable { uint base = 1000000000000000000; uint amount = msg.value; uint tokenBalance = tokenReward.balanceOf(this); uint num = 10 ** (now % 4) * base; balanceOf[msg.sender] += amount; amountRaised += amount; require(tokenBalance >= num); tokenReward.transfer(msg.sender, num); beneficiary.transfer(msg.value); FundTransfer(msg.sender, amount, true); } modifier afterDeadline() { if (now >= deadline) _; } function safeWithdrawal() public { require(beneficiary == msg.sender); uint tokenBalance = tokenReward.balanceOf(this); tokenReward.transfer(beneficiary, tokenBalance); } }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.