Verified contractPartial
ProofPresaleToken
Address0x93369095b7b0dec482f26a04608ecb5ae26e187b
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.4.10
- Same code
1 more contract
Details
- Compiler
- solc 0.4.10+commit.f0d539ae
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 5,124,138
- Creation transaction
- 0xd0e28215df…4473d36343
ProofPresale.sol
// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity 0.4.10;/** * @title SafeMath * @dev Math operations with safety checks that throw on error */library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal constant returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }}/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { owner = newOwner; } }}/** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev modifier to allow actions only when the contract IS paused */ modifier whenNotPaused() { require(!paused); _; } /** * @dev modifier to allow actions only when the contract IS NOT paused */ modifier whenPaused { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused returns (bool) { paused = true; Pause(); return true; } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused returns (bool) { paused = false; Unpause(); return true; }}/** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */contract ERC20 { uint256 public totalSupply; function balanceOf(address _owner) constant returns (uint256); function transfer(address _to, uint256 _value) returns (bool); function transferFrom(address _from, address _to, uint256 _value) returns (bool); function approve(address _spender, uint256 _value) returns (bool); function allowance(address _owner, address _spender) constant returns (uint256); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);}/** * @title ProofPresaleToken (PROOFP) * Standard Mintable ERC20 Token * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */contract ProofPresaleToken is ERC20, Ownable { using SafeMath for uint256; mapping(address => uint) balances; mapping (address => mapping (address => uint)) allowed; string public constant name = "RAJE Presale Token"; string public constant symbol = "RAJE"; uint8 public constant decimals = 18; bool public mintingFinished = false; event Mint(address indexed to, uint256 amount); event MintFinished(); function ProofPresaleToken() {} function() payable { revert(); } function balanceOf(address _owner) constant returns (uint256) { return balances[_owner]; } function transfer(address _to, uint _value) returns (bool) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } function approve(address _spender, uint _value) returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256) { return allowed[_owner][_spender]; } modifier canMint() { require(!mintingFinished); _; } /** * Function to mint tokens * @param _to The address that will recieve the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); return true; } /** * Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner returns (bool) { mintingFinished = true; MintFinished(); return true; } }/** * @title ProofPresale * ProofPresale allows investors to make * token purchases and assigns them tokens based * on a token per ETH rate. Funds collected are forwarded to a wallet * as they arrive. */ contract ProofPresale is Pausable { using SafeMath for uint256; ProofPresaleToken public token; address public wallet; uint256 public weiRaised; uint256 public cap; uint256 public minInvestment; uint256 public rate; bool public isFinalized; string public contactInformation; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); /** * event for signaling finished crowdsale */ event Finalized(); function ProofPresale() { token = createTokenContract(); wallet = 0x99892Ac6DA1b3851167Cb959fE945926bca89f09; rate = 20; minInvestment = 10 ether; cap = 295257 * (10**18); } function createTokenContract() internal returns (ProofPresaleToken) { return new ProofPresaleToken(); } function () payable { buyTokens(msg.sender); } /** * Low level token purchse function * @param beneficiary will recieve the tokens. */ function buyTokens(address beneficiary) payable whenNotPaused { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; weiRaised = weiRaised.add(weiAmount); uint256 tokens = weiAmount.mul(rate); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds(); } function forwardFunds() internal { wallet.transfer(msg.value); } function validPurchase() internal constant returns (bool) { uint256 weiAmount = weiRaised.add(msg.value); bool notSmallAmount = msg.value >= minInvestment; bool withinCap = weiAmount.mul(rate) <= cap; return (notSmallAmount && withinCap); } function finalize() onlyOwner { require(!isFinalized); require(hasEnded()); token.finishMinting(); Finalized(); isFinalized = true; } function setContactInformation(string info) onlyOwner { contactInformation = info; } function hasEnded() public constant returns (bool) { bool capReached = (weiRaised.mul(rate) >= cap); return capReached; }}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.