Sponsored Link:  Up to 2% Cryptocurrency Cashback - Reserve your card - Monaco App - www.mona.co
Contract Overview | StoxToken
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 42392 txns
Token Tracker 0x006bea43baa3f7a6f765f14f10a1a1b08334ef45
  Latest 25 txns from a total Of 42392 transactions (+11 PendingTxns) View All

TxHash Age From To Value [TxFee]
0x44a4eaba10bbdc1f1e086ac856895e22a10f7b5c18a201ba2000e548edf5022f(pending)1 hr 51 mins ago0x0fe919027b526b237185fce9d40dd74ae9dbc1fa  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0x78759c0c054e5b8b0db3b2ac0ef9e38e36f77589a1bb9900c6cff8671aa733eb(pending)1 hr 54 mins ago0x9dd07783b0518a869d999cc76dadfd584b692740  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xd4467b0178f9e23320df1f9712dd7422e20e1664af1de1acf98d48115c722e21(pending)1 hr 55 mins ago0xad14c8b5526c23386ba8de6ec8ba634568c45b8c  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xd2b5c70fef8832bf2bc0d4a2d5738e3a3d1afe9dc6369aed4047d67effcb578c(pending)1 hr 59 mins ago0x4e3d90490d054d3cbdad5e0592087effc7421fa2  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0x486229e323a7bdca54edbc7b3061952d2a255dfa206905bb0048ce7f78e038ba(pending)2 hrs 3 mins ago0xbc7c84ed78e8940a11d5710581bc4e235daf25e1  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xab5fb3882cf685424c930671d27ce19e098859b307dd25b5dd85df87721204ef(pending)2 hrs 4 mins ago0x3f006368b88229e36d562b5e01be40dd374a8c55  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xa9ada53b246689e2b5429f8653466fe8da19be393d22e302f33632d245cd3537(pending)2 hrs 4 mins ago0x6258d03a7e430c902811b034438c1bab865f06e8  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xc5c21e7e3d4a9b83495e5be5bb8536b2514d1e40fbb4f1d8afffbf4e98ef44c3(pending)2 hrs 6 mins ago0xa69a842bb7b966f55e81f67aa408da60718143a8  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xd1a5e458c844a1b78e4e2513ee22b6a18c71ba118e445d965475cdbf29ecc730(pending)2 hrs 7 mins ago0xb5a12a8851a233792feb81590f364dff18666131  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0x6cc270f03090ab5a9041a67e9f642a33fe152c1d6c50b2564f77c1865debc663(pending)2 hrs 12 mins ago0xf72ef9bc7fbe725d1c88bbc85a6e169023d98981  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0x1e843c48fb398a18216e74eb6b9954ab6d79ba906e32177c61bff0c5c0c85006(pending)2 hrs 16 mins ago0xf1b0470791e599680cdd5826e0eb3caee5994276  IN  0x006bea43baa3f7a6f765f14f10a1a1b08334ef450 Ether(pending)
0xa0fbf2662079dfa87986b3bad085a6355622cd7f619471136d991af899944e932 hrs 18 mins ago0x77a935e19660692b27775f1e10724bbf3f834fb3  IN   StoxToken0 Ether0.000524608
0x1b07b7679168ff87f9853a50af6fafe0c5e2f8e89e391c25599b72d8125264de2 hrs 31 mins ago0xba52d36533570beed0f86c4c1103775eaac279a8  IN   StoxToken0 Ether0.000918728
0x4966dd919e7caf5b7e96c6c73f6cdf5fb888aecefbec4f0fd7a3173c2337db1c2 hrs 38 mins ago0x4d468cf47eb6df39618dc9450be4b56a70a520c1  IN   StoxToken0 Ether0.0026204
0x404204bfb1a00a68d00774bd378272adbea7436062e0898bd6bdbd028062ced22 hrs 56 mins agoliqui.io_2  IN   StoxToken0 Ether0.0016928736
0xa13d00edb27db6b51547a42941b79187ccf9dfadd89f4ab61c174bb5f4279c243 hrs 4 mins ago0x05ee546c1a62f90d7acbffd6d846c9c54c7cf94c  IN   StoxToken0 Ether0.002253544
0xba64a2d2d7a011ac54c875151707c842a098e71d73ab6a5335f1fb3804091dae3 hrs 12 mins ago0x8c8234a33c070af6293fd8a3a7cc1bddec72529f  IN   StoxToken0 Ether0.001611296
0xcf4b74d5ac8d8346e7fe127e14e09f846ceba829e59c02fcb6a88b0074d6e1193 hrs 23 mins ago0x8cfaaac2187490d319f511f86d72f5f916082df8  IN   StoxToken0 Ether0.000788256
0xd1e95f8b8b58fc6966e6591681e656bd5661f0980174cdabcbeaa49bdb0786b43 hrs 49 mins ago0xc1d07d20d922d7b7b5d60a3c6ac830f937ec368c  IN   StoxToken0 Ether0.00018736
0x19a17ea031b4b94e1804e0b03fa3f4314ac96539702302daff588889032dd3c13 hrs 56 mins ago0x0990d969c35fb4f59b43c956a00e76d1dea7e482  IN   StoxToken0 Ether0.002151352
0xe1652ea561908fcf582c180aba1a006e5176d8de4b73bd3085500f84578190174 hrs 4 mins ago0x8676f92151771425c5a506a60105ee1a8e877456  IN   StoxToken0 Ether0.00224448
0x9f49e2c0c186507093391e1f1c92552f4c9b0d3635c4935822e2bca679d8558c4 hrs 7 mins agoliqui.io_2  IN   StoxToken0 Ether0.0023664872
0xf49fe214f88aeb59e0007ca0341c543087a8ba6116e2667a60b9897d8d3a5b524 hrs 17 mins ago0x5f7ae01f1915d59d1c177c3f7bb3364bcf695aa2  IN   StoxToken0 Ether0.00089632
0xaffd8f85131f4e8ff3fd8931cbc2132b06f5c9683046c2d7aceb5f13c80a89f74 hrs 17 mins ago0x176dc8ee134da454d189861d165ca38d26eeafd7  IN   StoxToken0 Ether0.00089632
0x668ac7748c9b9cb3c688e42b4b0c1cf5c52209708ca6b8d822e33d99742133184 hrs 28 mins ago0x00594a478606ff23ccb41c84b87b2389999c5d3d  IN   StoxToken0 Ether0.00149888
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The compiled contract might be susceptible to ZeroFunctionSelector (very low-severity), DelegateCallReturnValue (low-severity), ECRecoverMalformedInput (medium-severity), SkipEmptyStringLiteral (low-severity) Solidity compiler bugs.

