Sponsored Link:  Download the Monaco app for Android and iOS on Aug 31 - www.mona.co
Contract Overview | CreditProtocolToken
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 3647 txns
Token Tracker 0x1c4481750daa5Ff521A2a7490d9981eD46465Dbd
  Latest 25 txns from a total Of 3647 transactions View All

TxHash Age From To Value [TxFee]
0x9f1d06d085e3f9acdb6012c4368224daacc23776096396964802a8a65571b8631 hr 22 mins ago0x4e725d492e99de8def63e47d96a3dc2e9e1df4a5  IN   CreditProtocolToken0 Ether0.000790062
0xdb0a384d6db15fe0e845cf30def4392e6c2fc32fdec260c9b73626bf1cba147b2 hrs 45 mins agoBinance  IN   CreditProtocolToken0 Ether0.000422
0x4cd24eb5d4a37a841f9bcc9268689c3b3573b7c4f4142e0c6077e77299112ab53 hrs 48 mins agoBinance  IN   CreditProtocolToken0 Ether0.00105244
0xe07036ce1cf35062f38eb033e89754b5eb940a55929904b2fcc04d97344a86634 hrs agoBinance  IN   CreditProtocolToken0 Ether0.00075244
0x177bab2a33ae2f95402053aa4de14ebe7d94ba9a1b41b810e4894fa79a2226d94 hrs 17 mins agoBinance  IN   CreditProtocolToken0 Ether0.00037622
0xadfcff7a81cf6e32c7703e8b3153537dd1f0b2a6bc0b3cf3efa135dbce07fd164 hrs 27 mins ago0x0790ff32158ce0d13570d7d8e76fff1f58ccf448  IN   CreditProtocolToken0 Ether0.000504
0x061a34218fb45c69f12b0d6bcbac8d34d152f63edad3d02cc0cb16f61e7a5e4e4 hrs 30 mins ago0xc80952529a1c2f0f2e648518d48213b1645f571e  IN   CreditProtocolToken0 Ether0.000075244
0x2b1a1d627c1ea6e3bb390067150118b3335fe1bbf8f5320755b0406f5decd72d5 hrs ago0x89eeb8a6b3dae9be65c79ce7e792fc5ad7282ace  IN   CreditProtocolToken0 Ether0.000150488
0x3c9e50f9500b2db657b4bcdab78992a4e9925348b4b545d5a1205b32be5c9d185 hrs 44 mins ago0x1daa0f0a5a4701726a9e3f83d7cf8f8fab9525e1  IN   CreditProtocolToken0 Ether0.000791406
0x7e6afa8b28f394da4234993ce6b9ca553543e817ef0adf34e3fe365bf0dd0aca5 hrs 44 mins ago0x846caacca38239d45a16cfdeabf8f8adbbadab79  IN   CreditProtocolToken0 Ether0.000302512
0xa57876e3b11862fd26e8132c02542c35859f46f26fe2693ebceadaf2ff02b17d6 hrs 8 mins ago0x54163c4f353a4ff260d7fd2f1685511fd9247b55  IN   CreditProtocolToken0 Ether0.000182268
0xecbb23e4edc797d3f47d1fa8bd73f635b0dfd1cd226511ecbc856adf061c22b87 hrs 54 mins agoBinance  IN   CreditProtocolToken0 Ether0.000432653
0x1bd8187eb327559f8eb824ebdb68642b8e1961255adb20ff75c069a3784d919f8 hrs 31 mins agoBinance  IN   CreditProtocolToken0 Ether0.000420464
0x7246052b95f07e9d24c6fb3e0aa1d3ebbac8a0c8a929ae893b00c94e9702ed2f9 hrs ago0x42a7c8fd493d8bd1198072ba283f78c43dd1a0a6  IN   CreditProtocolToken0 Ether0.000091
0xa62d7c05de5e7729425bd182580de2d83065494a622270053c5e3330bcea40c49 hrs 2 mins ago0x42a7c8fd493d8bd1198072ba283f78c43dd1a0a6  IN   CreditProtocolToken0 Ether0.000210488
0x717ff1854bad8f3af2ee5982a4d10f4142ad0cf36cbe99c3fe82c3c4b2d579d310 hrs 18 mins agoBinance  IN   CreditProtocolToken0 Ether0.00075372
0x6ec137166dd3c992ce0ea8c288d0efee103b19e41dae59624d775bf41563340311 hrs 49 mins ago0x3ed2dc2f7b063ba933fa8aaeabecdf6583ac335d  IN   CreditProtocolToken0 Ether0.000151
0xceebfea648506a72024a24efe1d8f4c3b0a65615070a96d02a2e64b20e4e603a12 hrs 21 mins ago0xc93e535d796dff10347e74f7e459853cb7225d93  IN   CreditProtocolToken0 Ether0.00045567
0x5cd9de74988693467427b3f0f07eee7ef9bf9febfd27ce695fc59e109b25b12912 hrs 22 mins agoBinance  IN   CreditProtocolToken0 Ether0.000585879182
0x975938debdd6c6c13a31845065856a31cd21d27b3e0149ef6db32316b850b72c12 hrs 44 mins ago0xc93e535d796dff10347e74f7e459853cb7225d93  IN   CreditProtocolToken0 Ether0.00022622
0xc8211e27cacf8941344f1a89aa0aa15a2413bb7488fbe9c7a542af82e26d095012 hrs 45 mins ago0x739c5f6d73d483705a08f9a52c7cd61c7933573e  IN   CreditProtocolToken0 Ether0.000829092
0xae8a076ce3fa7b38c086ce343843b7785a84faf08b156170fb3c6576422b290312 hrs 50 mins agoBinance  IN   CreditProtocolToken0 Ether0.00052622
0x6081e761541e4e4954cc517a75e55475f92d819aa28646d80b28762eec29ea3612 hrs 57 mins ago0x509f2ccdb668bed09f3a2c74d639c2e853be0604  IN   CreditProtocolToken0 Ether0.000365048
0xd79260cb42bfc7baffbf9c96752ca5155b736db4f13346a0deb207fd96f173b112 hrs 57 mins ago0x5505a5412d55259fdf8b3911e27cda582553560f  IN   CreditProtocolToken0 Ether0.000364024
0x964fed24503ab752c4cd901db1bf011968c31fbc3a01fc9f2fd518a05b4ded0213 hrs 18 mins ago0x130ecb6dc61dae847f50c192ff3be2ad29cbf54f  IN   CreditProtocolToken0 Ether0.000011286675
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
  Latest 1 Internal Transaction

