ETH Price: $3,440.78 (+1.26%)
Gas: 10 Gwei

Contract

0x678B713730B6D5D9314d39c82662c08540916c75
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buy Tokens53543562018-03-31 10:39:572300 days ago1522492797IN
0x678B7137...540916c75
0.1454 ETH0.000141461
Buy Tokens53540362018-03-31 9:22:002300 days ago1522488120IN
0x678B7137...540916c75
0.1451 ETH0.000141461
Buy Tokens53527492018-03-31 4:17:472300 days ago1522469867IN
0x678B7137...540916c75
0.1448 ETH0.000141461
Buy Tokens53527102018-03-31 4:07:352300 days ago1522469255IN
0x678B7137...540916c75
0.1442 ETH0.000282922
Buy Tokens53527082018-03-31 4:07:032300 days ago1522469223IN
0x678B7137...540916c75
0.1442 ETH0.000282922
Buy Tokens53522122018-03-31 2:00:202300 days ago1522461620IN
0x678B7137...540916c75
0.1439 ETH0.000282922
Buy Tokens53511862018-03-30 21:47:012300 days ago1522446421IN
0x678B7137...540916c75
0.1433 ETH0.000282922
Buy Tokens53511822018-03-30 21:45:132300 days ago1522446313IN
0x678B7137...540916c75
0.1433 ETH0.000282922
Buy Tokens53363452018-03-28 9:45:302303 days ago1522230330IN
0x678B7137...540916c75
0.143 ETH0.000424383
Buy Tokens53355782018-03-28 6:30:142303 days ago1522218614IN
0x678B7137...540916c75
0.1427 ETH0.000565844
Buy Tokens53299212018-03-27 7:33:062304 days ago1522135986IN
0x678B7137...540916c75
0.1424 ETH0.000282922
Buy Tokens53257442018-03-26 14:34:442304 days ago1522074884IN
0x678B7137...540916c75
0.1421 ETH0.000141461
Buy Tokens53120032018-03-24 8:09:332307 days ago1521878973IN
0x678B7137...540916c75
0.709 ETH0.001449143
Buy Tokens53118942018-03-24 7:44:082307 days ago1521877448IN
0x678B7137...540916c75
0.1415 ETH0.000311212.2
Buy Tokens53034922018-03-22 21:50:412308 days ago1521755441IN
0x678B7137...540916c75
0.706 ETH0.002415245
Buy Tokens53021992018-03-22 16:47:592308 days ago1521737279IN
0x678B7137...540916c75
0.1409 ETH0.000424383
Buy Tokens53004452018-03-22 9:45:032309 days ago1521711903IN
0x678B7137...540916c75
0.703 ETH0.0048304910
Buy Tokens52993722018-03-22 5:22:132309 days ago1521696133IN
0x678B7137...540916c75
0.1403 ETH0.000282922
Buy Tokens52966332018-03-21 18:42:202309 days ago1521657740IN
0x678B7137...540916c75
0.7 ETH0.000531351.1
Buy Tokens52944552018-03-21 9:38:472310 days ago1521625127IN
0x678B7137...540916c75
0.1397 ETH0.000282922
Buy Tokens52938102018-03-21 6:55:122310 days ago1521615312IN
0x678B7137...540916c75
0.697 ETH0.000966092
Buy Tokens52913172018-03-20 20:56:212310 days ago1521579381IN
0x678B7137...540916c75
0.6955 ETH0.000966092
Buy Tokens52906702018-03-20 18:29:012310 days ago1521570541IN
0x678B7137...540916c75
0.1388 ETH0.000017110.121
Buy Tokens52864992018-03-20 1:31:532311 days ago1521509513IN
0x678B7137...540916c75
0.6925 ETH0.000966092
Buy Tokens52628812018-03-16 1:45:412315 days ago1521164741IN
0x678B7137...540916c75
0.6895 ETH0.000531351.1
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
53543562018-03-31 10:39:572300 days ago1522492797
0x678B7137...540916c75
0.0012 ETH
53543562018-03-31 10:39:572300 days ago1522492797
0x678B7137...540916c75
0.1442 ETH
53540362018-03-31 9:22:002300 days ago1522488120
0x678B7137...540916c75
0.0012 ETH
53540362018-03-31 9:22:002300 days ago1522488120
0x678B7137...540916c75
0.1439 ETH
53527492018-03-31 4:17:472300 days ago1522469867
0x678B7137...540916c75
0.0012 ETH
53527492018-03-31 4:17:472300 days ago1522469867
0x678B7137...540916c75
0.1436 ETH
53527102018-03-31 4:07:352300 days ago1522469255
0x678B7137...540916c75
0.0009 ETH
53527102018-03-31 4:07:352300 days ago1522469255
0x678B7137...540916c75
0.1433 ETH
53527082018-03-31 4:07:032300 days ago1522469223
0x678B7137...540916c75
0.0012 ETH
53527082018-03-31 4:07:032300 days ago1522469223
0x678B7137...540916c75
0.143 ETH
53522122018-03-31 2:00:202300 days ago1522461620
0x678B7137...540916c75
0.0012 ETH
53522122018-03-31 2:00:202300 days ago1522461620
0x678B7137...540916c75
0.1427 ETH
53511862018-03-30 21:47:012300 days ago1522446421
0x678B7137...540916c75
0.0009 ETH
53511862018-03-30 21:47:012300 days ago1522446421
0x678B7137...540916c75
0.1424 ETH
53511822018-03-30 21:45:132300 days ago1522446313
0x678B7137...540916c75
0.0012 ETH
53511822018-03-30 21:45:132300 days ago1522446313
0x678B7137...540916c75
0.1421 ETH
53363452018-03-28 9:45:302303 days ago1522230330
0x678B7137...540916c75
0.0012 ETH
53363452018-03-28 9:45:302303 days ago1522230330
0x678B7137...540916c75
0.1418 ETH
53355782018-03-28 6:30:142303 days ago1522218614
0x678B7137...540916c75
0.0012 ETH
53355782018-03-28 6:30:142303 days ago1522218614
0x678B7137...540916c75
0.1415 ETH
53299212018-03-27 7:33:062304 days ago1522135986
0x678B7137...540916c75
0.0012 ETH
53299212018-03-27 7:33:062304 days ago1522135986
0x678B7137...540916c75
0.1412 ETH
53257442018-03-26 14:34:442304 days ago1522074884
0x678B7137...540916c75
0.0012 ETH
53257442018-03-26 14:34:442304 days ago1522074884
0x678B7137...540916c75
0.1409 ETH
53120032018-03-24 8:09:332307 days ago1521878973
0x678B7137...540916c75
0.006 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Presale