Contract Source Code Verified
Contract Name: StoxSmartToken
Compiler Version: v0.4.11+commit.68ef5810
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.11;

/*
    Owned contract interface
*/
contract IOwned {
    // this function isn't abstract since the compiler emits automatically generated getter functions as external
    function owner() public constant returns (address owner) { owner; }

    function transferOwnership(address _newOwner) public;
    function acceptOwnership() public;
}

/*
    ERC20 Standard Token interface
*/
contract IERC20Token {
    // these functions aren't abstract since the compiler emits automatically generated getter functions as external
    function name() public constant returns (string name) { name; }
    function symbol() public constant returns (string symbol) { symbol; }
    function decimals() public constant returns (uint8 decimals) { decimals; }
    function totalSupply() public constant returns (uint256 totalSupply) { totalSupply; }
    function balanceOf(address _owner) public constant returns (uint256 balance) { _owner; balance; }
    function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { _owner; _spender; remaining; }

    function transfer(address _to, uint256 _value) public returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
    function approve(address _spender, uint256 _value) public returns (bool success);
}

/*
    Token Holder interface
*/
contract ITokenHolder is IOwned {
    function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public;
}

/*
    Smart Token interface
*/
contract ISmartToken is ITokenHolder, IERC20Token {
    function disableTransfers(bool _disable) public;
    function issue(address _to, uint256 _amount) public;
    function destroy(address _from, uint256 _amount) public;
}

/*
    Overflow protected math functions
*/
contract SafeMath {
    /**
        constructor
    */
    function SafeMath() {
    }

    /**
        @dev returns the sum of _x and _y, asserts if the calculation overflows

        @param _x   value 1
        @param _y   value 2

        @return sum
    */
    function safeAdd(uint256 _x, uint256 _y) internal returns (uint256) {
        uint256 z = _x + _y;
        assert(z >= _x);
        return z;
    }

    /**
        @dev returns the difference of _x minus _y, asserts if the subtraction results in a negative number

        @param _x   minuend
        @param _y   subtrahend

        @return difference
    */
    function safeSub(uint256 _x, uint256 _y) internal returns (uint256) {
        assert(_x >= _y);
        return _x - _y;
    }

    /**
        @dev returns the product of multiplying _x by _y, asserts if the calculation overflows

        @param _x   factor 1
        @param _y   factor 2

        @return product
    */
    function safeMul(uint256 _x, uint256 _y) internal returns (uint256) {
        uint256 z = _x * _y;
        assert(_x == 0 || z / _x == _y);
        return z;
    }
}