ParentTxHash Block Age From To Value
0x87e91b1e225f09208d011dd95bddf033f255756b14e99b2072cfb55ff84aa6e5432172650 days 19 hrs ago0x255d597951300a913d5e327c6e92ddc05923febe  Contract Creation0 Ether
[ Download CSV Export  ] 
Warning: The compiled contract might be susceptible to ZeroFunctionSelector (very low-severity) Solidity compiler bugs.

Contract Source Code Verified
Contract Name: CPToken
Compiler Version: v0.4.15+commit.bbb8e64f
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity 0.4.15;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
  function mul(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal constant returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  }

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

/**
 * @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() {
    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) onlyOwner public {
    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 ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  uint256 public totalSupply;
  function balanceOf(address who) public constant 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 constant 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;

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

    // SafeMath.sub will throw if there is not enough balance.
    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    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 constant returns (uint256 balance) {
    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)) 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));

    uint256 _allowance = allowed[_from][msg.sender];

    // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
    // require (_value <= _allowance);

    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);
    allowed[_from][msg.sender] = _allowance.sub(_value);
    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;
    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 constant returns (uint256 remaining) {
    return allowed[_owner][_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
   */
  function increaseApproval (address _spender, uint _addedValue)
    returns (bool success) {
    allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
    Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

  function decreaseApproval (address _spender, uint _subtractedValue)
    returns (bool success) {
    uint oldValue = allowed[msg.sender][_spender];
    if (_subtractedValue > oldValue) {
      allowed[msg.sender][_spender] = 0;
    } else {
      allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
    }
    Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

}

/**
 * @title Mintable token
 * @dev Simple ERC20 Token example, with mintable token creation
 * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
 */

contract MintableToken is StandardToken, Ownable {
  event Mint(address indexed to, uint256 amount);
  event MintFinished();

  bool public mintingFinished = false;


  modifier canMint() {
    require(!mintingFinished);
    _;
  }

  /**
   * @dev Function to mint tokens
   * @param _to The address that will receive the minted tokens.
   * @param _amount The amount of tokens to mint.
   * @return A boolean that indicates if the operation was successful.
   */
  function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
    totalSupply = totalSupply.add(_amount);
    balances[_to] = balances[_to].add(_amount);
    Mint(_to, _amount);
    Transfer(0x0, _to, _amount);
    return true;
  }

  /**
   * @dev Function to stop minting new tokens.
   * @return True if the operation was successful.
   */
  function finishMinting() onlyOwner public returns (bool) {
    mintingFinished = true;
    MintFinished();
    return true;
  }
}