Compiler Version
v0.4.18+commit.9cf6e910

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-01-31
*/

pragma solidity ^0.4.18;

/**
 * @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 OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


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

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

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is Ownable {
  event Pause();
  event Unpause();

  bool public paused = false;


  /**
   * @dev Modifier to make a function callable only when the contract is not paused.
   */
  modifier whenNotPaused() {
    require(!paused);
    _;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   */
  modifier whenPaused() {
    require(paused);
    _;
  }

  /**
   * @dev called by the owner to pause, triggers stopped state
   */
  function pause() onlyOwner whenNotPaused public {
    paused = true;
    Pause();
  }

  /**
   * @dev called by the owner to unpause, returns to normal state
   */
  function unpause() onlyOwner whenPaused public {
    paused = false;
    Unpause();
  }
}

/**
 * @title Claimable
 * @dev Extension for the Ownable contract, where the ownership needs to be claimed.
 * This allows the new owner to accept the transfer.
 */
contract Claimable is Ownable {
  address public pendingOwner;

  /**
   * @dev Modifier throws if called by any account other than the pendingOwner.
   */
  modifier onlyPendingOwner() {
    require(msg.sender == pendingOwner);
    _;
  }

  /**
   * @dev Allows the current owner to set the pendingOwner address.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) onlyOwner public {
    pendingOwner = newOwner;
  }

  /**
   * @dev Allows the pendingOwner address to finalize the transfer.
   */
  function claimOwnership() onlyPendingOwner public {
    OwnershipTransferred(owner, pendingOwner);
    owner = pendingOwner;
    pendingOwner = address(0);
  }
}

/**
 * @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) {
    if (a == 0) {
      return 0;
    }
    uint256 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 c;
  }

  /**
  * @dev Substracts 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) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

/**
 * @title ERC721 interface
 * @dev see https://github.com/ethereum/eips/issues/721
 */
contract ERC721 {
  event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
  event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);

  function balanceOf(address _owner) public view returns (uint256 _balance);
  function ownerOf(uint256 _tokenId) public view returns (address _owner);
  function transfer(address _to, uint256 _tokenId) public;
  function approve(address _to, uint256 _tokenId) public;
  function takeOwnership(uint256 _tokenId) public;
}