/**
    ERC20 Standard Token implementation
*/
contract ERC20Token is IERC20Token, SafeMath {
    string public standard = 'Token 0.1';
    string public name = '';
    string public symbol = '';
    uint8 public decimals = 0;
    uint256 public totalSupply = 0;
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

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

    /**
        @dev constructor

        @param _name        token name
        @param _symbol      token symbol
        @param _decimals    decimal points, for display purposes
    */
    function ERC20Token(string _name, string _symbol, uint8 _decimals) {
        require(bytes(_name).length > 0 && bytes(_symbol).length > 0); // validate input

        name = _name;
        symbol = _symbol;
        decimals = _decimals;
    }

    // validates an address - currently only checks that it isn't null
    modifier validAddress(address _address) {
        require(_address != 0x0);
        _;
    }

    /**
        @dev send coins
        throws on any error rather then return a false flag to minimize user errors

        @param _to      target address
        @param _value   transfer amount

        @return true if the transfer was successful, false if it wasn't
    */
    function transfer(address _to, uint256 _value)
        public
        validAddress(_to)
        returns (bool success)
    {
        balanceOf[msg.sender] = safeSub(balanceOf[msg.sender], _value);
        balanceOf[_to] = safeAdd(balanceOf[_to], _value);
        Transfer(msg.sender, _to, _value);
        return true;
    }

    /**
        @dev an account/contract attempts to get the coins
        throws on any error rather then return a false flag to minimize user errors

        @param _from    source address
        @param _to      target address
        @param _value   transfer amount

        @return true if the transfer was successful, false if it wasn't
    */
    function transferFrom(address _from, address _to, uint256 _value)
        public
        validAddress(_from)
        validAddress(_to)
        returns (bool success)
    {
        allowance[_from][msg.sender] = safeSub(allowance[_from][msg.sender], _value);
        balanceOf[_from] = safeSub(balanceOf[_from], _value);
        balanceOf[_to] = safeAdd(balanceOf[_to], _value);
        Transfer(_from, _to, _value);
        return true;
    }

    /**
        @dev allow another account/contract to spend some tokens on your behalf
        throws on any error rather then return a false flag to minimize user errors

        also, to minimize the risk of the approve/transferFrom attack vector
        (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), approve has to be called twice
        in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new allowance value

        @param _spender approved address
        @param _value   allowance amount

        @return true if the approval was successful, false if it wasn't
    */
    function approve(address _spender, uint256 _value)
        public
        validAddress(_spender)
        returns (bool success)
    {
        // if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
        require(_value == 0 || allowance[msg.sender][_spender] == 0);

        allowance[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }
}

/*
    Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
    address public owner;
    address public newOwner;

    event OwnerUpdate(address _prevOwner, address _newOwner);

    /**
        @dev constructor
    */
    function Owned() {
        owner = msg.sender;
    }

    // allows execution by the owner only
    modifier ownerOnly {
        assert(msg.sender == owner);
        _;
    }

    /**
        @dev allows transferring the contract ownership
        the new owner still need to accept the transfer
        can only be called by the contract owner

        @param _newOwner    new contract owner
    */
    function transferOwnership(address _newOwner) public ownerOnly {
        require(_newOwner != owner);
        newOwner = _newOwner;
    }

    /**
        @dev used by a new owner to accept an ownership transfer
    */
    function acceptOwnership() public {
        require(msg.sender == newOwner);
        OwnerUpdate(owner, newOwner);
        owner = newOwner;
        newOwner = 0x0;
    }
}

/*
    We consider every contract to be a 'token holder' since it's currently not possible
    for a contract to deny receiving tokens.

    The TokenHolder's contract sole purpose is to provide a safety mechanism that allows
    the owner to send tokens that were sent to the contract by mistake back to their sender.
*/
contract TokenHolder is ITokenHolder, Owned {
    /**
        @dev constructor
    */
    function TokenHolder() {
    }

    // validates an address - currently only checks that it isn't null
    modifier validAddress(address _address) {
        require(_address != 0x0);
        _;
    }

    // verifies that the address is different than this contract address
    modifier notThis(address _address) {
        require(_address != address(this));
        _;
    }

    /**
        @dev withdraws tokens held by the contract and sends them to an account
        can only be called by the owner

        @param _token   ERC20 token contract address
        @param _to      account to receive the new amount
        @param _amount  amount to withdraw
    */
    function withdrawTokens(IERC20Token _token, address _to, uint256 _amount)
        public
        ownerOnly
        validAddress(_token)
        validAddress(_to)
        notThis(_to)
    {
        assert(_token.transfer(_to, _amount));
    }
}

