Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 4635 txns
 Latest 25 transactions from a total of 4635 transactions

TxHash Age From To Value [TxFee]
0xd4558ecf53520d243f597625fc44d79d47defec1925416f49c05114f90e6cbca2 mins ago0x5c33bf00b26d394be5bf596a286cc4a6ba958f69  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00060662
0x0401da0038334197fb2b2f84bfef0baf764c938adfbbec39ee2651d5c10a52c723 mins ago0x0d0e2877d0b77ff4b172f650f84c111039b6c92c  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.001147584
0x842f6ee92bc26bfa4e258238ebb83772d4a0aa707cb0d606195cdb7e3da1371b29 mins ago0x0d0e2877d0b77ff4b172f650f84c111039b6c92c  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00086724
0x8abbb311ca26bd238af0e629f27ec9c08cfebf1f766792d7e9227596500d9e1a2 hrs 8 mins ago0x105580e944f8c7a99f301388ac7b3eb55df07005  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.001024738
0xa561c2555853eb0e5fd5666178b60839c1352ecf9d49de9a6bef576128f393e52 hrs 24 mins ago0x105580e944f8c7a99f301388ac7b3eb55df07005  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.0008555722
0x57404d4c117ea487688dd760b249363c6174821f2ee9b73a194bbe8d49a1b7052 hrs 30 mins ago0x105580e944f8c7a99f301388ac7b3eb55df07005  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000945912
0x59f1ff1e840d7d098114accd61f0ac4784b1797641a696533fc37109212d5fd02 hrs 42 mins ago0x105580e944f8c7a99f301388ac7b3eb55df07005  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00071596
0xda8f26195e14e1e6d390e90da68dd3e3c47e0a56454c0f9f7d10d3531f25ddad4 hrs 10 mins ago0x94abb9d27a65b11549f59b3942444e402e271a78  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.0003583
0x672cd7d2cfd35419111f645f5fee22532d5d3ad244cb74ff6d86f752174dbe4e4 hrs 13 mins ago0xb1735189b9b5b51cdaddd2661d2886d77f0d3321  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0xa41739764e1a19993c899c052f27fbb1cbdf2a3e4922d2593628b5f52e89c7274 hrs 17 mins ago0x94abb9d27a65b11549f59b3942444e402e271a78  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000214788
0x929353d1c1c2d0743c2a2adcc60aa784faaa4cd3d2c73c86c2a5ca7615fb6daa4 hrs 20 mins ago0x94abb9d27a65b11549f59b3942444e402e271a78  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0x9bd23918c00dc3b4e2fb41639e8f4e4d8063c03a5d22b12f5624337d9745f2fe4 hrs 21 mins ago0x94abb9d27a65b11549f59b3942444e402e271a78  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0xb0a38cfa73abbedaa70d667e3db5d10acb12f5b8065344d62a74b347ab1874f64 hrs 21 mins ago0xb1735189b9b5b51cdaddd2661d2886d77f0d3321  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0x53feade2189bee6466a661f77797779fd4aa38afc6b99e441ac18e459a49f8b34 hrs 26 mins ago0x94abb9d27a65b11549f59b3942444e402e271a78  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.0001821204
0xea532b647a9d61eacb6982e83dbdddb097119fbb74e9446edc6fa41393a19d9c4 hrs 50 mins ago0x2f3cb7658c957aca035036bbd4947ce6f3b36f2d  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.0003583
0x72b070a122e04c2e5857fef8d82ed9f469a8e8e6f858c61e083b5f95bf485f5d4 hrs 59 mins ago0xddda12b3f270d60b52dd2c189a9a2bc6f8657089  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0x10b79d3ac240bc491099d1c8741a703c4aecc0518d01411db779481f9eff32115 hrs ago0xddda12b3f270d60b52dd2c189a9a2bc6f8657089  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0xb34e40c66022793d892652e8c810ba6269eb01541728ef4b556fbb5d3485dba05 hrs 2 mins ago0xddda12b3f270d60b52dd2c189a9a2bc6f8657089  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00021498
0xabca65238943c7817156a28cb53adc7f25a7650b89bbe30ee04837e20061c0ca5 hrs 4 mins ago0xcd3f95401a82e4cbfd2a4086f4d12a26a868c3b2  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000259788
0x7b12b1022878de65f9d025e6b48858a3298a3a40c1c950b472d01c00907a79d05 hrs 6 mins ago0xddda12b3f270d60b52dd2c189a9a2bc6f8657089  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00021498
0x0aac597a582ee229808f2a7fac66f54dd36c64767f3eed5ed79dd8654ab98eff5 hrs 26 mins ago0xddda12b3f270d60b52dd2c189a9a2bc6f8657089  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00021498
0x372b0562413b813f08a30671512c0c400cd6989efcc213f7d752ac1eaa9632495 hrs 29 mins ago0x1de28a53d60809a21df2d9dddd42c5bc9a3a4f6f  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000259788
0x0beb8d96a7cb639e0803fbcda870a4a5b6a5814178cbe7d28e8a8786bf4cdc6a5 hrs 29 mins ago0xddda12b3f270d60b52dd2c189a9a2bc6f8657089  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.00021498
0xb3bc7679deaed8eca9b3b6a19f8d6ca97f80724822f654ff653e2ab9039599285 hrs 29 mins ago0xb1735189b9b5b51cdaddd2661d2886d77f0d3321  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
0x2088876551a56678c667793d8a6129ea4cd29efd6cc0cc0569ff80917877cc005 hrs 31 mins ago0x2f04ab319678b197b5d37e08f71e82816eb798ad  IN   0x6c228badcf181febf7f3b4a61f8e26086942a3db0 Ether0.000215172
[ 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 ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: EmcoVoucher
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity 0.4.24;
/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    // uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return a / b;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
    c = a + b;
    assert(c >= a);
    return c;
  }
}


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}