/**
 * @title LimitedTransferToken
 * @dev LimitedTransferToken defines the generic interface and the implementation to limit token
 * transferability for different events. It is intended to be used as a base class for other token
 * contracts.
 * LimitedTransferToken has been designed to allow for different limiting factors,
 * this can be achieved by recursively calling super.transferableTokens() until the base class is
 * hit. For example:
 *     function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
 *       return min256(unlockedTokens, super.transferableTokens(holder, time));
 *     }
 * A working example is VestedToken.sol:
 * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/VestedToken.sol
 */

contract LimitedTransferToken is ERC20 {

  /**
   * @dev Checks whether it can transfer or otherwise throws.
   */
  modifier canTransfer(address _sender, uint256 _value) {
   require(_value <= transferableTokens(_sender, uint64(now)));
   _;
  }

  /**
   * @dev Checks modifier and allows transfer if tokens are not locked.
   * @param _to The address that will receive the tokens.
   * @param _value The amount of tokens to be transferred.
   */
  function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns (bool) {
    return super.transfer(_to, _value);
  }

  /**
  * @dev Checks modifier and allows transfer if tokens are not locked.
  * @param _from The address that will send the tokens.
  * @param _to The address that will receive the tokens.
  * @param _value The amount of tokens to be transferred.
  */
  function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns (bool) {
    return super.transferFrom(_from, _to, _value);
  }

  /**
   * @dev Default transferable tokens function returns all tokens for a holder (no limit).
   * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
   * specific logic for limiting token transferability for a holder over time.
   */
  function transferableTokens(address holder, uint64 time) public constant returns (uint256) {
    return balanceOf(holder);
  }
}


/**
 * @title Crowdsale
 * @dev Crowdsale is a base contract for managing a token crowdsale.
 * Crowdsales have a start and end timestamps, where investors can make
 * token purchases and the crowdsale will assign them tokens based
 * on a token per ETH rate. Funds collected are forwarded to a wallet
 * as they arrive.
 */
contract Crowdsale {
  using SafeMath for uint256;

  // The token being sold
  MintableToken public token;

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

  // address where funds are collected
  address public wallet;

  // how many token units a buyer gets per wei
  uint256 public rate;

  // amount of raised money in wei
  uint256 public weiRaised;

  /**
   * event for token purchase logging
   * @param purchaser who paid for the tokens
   * @param beneficiary who got the tokens
   * @param value weis paid for purchase
   * @param amount amount of tokens purchased
   */
  event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);


  function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) {
    require(_startTime >= now);
    require(_endTime >= _startTime);
    require(_rate > 0);
    require(_wallet != 0x0);

    token = createTokenContract();
    startTime = _startTime;
    endTime = _endTime;
    rate = _rate;
    wallet = _wallet;
  }

  // creates the token to be sold.
  // override this method to have crowdsale of a specific mintable token.
  function createTokenContract() internal returns (MintableToken) {
    return new MintableToken();
  }


  // fallback function can be used to buy tokens
  function () payable {
    buyTokens(msg.sender);
  }

  // low level token purchase function
  function buyTokens(address beneficiary) public payable {
    require(beneficiary != 0x0);
    require(validPurchase());

    uint256 weiAmount = msg.value;

    // calculate token amount to be created
    uint256 tokens = weiAmount.mul(rate);

    // update state
    weiRaised = weiRaised.add(weiAmount);

    token.mint(beneficiary, tokens);
    TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);

    forwardFunds();
  }

  // send ether to the fund collection wallet
  // override to create custom fund forwarding mechanisms
  function forwardFunds() internal {
    wallet.transfer(msg.value);
  }

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

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


}