/*
    Smart Token v0.2

    'Owned' is specified here for readability reasons
*/
contract SmartToken is ISmartToken, ERC20Token, Owned, TokenHolder {
    string public version = '0.2';

    bool public transfersEnabled = true;    // true if transfer/transferFrom are enabled, false if not

    // triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory
    event NewSmartToken(address _token);
    // triggered when the total supply is increased
    event Issuance(uint256 _amount);
    // triggered when the total supply is decreased
    event Destruction(uint256 _amount);

    /**
        @dev constructor

        @param _name       token name
        @param _symbol     token short symbol, 1-6 characters
        @param _decimals   for display purposes only
    */
    function SmartToken(string _name, string _symbol, uint8 _decimals)
        ERC20Token(_name, _symbol, _decimals)
    {
        require(bytes(_symbol).length <= 6); // validate input
        NewSmartToken(address(this));
    }

    // allows execution only when transfers aren't disabled
    modifier transfersAllowed {
        assert(transfersEnabled);
        _;
    }

    /**
        @dev disables/enables transfers
        can only be called by the contract owner

        @param _disable    true to disable transfers, false to enable them
    */
    function disableTransfers(bool _disable) public ownerOnly {
        transfersEnabled = !_disable;
    }

    /**
        @dev increases the token supply and sends the new tokens to an account
        can only be called by the contract owner

        @param _to         account to receive the new amount
        @param _amount     amount to increase the supply by
    */
    function issue(address _to, uint256 _amount)
        public
        ownerOnly
        validAddress(_to)
        notThis(_to)
    {
        totalSupply = safeAdd(totalSupply, _amount);
        balanceOf[_to] = safeAdd(balanceOf[_to], _amount);

        Issuance(_amount);
        Transfer(this, _to, _amount);
    }

    /**
        @dev removes tokens from an account and decreases the token supply
        can only be called by the contract owner

        @param _from       account to remove the amount from
        @param _amount     amount to decrease the supply by
    */
    function destroy(address _from, uint256 _amount)
        public
        ownerOnly
    {
        balanceOf[_from] = safeSub(balanceOf[_from], _amount);
        totalSupply = safeSub(totalSupply, _amount);

        Transfer(_from, this, _amount);
        Destruction(_amount);
    }

    // ERC20 standard method overrides with some extra functionality

    /**
        @dev send coins
        throws on any error rather then return a false flag to minimize user errors
        note that when transferring to the smart token's address, the coins are actually destroyed

        @param _to      target address
        @param _value   transfer amount

        @return true if the transfer was successful, false if it wasn't
    */
    function transfer(address _to, uint256 _value) public transfersAllowed returns (bool success) {
        assert(super.transfer(_to, _value));

        // transferring to the contract address destroys tokens
        if (_to == address(this)) {
            balanceOf[_to] -= _value;
            totalSupply -= _value;
            Destruction(_value);
        }

        return true;
    }

    /**
        @dev an account/contract attempts to get the coins
        throws on any error rather then return a false flag to minimize user errors
        note that when transferring to the smart token's address, the coins are actually destroyed

        @param _from    source address
        @param _to      target address
        @param _value   transfer amount

        @return true if the transfer was successful, false if it wasn't
    */
    function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed returns (bool success) {
        assert(super.transferFrom(_from, _to, _value));

        // transferring to the contract address destroys tokens
        if (_to == address(this)) {
            balanceOf[_to] -= _value;
            totalSupply -= _value;
            Destruction(_value);
        }

        return true;
    }
}

/// @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;
    address public newOwnerCandidate;

    event OwnershipRequested(address indexed _by, address indexed _to);
    event OwnershipTransferred(address indexed _from, address indexed _to);

    /// @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() {
        if (msg.sender != owner) {
            throw;
        }

        _;
    }

    /// @dev Proposes to transfer control of the contract to a newOwnerCandidate.
    /// @param _newOwnerCandidate address The address to transfer ownership to.
    function transferOwnership(address _newOwnerCandidate) onlyOwner {
        require(_newOwnerCandidate != address(0));

        newOwnerCandidate = _newOwnerCandidate;

        OwnershipRequested(msg.sender, newOwnerCandidate);
    }

    /// @dev Accept ownership transfer. This method needs to be called by the perviously proposed owner.
    function acceptOwnership() {
        if (msg.sender == newOwnerCandidate) {
            owner = newOwnerCandidate;
            newOwnerCandidate = address(0);

            OwnershipTransferred(owner, newOwnerCandidate);
        }
    }
}

/// @title Math operations with safety checks
library SaferMath {
    function mul(uint256 a, uint256 b) internal returns (uint256) {
        uint256 c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function div(uint256 a, uint256 b) internal 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 returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    function add(uint256 a, uint256 b) internal returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }

    function max64(uint64 a, uint64 b) internal constant returns (uint64) {
        return a >= b ? a : b;
    }

    function min64(uint64 a, uint64 b) internal constant returns (uint64) {
        return a < b ? a : b;
    }

    function max256(uint256 a, uint256 b) internal constant returns (uint256) {
        return a >= b ? a : b;
    }

    function min256(uint256 a, uint256 b) internal constant returns (uint256) {
        return a < b ? a : b;
    }
}


/// @title Stox Smart Token
contract StoxSmartToken is SmartToken {
    function StoxSmartToken() SmartToken('Stox', 'STX', 18) {
        disableTransfers(true);
    }
}


