Verified contractPartial
SOCTokenSale
Address0xa4de910f252c38fcec811075e532d4644cb86f58
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.4.11
- Same code
1 more contract
Details
- Compiler
- solc 0.4.11+commit.68ef5810
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 3,954,147
- Creation transaction
- 0x45ef70a9e1…fcca159efa
SOCToken.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity ^0.4.2;
contract SOCToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
function SOCToken(
uint256 initialSupply
) {
balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
}
/* Send coins */
function transfer(address _to, uint256 _value) {
if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
balanceOf[msg.sender] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
}
}
contract SOCTokenSale {
address public beneficiary;
uint public fundingGoal;
uint public amountRaised;
uint public deadline;
uint public price;
SOCToken public tokenReward;
mapping(address => uint256) public balanceOf;
bool fundingGoalReached = false;
uint softMarketingLimit = 25 * 1 ether;
event GoalReached(address beneficiary, uint amountRaised);
event FundTransfer(address backer, uint amount, bool isContribution);
bool crowdsaleClosed = false;
/* data structure to hold information about campaign contributors */
/* at initialization, setup the owner */
function SOCTokenSale(
address ifSuccessfulSendTo,
uint fundingGoalInEthers,
uint durationInMinutes,
uint pricePerEther,
SOCToken addressOfTokenUsedAsReward
) {
beneficiary = ifSuccessfulSendTo;
fundingGoal = fundingGoalInEthers * 1 ether;
deadline = now + durationInMinutes * 1 minutes;
price = 1 ether / pricePerEther;
tokenReward = SOCToken(addressOfTokenUsedAsReward);
}
/* The function without name is the default function that is called whenever anyone sends funds to a contract */
function () payable {
if (crowdsaleClosed) throw;
uint amount = msg.value;
balanceOf[msg.sender] = amount;
amountRaised += amount;
tokenReward.transfer(msg.sender, amount / price);
FundTransfer(msg.sender, amount, true);
}
modifier afterDeadline() { if (now >= deadline) _; }
/* checks if the goal or time limit has been reached and ends the campaign */
function checkGoalReached() afterDeadline {
if (amountRaised >= fundingGoal){
fundingGoalReached = true;
GoalReached(beneficiary, amountRaised);
}
crowdsaleClosed = true;
}
function withdrawal(uint amount) {
if (msg.sender == beneficiary) {
if (beneficiary.send(amount * 1 finney)) {
FundTransfer(beneficiary, amount * 1 finney, false);
}
}
}
function safeWithdrawal() afterDeadline {
if (amountRaised < softMarketingLimit) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(this.balance)) {
FundTransfer(beneficiary, this.balance, false);
} else {
fundingGoalReached = false;
}
}
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.