/**
 * @title CappedCrowdsale
 * @dev Extension of Crowdsale with a max amount of funds raised
 */
contract CappedCrowdsale is Crowdsale {
  using SafeMath for uint256;

  uint256 public cap;

  function CappedCrowdsale(uint256 _cap) {
    require(_cap > 0);
    cap = _cap;
  }

  // overriding Crowdsale#validPurchase to add extra cap logic
  // @return true if investors can buy at the moment
  function validPurchase() internal constant returns (bool) {
    bool withinCap = weiRaised.add(msg.value) <= cap;
    return super.validPurchase() && withinCap;
  }

  // overriding Crowdsale#hasEnded to add cap logic
  // @return true if crowdsale event has ended
  function hasEnded() public constant returns (bool) {
    bool capReached = weiRaised >= cap;
    return super.hasEnded() || capReached;
  }

}

/**
 * @title FinalizableCrowdsale
 * @dev Extension of Crowdsale where an owner can do extra work
 * after finishing.
 */
contract FinalizableCrowdsale is Crowdsale, Ownable {
  using SafeMath for uint256;

  bool public isFinalized = false;

  event Finalized();

  /**
   * @dev Must be called after crowdsale ends, to do some extra finalization
   * work. Calls the contract's finalization function.
   */
  function finalize() onlyOwner public {
    require(!isFinalized);
    require(hasEnded());

    finalization();
    Finalized();

    isFinalized = true;
  }

  /**
   * @dev Can be overridden to add finalization logic. The overriding function
   * should call super.finalization() to ensure the chain of finalization is
   * executed entirely.
   */
  function finalization() internal {
  }
}



contract Tiers {
  using SafeMath for uint256;

  uint256 public cpCap = 45000 ether;
  uint256 public presaleWeiSold = 18000 ether;

  uint256[6] public tierAmountCaps =  [ presaleWeiSold
                                      , presaleWeiSold + 5000 ether
                                      , presaleWeiSold + 10000 ether
                                      , presaleWeiSold + 15000 ether
                                      , presaleWeiSold + 21000 ether
                                      , cpCap
                                      ];
  uint256[6] public tierRates = [ 2000 // tierRates[0] should never be used, but it is accurate
                                , 1500 // Tokens are purchased at a rate of 105-150
                                , 1350 // per deciEth, depending on purchase tier.
                                , 1250 // tierRates[i] is the purchase rate of tier_i
                                , 1150
                                , 1050
                                ];

    function tierIndexByWeiAmount(uint256 weiLevel) public constant returns (uint256) {
        require(weiLevel <= cpCap);
        for (uint256 i = 0; i < tierAmountCaps.length; i++) {
            if (weiLevel <= tierAmountCaps[i]) {
                return i;
            }
        }
    }

    /**
     * @dev Calculates how many tokens a given amount of wei can buy at
     * a particular level of weiRaised. Takes into account tiers of purchase
     * bonus
     */
    function calculateTokens(uint256 _amountWei, uint256 _weiRaised) public constant returns (uint256) {
        uint256 currentTier = tierIndexByWeiAmount(_weiRaised);
        uint256 startWeiLevel = _weiRaised;
        uint256 endWeiLevel = _amountWei.add(_weiRaised);
        uint256 tokens = 0;
        for (uint256 i = currentTier; i < tierAmountCaps.length; i++) {
            if (endWeiLevel <= tierAmountCaps[i]) {
                tokens = tokens.add((endWeiLevel.sub(startWeiLevel)).mul(tierRates[i]));
                break;
            } else {
                tokens = tokens.add((tierAmountCaps[i].sub(startWeiLevel)).mul(tierRates[i]));
                startWeiLevel = tierAmountCaps[i];
            }
        }
        return tokens;
    }

}