/// @title Vesting trustee
contract Trustee is Ownable {
    using SaferMath for uint256;

    // The address of the STX ERC20 token.
    StoxSmartToken public stox;

    struct Grant {
        uint256 value;
        uint256 start;
        uint256 cliff;
        uint256 end;
        uint256 transferred;
        bool revokable;
    }

    // Grants holder.
    mapping (address => Grant) public grants;

    // Total tokens available for vesting.
    uint256 public totalVesting;

    event NewGrant(address indexed _from, address indexed _to, uint256 _value);
    event UnlockGrant(address indexed _holder, uint256 _value);
    event RevokeGrant(address indexed _holder, uint256 _refund);

    /// @dev Constructor that initializes the address of the StoxSmartToken contract.
    /// @param _stox StoxSmartToken The address of the previously deployed StoxSmartToken smart contract.
    function Trustee(StoxSmartToken _stox) {
        require(_stox != address(0));

        stox = _stox;
    }

    /// @dev Grant tokens to a specified address.
    /// @param _to address The address to grant tokens to.
    /// @param _value uint256 The amount of tokens to be granted.
    /// @param _start uint256 The beginning of the vesting period.
    /// @param _cliff uint256 Duration of the cliff period.
    /// @param _end uint256 The end of the vesting period.
    /// @param _revokable bool Whether the grant is revokable or not.
    function grant(address _to, uint256 _value, uint256 _start, uint256 _cliff, uint256 _end, bool _revokable)
        public onlyOwner {
        require(_to != address(0));
        require(_value > 0);

        // Make sure that a single address can be granted tokens only once.
        require(grants[_to].value == 0);

        // Check for date inconsistencies that may cause unexpected behavior.
        require(_start <= _cliff && _cliff <= _end);

        // Check that this grant doesn't exceed the total amount of tokens currently available for vesting.
        require(totalVesting.add(_value) <= stox.balanceOf(address(this)));

        // Assign a new grant.
        grants[_to] = Grant({
            value: _value,
            start: _start,
            cliff: _cliff,
            end: _end,
            transferred: 0,
            revokable: _revokable
        });

        // Tokens granted, reduce the total amount available for vesting.
        totalVesting = totalVesting.add(_value);

        NewGrant(msg.sender, _to, _value);
    }

    /// @dev Revoke the grant of tokens of a specifed address.
    /// @param _holder The address which will have its tokens revoked.
    function revoke(address _holder) public onlyOwner {
        Grant grant = grants[_holder];

        require(grant.revokable);

        // Send the remaining STX back to the owner.
        uint256 refund = grant.value.sub(grant.transferred);

        // Remove the grant.
        delete grants[_holder];

        totalVesting = totalVesting.sub(refund);
        stox.transfer(msg.sender, refund);

        RevokeGrant(_holder, refund);
    }

    /// @dev Calculate the total amount of vested tokens of a holder at a given time.
    /// @param _holder address The address of the holder.
    /// @param _time uint256 The specific time.
    /// @return a uint256 representing a holder's total amount of vested tokens.
    function vestedTokens(address _holder, uint256 _time) public constant returns (uint256) {
        Grant grant = grants[_holder];
        if (grant.value == 0) {
            return 0;
        }

        return calculateVestedTokens(grant, _time);
    }

    /// @dev Calculate amount of vested tokens at a specifc time.
    /// @param _grant Grant The vesting grant.
    /// @param _time uint256 The time to be checked
    /// @return An uint256 representing the amount of vested tokens of a specific grant.
    ///   |                         _/--------   vestedTokens rect
    ///   |                       _/
    ///   |                     _/
    ///   |                   _/
    ///   |                 _/
    ///   |                /
    ///   |              .|
    ///   |            .  |
    ///   |          .    |
    ///   |        .      |
    ///   |      .        |
    ///   |    .          |
    ///   +===+===========+---------+----------> time
    ///     Start       Cliff      End
    function calculateVestedTokens(Grant _grant, uint256 _time) private constant returns (uint256) {
        // If we're before the cliff, then nothing is vested.
        if (_time < _grant.cliff) {
            return 0;
        }

        // If we're after the end of the vesting period - everything is vested;
        if (_time >= _grant.end) {
            return _grant.value;
        }

        // Interpolate all vested tokens: vestedTokens = tokens/// (time - start) / (end - start)
         return _grant.value.mul(_time.sub(_grant.start)).div(_grant.end.sub(_grant.start));
    }

    /// @dev Unlock vested tokens and transfer them to their holder.
    /// @return a uint256 representing the amount of vested tokens transferred to their holder.
    function unlockVestedTokens() public {
        Grant grant = grants[msg.sender];
        require(grant.value != 0);

        // Get the total amount of vested tokens, acccording to grant.
        uint256 vested = calculateVestedTokens(grant, now);
        if (vested == 0) {
            return;
        }

        // Make sure the holder doesn't transfer more than what he already has.
        uint256 transferable = vested.sub(grant.transferred);
        if (transferable == 0) {
            return;
        }

        grant.transferred = grant.transferred.add(transferable);
        totalVesting = totalVesting.sub(transferable);
        stox.transfer(msg.sender, transferable);

        UnlockGrant(msg.sender, transferable);
    }
}


