ETH Price: $2,449.25 (+1.86%)

Transaction Decoder

Block:
2839726 at Dec-19-2016 11:07:03 PM +UTC
Transaction Fee:
0.004166743 ETH $10.21
Gas Used:
96,901 Gas / 43 Gwei

Account State Difference:

  Address   Before After State Difference Code
(DwarfPool)
7,792.667022581211110932 Eth7,792.671189324211110932 Eth0.004166743
0x6ee16a57...e35A27282
4.281146987 Eth
Nonce: 6
0.777197145408452596 Eth
Nonce: 7
3.503949841591547404
0x9734c136...3d72E024D
0xa2c9a757...76F9E7883
(Humaniq: Wallet)
2,118.561321839265999618 Eth2,122.061104937857547022 Eth3.499783098591547404
0xE1a6b457...d0885e1Db

Execution Trace

ETH 3.5 HumaniqICO.CALL( )
  • ETH 0.000216901408452596 0x6ee16a5794171a0146b33392fe5b832e35a27282.CALL( )
  • ETH 3.499783098591547404 Humaniq: Wallet.CALL( )
  • HumaniqToken.issueTokens( _for=0x6ee16a5794171A0146B33392FE5B832e35A27282, tokenCount=7462 ) => ( True )
    File 1 of 2: HumaniqICO
    pragma solidity ^0.4.2;
    
    /// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20
    /// @title Abstract token contract - Functions to be implemented by token contracts.
    contract Token {
        // This is not an abstract function, because solc won't recognize generated getter functions for public variables as functions
        function totalSupply() constant returns (uint256 supply) {}
        function balanceOf(address owner) constant returns (uint256 balance);
        function transfer(address to, uint256 value) returns (bool success);
        function transferFrom(address from, address to, uint256 value) returns (bool success);
        function approve(address spender, uint256 value) returns (bool success);
        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);
    }
    
    contract HumaniqToken is Token {
        function issueTokens(address _for, uint tokenCount) payable returns (bool);
        function changeEmissionContractAddress(address newAddress) returns (bool);
    }
    
    /// @title HumaniqICO contract - Takes funds from users and issues tokens.
    /// @author Evgeny Yurtaev - <[email protected]>
    contract HumaniqICO {
    
        /*
         * External contracts
         */
        HumaniqToken public humaniqToken = HumaniqToken(0x9734c136F5c63531b60D02548Bca73a3d72E024D);
    
        /*
         * Crowdfunding parameters
         */
        uint constant public CROWDFUNDING_PERIOD = 12 days;
        // Goal threshold, 10000 ETH
        uint constant public CROWDSALE_TARGET = 10000 ether;
    
        /*
         *  Storage
         */
        address public founder;
        address public multisig;
        uint public startDate = 0;
        uint public icoBalance = 0;
        uint public baseTokenPrice = 666 szabo; // 0.000666 ETH
        uint public discountedPrice = baseTokenPrice;
        bool public isICOActive = false;
    
        // participant address => value in Wei
        mapping (address => uint) public investments;
    
        /*
         *  Modifiers
         */
        modifier onlyFounder() {
            // Only founder is allowed to do this action.
            if (msg.sender != founder) {
                throw;
            }
            _;
        }
    
        modifier minInvestment() {
            // User has to send at least the ether value of one token.
            if (msg.value < baseTokenPrice) {
                throw;
            }
            _;
        }
    
        modifier icoActive() {
            if (isICOActive == false) {
                throw;
            }
            _;
        }
    
        modifier applyBonus() {
            uint icoDuration = now - startDate;
            if (icoDuration >= 248 hours) {
                discountedPrice = baseTokenPrice;
            }
            else if (icoDuration >= 176 hours) {
                discountedPrice = (baseTokenPrice * 100) / 107;
            }
            else if (icoDuration >= 104 hours) {
                discountedPrice = (baseTokenPrice * 100) / 120;
            }
            else if (icoDuration >= 32 hours) {
                discountedPrice = (baseTokenPrice * 100) / 142;
            }
            else if (icoDuration >= 12 hours) {
                discountedPrice = (baseTokenPrice * 100) / 150;
            }
            else {
                discountedPrice = (baseTokenPrice * 100) / 170;
            }
            _;
        }
    
        /// @dev Allows user to create tokens if token creation is still going
        /// and cap was not reached. Returns token count.
        function fund()
            public
            applyBonus
            icoActive
            minInvestment
            payable
            returns (uint)
        {
            // Token count is rounded down. Sent ETH should be multiples of baseTokenPrice.
            uint tokenCount = msg.value / discountedPrice;
            // Ether spent by user.
            uint investment = tokenCount * discountedPrice;
            // Send change back to user.
            if (msg.value > investment && !msg.sender.send(msg.value - investment)) {
                throw;
            }
            // Update fund's and user's balance and total supply of tokens.
            icoBalance += investment;
            investments[msg.sender] += investment;
            // Send funds to founders.
            if (!multisig.send(investment)) {
                // Could not send money
                throw;
            }
            if (!humaniqToken.issueTokens(msg.sender, tokenCount)) {
                // Tokens could not be issued.
                throw;
            }
            return tokenCount;
        }
    
        /// @dev Issues tokens for users who made BTC purchases.
        /// @param beneficiary Address the tokens will be issued to.
        /// @param _tokenCount Number of tokens to issue.
        function fundBTC(address beneficiary, uint _tokenCount)
            external
            applyBonus
            icoActive
            onlyFounder
            returns (uint)
        {
            // Approximate ether spent.
            uint investment = _tokenCount * discountedPrice;
            // Update fund's and user's balance and total supply of tokens.
            icoBalance += investment;
            investments[beneficiary] += investment;
            if (!humaniqToken.issueTokens(beneficiary, _tokenCount)) {
                // Tokens could not be issued.
                throw;
            }
            return _tokenCount;
        }
    
        /// @dev If ICO has successfully finished sends the money to multisig
        /// wallet.
        function finishCrowdsale()
            external
            onlyFounder
            returns (bool)
        {
            if (isICOActive == true) {
                isICOActive = false;
                // Founders receive 14% of all created tokens.
                uint founderBonus = ((icoBalance / baseTokenPrice) * 114) / 100;
                if (!humaniqToken.issueTokens(multisig, founderBonus)) {
                    // Tokens could not be issued.
                    throw;
                }
            }
        }
    
        /// @dev Sets token value in Wei.
        /// @param valueInWei New value.
        function changeBaseTokenPrice(uint valueInWei)
            external
            onlyFounder
            returns (bool)
        {
            baseTokenPrice = valueInWei;
            return true;
        }
    
        /// @dev Function that activates ICO.
        function startICO()
            external
            onlyFounder
        {
            if (isICOActive == false && startDate == 0) {
              // Start ICO
              isICOActive = true;
              // Set start-date of token creation
              startDate = now;
            }
        }
    
        /// @dev Contract constructor function sets founder and multisig addresses.
        function HumaniqICO(address _multisig) {
            // Set founder address
            founder = msg.sender;
            // Set multisig address
            multisig = _multisig;
        }
    
        /// @dev Fallback function. Calls fund() function to create tokens.
        function () payable {
            fund();
        }
    }

    File 2 of 2: HumaniqToken
    pragma solidity ^0.4.2;
    /// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20
    
    /// @title Abstract token contract - Functions to be implemented by token contracts.
    contract Token {
        // This is not an abstract function, because solc won't recognize generated getter functions for public variables as functions
        function totalSupply() constant returns (uint256 supply) {}
        function balanceOf(address owner) constant returns (uint256 balance);
        function transfer(address to, uint256 value) returns (bool success);
        function transferFrom(address from, address to, uint256 value) returns (bool success);
        function approve(address spender, uint256 value) returns (bool success);
        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);
    }
    
    
    contract StandardToken is Token {
    
        /*
         *  Data structures
         */
        mapping (address => uint256) balances;
        mapping (address => mapping (address => uint256)) allowed;
        uint256 public totalSupply;
    
        /*
         *  Read and write storage functions
         */
        /// @dev Transfers sender's tokens to a given address. Returns success.
        /// @param _to Address of token receiver.
        /// @param _value Number of tokens to transfer.
        function transfer(address _to, uint256 _value) returns (bool success) {
            if (balances[msg.sender] >= _value && _value > 0) {
                balances[msg.sender] -= _value;
                balances[_to] += _value;
                Transfer(msg.sender, _to, _value);
                return true;
            }
            else {
                return false;
            }
        }
    
        /// @dev Allows allowed third party to transfer tokens from one address to another. Returns success.
        /// @param _from Address from where tokens are withdrawn.
        /// @param _to Address to where tokens are sent.
        /// @param _value Number of tokens to transfer.
        function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
            if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
                balances[_to] += _value;
                balances[_from] -= _value;
                allowed[_from][msg.sender] -= _value;
                Transfer(_from, _to, _value);
                return true;
            }
            else {
                return false;
            }
        }
    
        /// @dev Returns number of tokens owned by given address.
        /// @param _owner Address of token owner.
        function balanceOf(address _owner) constant returns (uint256 balance) {
            return balances[_owner];
        }
    
        /// @dev Sets approved amount of tokens for spender. Returns success.
        /// @param _spender Address of allowed account.
        /// @param _value Number of approved tokens.
        function approve(address _spender, uint256 _value) returns (bool success) {
            allowed[msg.sender][_spender] = _value;
            Approval(msg.sender, _spender, _value);
            return true;
        }
    
        /*
         * Read storage functions
         */
        /// @dev Returns number of allowed tokens for given address.
        /// @param _owner Address of token owner.
        /// @param _spender Address of token spender.
        function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
          return allowed[_owner][_spender];
        }
    
    }
    
    
    /// @title Token contract - Implements Standard Token Interface with HumaniQ features.
    /// @author Evgeny Yurtaev - <[email protected]>
    contract HumaniqToken is StandardToken {
    
        /*
         * External contracts
         */
        address public emissionContractAddress = 0x0;
    
        /*
         * Token meta data
         */
        string constant public name = "HumaniQ";
        string constant public symbol = "HMQ";
        uint8 constant public decimals = 0;
    
        address public founder = 0x0;
        bool locked = true;
        /*
         * Modifiers
         */
        modifier onlyFounder() {
            // Only founder is allowed to do this action.
            if (msg.sender != founder) {
                throw;
            }
            _;
        }
    
        modifier isCrowdfundingContract() {
            // Only emission address is allowed to proceed.
            if (msg.sender != emissionContractAddress) {
                throw;
            }
            _;
        }
    
        modifier unlocked() {
            // Only when transferring coins is enabled.
            if (locked == true) {
                throw;
            }
            _;
        }
    
        /*
         * Contract functions
         */
    
        /// @dev Crowdfunding contract issues new tokens for address. Returns success.
        /// @param _for Address of receiver.
        /// @param tokenCount Number of tokens to issue.
        function issueTokens(address _for, uint tokenCount)
            external
            payable
            isCrowdfundingContract
            returns (bool)
        {
            if (tokenCount == 0) {
                return false;
            }
            balances[_for] += tokenCount;
            totalSupply += tokenCount;
            return true;
        }
    
        function transfer(address _to, uint256 _value)
            unlocked
            returns (bool success)
        {
            return super.transfer(_to, _value);
        }
    
        function transferFrom(address _from, address _to, uint256 _value)
            unlocked
            returns (bool success)
        {
            return super.transferFrom(_from, _to, _value);
        }
    
        /// @dev Function to change address that is allowed to do emission.
        /// @param newAddress Address of new emission contract.
        function changeEmissionContractAddress(address newAddress)
            external
            onlyFounder
            returns (bool)
        {
            emissionContractAddress = newAddress;
        }
    
        /// @dev Function that locks/unlocks transfers of token.
        /// @param value True/False
        function lock(bool value)
            external
            onlyFounder
        {
            locked = value;
        }
    
        /// @dev Contract constructor function sets initial token balances.
        /// @param _founder Address of the founder of HumaniQ.
        function HumaniqToken(address _founder)
        {
            totalSupply = 0;
            founder = _founder;
        }
    }