Contract Overview
Balance:
0 Ether
EtherValue:
$0
Transactions:
46 txns
Latest 25 transactions from a total of 46 transactions
[ Download CSV Export ]
Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution
[ Download CSV Export ]
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.
Contract Source Code Verified (Exact Match)
Contract Source Code Verified (Exact Match)
Contract Name: | Crowdsale |
Compiler Version: | v0.4.24+commit.e67f0147 |
Optimization Enabled: | Yes |
Runs (Optimizer): | 200 |
Contract Source Code
pragma solidity ^0.4.24; contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract Ownable { address public owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { 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) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract Crowdsale is Ownable { using SafeMath for uint256; ERC20 public token; // How many wei units a buyer gets per token uint256 public price; // Amount of wei raised uint256 public weiRaised; /** * Event for token purchase logging * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase( address indexed beneficiary, uint256 value, uint256 amount ); bool public isFinalized = false; event Finalized(); /** * @param _token Address of the token being sold * @param _price How many wei units a buyer gets per token */ constructor(ERC20 _token, uint256 _price) public { require(_token != address(0)); require(_price > 0); token = _token; price = _price; } /** * Crowdsale token purchase logic */ function () external payable { require(!isFinalized); address beneficiary = msg.sender; uint256 weiAmount = msg.value; require(beneficiary != address(0)); require(weiAmount != 0); uint256 tokens = weiAmount.div(price); uint256 selfBalance = balance(); require(tokens > 0); require(tokens <= selfBalance); // Get tokens to beneficiary token.transfer(beneficiary, tokens); emit TokenPurchase( beneficiary, weiAmount, tokens ); // Transfet eth to owner owner.transfer(msg.value); // update state weiRaised = weiRaised.add(weiAmount); } /** * Self tokken ballance */ function balance() public view returns (uint256) { address self = address(this); uint256 selfBalance = token.balanceOf(self); return selfBalance; } /** * Set new price * @param _price How many wei units a buyer gets per token */ function setPrice(uint256 _price) onlyOwner public { require(_price > 0); price = _price; } /** * Must be called after crowdsale ends, to do some extra finalization work. */ function finalize() onlyOwner public { require(!isFinalized); transferBallance(); emit Finalized(); isFinalized = true; } /** * Send all token ballance to owner */ function transferBallance() onlyOwner public { uint256 selfBalance = balance(); token.transfer(msg.sender, selfBalance); } } library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
Contract ABI
[{"constant":true,"inputs":[],"name":"weiRaised","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finalize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isFinalized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"transferBallance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_price","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"TokenPurchase","type":"event"},{"anonymous":false,"inputs":[],"name":"Finalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
Contract Creation Code
60806040526004805460ff1916905534801561001a57600080fd5b5060405160408061071183398101604052805160209091015160008054600160a060020a03191633179055600160a060020a038216151561005a57600080fd5b6000811161006757600080fd5b60018054600160a060020a031916600160a060020a0393909316929092179091556002556106778061009a6000396000f3006080604052600436106100a35763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634042b66f81146102495780634bb278f3146102705780638d4e4083146102875780638da5cb5b146102b057806391b7f5ed146102e15780639aeceb1d146102f9578063a035b1fe1461030e578063b69ef8a814610323578063f2fde38b14610338578063fc0c546a14610359575b60045460009081908190819060ff16156100bc57600080fd5b3393503492508315156100ce57600080fd5b8215156100da57600080fd5b6002546100ee90849063ffffffff61036e16565b91506100f8610383565b90506000821161010757600080fd5b8082111561011457600080fd5b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561018357600080fd5b505af1158015610197573d6000803e3d6000fd5b505050506040513d60208110156101ad57600080fd5b505060408051848152602081018490528151600160a060020a038716927fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f928290030190a260008054604051600160a060020a03909116913480156108fc02929091818181858888f1935050505015801561022c573d6000803e3d6000fd5b50600354610240908463ffffffff61042216565b60035550505050005b34801561025557600080fd5b5061025e610435565b60408051918252519081900360200190f35b34801561027c57600080fd5b5061028561043b565b005b34801561029357600080fd5b5061029c6104a2565b604080519115158252519081900360200190f35b3480156102bc57600080fd5b506102c56104ab565b60408051600160a060020a039092168252519081900360200190f35b3480156102ed57600080fd5b506102856004356104ba565b34801561030557600080fd5b506102856104e3565b34801561031a57600080fd5b5061025e6105a2565b34801561032f57600080fd5b5061025e610383565b34801561034457600080fd5b50610285600160a060020a03600435166105a8565b34801561036557600080fd5b506102c561063c565b6000818381151561037b57fe5b049392505050565b600154604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820181905291516000938492600160a060020a03909116916370a082319160248082019260209290919082900301818787803b1580156103ef57600080fd5b505af1158015610403573d6000803e3d6000fd5b505050506040513d602081101561041957600080fd5b50519392505050565b8181018281101561042f57fe5b92915050565b60035481565b600054600160a060020a0316331461045257600080fd5b60045460ff161561046257600080fd5b61046a6104e3565b6040517f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768190600090a16004805460ff19166001179055565b60045460ff1681565b600054600160a060020a031681565b600054600160a060020a031633146104d157600080fd5b600081116104de57600080fd5b600255565b60008054600160a060020a031633146104fb57600080fd5b610503610383565b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051929350600160a060020a039091169163a9059cbb916044808201926020929091908290030181600087803b15801561057357600080fd5b505af1158015610587573d6000803e3d6000fd5b505050506040513d602081101561059d57600080fd5b505050565b60025481565b600054600160a060020a031633146105bf57600080fd5b600160a060020a03811615156105d457600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a0316815600a165627a7a723058208958ee9f856fd2dfbc5aad65f3a9a147aee31ef1d0daf7893847a4172d3f511100290000000000000000000000002cf2d4919e639b25b806126eb5c97d043ffb0a7000000000000000000000000000000000000000000000000000000000002d8c72
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002cf2d4919e639b25b806126eb5c97d043ffb0a7000000000000000000000000000000000000000000000000000000000002d8c72
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002cf2d4919e639b25b806126eb5c97d043ffb0a70
Arg [1] : 00000000000000000000000000000000000000000000000000000000002d8c72
Swarm Source:
bzzr://8958ee9f856fd2dfbc5aad65f3a9a147aee31ef1d0daf7893847a4172d3f5111
Block | Age | transaction | Difficulty | GasUsed | Reward |
---|
Block | Age | Uncle Number | Difficulty | GasUsed | Reward |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.