Verified contractPartial
Crowdsale
Address0xff7560b413945e602931dc71077a080d90feba68
- Balance
0 ETH
- Transactions
7
- Compiler
solc 0.4.18
- Same code
Only this contract
Details
- Compiler
- solc 0.4.18+commit.9cf6e910
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 4,823,043
- Creation transaction
- 0xd754901e9f…f4fdd5172e
Crowdsale.sol
pragma solidity ^0.4.18;
interface token {
function transfer(address receiver, uint amount) public;
}
contract Crowdsale {
address public owner;
uint public amountRaised;
uint public deadline;
uint public rateOfEther;
token public tokenReward;
mapping(address => uint256) public balanceOf;
bool crowdsaleClosed = false;
event FundTransfer(address backer, uint amount, bool isContribution);
/**
* Constrctor function
*
* Setup the owner
*/
function Crowdsale(
uint durationInMinutes,
address addressOfTokenUsedAsReward
) public {
owner = msg.sender;
deadline = now + durationInMinutes * 1 minutes;
rateOfEther = 42352;
tokenReward = token(addressOfTokenUsedAsReward);
}
function setPrice(uint tokenRateOfEachEther) public {
if(msg.sender == owner) {
rateOfEther = tokenRateOfEachEther;
}
}
function changeOwner (address newOwner) public {
if(msg.sender == owner) {
owner = newOwner;
}
}
function changeCrowdsale(bool isClose) public {
if(msg.sender == owner) {
crowdsaleClosed = isClose;
}
}
function finishPresale(uint value) public {
if(msg.sender == owner) {
if(owner.send(value)) {
FundTransfer(owner, value, false);
}
}
}
function buyToken() payable public {
require(!crowdsaleClosed);
require(now <= deadline);
uint amount = msg.value;
amountRaised += amount;
uint tokens = amount * rateOfEther;
balanceOf[msg.sender] += tokens;
tokenReward.transfer(msg.sender, tokens);
FundTransfer(msg.sender, tokens, true);
}
/**
* Fallback function
*
* The function without name is the default function that is called whenever anyone sends funds to a contract
*/
function () payable public {
buyToken();
}
}Compiler settingsShow
{
"optimizer": {
"runs": 0,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.