Latest 25 transactions from a total of 14275 transactions

TxHash Age From To Value [TxFee]
0xe7450523fc530b839f45bd5c33f71b23841625ad9027d54c36f76ac5f0dcc83a196 days 53 mins ago0x97ac94acf416809dc398e624038446e5aef9ac77  IN   VeChainTokenSale0.001 Ether0.000329715
0x75554c0c243f6f9d82eb8f678599edd13a546274b02cd2270c55a414f68c63ba231 days 39 mins ago0xa657c233a4f7a9e8d226ee79f336641a40800db0  IN   VeChainTokenSale0.0008 Ether0.000021981
0xc42ccb2fcbadeb4cd9411c1da675b9379791f73182e40cb9b08d3b8787c68d2b277 days 21 hrs ago0x768d4f1cd8594701be8b906462b73c9040e392df  IN   VeChainTokenSale0 Ether0.000953291
0xe2f25d1f756a103fd023945b8a94813501ab62d775e4d4ddf09d34113bc2da54312 days 21 hrs ago0x0876462eec1761b717f8419efb36fed60a43ea4b  IN   VeChainTokenSale0.0001 Ether0.00053812306
0x2b76505fca498028e11fb785d2a1f6f13d650d58417b00ba1383ec047301e76c350 days 22 hrs ago0x8dc47921d8efbaef2ecdafe29dad15502a9516da  IN   VeChainTokenSale0.001 Ether0.000461601
0x8d6a2e17e14c2830be8543b8e35b888a983674a8ec6b268baf428bed43ed94ee451 days 14 hrs ago0x00038e6ba2fd5c09aedb96697c8d7b8fa6632e5e  IN   VeChainTokenSale30 Ether0.0018
0x5d7805a8bc3e8352c85f5556a558831f8622c171ad3ac407b2468bb10a7265e7469 days 1 hr agoOkex_2  IN   VeChainTokenSale0.25 Ether0.012628182775
0xbf5ac086c2724d92bfb96f30c94fb9c875b7b39a008d538163a071312230cd90476 days 17 hrs ago0x69f38ca1f9f1be4c233330cc4a5d6565ed62ab55  IN   VeChainTokenSale0.0001 Ether0.00189
0xabb3a9229ab1e9d7cf9acf64a5e8a729701d35f593972940a7dcacced53991b4477 days 16 hrs ago0x9f595955e836dd72630dc28e9f6a23c2866c2426  IN   VeChainTokenSale29.8 Ether0.00044
0xf71648a6d9be69ecab29c27005489f5ae808c6b51c4c61c26422588066e3f2fc477 days 16 hrs ago0x8dcbd09c3778f37ad99c4593b49bbd14e4eb699d  IN   VeChainTokenSale5 Ether0.00189
0x247df51581324b1798bcc38a05f5f8d7121139186285a226d8cbb6a7afaa36a7477 days 19 hrs ago0x9f595955e836dd72630dc28e9f6a23c2866c2426  IN   VeChainTokenSale29.8 Ether0.0005292
0x36988c5f6996c797e119fc2665898a7ae9aa0dd05738851a8406857c5af6b7b0478 days 22 hrs ago0x0eef6d21fbde2d6c46c24c97d1b6977e822ec1fc  IN   VeChainTokenSale9.5 Ether0.13403916
0xf6c54dda2d6cc039b7bf2dbe955376667e6138d7fc51518222add65439563499479 days 1 hr ago0x65349065d282a9f750b5a43951fede15f5f14ceb  IN   VeChainTokenSale0.1 Ether0.006379865
0x6e69db259f701f3b7f919eece04da024b1220727244dfb919425f5cc968c7964479 days 7 hrs ago0x3d8e0c38477d31bc8be9a6cce78ad459db91ea87  IN   VeChainTokenSale0.28 Ether0.00637055
0x73ac22594e6d21f5b89e6526c098cd9d4f0ab2ead2a8c4122bb24409611b13cf480 days 1 hr ago0x00cc7e10990a2bc20794bf6c25f0d26676667f34  IN   VeChainTokenSale0.005 Ether0.000497982612
0x2235a39d8911e711da83eb7b914de6ab7ce3bb4a4a54705fea61b7c55d17f534480 days 2 hrs ago0x6f1d425e36afc351cf8385ef4e43bfb7931fa5be  IN   VeChainTokenSale0.1 Ether0.0018
0x060fb916ec132f3c8a4e73a1721e392559fc952408f286a04c198c2b123e79a6480 days 2 hrs ago0x8332f051fbe3b1ef7bdf63e3267b431ffad64909  IN   VeChainTokenSale3.36 Ether0.0018
0x9f997f8a97e10dda38079f6e07d0719a1191e8e19745c9a3bea8220aee7d6696480 days 2 hrs ago0x8332f051fbe3b1ef7bdf63e3267b431ffad64909  IN   VeChainTokenSale3.3618 Ether0.0018
0x3b590b34496aa745e5aa3710fed370e4a0096828f3f44417b40e16c73ecc9d29480 days 3 hrs ago0x602c439b02ff3083afe197f58b6f5dba2be051b8  IN   VeChainTokenSale0.031414889 Ether0.000441
0x6e7b327d275c3247eac7da45e6c88e2e0e6f23efe8fe3f0c5b1b8cc518440089480 days 3 hrs ago0xcbe9174b68fd54187d46f025e5c878b22e9294fa  IN   VeChainTokenSale0.031414889 Ether0.000441
0x8e4cc5d598a2c96be89923f8d21f5fffb4817b2d977ea1ced71c473aae36ff94480 days 3 hrs ago0x0125f02f4869f54d56f15acf240d70b04554c327  IN   VeChainTokenSale0.031414889 Ether0.000441
0x686d41e90c6fe5e89f95d2927d72f2426a304ed2e3eef0a8e6dd2cbf947f9985480 days 3 hrs ago0x6fe84ef7c7194635f6b70bfe5b7a99a2e029d351  IN   VeChainTokenSale0.031414889 Ether0.000441
0x54817a84aefbe48fd72a308c33ef236d5d967437da710774a10e852035dbba88480 days 3 hrs ago0x9dfb244dcc98a70c231686e89cb0afb89bf57276  IN   VeChainTokenSale0.031414889 Ether0.000441
0x0d50ab0c633a59edf5cc46e6f591820505bd3efcba065483f103edc4fa998f44480 days 3 hrs ago0x147dff6f804c66b86b52bce1b1b1c8583b2629ec  IN   VeChainTokenSale0.031414889 Ether0.000441
0x7da4a98f9315dc36f4e3efbb6a0873c50655b9b2cd03efea43a4734c6f640aa5480 days 3 hrs ago0xb6010f9e7b6b797a647c8fa13d3742b73f101a51  IN   VeChainTokenSale0.031414889 Ether0.000441
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here To View More View All
ParentTxHash Block Age From To Value
0x863fc4dd8262aaeb3755ef971d4bca0393070f2c041038a5e32cf536719123134173327480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x004597dc0bca8705dd94079200816666a6bfde146.63 Ether
0x658c430f5048ecb933365a22acde507748411dec4a8e57d553bbccde3353b1134173326480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x600e001b6a7f2f13011d71e127da290c35a3bfa85.2 Ether
0x0d40974d6d6fa698bf7e1b81f8ac4d3c318788d4579af8a4d7ddd37ef1eb3f1d4173326480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x6f4fb1904b0d7a2415b84a18c710f3e2705fa27d30 Ether
0xba9446824129dc05497e78372ae0c6d90e6f3274d726ffb7f6fa5f997eb0adec4173326480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x840601da12435db80c96c35fd6f524c7535646b710.52 Ether
0x5459b116143030dfde87ba8ccaffbef07db6bf168d1e77130849e8a55643f42b4173326480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x47375ebc47a4b7e3e83d034ca17889b569d205253.5 Ether
0x37570846840ff63b95a6cb1c06aca5a1f0b40cdd40770ce21634219b4feee1d24173326480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xcf1ab8e682a496f76d9bcc66ccd8826df171213d30 Ether
0x985a4ed72e4f726de78a380eaf0f44ec77a0a4f1e048a32d758432d528971bc24173326480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x1fca685826ba84ccf1348a8c7594bdbef3c4c52b10 Ether
0xfd6675ea5d7a5ff657392cc64bd69609721678f288db16508cda72cad68c0adc4173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xca39634666e66e796bdc360585b66ab843275d3e0.5 Ether
0x6407db7103d2a15d5184a9c6487522dfc735598a7a70de5cc6d66fd0e08f9d834173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xf76e9d7d85c63662640394a86138b75cfb172b432 Ether
0xdff58c4c59b9ba39e2b79685b00bfb3d6d1a294a2a6b4a627c2920e55f87b9fb4173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xbe36d681849f67f877e1daf64236bb2102f1978c2 Ether
0xfcb9742ca187a1be41e1da4d051a0b01afc1d16efa8c6f25a6c346b84ccb7cf44173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x3b2b933f8576c8f77a9c11cf8c69eaba3f7322a815 Ether
0xbce88cbbd3ad378d1532101270b1973708d3839f2f8418977cd025ba10868f724173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x4d1f0e7d6941ac51e65ffcfbe8f84db0ef919f552.06 Ether
0xb90d5c6f13c8bfc8651f88ef04a3f7f53779deb2f127bc7a1dfc70ab72ae8ae14173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x7f49ce2db7f747a62857b623567fca39242ec57230 Ether
0xbfce5c8edcd470d9ba4efe6a04ebd3b9dd280ed76c889e0fc95abcd76cdf63554173325480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x34d468bfcbcc0d83f4df417e6660b3cf3e14f62a13 Ether
0x993ef39ba021004519a871a3750d68419c0a6b9a51430966623eb272c2769ca94173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xf3a4aa8023e9d2ef392fce0033087789ad7b0d1430 Ether
0xedad58d8b70bb42e81127a62cb5e98b0d016f22ab62500004ca70eff31a8a7ed4173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xd634d517375661c5d347bb625cc62c47f2107e6f19.9 Ether
0x14a391bc9c39ad5fbe7988c5b33d9e113efbe5a04ff35b8f3fc2f796828e4f434173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x1dc2def16f70df30bd16ba5773470b902e7a19cc4 Ether
0x5eb3f3cd1052cb5db3caff68bb28e4aaec625c5bc413d7b2c01380bf8c388ce94173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x7a791089a89902a3aa245dfa5e6624bb0e4a0fce15 Ether
0xec4545e88bb4f1a3dcc9e4366b4956983a0f7ecabceebf924ebc80f18ecb56cf4173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x9eef45004ee9a4995bb10517f07a4dbb3f02b2516.4 Ether
0x6ac045a8720269ec4a940434977f964b46db7d1c0daccce53f153f253f2b70ab4173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xbaee21cb585c64fed19df668a739ff99706b9ddf12.1 Ether
0xbb8ce31c341ec8126627888722aad59d4dc78d185d69e1f01909a18901180f914173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x6f6ecd37dad168f986b526c18762ed30f73cb81f30 Ether
0xce912494de16999279b0e64304c927bc13ef29983584771272aeadaac40fd6134173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x66bef423a01d971447dd3b3a5a0d28aeec8ecf7030 Ether
0x7543837cd41ce9bf6dfdfff0852923f2815cfb934c84d11c8286dd13f646f7f34173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x8bb48ac9f00a6c146d444c4206b64da49172b75d1 Ether
0x567798419c28d95f002beab34d9bd04fb14798f962e6f78245479d990f2282214173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0x1709b26a9a1dd850b9eedd1ae37f35572f785ef10.8 Ether
0x8f0b84820d4de15fe1938a66adcafe13e4498a3b44778c9f6cd0fa7a7755a9114173324480 days 16 hrs ago0xaaab2ec23dd5dd9602e631b8399fa94c9d134b3a0xd414803a1749d553127df3e2fbd27a2675cdf0f730 Ether
[ Download CSV Export  ] 
Contract Name: VENSale
Compiler Text: v0.4.11+commit.68ef5810
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.11;