contract CPToken is MintableToken, LimitedTransferToken {
    string public name = "BLOCKMASON CREDIT PROTOCOL TOKEN";
    string public symbol = "BCPT";
    uint256 public decimals = 18;

    bool public saleOver = false;

    function CPToken() {
    }

    function endSale() public onlyOwner {
        require (!saleOver);
        saleOver = true;
    }

    /**
     * @dev returns all user's tokens if time >= releaseTime
     */
    function transferableTokens(address holder, uint64 time) public constant returns (uint256) {
        if (saleOver)
            return balanceOf(holder);
        else
            return 0;
    }

}



contract DPIcoWhitelist {
    address public admin;
    bool public isOn;
    mapping (address => bool) public whitelist;
    address[] public users;

    modifier signUpOpen() {
        if (!isOn) revert();
        _;
    }

    modifier isAdmin() {
        if (msg.sender != admin) revert();
        _;
    }

    modifier newAddr() {
        if (whitelist[msg.sender]) revert();
        _;
    }

    function DPIcoWhitelist() {
        admin = msg.sender;
        isOn = false;
    }

    function () {
        signUp();
    }

    // Public functions

    function setSignUpOnOff(bool state) public isAdmin {
        isOn = state;
    }

    function signUp() public signUpOpen newAddr {
        whitelist[msg.sender] = true;
        users.push(msg.sender);
    }

    function getAdmin() public constant returns (address) {
        return admin;
    }

    function signUpOn() public constant returns (bool) {
        return isOn;
    }

    function isSignedUp(address addr) public constant returns (bool) {
        return whitelist[addr];
    }

    function getUsers() public constant returns (address[]) {
        return users;
    }

    function numUsers() public constant returns (uint) {
        return users.length;
    }

    function userAtIndex(uint idx) public constant returns (address) {
        return users[idx];
    }
}