/// @title Stox Smart Token sale
contract StoxSmartTokenSale is Ownable {
    using SaferMath for uint256;

    uint256 public constant DURATION = 14 days;

    bool public isFinalized = false;
    bool public isDistributed = false;

    // The address of the STX ERC20 token.
    StoxSmartToken public stox;

    // The address of the token allocation trustee;
    Trustee public trustee;

    uint256 public startTime = 0;
    uint256 public endTime = 0;
    address public fundingRecipient;

    uint256 public tokensSold = 0;

    // TODO: update to the correct values.
    uint256 public constant ETH_CAP = 148000;
    uint256 public constant EXCHANGE_RATE = 200; // 200 STX for ETH
    uint256 public constant TOKEN_SALE_CAP = ETH_CAP * EXCHANGE_RATE * 10 ** 18;

    event TokensIssued(address indexed _to, uint256 _tokens);

    /// @dev Throws if called when not during sale.
    modifier onlyDuringSale() {
        if (tokensSold >= TOKEN_SALE_CAP || now < startTime || now >= endTime) {
            throw;
        }

        _;
    }

    /// @dev Throws if called before sale ends.
    modifier onlyAfterSale() {
        if (!(tokensSold >= TOKEN_SALE_CAP || now >= endTime)) {
            throw;
        }

        _;
    }

    /// @dev Constructor that initializes the sale conditions.
    /// @param _fundingRecipient address The address of the funding recipient.
    /// @param _startTime uint256 The start time of the token sale.
    function StoxSmartTokenSale(address _stox, address _fundingRecipient, uint256 _startTime) {
        require(_stox != address(0));
        require(_fundingRecipient != address(0));
        require(_startTime > now);

        stox = StoxSmartToken(_stox);

        fundingRecipient = _fundingRecipient;
        startTime = _startTime;
        endTime = startTime + DURATION;
    }

    /// @dev Distributed tokens to the partners who have participated during the pre-sale.
    function distributePartnerTokens() external onlyOwner {
        require(!isDistributed);

        assert(tokensSold == 0);
        assert(stox.totalSupply() == 0);

        // Distribute strategic tokens to partners. Please note, that this address doesn't represent a single entity or
        // person and will be only used to distribute tokens to 30~ partners.
        //
        // Please expect to see token transfers from this address in the first 24 hours after the token sale ends.
        issueTokens(0x9065260ef6830f6372F1Bde408DeC57Fe3150530, 14800000 * 10 ** 18);

        isDistributed = true;
    }

    /// @dev Finalizes the token sale event.
    function finalize() external onlyAfterSale {
        if (isFinalized) {
            throw;
        }

        // Grant vesting grants.
        //
        // TODO: use real addresses.
        trustee = new Trustee(stox);

        // Since only 50% of the tokens will be sold, we will automatically issue the same amount of sold STX to the
        // trustee.
        uint256 unsoldTokens = tokensSold;

        // Issue 55% of the remaining tokens (== 27.5%) go to strategic parternships.
        uint256 strategicPartnershipTokens = unsoldTokens.mul(55).div(100);

        // Note: we will substract the bonus tokens from this grant, since they were already issued for the pre-sale
        // strategic partners and should've been taken from this allocation.
        stox.issue(0xbC14105ccDdeAadB96Ba8dCE18b40C45b6bACf58, strategicPartnershipTokens);

        // Issue the remaining tokens as vesting grants:
        stox.issue(trustee, unsoldTokens.sub(strategicPartnershipTokens));

        // 25% of the remaining tokens (== 12.5%) go to Invest.com, at uniform 12 months vesting schedule.
        trustee.grant(0xb54c6a870d4aD65e23d471Fb7941aD271D323f5E, unsoldTokens.mul(25).div(100), now, now,
            now.add(1 years), true);

        // 20% of the remaining tokens (== 10%) go to Stox team, at uniform 24 months vesting schedule.
        trustee.grant(0x4eB4Cd1D125d9d281709Ff38d65b99a6927b46c1, unsoldTokens.mul(20).div(100), now, now,
            now.add(2 years), true);

        // Re-enable transfers after the token sale.
        stox.disableTransfers(false);

        isFinalized = true;
    }

    /// @dev Create and sell tokens to the caller.
    /// @param _recipient address The address of the recipient.
    function create(address _recipient) public payable onlyDuringSale {
        require(_recipient != address(0));
        require(msg.value > 0);

        assert(isDistributed);

        uint256 tokens = SaferMath.min256(msg.value.mul(EXCHANGE_RATE), TOKEN_SALE_CAP.sub(tokensSold));
        uint256 contribution = tokens.div(EXCHANGE_RATE);

        issueTokens(_recipient, tokens);

        // Transfer the funds to the funding recipient.
        fundingRecipient.transfer(contribution);

        // Refund the msg.sender, in the case that not all of its ETH was used. This can happen only when selling the
        // last chunk of STX.
        uint256 refund = msg.value.sub(contribution);
        if (refund > 0) {
            msg.sender.transfer(refund);
        }
    }

    /// @dev Issues tokens for the recipient.
    /// @param _recipient address The address of the recipient.
    /// @param _tokens uint256 The amount of tokens to issue.
    function issueTokens(address _recipient, uint256 _tokens) private {
        // Update total sold tokens.
        tokensSold = tokensSold.add(_tokens);

        stox.issue(_recipient, _tokens);

        TokensIssued(_recipient, _tokens);
    }

    /// @dev Fallback function that will delegate the request to create.
    function () external payable onlyDuringSale {
        create(msg.sender);
    }

    /// @dev Proposes to transfer control of the StoxSmartToken contract to a new owner.
    /// @param _newOwnerCandidate address The address to transfer ownership to.
    ///
    /// Note that:
    ///   1. The new owner will need to call StoxSmartToken's acceptOwnership directly in order to accept the ownership.
    ///   2. Calling this method during the token sale will prevent the token sale to continue, since only the owner of
    ///      the StoxSmartToken contract can issue new tokens.
    function transferSmartTokenOwnership(address _newOwnerCandidate) external onlyOwner {
        stox.transferOwnership(_newOwnerCandidate);
    }

    /// @dev Accepts new ownership on behalf of the StoxSmartToken contract. This can be used, by the token sale
    /// contract itself to claim back ownership of the StoxSmartToken contract.
    function acceptSmartTokenOwnership() external onlyOwner {
        stox.acceptOwnership();
    }

    /// @dev Proposes to transfer control of the Trustee contract to a new owner.
    /// @param _newOwnerCandidate address The address to transfer ownership to.
    ///
    /// Note that:
    ///   1. The new owner will need to call Trustee's acceptOwnership directly in order to accept the ownership.
    ///   2. Calling this method during the token sale won't be possible, as the Trustee is only created after its
    ///      finalization.
    function transferTrusteeOwnership(address _newOwnerCandidate) external onlyOwner {
        trustee.transferOwnership(_newOwnerCandidate);
    }

    /// @dev Accepts new ownership on behalf of the Trustee contract. This can be used, by the token sale
    /// contract itself to claim back ownership of the Trustee contract.
    function acceptTrusteeOwnership() external onlyOwner {
        trustee.acceptOwnership();
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"standard","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroy","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_token","type":"address"}],"name":"NewSmartToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Issuance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Destruction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_prevOwner","type":"address"},{"indexed":false,"name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60a0604052600960608190527f546f6b656e20302e310000000000000000000000000000000000000000000000608090815262000040916000919062000288565b50604080516020810191829052600090819052620000619160019162000288565b50604080516020810191829052600090819052620000829160029162000288565b506003805460ff191681556000600455604080518082019091528181527f302e3200000000000000000000000000000000000000000000000000000000006020909101908152620000d7916009919062000288565b50600a805460ff191660011790553415620000ee57fe5b5b604060405190810160405280600481526020017f53746f7800000000000000000000000000000000000000000000000000000000815250604060405190810160405280600381526020017f535458000000000000000000000000000000000000000000000000000000000081525060125b5b5b8282825b5b5b600083511180156200017b575060008251115b1515620001885760006000fd5b82516200019d90600190602086019062000288565b508151620001b390600290602085019062000288565b506003805460ff191660ff83161790555b505060078054600160a060020a03191633600160a060020a0316179055505b5b81516006901115620001f65760006000fd5b60408051600160a060020a033016815290517ff4cd1f8571e8d9c97ffcb81558807ab73f9803d54de5da6a0420593c82a4a9f09181900360200190a15b5050506200025660016200025d6401000000000262000712176401000000009004565b5b62000332565b60075433600160a060020a039081169116146200027657fe5b600a805460ff191682151790555b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002cb57805160ff1916838001178555620002fb565b82800160010185558215620002fb579182015b82811115620002fb578251825591602001919060010190620002de565b5b506200030a9291506200030e565b5090565b6200032f91905b808211156200030a576000815560010162000315565b5090565b90565b6110f180620003426000396000f3006060604052361561010f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610111578063095ea7b3146101a15780631608f18f146101d457806318160ddd146101eb57806323b872dd1461020d578063313ce5671461024657806354fd4d501461026c5780635a3b7e42146102fc5780635e35359e1461038c57806370a08231146103b357806379ba5097146103e1578063867904b4146103f35780638da5cb5b1461041457806395d89b4114610440578063a24835d1146104d0578063a9059cbb146104f1578063bef97c8714610524578063d4ee1d9014610548578063dd62ed3e14610574578063f2fde38b146105a8575bfe5b341561011957fe5b6101216105c6565b604080516020808252835181830152835191928392908301918501908083838215610167575b80518252602083111561016757601f199092019160209182019101610147565b505050905090810190601f1680156101935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a957fe5b6101c0600160a060020a0360043516602435610653565b604080519115158252519081900360200190f35b34156101dc57fe5b6101e96004351515610712565b005b34156101f357fe5b6101fb61073c565b60408051918252519081900360200190f35b341561021557fe5b6101c0600160a060020a0360043581169060243516604435610742565b604080519115158252519081900360200190f35b341561024e57fe5b6102566107ea565b6040805160ff9092168252519081900360200190f35b341561027457fe5b6101216107f3565b604080516020808252835181830152835191928392908301918501908083838215610167575b80518252602083111561016757601f199092019160209182019101610147565b505050905090810190601f1680156101935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561030457fe5b610121610881565b604080516020808252835181830152835191928392908301918501908083838215610167575b80518252602083111561016757601f199092019160209182019101610147565b505050905090810190601f1680156101935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561039457fe5b6101e9600160a060020a036004358116906024351660443561090f565b005b34156103bb57fe5b6101fb600160a060020a0360043516610a24565b60408051918252519081900360200190f35b34156103e957fe5b6101e9610a36565b005b34156103fb57fe5b6101e9600160a060020a0360043516602435610ad3565b005b341561041c57fe5b610424610bec565b60408051600160a060020a039092168252519081900360200190f35b341561044857fe5b610121610bfb565b604080516020808252835181830152835191928392908301918501908083838215610167575b80518252602083111561016757601f199092019160209182019101610147565b505050905090810190601f1680156101935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104d857fe5b6101e9600160a060020a0360043516602435610c86565b005b34156104f957fe5b6101c0600160a060020a0360043516602435610d54565b604080519115158252519081900360200190f35b341561052c57fe5b6101c0610dfa565b604080519115158252519081900360200190f35b341561055057fe5b610424610e03565b60408051600160a060020a039092168252519081900360200190f35b341561057c57fe5b6101fb600160a060020a0360043581169060243516610e12565b60408051918252519081900360200190f35b34156105b057fe5b6101e9600160a060020a0360043516610e2f565b005b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561064b5780601f106106205761010080835404028352916020019161064b565b820191906000526020600020905b81548152906001019060200180831161062e57829003601f168201915b505050505081565b600082600160a060020a038116151561066c5760006000fd5b82158061069c5750600160a060020a03338116600090815260066020908152604080832093881683529290522054155b15156106a85760006000fd5b600160a060020a03338116600081815260066020908152604080832094891680845294825291829020879055815187815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3600191505b5b5092915050565b60075433600160a060020a0390811691161461072a57fe5b600a805460ff191682151790555b5b50565b60045481565b600a5460009060ff16151561075357fe5b61075e848484610e90565b151561076657fe5b30600160a060020a031683600160a060020a031614156107de57600160a060020a03831660009081526005602090815260409182902080548590039055600480548590039055815184815291517f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd34539281900390910190a15b5060015b5b9392505050565b60035460ff1681565b6009805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561064b5780601f106106205761010080835404028352916020019161064b565b820191906000526020600020905b81548152906001019060200180831161062e57829003601f168201915b505050505081565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561064b5780601f106106205761010080835404028352916020019161064b565b820191906000526020600020905b81548152906001019060200180831161062e57829003601f168201915b505050505081565b60075433600160a060020a0390811691161461092757fe5b82600160a060020a038116151561093e5760006000fd5b82600160a060020a03811615156109555760006000fd5b8330600160a060020a031681600160a060020a0316141515156109785760006000fd5b85600160a060020a031663a9059cbb86866000604051602001526040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15156109f957fe5b6102c65a03f11515610a0757fe5b50506040515115159050610a1757fe5b5b5b505b505b505b505050565b60056020526000908152604090205481565b60085433600160a060020a03908116911614610a525760006000fd5b60075460085460408051600160a060020a03938416815292909116602083015280517f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a9281900390910190a1600880546007805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a038416179091551690555b565b60075433600160a060020a03908116911614610aeb57fe5b81600160a060020a0381161515610b025760006000fd5b8230600160a060020a031681600160a060020a031614151515610b255760006000fd5b610b3160045484610fb6565b600455600160a060020a038416600090815260056020526040902054610b579084610fb6565b600160a060020a03851660009081526005602090815260409182902092909255805185815290517f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3929181900390910190a183600160a060020a031630600160a060020a03166000805160206110a6833981519152856040518082815260200191505060405180910390a35b5b505b505b5050565b600754600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561064b5780601f106106205761010080835404028352916020019161064b565b820191906000526020600020905b81548152906001019060200180831161062e57829003601f168201915b505050505081565b60075433600160a060020a03908116911614610c9e57fe5b600160a060020a038216600090815260056020526040902054610cc19082610fd0565b600160a060020a038316600090815260056020526040902055600454610ce79082610fd0565b600455604080518281529051600160a060020a0330811692908516916000805160206110a68339815191529181900360200190a36040805182815290517f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd34539181900360200190a15b5b5050565b600a5460009060ff161515610d6557fe5b610d6f8383610fe7565b1515610d7757fe5b30600160a060020a031683600160a060020a03161415610def57600160a060020a03831660009081526005602090815260409182902080548590039055600480548590039055815184815291517f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd34539281900390910190a15b5060015b5b92915050565b600a5460ff1681565b600854600160a060020a031681565b600660209081526000928352604080842090915290825290205481565b60075433600160a060020a03908116911614610e4757fe5b600754600160a060020a0382811691161415610e635760006000fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600083600160a060020a0381161515610ea95760006000fd5b83600160a060020a0381161515610ec05760006000fd5b600160a060020a0380871660009081526006602090815260408083203390941683529290522054610ef19085610fd0565b600160a060020a038088166000818152600660209081526040808320339095168352938152838220949094559081526005909252902054610f329085610fd0565b600160a060020a038088166000908152600560205260408082209390935590871681522054610f619085610fb6565b600160a060020a0380871660008181526005602090815260409182902094909455805188815290519193928a16926000805160206110a683398151915292918290030190a3600192505b5b505b509392505050565b600082820183811015610fc557fe5b8091505b5092915050565b600081831015610fdc57fe5b508082035b92915050565b600082600160a060020a03811615156110005760006000fd5b600160a060020a0333166000908152600560205260409020546110239084610fd0565b600160a060020a0333811660009081526005602052604080822093909355908616815220546110529084610fb6565b600160a060020a038086166000818152600560209081526040918290209490945580518781529051919333909316926000805160206110a683398151915292918290030190a3600191505b5b50929150505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058207005dfc56dca66631199f0571f344e340c32495dc02b7aa85d189a081bc3d6090029

   Swarm Source:
bzzr://7005dfc56dca66631199f0571f344e340c32495dc02b7aa85d189a081bc3d609
View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.