contract Owned {

    address public owner;

    function Owned() {
        owner = msg.sender;
    }

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    function setOwner(address _newOwner) onlyOwner {
        owner = _newOwner;
    }
}

/**
 * @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) {
    // 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 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;
  }

  function toUINT112(uint256 a) internal constant returns(uint112) {
    assert(uint112(a) == a);
    return uint112(a);
  }

  function toUINT120(uint256 a) internal constant returns(uint120) {
    assert(uint120(a) == a);
    return uint120(a);
  }

  function toUINT128(uint256 a) internal constant returns(uint128) {
    assert(uint128(a) == a);
    return uint128(a);
  }
}


// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20

contract Token {
    /* This is a slight change to the ERC20 base standard.
    function totalSupply() constant returns (uint256 supply);
    is replaced with:
    uint256 public totalSupply;
    This automatically creates a getter function for the totalSupply.
    This is moved to the base contract since public getter functions are not
    currently recognised as an implementation of the matching abstract
    function by the compiler.
    */
    /// total amount of tokens
    //uint256 public totalSupply;
    function totalSupply() constant returns (uint256 supply);

    /// @param _owner The address from which the balance will be retrieved
    /// @return The balance
    function balanceOf(address _owner) constant returns (uint256 balance);

    /// @notice send `_value` token to `_to` from `msg.sender`
    /// @param _to The address of the recipient
    /// @param _value The amount of token to be transferred
    /// @return Whether the transfer was successful or not
    function transfer(address _to, uint256 _value) returns (bool success);

    /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
    /// @param _from The address of the sender
    /// @param _to The address of the recipient
    /// @param _value The amount of token to be transferred
    /// @return Whether the transfer was successful or not
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success);

    /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
    /// @param _spender The address of the account able to transfer the tokens
    /// @param _value The amount of wei to be approved for transfer
    /// @return Whether the approval was successful or not
    function approve(address _spender, uint256 _value) returns (bool success);

    /// @param _owner The address of the account owning tokens
    /// @param _spender The address of the account able to transfer the tokens
    /// @return Amount of remaining tokens allowed to spent
    function allowance(address _owner, address _spender) constant returns (uint256 remaining);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}


