Skip to content
Verified contractPartial

Crowdsale

Address0x3bbd1147aecf2bf46877ae0a754fa39020ee562c
Balance

0.000155 ETH

 

Transactions

36

 

Compiler

solc 0.4.25

 

Same code

Only this contract

 

Details

Compiler
solc 0.4.25+commit.59dbf8f1
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
7,067,042
Creation transaction
0x5be568e347…868d008a79

Crowdsale.sol

pragma solidity ^0.4.18;

interface token {
    function transfer(address receiver, uint amount) external;
}

contract Crowdsale {
    address public beneficiary;
    uint public start;
    token public tokenReward;
    
    uint public amountRaised;
    mapping(address => uint256) public contributionOf;

    event FundTransfer(address backer, uint amount, bool isContribution);

    /**
     * Constructor function
     *
     * Setup the owner and ERC20 token
     */
    function Crowdsale(
        address sendTo,
        address addressOfTokenUsedAsReward
    ) public {
        beneficiary = sendTo;
        tokenReward = token(addressOfTokenUsedAsReward);
        start = now;
    }

    /**
     * Fallback function
     *
     * The function without name is the default function that is called whenever anyone sends funds to the contract
     */
    function () payable public {
        require(now < start + 59 days);
        uint amount = msg.value;
		
		uint price = 200000000000 wei;
		
		if (now < start + 29 days) {
			price = 160000000000 wei;
		}
		
        contributionOf[msg.sender] += amount;
        amountRaised += amount;
        tokenReward.transfer(msg.sender, amount * 10 ** uint256(18) / price);
        emit FundTransfer(msg.sender, amount, true);
    }

    /**
     * Withdraw function
     *
     * Sends the specified amount to the beneficiary. 
     */
    function withdrawal(uint amount) public {
        if (beneficiary == msg.sender) {
            if (beneficiary.send(amount)) {
               emit FundTransfer(beneficiary, amountRaised, false);
            } 
        }
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 0,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.