/**
 * @title ERC721Token
 * Generic implementation for the required functionality of the ERC721 standard
 */
contract ERC721Token is ERC721 {
  using SafeMath for uint256;

  // Total amount of tokens
  uint256 private totalTokens;

  // Mapping from token ID to owner
  mapping (uint256 => address) private tokenOwner;

  // Mapping from token ID to approved address
  mapping (uint256 => address) private tokenApprovals;

  // Mapping from owner to list of owned token IDs
  mapping (address => uint256[]) private ownedTokens;

  // Mapping from token ID to index of the owner tokens list
  mapping(uint256 => uint256) private ownedTokensIndex;

  /**
  * @dev Guarantees msg.sender is owner of the given token
  * @param _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender
  */
  modifier onlyOwnerOf(uint256 _tokenId) {
    require(ownerOf(_tokenId) == msg.sender);
    _;
  }

  /**
  * @dev Gets the total amount of tokens stored by the contract
  * @return uint256 representing the total amount of tokens
  */
  function totalSupply() public view returns (uint256) {
    return totalTokens;
  }

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

  /**
  * @dev Gets the list of tokens owned by a given address
  * @param _owner address to query the tokens of
  * @return uint256[] representing the list of tokens owned by the passed address
  */
  function tokensOf(address _owner) public view returns (uint256[]) {
    return ownedTokens[_owner];
  }

  /**
  * @dev Gets the owner of the specified token ID
  * @param _tokenId uint256 ID of the token to query the owner of
  * @return owner address currently marked as the owner of the given token ID
  */
  function ownerOf(uint256 _tokenId) public view returns (address) {
    address owner = tokenOwner[_tokenId];
    require(owner != address(0));
    return owner;
  }

  /**
   * @dev Gets the approved address to take ownership of a given token ID
   * @param _tokenId uint256 ID of the token to query the approval of
   * @return address currently approved to take ownership of the given token ID
   */
  function approvedFor(uint256 _tokenId) public view returns (address) {
    return tokenApprovals[_tokenId];
  }

  /**
  * @dev Transfers the ownership of a given token ID to another address
  * @param _to address to receive the ownership of the given token ID
  * @param _tokenId uint256 ID of the token to be transferred
  */
  function transfer(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
    clearApprovalAndTransfer(msg.sender, _to, _tokenId);
  }

  /**
  * @dev Approves another address to claim for the ownership of the given token ID
  * @param _to address to be approved for the given token ID
  * @param _tokenId uint256 ID of the token to be approved
  */
  function approve(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
    address owner = ownerOf(_tokenId);
    require(_to != owner);
    if (approvedFor(_tokenId) != 0 || _to != 0) {
      tokenApprovals[_tokenId] = _to;
      Approval(owner, _to, _tokenId);
    }
  }

  /**
  * @dev Claims the ownership of a given token ID
  * @param _tokenId uint256 ID of the token being claimed by the msg.sender
  */
  function takeOwnership(uint256 _tokenId) public {
    require(isApprovedFor(msg.sender, _tokenId));
    clearApprovalAndTransfer(ownerOf(_tokenId), msg.sender, _tokenId);
  }

  /**
  * @dev Mint token function
  * @param _to The address that will own the minted token
  * @param _tokenId uint256 ID of the token to be minted by the msg.sender
  */
  function _mint(address _to, uint256 _tokenId) internal {
    require(_to != address(0));
    addToken(_to, _tokenId);
    Transfer(0x0, _to, _tokenId);
  }

  /**
  * @dev Burns a specific token
  * @param _tokenId uint256 ID of the token being burned by the msg.sender
  */
  function _burn(uint256 _tokenId) onlyOwnerOf(_tokenId) internal {
    if (approvedFor(_tokenId) != 0) {
      clearApproval(msg.sender, _tokenId);
    }
    removeToken(msg.sender, _tokenId);
    Transfer(msg.sender, 0x0, _tokenId);
  }

  /**
   * @dev Tells whether the msg.sender is approved for the given token ID or not
   * This function is not private so it can be extended in further implementations like the operatable ERC721
   * @param _owner address of the owner to query the approval of
   * @param _tokenId uint256 ID of the token to query the approval of
   * @return bool whether the msg.sender is approved for the given token ID or not
   */
  function isApprovedFor(address _owner, uint256 _tokenId) internal view returns (bool) {
    return approvedFor(_tokenId) == _owner;
  }

  /**
  * @dev Internal function to clear current approval and transfer the ownership of a given token ID
  * @param _from address which you want to send tokens from
  * @param _to address which you want to transfer the token to
  * @param _tokenId uint256 ID of the token to be transferred
  */
  function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
    require(_to != address(0));
    require(_to != ownerOf(_tokenId));
    require(ownerOf(_tokenId) == _from);

    clearApproval(_from, _tokenId);
    removeToken(_from, _tokenId);
    addToken(_to, _tokenId);
    Transfer(_from, _to, _tokenId);
  }

  /**
  * @dev Internal function to clear current approval of a given token ID
  * @param _tokenId uint256 ID of the token to be transferred
  */
  function clearApproval(address _owner, uint256 _tokenId) private {
    require(ownerOf(_tokenId) == _owner);
    tokenApprovals[_tokenId] = 0;
    Approval(_owner, 0, _tokenId);
  }

  /**
  * @dev Internal function to add a token ID to the list of a given address
  * @param _to address representing the new owner of the given token ID
  * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address
  */
  function addToken(address _to, uint256 _tokenId) private {
    require(tokenOwner[_tokenId] == address(0));
    tokenOwner[_tokenId] = _to;
    uint256 length = balanceOf(_to);
    ownedTokens[_to].push(_tokenId);
    ownedTokensIndex[_tokenId] = length;
    totalTokens = totalTokens.add(1);
  }

  /**
  * @dev Internal function to remove a token ID from the list of a given address
  * @param _from address representing the previous owner of the given token ID
  * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address
  */
  function removeToken(address _from, uint256 _tokenId) private {
    require(ownerOf(_tokenId) == _from);

    uint256 tokenIndex = ownedTokensIndex[_tokenId];
    uint256 lastTokenIndex = balanceOf(_from).sub(1);
    uint256 lastToken = ownedTokens[_from][lastTokenIndex];

    tokenOwner[_tokenId] = 0;
    ownedTokens[_from][tokenIndex] = lastToken;
    ownedTokens[_from][lastTokenIndex] = 0;
    // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to
    // be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping
    // the lastToken to the first position, and then dropping the element placed in the last position of the list

    ownedTokens[_from].length--;
    ownedTokensIndex[_tokenId] = 0;
    ownedTokensIndex[lastToken] = tokenIndex;
    totalTokens = totalTokens.sub(1);
  }
}