/// VEN token, ERC20 compliant
contract VEN is Token, Owned {
    using SafeMath for uint256;

    string public constant name    = "VeChain Token";  //The Token's name
    uint8 public constant decimals = 18;               //Number of decimals of the smallest unit
    string public constant symbol  = "VEN";            //An identifier    

    // packed to 256bit to save gas usage.
    struct Supplies {
        // uint128's max value is about 3e38.
        // it's enough to present amount of tokens
        uint128 total;
        uint128 rawTokens;
    }

    Supplies supplies;

    // Packed to 256bit to save gas usage.    
    struct Account {
        // uint112's max value is about 5e33.
        // it's enough to present amount of tokens
        uint112 balance;

        // raw token can be transformed into balance with bonus        
        uint112 rawTokens;

        // safe to store timestamp
        uint32 lastMintedTimestamp;
    }

    // Balances for each account
    mapping(address => Account) accounts;

    // Owner of account approves the transfer of an amount to another account
    mapping(address => mapping(address => uint256)) allowed;

    // bonus that can be shared by raw tokens
    uint256 bonusOffered;

    // Constructor
    function VEN() {
    }

    function totalSupply() constant returns (uint256 supply){
        return supplies.total;
    }

    // Send back ether sent to me
    function () {
        revert();
    }

    // If sealed, transfer is enabled and mint is disabled
    function isSealed() constant returns (bool) {
        return owner == 0;
    }

    function lastMintedTimestamp(address _owner) constant returns(uint32) {
        return accounts[_owner].lastMintedTimestamp;
    }

    // Claim bonus by raw tokens
    function claimBonus(address _owner) internal{      
        require(isSealed());
        if (accounts[_owner].rawTokens != 0) {
            uint256 realBalance = balanceOf(_owner);
            uint256 bonus = realBalance
                .sub(accounts[_owner].balance)
                .sub(accounts[_owner].rawTokens);

            accounts[_owner].balance = realBalance.toUINT112();
            accounts[_owner].rawTokens = 0;
            if(bonus > 0){
                Transfer(this, _owner, bonus);
            }
        }
    }

    // What is the balance of a particular account?
    function balanceOf(address _owner) constant returns (uint256 balance) {
        if (accounts[_owner].rawTokens == 0)
            return accounts[_owner].balance;

        if (bonusOffered > 0) {
            uint256 bonus = bonusOffered
                 .mul(accounts[_owner].rawTokens)
                 .div(supplies.rawTokens);

            return bonus.add(accounts[_owner].balance)
                    .add(accounts[_owner].rawTokens);
        }
        
        return uint256(accounts[_owner].balance)
            .add(accounts[_owner].rawTokens);
    }

    // Transfer the balance from owner's account to another account
    function transfer(address _to, uint256 _amount) returns (bool success) {
        require(isSealed());

        // implicitly claim bonus for both sender and receiver
        claimBonus(msg.sender);
        claimBonus(_to);

        // according to VEN's total supply, never overflow here
        if (accounts[msg.sender].balance >= _amount
            && _amount > 0) {            
            accounts[msg.sender].balance -= uint112(_amount);
            accounts[_to].balance = _amount.add(accounts[_to].balance).toUINT112();
            Transfer(msg.sender, _to, _amount);
            return true;
        } else {
            return false;
        }
    }

    // Send _value amount of tokens from address _from to address _to
    // The transferFrom method is used for a withdraw workflow, allowing contracts to send
    // tokens on your behalf, for example to "deposit" to a contract address and/or to charge
    // fees in sub-currencies; the command should fail unless the _from account has
    // deliberately authorized the sender of the message via some mechanism; we propose
    // these standardized APIs for approval:
    function transferFrom(
        address _from,
        address _to,
        uint256 _amount
    ) returns (bool success) {
        require(isSealed());

        // implicitly claim bonus for both sender and receiver
        claimBonus(_from);
        claimBonus(_to);

        // according to VEN's total supply, never overflow here
        if (accounts[_from].balance >= _amount
            && allowed[_from][msg.sender] >= _amount
            && _amount > 0) {
            accounts[_from].balance -= uint112(_amount);
            allowed[_from][msg.sender] -= _amount;
            accounts[_to].balance = _amount.add(accounts[_to].balance).toUINT112();
            Transfer(_from, _to, _amount);
            return true;
        } else {
            return false;
        }
    }

    // Allow _spender to withdraw from your account, multiple times, up to the _value amount.
    // If this function is called again it overwrites the current allowance with _value.
    function approve(address _spender, uint256 _amount) returns (bool success) {
        allowed[msg.sender][_spender] = _amount;
        Approval(msg.sender, _spender, _amount);
        return true;
    }

    /* Approves and then calls the receiving contract */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);

        //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
        //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
        //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
        //if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { revert(); }
        ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, this, _extraData);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }

    // Mint tokens and assign to some one
    function mint(address _owner, uint256 _amount, bool _isRaw, uint32 timestamp) onlyOwner{
        if (_isRaw) {
            accounts[_owner].rawTokens = _amount.add(accounts[_owner].rawTokens).toUINT112();
            supplies.rawTokens = _amount.add(supplies.rawTokens).toUINT128();
        } else {
            accounts[_owner].balance = _amount.add(accounts[_owner].balance).toUINT112();
        }

        accounts[_owner].lastMintedTimestamp = timestamp;

        supplies.total = _amount.add(supplies.total).toUINT128();
        Transfer(0, _owner, _amount);
    }
    
    // Offer bonus to raw tokens holder
    function offerBonus(uint256 _bonus) onlyOwner { 
        bonusOffered = bonusOffered.add(_bonus);
        supplies.total = _bonus.add(supplies.total).toUINT128();
        Transfer(0, this, _bonus);
    }

    // Set owner to zero address, to disable mint, and enable token transfer
    function seal() onlyOwner {
        setOwner(0);
    }
}