contract CPCrowdsale is CappedCrowdsale, FinalizableCrowdsale, Pausable {
    using SafeMath for uint256;

    DPIcoWhitelist private aw;
    Tiers private at;
    mapping (address => bool) private hasPurchased; // has whitelist address purchased already
    uint256 public whitelistEndTime;
    uint256 public maxWhitelistPurchaseWei;
    uint256 public openWhitelistEndTime;

    function CPCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _whitelistEndTime, uint256 _openWhitelistEndTime, address _wallet, address _tiersContract, address _whitelistContract, address _airdropWallet, address _advisorWallet, address _stakingWallet, address _privateSaleWallet)
        CappedCrowdsale(45000 ether) // crowdsale capped at 45000 ether
        FinalizableCrowdsale()
        Crowdsale(_startTime, _endTime, 1, _wallet)  // rate = 1 is a dummy value; we use tiers instead
    {
        token.mint(_wallet, 23226934 * (10 ** 18));
        token.mint(_airdropWallet, 5807933 * (10 ** 18));
        token.mint(_advisorWallet, 5807933 * (10 ** 18));
        token.mint(_stakingWallet, 11615867 * (10 ** 18));
        token.mint(_privateSaleWallet, 36000000 * (10 ** 18));

        aw = DPIcoWhitelist(_whitelistContract);
        require (aw.numUsers() > 0);
        at = Tiers(_tiersContract);
        whitelistEndTime = _whitelistEndTime;
        openWhitelistEndTime = _openWhitelistEndTime;
        weiRaised = 18000 ether; // 18K ether was sold during presale
        maxWhitelistPurchaseWei = (cap.sub(weiRaised)).div(aw.numUsers());
    }

    // Public functions
    function buyTokens(address beneficiary) public payable whenNotPaused {
        uint256 weiAmount = msg.value;

        require(beneficiary != 0x0);
        require(validPurchase());
        require(!isWhitelistPeriod()
             || whitelistValidPurchase(msg.sender, beneficiary, weiAmount));
        require(!isOpenWhitelistPeriod()
             || openWhitelistValidPurchase(msg.sender, beneficiary));

        hasPurchased[beneficiary] = true;

        uint256 tokens = at.calculateTokens(weiAmount, weiRaised);
        weiRaised = weiRaised.add(weiAmount);
        token.mint(beneficiary, tokens);
        TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
        forwardFunds();
    }

    // Internal functions

    function createTokenContract() internal returns (MintableToken) {
        return new CPToken();
    }

    /**
     * @dev Overriden to add finalization logic.
     * Mints remaining tokens to dev wallet
     */
    function finalization() internal {
        uint256 remainingWei = cap.sub(weiRaised);
        if (remainingWei > 0) {
            uint256 remainingDevTokens = at.calculateTokens(remainingWei, weiRaised);
            token.mint(wallet, remainingDevTokens);
        }
        CPToken(token).endSale();
        token.finishMinting();
        super.finalization();
    }

    // Private functions

    // can't override `validPurchase` because need to pass additional values
    function whitelistValidPurchase(address buyer, address beneficiary, uint256 amountWei) private constant returns (bool) {
        bool beneficiaryPurchasedPreviously = hasPurchased[beneficiary];
        bool belowMaxWhitelistPurchase = amountWei <= maxWhitelistPurchaseWei;
        return (openWhitelistValidPurchase(buyer, beneficiary)
                && !beneficiaryPurchasedPreviously
                && belowMaxWhitelistPurchase);
    }

    // @return true if `now` is within the bounds of the whitelist period
    function isWhitelistPeriod() private constant returns (bool) {
        return (now <= whitelistEndTime && now >= startTime);
    }

    // can't override `validPurchase` because need to pass additional values
    function openWhitelistValidPurchase(address buyer, address beneficiary) private constant returns (bool) {
        bool buyerIsBeneficiary = buyer == beneficiary;
        bool signedup = aw.isSignedUp(beneficiary);
        return (buyerIsBeneficiary && signedup);
    }

    // @return true if `now` is within the bounds of the open whitelist period
    function isOpenWhitelistPeriod() private constant returns (bool) {
        bool cappedWhitelistOver = now > whitelistEndTime;
        bool openWhitelistPeriod = now <= openWhitelistEndTime;
        return cappedWhitelistOver && openWhitelistPeriod;
    }

}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"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":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"saleOver","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"endSale","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"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":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"holder","type":"address"},{"name":"time","type":"uint64"}],"name":"transferableTokens","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","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":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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"},{"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"}]

  Contract Creation Code Switch To Opcodes View