/**
 * @title AccessMint
 * @dev Adds grant/revoke functions to the contract.
 */
contract AccessMint is Claimable {

  // Access for minting new tokens.
  mapping(address => bool) private mintAccess;

  // Event that is fired when minted.
  event Mint(
    address indexed _to,
    uint256 indexed _tokenId
  );

  // Modifier for accessibility to define new hero types.
  modifier onlyAccessMint {
    require(msg.sender == owner || mintAccess[msg.sender] == true);
    _;
  }

  // @dev Grant acess to mint heroes.
  function grantAccessMint(address _address)
    onlyOwner
    public
  {
    mintAccess[_address] = true;
  }

  // @dev Revoke acess to mint heroes.
  function revokeAccessMint(address _address)
    onlyOwner
    public
  {
    mintAccess[_address] = false;
  }

}

/**
 * @title The swap contract (Card => reward)
 * @dev With this contract, a CryptoSagaCard holder can swap his/her CryptoSagaCard for reward.
 *  This contract is intended to be inherited by CryptoSagaCore later.
 */
contract CryptoSagaCardSwap is Ownable {

  // Card contract.
  address internal cardAddess;

  // Modifier for accessibility to define new hero types.
  modifier onlyCard {
    require(msg.sender == cardAddess);
    _;
  }
  
  // @dev Set the address of the contract that represents ERC721 Card.
  function setCardContract(address _contractAddress)
    public
    onlyOwner
  {
    cardAddess = _contractAddress;
  }

  // @dev Convert card into reward.
  //  This should be implemented by CryptoSagaCore later.
  function swapCardForReward(address _by, uint8 _rank)
    onlyCard
    public 
    returns (uint256)
  {
    return 0;
  }

}

/**
 * @title CryptoSaga Card
 * @dev ERC721 Token that repesents CryptoSaga's cards.
 *  Buy consuming a card, players of CryptoSaga can get a heroe.
 */