contract ApprovalReceiver {
    function receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData);
}


// Contract to sell and distribute VEN tokens
contract VENSale is Owned{

    /// chart of stage transition 
    ///
    /// deploy   initialize      startTime                            endTime                 finalize
    ///                              | <-earlyStageLasts-> |             | <- closedStageLasts -> |
    ///  O-----------O---------------O---------------------O-------------O------------------------O------------>
    ///     Created     Initialized           Early             Normal             Closed            Finalized
    enum Stage {
        NotCreated,
        Created,
        Initialized,
        Early,
        Normal,
        Closed,
        Finalized
    }

    using SafeMath for uint256;
    
    uint256 public constant totalSupply         = (10 ** 9) * (10 ** 18); // 1 billion VEN, decimals set to 18

    uint256 constant privateSupply              = totalSupply * 9 / 100;  // 9% for private ICO
    uint256 constant commercialPlan             = totalSupply * 23 / 100; // 23% for commercial plan
    uint256 constant reservedForTeam            = totalSupply * 5 / 100;  // 5% for team
    uint256 constant reservedForOperations      = totalSupply * 22 / 100; // 22 for operations

    // 59%
    uint256 public constant nonPublicSupply     = privateSupply + commercialPlan + reservedForTeam + reservedForOperations;
    // 41%
    uint256 public constant publicSupply = totalSupply - nonPublicSupply;


    uint256 public constant officialLimit = 64371825 * (10 ** 18);
    uint256 public constant channelsLimit = publicSupply - officialLimit;

    // packed to 256bit
    struct SoldOut {
        uint16 placeholder; // placeholder to make struct pre-alloced

        // amount of tokens officially sold out.
        // max value of 120bit is about 1e36, it's enough for token amount
        uint120 official; 

        uint120 channels; // amount of tokens sold out via channels
    }

    SoldOut soldOut;
    
    uint256 constant venPerEth = 3500;  // normal exchange rate
    uint256 constant venPerEthEarlyStage = venPerEth + venPerEth * 15 / 100;  // early stage has 15% reward

    uint constant minBuyInterval = 30 minutes; // each account can buy once in 30 minutes
    uint constant maxBuyEthAmount = 30 ether;
   
    VEN ven; // VEN token contract follows ERC20 standard

    address ethVault; // the account to keep received ether
    address venVault; // the account to keep non-public offered VEN tokens

    uint public constant startTime = 1503057600; // time to start sale
    uint public constant endTime = 1504180800;   // tiem to close sale
    uint public constant earlyStageLasts = 3 days; // early bird stage lasts in seconds

    bool initialized;
    bool finalized;

    function VENSale() {
        soldOut.placeholder = 1;
    }    

    /// @notice calculte exchange rate according to current stage
    /// @return exchange rate. zero if not in sale.
    function exchangeRate() constant returns (uint256){
        if (stage() == Stage.Early) {
            return venPerEthEarlyStage;
        }
        if (stage() == Stage.Normal) {
            return venPerEth;
        }
        return 0;
    }

    /// @notice for test purpose
    function blockTime() constant returns (uint32) {
        return uint32(block.timestamp);
    }

    /// @notice estimate stage
    /// @return current stage
    function stage() constant returns (Stage) { 
        if (finalized) {
            return Stage.Finalized;
        }

        if (!initialized) {
            // deployed but not initialized
            return Stage.Created;
        }

        if (blockTime() < startTime) {
            // not started yet
            return Stage.Initialized;
        }

        if (uint256(soldOut.official).add(soldOut.channels) >= publicSupply) {
            // all sold out
            return Stage.Closed;
        }

        if (blockTime() < endTime) {
            // in sale            
            if (blockTime() < startTime.add(earlyStageLasts)) {
                // early bird stage
                return Stage.Early;
            }
            // normal stage
            return Stage.Normal;
        }

        // closed
        return Stage.Closed;
    }

    function isContract(address _addr) constant internal returns(bool) {
        uint size;
        if (_addr == 0) return false;
        assembly {
            size := extcodesize(_addr)
        }
        return size > 0;
    }

    /// @notice entry to buy tokens
    function () payable {        
        buy();
    }

    /// @notice entry to buy tokens
    function buy() payable {
        // reject contract buyer to avoid breaking interval limit
        require(!isContract(msg.sender));
        require(msg.value >= 0.01 ether);

        uint256 rate = exchangeRate();
        // here don't need to check stage. rate is only valid when in sale
        require(rate > 0);
        // each account is allowed once in minBuyInterval
        require(blockTime() >= ven.lastMintedTimestamp(msg.sender) + minBuyInterval);

        uint256 requested;
        // and limited to maxBuyEthAmount
        if (msg.value > maxBuyEthAmount) {
            requested = maxBuyEthAmount.mul(rate);
        } else {
            requested = msg.value.mul(rate);
        }

        uint256 remained = officialLimit.sub(soldOut.official);
        if (requested > remained) {
            //exceed remained
            requested = remained;
        }

        uint256 ethCost = requested.div(rate);
        if (requested > 0) {
            ven.mint(msg.sender, requested, true, blockTime());
            // transfer ETH to vault
            ethVault.transfer(ethCost);

            soldOut.official = requested.add(soldOut.official).toUINT120();
            onSold(msg.sender, requested, ethCost);        
        }

        uint256 toReturn = msg.value.sub(ethCost);
        if(toReturn > 0) {
            // return over payed ETH
            msg.sender.transfer(toReturn);
        }        
    }

    /// @notice returns tokens sold officially
    function officialSold() constant returns (uint256) {
        return soldOut.official;
    }

    /// @notice returns tokens sold via channels
    function channelsSold() constant returns (uint256) {
        return soldOut.channels;
    } 

    /// @notice manually offer tokens to channel
    function offerToChannel(address _channelAccount, uint256 _venAmount) onlyOwner {
        Stage stg = stage();
        // since the settlement may be delayed, so it's allowed in closed stage
        require(stg == Stage.Early || stg == Stage.Normal || stg == Stage.Closed);

        soldOut.channels = _venAmount.add(soldOut.channels).toUINT120();

        //should not exceed limit
        require(soldOut.channels <= channelsLimit);

        ven.mint(
            _channelAccount,
            _venAmount,
            true,  // unsold tokens can be claimed by channels portion
            blockTime()
            );

        onSold(_channelAccount, _venAmount, 0);
    }

    /// @notice initialize to prepare for sale
    /// @param _ven The address VEN token contract following ERC20 standard
    /// @param _ethVault The place to store received ETH
    /// @param _venVault The place to store non-publicly supplied VEN tokens
    function initialize(
        VEN _ven,
        address _ethVault,
        address _venVault) onlyOwner {
        require(stage() == Stage.Created);

        // ownership of token contract should already be this
        require(_ven.owner() == address(this));

        require(address(_ethVault) != 0);
        require(address(_venVault) != 0);      

        ven = _ven;
        
        ethVault = _ethVault;
        venVault = _venVault;    
        
        ven.mint(
            venVault,
            reservedForTeam.add(reservedForOperations),
            false, // team and operations reserved portion can't share unsold tokens
            blockTime()
        );

        ven.mint(
            venVault,
            privateSupply.add(commercialPlan),
            true, // private ICO and commercial plan can share unsold tokens
            blockTime()
        );

        initialized = true;
        onInitialized();
    }

    /// @notice finalize
    function finalize() onlyOwner {
        // only after closed stage
        require(stage() == Stage.Closed);       

        uint256 unsold = publicSupply.sub(soldOut.official).sub(soldOut.channels);

        if (unsold > 0) {
            // unsold VEN as bonus
            ven.offerBonus(unsold);        
        }
        ven.seal();

        finalized = true;
        onFinalized();
    }

    event onInitialized();
    event onFinalized();

    event onSold(address indexed buyer, uint256 venAmount, uint256 ethCost);
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"channelsLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"endTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"exchangeRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"blockTime","outputs":[{"name":"","type":"uint32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finalize","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"publicSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"officialSold","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"startTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"channelsSold","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"officialLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"earlyStageLasts","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"stage","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_ven","type":"address"},{"name":"_ethVault","type":"address"},{"name":"_venVault","type":"address"}],"name":"initialize","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_channelAccount","type":"address"},{"name":"_venAmount","type":"uint256"}],"name":"offerToChannel","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"nonPublicSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[],"name":"onInitialized","type":"event"},{"anonymous":false,"inputs":[],"name":"onFinalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"buyer","type":"address"},{"indexed":false,"name":"venAmount","type":"uint256"},{"indexed":false,"name":"ethCost","type":"uint256"}],"name":"onSold","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052341561000c57fe5b5b5b60008054600160a060020a03191633600160a060020a03161790555b6001805461ffff1916811790555b5b6112d0806100486000396000f300606060405236156100eb5763ffffffff60e060020a60003504166313af403581146100fc578063165a0e031461011a57806318160ddd1461013c5780633197cbb61461015e5780633ba0b9a91461018057806348b15166146101a25780634bb278f3146101cb5780635e84d723146101dd57806369d4f28e146101ff57806378e97925146102215780638438600414610243578063873c56d7146102655780638da5cb5b14610287578063a6f2ae3a146102b3578063ab96dd18146102bd578063c040e6b8146102df578063c0c53b8b14610313578063de009e7f1461033d578063ff91b9491461035e575b6100fa5b6100f7610380565b5b565b005b341561010457fe5b6100fa600160a060020a03600435166106c1565b005b341561012257fe5b61012a61070a565b60408051918252519081900360200190f35b341561014457fe5b61012a61076f565b60408051918252519081900360200190f35b341561016657fe5b61012a61077f565b60408051918252519081900360200190f35b341561018857fe5b61012a610787565b60408051918252519081900360200190f35b34156101aa57fe5b6101b26107e3565b6040805163ffffffff9092168252519081900360200190f35b34156101d357fe5b6100fa6107e8565b005b34156101e557fe5b61012a610a08565b60408051918252519081900360200190f35b341561020757fe5b61012a610a60565b60408051918252519081900360200190f35b341561022957fe5b61012a610a76565b60408051918252519081900360200190f35b341561024b57fe5b61012a610a7e565b60408051918252519081900360200190f35b341561026d57fe5b61012a610a95565b60408051918252519081900360200190f35b341561028f57fe5b610297610aa4565b60408051600160a060020a039092168252519081900360200190f35b6100fa610380565b005b34156102c557fe5b61012a610ab3565b60408051918252519081900360200190f35b34156102e757fe5b6102ef610aba565b604051808260068111156102ff57fe5b60ff16815260200191505060405180910390f35b341561031b57fe5b6100fa600160a060020a0360043581169060243581169060443516610c24565b005b341561034557fe5b6100fa600160a060020a0360043516602435610f52565b005b341561036657fe5b61012a611194565b60408051918252519081900360200190f35b60006000600060006000610393336111de565b1561039e5760006000fd5b662386f26fc100003410156103b35760006000fd5b6103bb610787565b9450600085116103cb5760006000fd5b600254604080516000602091820181905282517f7ba49b81000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301529351610708959490941693637ba49b819360248084019491938390030190829087803b151561043c57fe5b6102c65a03f1151561044a57fe5b5050506040518051905063ffffffff16016104636107e3565b63ffffffff1610156104755760006000fd5b6801a055690d9db800003411156104a65761049f6801a055690d9db800008663ffffffff61120b16565b93506104b9565b6104b6348663ffffffff61120b16565b93505b6001546104e1906a353f43a026da2053240000906201000090046001607860020a031661123a565b9250828411156104ef578293505b6104ff848663ffffffff61125116565b9150600084111561067057600254600160a060020a031663b5e73249338660016105276107e3565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a03168152602001848152602001831515151581526020018263ffffffff1663ffffffff168152602001945050505050600060405180830381600087803b151561059357fe5b6102c65a03f115156105a157fe5b5050600354604051600160a060020a03909116915083156108fc029084906000818181858888f1935050505015156105d557fe5b6001546105fb906105f69086906201000090046001607860020a031661126e565b611288565b600180546001607860020a0392909216620100000270ffffffffffffffffffffffffffffff00001990921691909117905560408051858152602081018490528151600160a060020a033316927f4d1636c3e75537f2cbca3bdf3cf2c7825eb501463bc634e6923119dee5d1cc43928290030190a25b610680348363ffffffff61123a16565b905060008111156106b857604051600160a060020a0333169082156108fc029083906000818181858888f1935050505015156106b857fe5b5b5b5050505050565b60005433600160a060020a039081169116146106dd5760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b6a353f43a026da205324000060646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b0460646b4a5127725bbb8578d80000005b0460646b1d14a0219e548224280000005b040101016b033b2e3c9fd0803ce8000000030381565b6b033b2e3c9fd0803ce800000081565b6359a7fa4081565b600060035b610794610aba565b600681111561079f57fe5b14156107b757606461cd145b04610dac0190506107e0565b60045b6107c2610aba565b60068111156107cd57fe5b14156107dc5750610dac6107e0565b5060005b90565b425b90565b6000805433600160a060020a039081169116146108055760006000fd5b60055b610810610aba565b600681111561081b57fe5b146108265760006000fd5b6001546108b8906001607860020a03608860020a82048116916108ac91620100009091041660646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b0460646b4a5127725bbb8578d80000005b0460646b1d14a0219e548224280000005b040101016b033b2e3c9fd0803ce8000000039063ffffffff61123a16565b9063ffffffff61123a16565b9050600081111561093757600254604080517f534eb1d4000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a039092169163534eb1d49160248082019260009290919082900301818387803b151561092557fe5b6102c65a03f1151561093357fe5b5050505b600254604080517f3fb27b850000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633fb27b859160048082019260009290919082900301818387803b151561099257fe5b6102c65a03f115156109a057fe5b50506004805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055506040517f6c750432a9907ef296a47d6b38305b8ad777291aefc349e462a0a3285799425490600090a15b5b50565b60646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b0460646b4a5127725bbb8578d80000005b0460646b1d14a0219e548224280000005b040101016b033b2e3c9fd0803ce80000000381565b6001546201000090046001607860020a03165b90565b635996d6c081565b600154608860020a90046001607860020a03165b90565b6a353f43a026da205324000081565b600054600160a060020a031681565b6203f48081565b6004546000907501000000000000000000000000000000000000000000900460ff1615610ae9575060066107e0565b60045474010000000000000000000000000000000000000000900460ff161515610b15575060016107e0565b635996d6c0610b226107e3565b63ffffffff161015610b36575060026107e0565b60646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b0460646b4a5127725bbb8578d80000005b0460646b1d14a0219e548224280000005b6001549190049190910191909101919091016b033b2e3c9fd0803ce80000000390610bbc906001607860020a03620100008204811691608860020a90041661126e565b10610bc9575060056107e0565b6359a7fa40610bd66107e3565b63ffffffff161015610c1d57610bf9635996d6c06203f48063ffffffff61126e16565b610c016107e3565b63ffffffff161015610c15575060036107e0565b5060046107e0565b5060055b90565b60005433600160a060020a03908116911614610c405760006000fd5b60015b610c4b610aba565b6006811115610c5657fe5b14610c615760006000fd5b30600160a060020a031683600160a060020a0316638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b1515610cb157fe5b6102c65a03f11515610cbf57fe5b505060405151600160a060020a0316919091149050610cde5760006000fd5b600160a060020a0382161515610cf45760006000fd5b600160a060020a0381161515610d0a5760006000fd5b60028054600160a060020a0380861673ffffffffffffffffffffffffffffffffffffffff1992831617928390556003805486831690841617905560048054858316931692909217918290559182169163b5e732499116610d9160646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b049063ffffffff61126e16565b6000610d9b6107e3565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a03168152602001848152602001831515151581526020018263ffffffff1663ffffffff168152602001945050505050600060405180830381600087803b1515610e0757fe5b6102c65a03f11515610e1557fe5b5050600254600454600160a060020a03918216925063b5e732499116610e6660646b4a5127725bbb8578d80000005b0460646b1d14a0219e54822428000000610d84565b049063ffffffff61126e16565b6001610e706107e3565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a03168152602001848152602001831515151581526020018263ffffffff1663ffffffff168152602001945050505050600060405180830381600087803b1515610edc57fe5b6102c65a03f11515610eea57fe5b50506004805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055506040517f1b0e25e2531ab5dbde6724b973ffb1819ece38c4a44247d242e5079db9ce461190600090a15b5b505050565b6000805433600160a060020a03908116911614610f6f5760006000fd5b610f77610aba565b905060035b816006811115610f8857fe5b1480610fa0575060045b816006811115610f9e57fe5b145b80610fb7575060055b816006811115610fb557fe5b145b1515610fc35760006000fd5b600154610fea906105f6908490608860020a90046001607860020a031661126e565b611288565b600180546001607860020a0392909216608860020a0270ffffffffffffffffffffffffffffffffff9092169190911790556a353f43a026da205324000060646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b0460646b4a5127725bbb8578d80000005b0460646b1d14a0219e548224280000005b040101016b033b2e3c9fd0803ce80000000303600160000160119054906101000a90046001607860020a03166001607860020a0316111515156110ad5760006000fd5b600254600160a060020a031663b5e73249848460016110ca6107e3565b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a03168152602001848152602001831515151581526020018263ffffffff1663ffffffff168152602001945050505050600060405180830381600087803b151561113657fe5b6102c65a03f1151561114457fe5b505060408051848152600060208201528151600160a060020a03871693507f4d1636c3e75537f2cbca3bdf3cf2c7825eb501463bc634e6923119dee5d1cc43929181900390910190a25b5b505050565b60646b4715f935bbeb053bf00000005b0460646b1027e72f1f128130880000005b0460646b4a5127725bbb8578d80000005b0460646b1d14a0219e548224280000005b0401010181565b600080600160a060020a03831615156111fa5760009150611205565b823b90506000811191505b50919050565b6000828202831580611227575082848281151561122457fe5b04145b151561122f57fe5b8091505b5092915050565b60008282111561124657fe5b508082035b92915050565b60006000828481151561126057fe5b0490508091505b5092915050565b60008282018381101561122f57fe5b8091505b5092915050565b60006001607860020a038216821461129c57fe5b50805b9190505600a165627a7a723058207af0d29c3d6b2e033b9f1c122d05844595af42aa49ac8394ec18f91f052417e00029

   Swarm Source:
bzzr://7af0d29c3d6b2e033b9f1c122d05844595af42aa49ac8394ec18f91f052417e0

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.