606060409081526003805460a060020a60ff0219169055805190810160405260208082527f424c4f434b4d41534f4e204352454449542050524f544f434f4c20544f4b454e90820152600490805161005b9291602001906100e2565b5060408051908101604052600481527f4243505400000000000000000000000000000000000000000000000000000000602082015260059080516100a39291602001906100e2565b5060126006556007805460ff1916905534156100be57600080fd5b5b5b60038054600160a060020a03191633600160a060020a03161790555b5b610182565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061012357805160ff1916838001178555610150565b82800160010185558215610150579182015b82811115610150578251825591602001919060010190610135565b5b5061015d929150610161565b5090565b61017f91905b8082111561015d5760008155600101610167565b5090565b90565b610e7a80620001926000396000f300606060405236156101045763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010957806306fdde0314610130578063095ea7b3146101bb57806318160ddd146101f157806323b809951461021657806323b872dd1461023d578063313ce56714610279578063380d831b1461029e57806340c10f19146102b357806366188463146102e957806370a082311461031f5780637d64bcb4146103505780638da5cb5b1461037757806395d89b41146103a6578063a9059cbb14610431578063d347c20514610467578063d73dd623146104a5578063dd62ed3e146104db578063f2fde38b14610512575b600080fd5b341561011457600080fd5b61011c610533565b604051901515815260200160405180910390f35b341561013b57600080fd5b610143610554565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101805780820151818401525b602001610167565b50505050905090810190601f1680156101ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c657600080fd5b61011c600160a060020a03600435166024356105f2565b604051901515815260200160405180910390f35b34156101fc57600080fd5b61020461065f565b60405190815260200160405180910390f35b341561022157600080fd5b61011c610665565b604051901515815260200160405180910390f35b341561024857600080fd5b61011c600160a060020a036004358116906024351660443561066e565b604051901515815260200160405180910390f35b341561028457600080fd5b6102046106a0565b60405190815260200160405180910390f35b34156102a957600080fd5b6102b16106a6565b005b34156102be57600080fd5b61011c600160a060020a03600435166024356106e2565b604051901515815260200160405180910390f35b34156102f457600080fd5b61011c600160a060020a0360043516602435610803565b604051901515815260200160405180910390f35b341561032a57600080fd5b610204600160a060020a03600435166108ff565b60405190815260200160405180910390f35b341561035b57600080fd5b61011c61091e565b604051901515815260200160405180910390f35b341561038257600080fd5b61038a6109a5565b604051600160a060020a03909116815260200160405180910390f35b34156103b157600080fd5b6101436109b4565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101805780820151818401525b602001610167565b50505050905090810190601f1680156101ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561043c57600080fd5b61011c600160a060020a0360043516602435610a52565b604051901515815260200160405180910390f35b341561047257600080fd5b610204600160a060020a036004351667ffffffffffffffff60243516610a82565b60405190815260200160405180910390f35b34156104b057600080fd5b61011c600160a060020a0360043516602435610aaf565b604051901515815260200160405180910390f35b34156104e657600080fd5b610204600160a060020a0360043581169060243516610b54565b60405190815260200160405180910390f35b341561051d57600080fd5b6102b1600160a060020a0360043516610b81565b005b60035474010000000000000000000000000000000000000000900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ea5780601f106105bf576101008083540402835291602001916105ea565b820191906000526020600020905b8154815290600101906020018083116105cd57829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005481565b60075460ff1681565b6000838261067c8242610a82565b81111561068857600080fd5b610693868686610c1a565b92505b5b50509392505050565b60065481565b60035433600160a060020a039081169116146106c157600080fd5b60075460ff16156106d157600080fd5b6007805460ff191660011790555b5b565b60035460009033600160a060020a0390811691161461070057600080fd5b60035474010000000000000000000000000000000000000000900460ff161561072857600080fd5b60005461073b908363ffffffff610d4616565b6000908155600160a060020a038416815260016020526040902054610766908363ffffffff610d4616565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a282600160a060020a031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35060015b5b5b92915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561086057600160a060020a033381166000908152600260209081526040808320938816835292905290812055610897565b610870818463ffffffff610d6016565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a0381166000908152600160205260409020545b919050565b60035460009033600160a060020a0390811691161461093c57600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a15060015b5b90565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ea5780601f106105bf576101008083540402835291602001916105ea565b820191906000526020600020905b8154815290600101906020018083116105cd57829003601f168201915b505050505081565b60003382610a608242610a82565b811115610a6c57600080fd5b610a768585610d77565b92505b5b505092915050565b60075460009060ff1615610aa057610a99836108ff565b9050610659565b506000610659565b5b92915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610ae7908363ffffffff610d4616565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a35060015b92915050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60035433600160a060020a03908116911614610b9c57600080fd5b600160a060020a0381161515610bb157600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600080600160a060020a0384161515610c3257600080fd5b50600160a060020a03808516600081815260026020908152604080832033909516835293815283822054928252600190529190912054610c78908463ffffffff610d6016565b600160a060020a038087166000908152600160205260408082209390935590861681522054610cad908463ffffffff610d4616565b600160a060020a038516600090815260016020526040902055610cd6818463ffffffff610d6016565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b509392505050565b600082820183811015610d5557fe5b8091505b5092915050565b600082821115610d6c57fe5b508082035b92915050565b6000600160a060020a0383161515610d8e57600080fd5b600160a060020a033316600090815260016020526040902054610db7908363ffffffff610d6016565b600160a060020a033381166000908152600160205260408082209390935590851681522054610dec908363ffffffff610d4616565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b929150505600a165627a7a72305820466ab3fc21f3fe81c69db487d2387b7e4a7c3736df514315b815240cbe2e1ba30029

   Swarm Source:
bzzr://466ab3fc21f3fe81c69db487d2387b7e4a7c3736df514315b815240cbe2e1ba3
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.