/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender)
    public view returns (uint256);

  function transferFrom(address from, address to, uint256 value)
    public returns (bool);

  function approve(address spender, uint256 value) public returns (bool);
  event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
  );
}

/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances.
 */
contract BasicToken is ERC20Basic {
  using SafeMath for uint256;

  mapping(address => uint256) balances;

  uint256 totalSupply_;

  /**
  * @dev total number of tokens in existence
  */
  function totalSupply() public view returns (uint256) {
    return totalSupply_;
  }

  /**
  * @dev transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transfer(address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);

    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    emit Transfer(msg.sender, _to, _value);
    return true;
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of.
  * @return An uint256 representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) public view returns (uint256) {
    return balances[_owner];
  }

}

/**
 * @title Standard ERC20 token
 *
 * @dev Implementation of the basic standard token.
 * @dev https://github.com/ethereum/EIPs/issues/20
 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
 */
contract StandardToken is ERC20, BasicToken {

  mapping (address => mapping (address => uint256)) internal allowed;


  /**
   * @dev Transfer tokens from one address to another
   * @param _from address The address which you want to send tokens from
   * @param _to address The address which you want to transfer to
   * @param _value uint256 the amount of tokens to be transferred
   */
  function transferFrom(
    address _from,
    address _to,
    uint256 _value
  )
    public
    returns (bool)
  {
    require(_to != address(0));
    require(_value <= balances[_from]);
    require(_value <= allowed[_from][msg.sender]);

    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);
    allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
    emit Transfer(_from, _to, _value);
    return true;
  }

  /**
   * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
   *
   * Beware that changing an allowance with this method brings the risk that someone may use both the old
   * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
   * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   * @param _spender The address which will spend the funds.
   * @param _value The amount of tokens to be spent.
   */
  function approve(address _spender, uint256 _value) public returns (bool) {
    allowed[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
  }

  /**
   * @dev Function to check the amount of tokens that an owner allowed to a spender.
   * @param _owner address The address which owns the funds.
   * @param _spender address The address which will spend the funds.
   * @return A uint256 specifying the amount of tokens still available for the spender.
   */
  function allowance(
    address _owner,
    address _spender
   )
    public
    view
    returns (uint256)
  {
    return allowed[_owner][_spender];
  }

  /**
   * @dev Increase the amount of tokens that an owner allowed to a spender.
   *
   * approve should be called when allowed[_spender] == 0. To increment
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _addedValue The amount of tokens to increase the allowance by.
   */
  function increaseApproval(
    address _spender,
    uint _addedValue
  )
    public
    returns (bool)
  {
    allowed[msg.sender][_spender] = (
      allowed[msg.sender][_spender].add(_addedValue));
    emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

  /**
   * @dev Decrease the amount of tokens that an owner allowed to a spender.
   *
   * approve should be called when allowed[_spender] == 0. To decrement
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _subtractedValue The amount of tokens to decrease the allowance by.
   */
  function decreaseApproval(
    address _spender,
    uint _subtractedValue
  )
    public
    returns (bool)
  {
    uint oldValue = allowed[msg.sender][_spender];
    if (_subtractedValue > oldValue) {
      allowed[msg.sender][_spender] = 0;
    } else {
      allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
    }
    emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    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;


  event OwnershipRenounced(address indexed previousOwner);
  event OwnershipTransferred(
    address indexed previousOwner,
    address indexed newOwner
  );


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function transferOwnership(address _newOwner) public onlyOwner {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}

/**
* @title Emco token
* @dev Emco token implementation
*/
contract EmcoToken is StandardToken, Ownable {

	string public constant name = "EmcoToken";
	string public constant symbol = "EMCO";
	uint8 public constant decimals = 18;

	uint public constant INITIAL_SUPPLY = 1500000 * (10 ** uint(decimals));
	uint public constant MAX_SUPPLY = 36000000 * (10 ** uint(decimals));

	mapping (address => uint) public miningBalances;
	mapping (address => uint) public lastMiningBalanceUpdateTime;

	address systemAddress;

	uint public constant DAY_MINING_DEPOSIT_LIMIT = 360000 * (10 ** uint(decimals));
	uint public constant TOTAL_MINING_DEPOSIT_LIMIT = 3600000 * (10 ** uint(decimals));
	uint currentDay;
	uint currentDayDeposited;
	uint public miningTotalDeposited;

	mapping(address => bytes32) public userReferralCodes;
	mapping(bytes32 => address) public referralCodeOwners;
	mapping(address => address) public referrals;

	event Mine(address indexed beneficiary, uint value);

	event MiningBalanceUpdated(address indexed owner, uint amount, bool isDeposit);

	constructor() public {
		balances[msg.sender] = INITIAL_SUPPLY;
		systemAddress = msg.sender;
		totalSupply_ = INITIAL_SUPPLY;
		emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
	}

	function setReferralCode(bytes32 _code) public returns (bytes32) {
		require(_code != "", "Ref code should not be empty");
		require(referralCodeOwners[_code] == address(0), "This referral code is already used");
		require(userReferralCodes[msg.sender] == "", "Referal code is already set");
		userReferralCodes[msg.sender] = _code;
		referralCodeOwners[_code] = msg.sender;
		return userReferralCodes[msg.sender];
	}

	function setReferral(bytes32 _code) public {
		require(referralCodeOwners[_code] != address(0), "Invalid referral code");
		require(referrals[msg.sender] == address(0), "You already have a referrer");
		address referrer = referralCodeOwners[_code];
		require(referrer != msg.sender, "Can not invite yourself");
		referrals[msg.sender] = referrer;
	}

	/**
	* @dev Gets the balance of specified address (amount of tokens on main balance 
	* plus amount of tokens on mining balance).
	* @param _owner The address to query the balance of.
	* @return An uint256 representing the amount owned by the passed address.
	*/
	function balanceOf(address _owner) public view returns (uint balance) {
		return balances[_owner].add(miningBalances[_owner]);
	}

	/**
	* @dev Gets the mining balance if caller.
	* @param _owner The address to query the balance of.
	* @return An uint256 representing the amount of tokens of caller's mining balance
	*/
	function miningBalanceOf(address _owner) public view returns (uint balance) {
		return miningBalances[_owner];
	}

	/**
	* @dev Moves specified amount of tokens from main balance to mining balance 
	* @param _amount An uint256 representing the amount of tokens to transfer to main balance
	*/
	function depositToMiningBalance(uint _amount) public {
		require(balances[msg.sender] >= _amount, "not enough tokens");
		require(getCurrentDayDeposited().add(_amount) <= DAY_MINING_DEPOSIT_LIMIT,
			"Day mining deposit exceeded");
		require(miningTotalDeposited.add(_amount) <= TOTAL_MINING_DEPOSIT_LIMIT,
			"Total mining deposit exceeded");

		balances[msg.sender] = balances[msg.sender].sub(_amount);
		miningBalances[msg.sender] = miningBalances[msg.sender].add(_amount);
		miningTotalDeposited = miningTotalDeposited.add(_amount);
		updateCurrentDayDeposited(_amount);
		lastMiningBalanceUpdateTime[msg.sender] = now;
		emit MiningBalanceUpdated(msg.sender, _amount, true);
	}

	/**
	* @dev Moves specified amount of tokens from mining balance to main balance
	* @param _amount An uint256 representing the amount of tokens to transfer to mining balance
	*/
	function withdrawFromMiningBalance(uint _amount) public {
		require(miningBalances[msg.sender] >= _amount, "not enough tokens on mining balance");

		miningBalances[msg.sender] = miningBalances[msg.sender].sub(_amount);
		balances[msg.sender] = balances[msg.sender].add(_amount);

		//updating mining limits
		miningTotalDeposited.sub(_amount);
		lastMiningBalanceUpdateTime[msg.sender] = now;
		emit MiningBalanceUpdated(msg.sender, _amount, false);
	}

	/**
	* @dev Mine tokens. For every 24h for each user�s token on mining balance, 
	* 1% is burnt on mining balance and Reward % is minted to the main balance. 15% fee of difference 
	* between minted coins and burnt coins goes to system address.
	*/ 
	function mine() public {
		require(totalSupply_ < MAX_SUPPLY, "mining is over");
		uint reward = getReward(totalSupply_);
		uint daysForReward = getDaysForReward();

		uint mintedAmount = miningBalances[msg.sender].mul(reward.sub(1000000000))
										.mul(daysForReward).div(100000000000);
		require(mintedAmount != 0, "mining will not produce any reward");

		uint amountToBurn = miningBalances[msg.sender].mul(daysForReward).div(100);

		//check exceeding max number of tokens
		if(totalSupply_.add(mintedAmount) > MAX_SUPPLY) {
			uint availableToMint = MAX_SUPPLY.sub(totalSupply_);
			amountToBurn = availableToMint.div(mintedAmount).mul(amountToBurn);
			mintedAmount = availableToMint;
		}

		totalSupply_ = totalSupply_.add(mintedAmount);

		miningBalances[msg.sender] = miningBalances[msg.sender].sub(amountToBurn);
		balances[msg.sender] = balances[msg.sender].add(amountToBurn);

		uint userReward;
		uint referrerReward = 0;
		address referrer = referrals[msg.sender];
		
		if(referrer == address(0)) {
			userReward = mintedAmount.mul(85).div(100);
		} else {
			userReward = mintedAmount.mul(86).div(100);
			referrerReward = mintedAmount.div(100);
			balances[referrer] = balances[referrer].add(referrerReward);
			emit Mine(referrer, referrerReward);
			emit Transfer(address(0), referrer, referrerReward);
		}
		balances[msg.sender] = balances[msg.sender].add(userReward);

		emit Mine(msg.sender, userReward);
		emit Transfer(address(0), msg.sender, userReward);

		//update limits
		miningTotalDeposited = miningTotalDeposited.sub(amountToBurn);
		emit MiningBalanceUpdated(msg.sender, amountToBurn, false);

		//set system fee
		uint systemFee = mintedAmount.sub(userReward).sub(referrerReward);
		balances[systemAddress] = balances[systemAddress].add(systemFee);

		emit Mine(systemAddress, systemFee);
		emit Transfer(address(0), systemAddress, systemFee);

		lastMiningBalanceUpdateTime[msg.sender] = now;
	}

	/**
	* @dev Set system address
	* @param _systemAddress An address to set
	*/
	function setSystemAddress(address _systemAddress) public onlyOwner {
		systemAddress = _systemAddress;
	}

	/**
	* @dev Get sum of deposits to mining accounts for current day
	*/
	function getCurrentDayDeposited() public view returns (uint) {
		if(now / 1 days == currentDay) {
			return currentDayDeposited;
		} else {
			return 0;
		}
	}

	/**
	* @dev Get number of days for reward on mining. Maximum 100 days.
	* @return An uint256 representing number of days user will get reward for.
	*/
	function getDaysForReward() public view returns (uint rewardDaysNum){
		if(lastMiningBalanceUpdateTime[msg.sender] == 0) {
			return 0;
		} else {
			uint value = (now - lastMiningBalanceUpdateTime[msg.sender]) / (1 days);
			if(value > 100) {
				return 100;
			} else {
				return value;
			}
		}
	}

	/**
	* @dev Calculate current mining reward based on total supply of tokens
	* @return An uint256 representing reward in percents multiplied by 1000000000
	*/
	function getReward(uint _totalSupply) public pure returns (uint rewardPercent){
		uint rewardFactor = 1000000 * (10 ** uint256(decimals));
		uint decreaseFactor = 41666666;

		if(_totalSupply < 23 * rewardFactor) {
			return 2000000000 - (decreaseFactor.mul(_totalSupply.div(rewardFactor)));
		}

		if(_totalSupply < MAX_SUPPLY) {
			return 1041666666;
		} else {
			return 1000000000;
		} 
	}

	function updateCurrentDayDeposited(uint _addedTokens) private {
		if(now / 1 days == currentDay) {
			currentDayDeposited = currentDayDeposited.add(_addedTokens);
		} else {
			currentDay = now / 1 days;
			currentDayDeposited = _addedTokens;
		}
	}

}

/**
* @title Emco voucher
* @dev Emco voucher implementation
*/
contract EmcoVoucher is Ownable {

	address signerAddress;
	EmcoToken public token;

	mapping (uint => bool) usedNonces;

	event VoucherRedemption(address indexed caller, uint indexed nonce, uint amount);

	constructor(EmcoToken _token) public {
		require(_token != address(0), "token address should not be empty");
		token = _token;
	}

	/**
	* @dev Sets the signer address. Signatures of vouchers would be checked with this address.
	* @param _address address of signer
	*/
	function setSignerAddress(address _address) public onlyOwner {
		require(_address != address(0), "signer address should not be empty");
		signerAddress = _address;
	}

	/**
	* @dev Function to withdraw tokens from conract. Is awailable only for token owner
	* @param _to Address tokens would be sent to
	* @param _amount An uint256 representing amount of tokens than would be sent
	*/
	function withdrawTokens(address _to, uint _amount) public onlyOwner {
		token.transfer(_to, _amount);
	}

	/**
	* @dev Check if nonce is used
	* @param _nonce Nonce to check
	* @return True is nonce is used
	*/
	function isNonceUsed(uint _nonce) public view returns (bool isUsed) {
		return usedNonces[_nonce];
	}

	/**
	* @dev Activates voucher. Checks nonce amount and signature and if it is correct
	* send amount of tokens to caller
	* @param nonce voucher's nonce
	* @param amount voucher's amount
	* @param signature voucher's signature
	*/
	function activateVoucher(uint256 nonce, uint256 amount, bytes signature) public {
		require(!usedNonces[nonce], "nonce is already used");
		require(nonce != 0, "nonce should be greater than zero");
		require(amount != 0, "amount should be greater than zero");
		usedNonces[nonce] = true;

		address beneficiary = msg.sender;

		bytes32 message = prefixed(keccak256(abi.encodePacked(
			this,
			nonce,
			amount,
		  beneficiary)));

		address signedBy = recoverSigner(message, signature);
		require(signedBy == signerAddress);

		require(token.transfer(beneficiary, amount));
		emit VoucherRedemption(msg.sender, nonce, amount);
	}

	function splitSignature(bytes sig) internal pure returns (uint8, bytes32, bytes32) {
		require(sig.length == 65);

		bytes32 r;
		bytes32 s;
		uint8 v;

		assembly {
			r := mload(add(sig, 32))
			s := mload(add(sig, 64))
			v := byte(0, mload(add(sig, 96)))
		}

		return (v, r, s);
	}

	function recoverSigner(bytes32 message, bytes sig) internal pure returns (address) {
		uint8 v;
		bytes32 r;
		bytes32 s;

		(v, r, s) = splitSignature(sig);

		return ecrecover(message, v, r, s);
	}

	// Builds a prefixed hash to mimic the behavior of eth_sign.
	function prefixed(bytes32 hash) internal pure returns (bytes32) {
		return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
	}

}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setSignerAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_nonce","type":"uint256"}],"name":"isNonceUsed","outputs":[{"name":"isUsed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"nonce","type":"uint256"},{"name":"amount","type":"uint256"},{"name":"signature","type":"bytes"}],"name":"activateVoucher","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"caller","type":"address"},{"indexed":true,"name":"nonce","type":"uint256"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"VoucherRedemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b50604051602080610a6f833981016040525160008054600160a060020a03191633179055600160a060020a03811615156100d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f746f6b656e20616464726573732073686f756c64206e6f7420626520656d707460448201527f7900000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60028054600160a060020a031916600160a060020a039290921691909117905561096f806101006000396000f30060806040526004361061008d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663046dc166811461009257806306b091f9146100b55780635d00bb12146100d9578063715018a6146101055780638da5cb5b1461011a578063dc21d5211461014b578063f2fde38b146101ab578063fc0c546a146101cc575b600080fd5b34801561009e57600080fd5b506100b3600160a060020a03600435166101e1565b005b3480156100c157600080fd5b506100b3600160a060020a03600435166024356102ad565b3480156100e557600080fd5b506100f1600435610363565b604080519115158252519081900360200190f35b34801561011157600080fd5b506100b3610378565b34801561012657600080fd5b5061012f6103e4565b60408051600160a060020a039092168252519081900360200190f35b34801561015757600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526100b39482359460248035953695946064949201919081908401838280828437509497506103f39650505050505050565b3480156101b757600080fd5b506100b3600160a060020a036004351661072a565b3480156101d857600080fd5b5061012f61074d565b600054600160a060020a031633146101f857600080fd5b600160a060020a038116151561027e576040805160e560020a62461bcd02815260206004820152602260248201527f7369676e657220616464726573732073686f756c64206e6f7420626520656d7060448201527f7479000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146102c457600080fd5b600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561033357600080fd5b505af1158015610347573d6000803e3d6000fd5b505050506040513d602081101561035d57600080fd5b50505050565b60009081526003602052604090205460ff1690565b600054600160a060020a0316331461038f57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b6000838152600360205260408120548190819060ff161561045e576040805160e560020a62461bcd02815260206004820152601560248201527f6e6f6e636520697320616c726561647920757365640000000000000000000000604482015290519081900360640190fd5b8515156104db576040805160e560020a62461bcd02815260206004820152602160248201527f6e6f6e63652073686f756c642062652067726561746572207468616e207a657260448201527f6f00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b841515610558576040805160e560020a62461bcd02815260206004820152602260248201527f616d6f756e742073686f756c642062652067726561746572207468616e207a6560448201527f726f000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600086815260036020908152604091829020805460ff1916600117905581516c0100000000000000000000000030810282840152603482018a90526054820189905233908102607483015283516068818403018152608890920193849052815190965061061c9391928291908401908083835b602083106105ea5780518252601f1990920191602091820191016105cb565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902061075c565b91506106288285610806565b600154909150600160a060020a0380831691161461064557600080fd5b600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018990529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156106b457600080fd5b505af11580156106c8573d6000803e3d6000fd5b505050506040513d60208110156106de57600080fd5b505115156106eb57600080fd5b604080518681529051879133917f63a68ae837e5978794ee766a078db1dd98e02ca34057b407e853b89534e9568f9181900360200190a3505050505050565b600054600160a060020a0316331461074157600080fd5b61074a8161088d565b50565b600254600160a060020a031681565b604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c80830185905283518084039091018152605c909201928390528151600093918291908401908083835b602083106107d45780518252601f1990920191602091820191016107b5565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b6000806000806108158561090a565b60408051600080825260208083018085528d905260ff8716838501526060830186905260808301859052925195985093965091945060019360a0808401949293601f19830193908390039091019190865af1158015610878573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b600160a060020a03811615156108a257600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000806000806000808651604114151561092357600080fd5b505050506020830151604084015160609094015160001a949093925090505600a165627a7a72305820a4a83defada8b821d3dc906c4d3ea5a572b78cd6acf16449b2c814e2eaf4d0660029000000000000000000000000d97e471695f73d8186deabc1ab5b8765e667cd96

    Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d97e471695f73d8186deabc1ab5b8765e667cd96

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d97e471695f73d8186deabc1ab5b8765e667cd96


   Swarm Source:
bzzr://a4a83defada8b821d3dc906c4d3ea5a572b78cd6acf16449b2c814e2eaf4d066

 

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.