contract CryptoSagaCard is ERC721Token, Claimable, AccessMint {

  string public constant name = "CryptoSaga Card";
  string public constant symbol = "CARD";

  // Rank of the token.
  mapping(uint256 => uint8) public tokenIdToRank;

  // The number of tokens ever minted.
  uint256 public numberOfTokenId;

  // The converter contract.
  CryptoSagaCardSwap private swapContract;

  // Event that should be fired when card is converted.
  event CardSwap(address indexed _by, uint256 _tokenId, uint256 _rewardId);

  // @dev Set the address of the contract that represents CryptoSaga Cards.
  function setCryptoSagaCardSwapContract(address _contractAddress)
    public
    onlyOwner
  {
    swapContract = CryptoSagaCardSwap(_contractAddress);
  }

  function rankOf(uint256 _tokenId) 
    public view
    returns (uint8)
  {
    return tokenIdToRank[_tokenId];
  }

  // @dev Mint a new card.
  function mint(address _beneficiary, uint256 _amount, uint8 _rank)
    onlyAccessMint
    public
  {
    for (uint256 i = 0; i < _amount; i++) {
      _mint(_beneficiary, numberOfTokenId);
      tokenIdToRank[numberOfTokenId] = _rank;
      numberOfTokenId ++;
    }
  }

  // @dev Swap this card for reward.
  //  The card will be burnt.
  function swap(uint256 _tokenId)
    onlyOwnerOf(_tokenId)
    public
    returns (uint256)
  {
    require(address(swapContract) != address(0));

    var _rank = tokenIdToRank[_tokenId];
    var _rewardId = swapContract.swapCardForReward(this, _rank);
    CardSwap(ownerOf(_tokenId), _tokenId, _rewardId);
    _burn(_tokenId);
    return _rewardId;
  }

}

/**
 * @title The smart contract for the pre-sale.
 * @dev Origin Card is an ERC20 token.
 */
contract Presale is Pausable {
  using SafeMath for uint256;

  // Eth will be sent to this wallet.
  address public wallet;

  // The token contract.
  CryptoSagaCard public cardContract;

  // Start and end timestamps where investments are allowed (both inclusive).
  uint256 public startTime;
  uint256 public endTime;

  // Price for a card in wei.
  uint256 public price;

  // Amount of card sold.
  uint256 public soldCards;

  // Increase of price per transaction.
  uint256 public priceIncrease;

  // Amount of card redeemed.
  uint256 public redeemedCards;

  // Event that is fired when purchase transaction is made.
  event TokenPurchase(
    address indexed purchaser, 
    address indexed beneficiary, 
    uint256 value,
    uint256 amount
  );

  // Event that is fired when redeem tokens.
  event TokenRedeem(
    address indexed beneficiary,
    uint256 amount
  );

  // Event that is fired when refunding excessive money from ther user.
  event RefundEth(
    address indexed beneficiary,
    uint256 amount
  );

  // @dev Contructor.
  function Presale(address _wallet, address _cardAddress, uint256 _startTime, uint256 _endTime, uint256 _price, uint256 _priceIncrease)
    public
  {
    require(_endTime >= _startTime);
    require(_price >= 0);
    require(_priceIncrease >= 0);
    require(_wallet != address(0));
    
    wallet = _wallet;
    cardContract = CryptoSagaCard(_cardAddress);
    startTime = _startTime;
    endTime = _endTime;
    price = _price;
    priceIncrease = _priceIncrease;
  }

  // @return true if the transaction can buy tokens
  function validPurchase()
    internal view 
    returns (bool)
  {
    bool withinPeriod = now >= startTime && now <= endTime;
    bool nonZeroPurchase = msg.value != 0;
    return withinPeriod && nonZeroPurchase;
  }

  // @Notify Redeem limit is 500 cards.
  // @return true if the transaction can redeem tokens
  function validRedeem()
    internal view
    returns (bool)
  {
    bool withinPeriod = now >= startTime && now <= endTime;
    bool notExceedRedeemLimit = redeemedCards < 500;
    return withinPeriod && notExceedRedeemLimit;
  }

  // @return true if crowdsale event has ended
  function hasEnded()
    public view 
    returns (bool) 
  {
    return now > endTime;
  }


  // @dev Low level token purchase function.
  function buyTokens(address _beneficiary, uint256 _amount)
    whenNotPaused
    public
    payable
  {
    require(_beneficiary != address(0));
    require(validPurchase());
    require(_amount >= 1 && _amount <= 5);

    var _priceOfBundle = price.mul(_amount);

    require(msg.value >= _priceOfBundle);

    // Increase the price.
    // The price increases only when a transaction is made.
    // Amount of tokens purchase at a transaction won't affect the price.
    price = price.add(priceIncrease);

    // Mint tokens.
    // Rank 0 means Origin Card.
    cardContract.mint(_beneficiary, _amount, 0);

    // Add count of tokens sold.
    soldCards += _amount;

    // Send the raised eth to the wallet.
    wallet.transfer(_priceOfBundle);

    // Send the exta eth paid by the sender.
    var _extraEthInWei = msg.value.sub(_priceOfBundle);
    if (_extraEthInWei >= 0) {
      msg.sender.transfer(_extraEthInWei);
    }

    // Fire event.
    TokenPurchase(msg.sender, _beneficiary, msg.value, _amount);
  }

  // @dev Low level token redeem function.
  function redeemTokens(address _beneficiary)
    onlyOwner
    public
  {
    require(_beneficiary != address(0));
    require(validRedeem());

    // Mint token.
    // Rank 0 means Origin Card.
    cardContract.mint(_beneficiary, 1, 0);

    // Add count of tokens redeemed.
    redeemedCards ++;

    // Fire event.
    TokenRedeem(_beneficiary, 1);
  }

  // @dev Set price increase of token per transaction.
  //  Note that this will never become below 0, 
  //  which means early buyers will always buy tokens at lower price than later buyers.
  function setPriceIncrease(uint256 _priceIncrease)
    onlyOwner
    public
  {
    require(priceIncrease >= 0);
    
    // Set price increase per transaction.
    priceIncrease = _priceIncrease;
  }

  // @dev Withdraw ether collected.
  function withdrawal()
    onlyOwner
    public
  {
    wallet.transfer(this.balance);
  }

}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_amount","type":"uint256"}],"name":"buyTokens","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"endTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"wallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"soldCards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"redeemedCards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cardContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"startTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_priceIncrease","type":"uint256"}],"name":"setPriceIncrease","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"redeemTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"hasEnded","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"priceIncrease","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_wallet","type":"address"},{"name":"_cardAddress","type":"address"},{"name":"_startTime","type":"uint256"},{"name":"_endTime","type":"uint256"},{"name":"_price","type":"uint256"},{"name":"_priceIncrease","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"purchaser","type":"address"},{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"TokenPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"TokenRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RefundEth","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

60606040526000805460a060020a60ff0219169055341561001f57600080fd5b60405160c080610a0883398101604052808051919060200180519190602001805191906020018051919060200180519190602001805160008054600160a060020a03191633600160a060020a03161790559150508383101561008057600080fd5b600082101561008e57600080fd5b600081101561009c57600080fd5b600160a060020a03861615156100b157600080fd5b60018054600160a060020a03978816600160a060020a0319918216179091556002805496909716951694909417909455600391909155600455600591909155600755610906806101026000396000f3006060604052600436106100e25763ffffffff60e060020a6000350416630752881a81146100e75780633197cbb6146101005780633f4ba83a14610125578063521eb273146101385780635c975abb14610167578063638b91191461018e578063686f4564146101a1578063693bd2d0146101b457806378e97925146101c75780638456cb59146101da5780638b122274146101ed5780638da5cb5b14610203578063a035b1fe14610216578063a575855214610229578063d4e9329214610248578063ecb70fb71461025b578063f2fde38b1461026e578063f8c340501461028d575b600080fd5b6100fe600160a060020a03600435166024356102a0565b005b341561010b57600080fd5b61011361048b565b60405190815260200160405180910390f35b341561013057600080fd5b6100fe610491565b341561014357600080fd5b61014b610510565b604051600160a060020a03909116815260200160405180910390f35b341561017257600080fd5b61017a61051f565b604051901515815260200160405180910390f35b341561019957600080fd5b61011361052f565b34156101ac57600080fd5b610113610535565b34156101bf57600080fd5b61014b61053b565b34156101d257600080fd5b61011361054a565b34156101e557600080fd5b6100fe610550565b34156101f857600080fd5b6100fe6004356105d4565b341561020e57600080fd5b61014b610605565b341561022157600080fd5b610113610614565b341561023457600080fd5b6100fe600160a060020a036004351661061a565b341561025357600080fd5b6100fe610722565b341561026657600080fd5b61017a610778565b341561027957600080fd5b6100fe600160a060020a0360043516610780565b341561029857600080fd5b61011361081b565b60008054819060a060020a900460ff16156102ba57600080fd5b600160a060020a03841615156102cf57600080fd5b6102d7610821565b15156102e257600080fd5b600183101580156102f4575060058311155b15156102ff57600080fd5b600554610312908463ffffffff61085116565b9150348290101561032257600080fd5b6007546005546103379163ffffffff61088716565b600555600254600160a060020a0316636112e8ac8585600060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915260ff166044820152606401600060405180830381600087803b151561039d57600080fd5b6102c65a03f115156103ae57600080fd5b5050600680548501905550600154600160a060020a031682156108fc0283604051600060405180830381858888f1935050505015156103ec57600080fd5b6103fc348363ffffffff61089616565b90506000811061043757600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561043757600080fd5b83600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18348660405191825260208201526040908101905180910390a350505050565b60045481565b60005433600160a060020a039081169116146104ac57600080fd5b60005460a060020a900460ff1615156104c457600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600154600160a060020a031681565b60005460a060020a900460ff1681565b60065481565b60085481565b600254600160a060020a031681565b60035481565b60005433600160a060020a0390811691161461056b57600080fd5b60005460a060020a900460ff161561058257600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60005433600160a060020a039081169116146105ef57600080fd5b600754600090101561060057600080fd5b600755565b600054600160a060020a031681565b60055481565b60005433600160a060020a0390811691161461063557600080fd5b600160a060020a038116151561064a57600080fd5b6106526108a8565b151561065d57600080fd5b600254600160a060020a0316636112e8ac826001600060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915260ff166044820152606401600060405180830381600087803b15156106c157600080fd5b6102c65a03f115156106d257600080fd5b5050600880546001908101909155600160a060020a03831691507fbdb57edcb6b7ce9397b9a0605c37466c6840e9df7a6a10356ff8ba66467e714a9060405190815260200160405180910390a250565b60005433600160a060020a0390811691161461073d57600080fd5b600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561077657600080fd5b565b600454421190565b60005433600160a060020a0390811691161461079b57600080fd5b600160a060020a03811615156107b057600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60075481565b6000806000600354421015801561083a57506004544211155b91505034151581801561084a5750805b9250505090565b6000808315156108645760009150610880565b5082820282848281151561087457fe5b041461087c57fe5b8091505b5092915050565b60008282018381101561087c57fe5b6000828211156108a257fe5b50900390565b600080600060035442101580156108c157506004544211155b91506101f460085410905081801561084a5750929150505600a165627a7a72305820431d42bbb6abf874050b6fc49323ec35951cc0b21c13782b6e59b44a5390ad8900290000000000000000000000006ea5f3284ccb1a1878167c640a42b3c9b6e5930b0000000000000000000000001b5242794288b45831ce069c9934a29b89af0197000000000000000000000000000000000000000000000000000000005a710700000000000000000000000000000000000000000000000000000000005abf78400000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000000110d9316ec000

Deployed Bytecode

0x6060604052600436106100e25763ffffffff60e060020a6000350416630752881a81146100e75780633197cbb6146101005780633f4ba83a14610125578063521eb273146101385780635c975abb14610167578063638b91191461018e578063686f4564146101a1578063693bd2d0146101b457806378e97925146101c75780638456cb59146101da5780638b122274146101ed5780638da5cb5b14610203578063a035b1fe14610216578063a575855214610229578063d4e9329214610248578063ecb70fb71461025b578063f2fde38b1461026e578063f8c340501461028d575b600080fd5b6100fe600160a060020a03600435166024356102a0565b005b341561010b57600080fd5b61011361048b565b60405190815260200160405180910390f35b341561013057600080fd5b6100fe610491565b341561014357600080fd5b61014b610510565b604051600160a060020a03909116815260200160405180910390f35b341561017257600080fd5b61017a61051f565b604051901515815260200160405180910390f35b341561019957600080fd5b61011361052f565b34156101ac57600080fd5b610113610535565b34156101bf57600080fd5b61014b61053b565b34156101d257600080fd5b61011361054a565b34156101e557600080fd5b6100fe610550565b34156101f857600080fd5b6100fe6004356105d4565b341561020e57600080fd5b61014b610605565b341561022157600080fd5b610113610614565b341561023457600080fd5b6100fe600160a060020a036004351661061a565b341561025357600080fd5b6100fe610722565b341561026657600080fd5b61017a610778565b341561027957600080fd5b6100fe600160a060020a0360043516610780565b341561029857600080fd5b61011361081b565b60008054819060a060020a900460ff16156102ba57600080fd5b600160a060020a03841615156102cf57600080fd5b6102d7610821565b15156102e257600080fd5b600183101580156102f4575060058311155b15156102ff57600080fd5b600554610312908463ffffffff61085116565b9150348290101561032257600080fd5b6007546005546103379163ffffffff61088716565b600555600254600160a060020a0316636112e8ac8585600060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915260ff166044820152606401600060405180830381600087803b151561039d57600080fd5b6102c65a03f115156103ae57600080fd5b5050600680548501905550600154600160a060020a031682156108fc0283604051600060405180830381858888f1935050505015156103ec57600080fd5b6103fc348363ffffffff61089616565b90506000811061043757600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561043757600080fd5b83600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18348660405191825260208201526040908101905180910390a350505050565b60045481565b60005433600160a060020a039081169116146104ac57600080fd5b60005460a060020a900460ff1615156104c457600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600154600160a060020a031681565b60005460a060020a900460ff1681565b60065481565b60085481565b600254600160a060020a031681565b60035481565b60005433600160a060020a0390811691161461056b57600080fd5b60005460a060020a900460ff161561058257600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60005433600160a060020a039081169116146105ef57600080fd5b600754600090101561060057600080fd5b600755565b600054600160a060020a031681565b60055481565b60005433600160a060020a0390811691161461063557600080fd5b600160a060020a038116151561064a57600080fd5b6106526108a8565b151561065d57600080fd5b600254600160a060020a0316636112e8ac826001600060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915260ff166044820152606401600060405180830381600087803b15156106c157600080fd5b6102c65a03f115156106d257600080fd5b5050600880546001908101909155600160a060020a03831691507fbdb57edcb6b7ce9397b9a0605c37466c6840e9df7a6a10356ff8ba66467e714a9060405190815260200160405180910390a250565b60005433600160a060020a0390811691161461073d57600080fd5b600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561077657600080fd5b565b600454421190565b60005433600160a060020a0390811691161461079b57600080fd5b600160a060020a03811615156107b057600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60075481565b6000806000600354421015801561083a57506004544211155b91505034151581801561084a5750805b9250505090565b6000808315156108645760009150610880565b5082820282848281151561087457fe5b041461087c57fe5b8091505b5092915050565b60008282018381101561087c57fe5b6000828211156108a257fe5b50900390565b600080600060035442101580156108c157506004544211155b91506101f460085410905081801561084a5750929150505600a165627a7a72305820431d42bbb6abf874050b6fc49323ec35951cc0b21c13782b6e59b44a5390ad890029

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

0000000000000000000000006ea5f3284ccb1a1878167c640a42b3c9b6e5930b0000000000000000000000001b5242794288b45831ce069c9934a29b89af0197000000000000000000000000000000000000000000000000000000005a710700000000000000000000000000000000000000000000000000000000005abf78400000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000000110d9316ec000

-----Decoded View---------------
Arg [0] : _wallet (address): 0x6eA5F3284cCB1a1878167c640A42B3C9b6e5930b
Arg [1] : _cardAddress (address): 0x1b5242794288B45831cE069C9934a29B89aF0197
Arg [2] : _startTime (uint256): 1517356800
Arg [3] : _endTime (uint256): 1522497600
Arg [4] : _price (uint256): 5000000000000000
Arg [5] : _priceIncrease (uint256): 300000000000000

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000006ea5f3284ccb1a1878167c640a42b3c9b6e5930b
Arg [1] : 0000000000000000000000001b5242794288b45831ce069c9934a29b89af0197
Arg [2] : 000000000000000000000000000000000000000000000000000000005a710700
Arg [3] : 000000000000000000000000000000000000000000000000000000005abf7840
Arg [4] : 0000000000000000000000000000000000000000000000000011c37937e08000
Arg [5] : 000000000000000000000000000000000000000000000000000110d9316ec000


Swarm Source

bzzr://431d42bbb6abf874050b6fc49323ec35951cc0b21c13782b6e59b44a5390ad89

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.