Contract 0xb547cc51ce58293e6945ba08d664ce051563d9ac


TxHash Block Age From To Value [TxFee]
0xad786e55ee34a9bd09d2a96453b0ad52ad4b2c7e482ad723a7102152c74d8e4c4948929398 days 6 hrs ago0x65fd7098758e16816a5c9b91f354d97268f13386 IN  Bloom_TokenSale0.76 Ether0.00114875
0xc1f8b2064eea49e7f21074eb5eeff2106a46fac4e302096cf3cc61aab80c1e504888195409 days 3 hrs ago0xd4e3f10ef300931a969923a218c01a6fa682c91c IN  Bloom_TokenSale0 Ether0.000714035
0x8175cb6fb07cf6f67da2baf16a74a6561e55ec1af28188e4e09e0339b45e046d4874377411 days 17 hrs agoKucoin IN  Bloom_TokenSale5.544711 Ether0.00173691
0xbf8b74f3c6ed6d8e557393cfa8825575194daa53709da839c45f03bf8519f6674856950414 days 21 hrs ago0xeeb339818b58d521c8a864fcc13e6add280d4564 IN  Bloom_TokenSale0.00105113 Ether0.001793408203
0x15e5bc1980ae1c419ff0efb527b1fd9151e74bdc3ae75d96b9a95aa6e7cc0cc04845826416 days 22 hrs ago0x61e91eb749f2dd854c7b1a920f0fba9452f58b83 IN  Bloom_TokenSale0.13 Ether0.00068925
0x35074a3ce8862af92e8c5db210d43995d49b3c4ae36084b778d93f41dcbae4a64845360417 days 53 mins ago0x61e91eb749f2dd854c7b1a920f0fba9452f58b83 IN  Bloom_TokenSale0.145 Ether0.0005514
0x6eebe717c9ae094921cc9ae10958cffcb9587e422549c32cbafee3a452e038994844326417 days 5 hrs ago0x497ead2182110f380303e9cb93e62aaacab96d9d IN  Bloom_TokenSale4 Ether0.001079825
0xcc23ec4cc65be48eef1473f695b9629ed56f2d3dd6472786704026112e7e5a6d4838906418 days 3 hrs ago0x7cbc34c589ec3744e9abd1651a804c791c8c30b6 IN  Bloom_TokenSale0.9 Ether0.0004595
0x622a066844ed513d9ae7584f98fbdbb6e67f84019eb67928409fc1e991b3c5f24838850418 days 4 hrs ago0xd4e3f10ef300931a969923a218c01a6fa682c91c IN  Bloom_TokenSale0 Ether0.00032092
0x06418366cc7443c0c585e5ebd1b867382474fb881b5df1975c772e66385780634838840418 days 4 hrs ago0xd4e3f10ef300931a969923a218c01a6fa682c91c IN  Bloom_TokenSale0 Ether0.00108103
0x17625835d1f7f8302b2686c8702c846ae0b92c0df157c5ec35a59a9bff2cc0d24838535418 days 5 hrs ago0x15f529e4b20c6d46ff41bb8936634a18c56a661b IN  Bloom_TokenSale0.00256187 Ether0.00042
0x1ef21b1897a84e1c15d5f9fb2d8e0db89af9fb3f59ed69bbcc627952446105ce4838477418 days 5 hrs ago0x2a7f03b118de7afebb0fa552061f9c8752deb4c5 IN  Bloom_TokenSale0.25420049 Ether0.0004595
0xa7382d316dece8c3d7897b9be5c974b12c801c2f9bdf4e6a7a803f1f2eaa9cba4838026418 days 7 hrs ago0x80a77771c133ba3a6182321d5d99ce8ec16e397f IN  Bloom_TokenSale0.2 Ether0.001079825
0xaca3c7854aee567099d62edad5518c197c0d8725114fbc61fe9cd697662b278c4837970418 days 7 hrs ago0xf7ca07d9acae8042fab57d1daeca2b1274e23a71 IN  Bloom_TokenSale2 Ether0.0004595
0xaede928bb07c7841c49e7147a5a753c8d87fe230a324d9e301b26e58301158284837854418 days 8 hrs ago0x73eafe5c15b73e42dd25191879411c5d366b493f IN  Bloom_TokenSale0.25 Ether0.000919
0xd7ca7c7d101cb94a8180a13ce081cb69b2792343d80806e861a8a41d7e3ebdbd4837784418 days 8 hrs ago0x4deb53f3b81dc24041787032639799d8778efeb7 IN  Bloom_TokenSale0.0486192025 Ether0.000022
0x325e27af6a9424b2828ad686e25a4c434d888be19d51134d4ecfe98a93ad333c4837776418 days 8 hrs ago0x72398a2115d3e2b5e714f03ffed6ca1e099d20ad IN  Bloom_TokenSale0.75 Ether0.0004595
0xbb3dca7a159a8ba87810ed0dfb89922eed90a5a9ca0836b4fe19fee9c2f7fa984837764418 days 8 hrs ago0x3071d6fe8edeb8f69bed291feb42d529855b682e IN  Bloom_TokenSale1 Ether0.0004595
0xfff8619d6a59de666ca01317c07b1dd217438824e916daed23c5dcb24b78bfe24837732418 days 8 hrs ago0x72382e1e6012074da48ce72efc3f2b2ed8fdb1b8 IN  Bloom_TokenSale0.00440502 Ether0.000441
0x3f1368e42c7918cbb83140794fb6bc3636bd9e88a879db6ef2f217ac84babdd04837712418 days 8 hrs ago0x98c0ef4f73bf1bd8a6e05a6ec91e36cf7b51b470 IN  Bloom_TokenSale0.20617 Ether0.0004595
0x6b6118d833b84acb23e3c97defcee4f1657a0d4e6d6e4bd2510628739cbf732f4837711418 days 8 hrs ago0xa1dac0b3027c2791aecf3ddc9a7bd50bd99ba028 IN  Bloom_TokenSale1 Ether0.0004595
0x8dd1b86f98a29f95faab50b3f0666a192276bbc02d2657250d27e4354356c2134837710418 days 8 hrs ago0xb9741e6d179958f0c128bbac611fbe719cd85554 IN  Bloom_TokenSale0.3089525 Ether0.0013785
0x7fce763c94279cac75ccfbf1794e9b1d790fac574e2e32ff36062fbf93e3c0574837700418 days 8 hrs ago0x72398a2115d3e2b5e714f03ffed6ca1e099d20ad IN  Bloom_TokenSale0.75 Ether0.0004595
0xd66dfa571c239adbd35e583be10f8dae892d4e79c6e0a16dc153bbb9dfe6dcaf4837699418 days 8 hrs ago0xfb51972b9fd9bcf9e5cc1997aca14eb73a2e3fe6 IN  Bloom_TokenSale0.5 Ether0.000482475
0x7a46a87ca15cd3d2ae1c1f3769c97028ff865274bc29f77d410e06d89fd8c9cf4837699418 days 8 hrs ago0x4deb53f3b81dc24041787032639799d8778efeb7 IN  Bloom_TokenSale0.09 Ether0.0013785
[ Download CSV Export 

Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0xc2040943c859d16d5c53051877ac988d626635418a64e4ef666ede410866ebd14837635418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab791 Ether
0xb4efac197696450aadd24ad8ffca745e0133c59a6ae4c99f182529740e7750634837635418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.1 Ether
0x500761fe9e3b02bbb66f43aea7349000ebc7e4c94aefd95d8cc682848f4ab1e74837635418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab792 Ether
0x7f01e9a5d452c3a1cd0574bd940b7eae65954472b09132ccccbd31f91f13c98b4837634418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.125 Ether
0x9d2831fbffbda159656c510f92d2dc34694ea896ef70885e8f6b9c4ab93931c94837633418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab792.645 Ether
0xa71645f9c65e8c449111b8548530f3e3d99e335bd52f39159fd374d2f77e55c44837633418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.165 Ether
0xe6570257a2787a9bd731a540501ff95fcdb88c7502d0f96d3e3493fea9cd77514837633418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab793 Ether
0x9857ad1e23f6b42a75a805877d00e0160f8f103cfb50328cce4609a461f5236a4837632418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab791.9 Ether
0x595446721e9d0bbaa7852782cad6ef7c05f138bc7d31db3dd1581eddb57f7a444837632418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.3 Ether
0xea8a226cd8bbf8c4a7d9a5ae69053e384df8ec2255609cea2ccacd706f94ecab4837632418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.54 Ether
0x657fbf41ed33d7f61f4f9ed07c447d035a9c699e5212c436318ae04d4cc548534837632418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.25 Ether
0x41790852c0ca1b45d9210ec67b0e1c30e73206d6a25f5530ca0b22d02a9de3a44837631418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.43 Ether
0x5667e70ee7b5d1ce6fb18e527562d39614bb27bed8f29eeb5342f5a36679f90a4837631418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.195 Ether
0x25c181c7842aaa3b492ef26d1b793525ed4fc06fd7c2dfee97fb1be1507aac464837630418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.15 Ether
0xe4e312d8601950e4f0397b77da963ff46c78352e39bd4dbc5cdad37d63ca1ff44837630418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab7950 Ether
0x7600a68d3e0331214e36dcf0f3d015adf82cb6bb3df750b52709eadf6d707e2e4837630418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab791 Ether
0xfcfce6ae24971e339d6f7131dcdb2fde903991388a3d784b275593c80ecc1c994837626418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab791 Ether
0x687c20ca3f9ed54dbc8e6d37c2302add10c44e62df08b51a0e32a6e5efb9f1d74837626418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab792 Ether
0x6e85f3bd7ad81b1998cb0aaa72766040b52bfe92e3c3c5a003f577319bfe6d454837625418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab791 Ether
0x06d90e43278c8cc1e63ed12a52046029506bf2bf33f332c7e7397c001c4cefeb4837625418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.7 Ether
0xea08d2f9a8d7dcc96d401a704f4f42bc4f1c0e171e0f5ad008f130e3dbeacdd14837624418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab791.33249346 Ether
0x5c048c186c1c518b2a265317de11459a8ffbc238f95e464a8db9b0b0592d64ea4837624418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.162 Ether
0xb711dfaf5c043c7374330a4ef7d3d4f847e6ea35ca208c0c0de337cbc81d4bef4837624418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab7916 Ether
0x429245a4c604d3b72615ae22553a046137948674ee3e5e82a67cf0fd3b69665a4837624418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.11 Ether
0x69916a7d5e5c0b4ff713b84532dd723a0ee9eadb9d14128811f495e36c8912bb4837624418 days 9 hrs ago0xb547cc51ce58293e6945ba08d664ce051563d9ac0x9d217bcbd0bfae4d7f8f12c7702108d162e3ab790.01311 Ether
[ Download CSV Export 
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), NestedArrayFunctionCallDecoder (medium-severity), ZeroFunctionSelector (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: BloomTokenSale
Compiler Version: v0.4.15+commit.bbb8e64f
Optimization Enabled: Yes
Runs (Optimizer):  200

Contract Source Code
pragma solidity ^0.4.13;

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

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

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

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

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;

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;


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() {

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

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

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

contract Configurable is Ownable {
  // Event triggered when the contract has been configured by the owner
  event Configured();

  bool public configured = false;

  // @dev Finalize configuration, prohibiting further configuration
  function finishConfiguration() public configuration returns (bool) {
    configured = true;
    return true;

  // @dev Enforce that a function is an owner-only configuration method.
  //   Intentionally duplicates the `onlyOwner` check so that we can't
  //   accidentally create a configuration option that without the owner modifier.
  //   This modifier will not let a function be called if the `finalizeConfiguration`
  //   has been called.
  modifier configuration() {
    require(msg.sender == owner);

  modifier onlyAfterConfiguration() {

contract Crowdsale {
  using SafeMath for uint256;

  // 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) public {
    require(_startTime >= now); // solhint-disable not-rely-on-time
    require(_endTime >= _startTime);
    require(_rate > 0);
    require(_wallet != 0x0);

    startTime = _startTime;
    endTime = _endTime;
    rate = _rate;
    wallet = _wallet;

  // fallback function can be used to buy tokens
  function () public payable {

  // Make a payment for the provided address
  // @param _owner address that will own the purchased tokens
  function proxyPayment(address _owner) public payable returns(bool);

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

  // send ether to the fund collection wallet
  // override to create custom fund forwarding mechanisms
  function forwardFunds() internal {

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

contract CappedCrowdsale is Crowdsale {
  using SafeMath for uint256;

  uint256 public cap;

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

  // 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;

  // 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;


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() public onlyOwner {


    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 { } // solhint-disable no-empty-blocks

contract TokenController {
    /// @notice Called when `_owner` sends ether to the MiniMe Token contract
    /// @param _owner The address that sent the ether to create tokens
    /// @return True if the ether is accepted, false if it throws
    function proxyPayment(address _owner) payable returns(bool);

    /// @notice Notifies the controller about a token transfer allowing the
    ///  controller to react if desired
    /// @param _from The origin of the transfer
    /// @param _to The destination of the transfer
    /// @param _amount The amount of the transfer
    /// @return False if the controller does not authorize the transfer
    function onTransfer(address _from, address _to, uint _amount) returns(bool);

    /// @notice Notifies the controller about an approval allowing the
    ///  controller to react if desired
    /// @param _owner The address that calls `approve()`
    /// @param _spender The spender in the `approve()` call
    /// @param _amount The amount in the `approve()` call
    /// @return False if the controller does not authorize the approval
    function onApprove(address _owner, address _spender, uint _amount)

contract BloomTokenSale is CappedCrowdsale, Ownable, TokenController, Pausable, Configurable, FinalizableCrowdsale {
  using SafeMath for uint256;

  BLT public token;

  // Solhint breaks on combination of scientific notation and `ether` keyword so disable next line
  // solhint-disable-next-line
  uint256 public constant TOTAL_SUPPLY = 1.5e8 ether; // 150 million BLT with 18 decimals
  uint256 internal constant FOUNDATION_SUPPLY = (TOTAL_SUPPLY * 4) / 10; // 40% supply
  uint256 internal constant ADVISOR_SUPPLY = TOTAL_SUPPLY / 20; // 5% supply
  uint256 internal constant PARTNERSHIP_SUPPLY = TOTAL_SUPPLY / 20; // 5% supply
  uint256 internal constant CONTROLLER_ALLOCATION =
  uint256 internal constant MAX_RAISE_IN_USD = 5e7; // Maximum raise of $50M

  // Wei ether with two extra decimal places. Useful for conversion when we set the ether price
  uint256 internal constant WEI_PER_ETHER_TWO_DECIMALS = 1e20;
  uint256 internal constant TOKEN_UNITS_PER_TOKEN = 1e18; // Decimal units per BLT

  uint256 public advisorPool = ADVISOR_SUPPLY;

  uint256 internal constant DUST = 1 finney; // Minimum payment

  event NewPresaleAllocation(address indexed holder, uint256 bltAmount);

  function BloomTokenSale(
    uint256 _startTime,
    uint256 _endTime,
    uint256 _rate,
    address _wallet,
    uint256 _cap
  ) public
    Crowdsale(_startTime, _endTime, _rate, _wallet)
    CappedCrowdsale(_cap) { } // solhint-disable-line no-empty-blocks

  // @dev Link the token to the Crowdsale
  // @param _token address of the deployed token
  function setToken(address _token) public presaleOnly {
    token = BLT(_token);

  // @dev Allocate our initial token supply
  function allocateSupply() public presaleOnly {
    require(token.totalSupply() == 0);
    token.generateTokens(address(this), CONTROLLER_ALLOCATION);
    token.generateTokens(wallet, WALLET_ALLOCATION);

  // @dev Explicitly allocate tokens from the advisor pool, updating how much is left in the pool.
  // @param _receiver Recipient of grant
  // @param _amount Total BLT units allocated
  // @param _cliffDate Vesting cliff
  // @param _vestingDate Date that the vesting finishes
  function allocateAdvisorTokens(address _receiver, uint256 _amount, uint64 _cliffDate, uint64 _vestingDate)
           presaleOnly {
    require(_amount <= advisorPool);
    advisorPool = advisorPool.sub(_amount);
    allocatePresaleTokens(_receiver, _amount, _cliffDate, _vestingDate);

  // @dev Allocate a normal presale grant. Does not necessarily come from a limited pool like the advisor tokens.
  // @param _receiver Recipient of grant
  // @param _amount Total BLT units allocated
  // @param _cliffDate Vesting cliff
  // @param _vestingDate Date that the vesting finishes
  function allocatePresaleTokens(address _receiver, uint256 _amount, uint64 cliffDate, uint64 vestingDate)
           presaleOnly {

    require(_amount <= 10 ** 25); // 10 million BLT. No presale partner will have more than this allocated. Prevent overflows.

    // solhint-disable-next-line not-rely-on-time
    token.grantVestedTokens(_receiver, _amount, uint64(now), cliffDate, vestingDate, true, false);

    NewPresaleAllocation(_receiver, _amount);

  // @dev Set the stage for the sale:
  //   1. Sets the `cap` controller variable based on the USD/ETH price
  //   2. Updates the `weiRaised` to the balance of our wallet
  //   3. Takes the unallocated portion of the advisor pool and transfers to the wallet
  //   4. Sets the `rate` for the sale now based on the remaining tokens and cap
  // @param _cents The number of cents in USD to purchase 1 ETH
  // @param _weiRaisedOffChain Total amount of wei raised (at specified conversion rate) outside of wallet
  function finishPresale(uint256 _cents, uint256 _weiRaisedOffChain) public presaleOnly returns (bool) {

  // @dev Revoke a token grant, transfering the unvested tokens to our sale wallet
  // @param _holder Owner of the vesting grant that is being revoked
  // @param _grantId ID of the grant being revoked
  function revokeGrant(address _holder, uint256 _grantId) public onlyOwner {
    token.revokeTokenGrant(_holder, wallet, _grantId);

  // @dev low level token purchase function
  // @param _beneficiary address the tokens will be credited to
  function proxyPayment(address _beneficiary)
    returns (bool) {
    require(_beneficiary != 0x0);

    uint256 weiAmount = msg.value;

    // Update the total wei raised
    weiRaised = weiRaised.add(weiAmount);

    // Transfer tokens from the controller to the _beneficiary
    allocateTokens(_beneficiary, weiAmount);

    // Send the transfered wei to our wallet

    return true;

  // @dev controller callback for approving token transfers. Only supports
  //   transfers from the controller for now.
  // @param _from address that wants to transfer their tokens
  function onTransfer(address _from, address _to, uint) public returns (bool) {
    return _from == address(this) || _to == address(wallet);

  // @dev controller callback for approving token transfers. This feature
  //   is disabled during the crowdsale for the sake of simplicity
  function onApprove(address, address, uint) public returns (bool) {
    return false;

  // @dev Change the token controller once the sale is over
  // @param _newController Address of new token controller
  function changeTokenController(address _newController) public onlyOwner whenFinalized {

  // @dev Set the crowdsale cap based on the ether price
  // @param _cents The number of cents in USD to purchase 1 ETH
  function setCapFromEtherPrice(uint256 _cents) internal {
    require(_cents > 10000 && _cents < 100000);
    uint256 weiPerDollar = WEI_PER_ETHER_TWO_DECIMALS.div(_cents);
    cap = MAX_RAISE_IN_USD.mul(weiPerDollar);

  // @dev Set the `weiRaised` for this contract to the balance of the sale wallet
  function syncPresaleWeiRaised(uint256 _weiRaisedOffChain) internal {
    require(weiRaised == 0);
    weiRaised = wallet.balance.add(_weiRaisedOffChain);

  // @dev Transfer unallocated advisor tokens to our wallet. Lets us sell any leftovers
  function transferUnallocatedAdvisorTokens() internal {
    uint256 _unallocatedTokens = advisorPool;
    // Advisor pool will not be used again but we zero it out anyways for the sake of book keeping
    advisorPool = 0;
    token.transferFrom(address(this), wallet, _unallocatedTokens);

  // @dev Set the `rate` based on our remaining token supply and how much we still need to raise
  function updateRateBasedOnFundsAndSupply() internal {
    uint256 _unraisedWei = cap - weiRaised;
    uint256 _tokensForSale = token.balanceOf(address(this));
    rate = _tokensForSale.mul(1e18).div(_unraisedWei);

  // @dev Transfer funds from the controller's address to the _beneficiary. Uses
  //   _weiAmount to compute the number of tokens purchased.
  // @param _beneficiary recipient of tokens
  // @param _weiAmount wei transfered to crowdsale
  function allocateTokens(address _beneficiary, uint256 _weiAmount) internal {
    token.transferFrom(address(this), _beneficiary, tokensFor(_weiAmount));

  // @dev Compute number of token units a given amount of wei gets
  // @param _weiAmount Amount of wei to convert
  function tokensFor(uint256 _weiAmount) internal constant returns (uint256) {
    return _weiAmount.mul(rate).div(1e18);

  // @dev validate purchases. Delegates to super method and also requires that
  //   the initial configuration phase is finished.
  function validPurchase() internal constant returns (bool) {
    return super.validPurchase() && msg.value >= DUST && configured;

  // @dev transfer leftover tokens to our wallet
  function finalization() internal {
    token.transferFrom(address(this), wallet, token.balanceOf(address(this)));

  function inPresalePhase() internal constant beforeSale configuration returns (bool) {
    return true;

  modifier presaleOnly() {

  modifier beforeSale {
    require(now < startTime); // solhint-disable-line not-rely-on-time

  modifier whenFinalized {

contract Controlled {
    /// @notice The address of the controller is the only address that can call
    ///  a function with this modifier
    modifier onlyController { require(msg.sender == controller); _; }

    address public controller;

    function Controlled() { controller = msg.sender;}

    /// @notice Changes the controller of the contract
    /// @param _newController The new controller of the contract
    function changeController(address _newController) onlyController {
        controller = _newController;

contract ApproveAndCallFallBack {
    function receiveApproval(address from, uint256 _amount, address _token, bytes _data);

contract MiniMeToken is Controlled {

    string public name;                //The Token's name: e.g. DigixDAO Tokens
    uint8 public decimals;             //Number of decimals of the smallest unit
    string public symbol;              //An identifier: e.g. REP
    string public version = 'MMT_0.1'; //An arbitrary versioning scheme

    /// @dev `Checkpoint` is the structure that attaches a block number to a
    ///  given value, the block number attached is the one that last changed the
    ///  value
    struct  Checkpoint {

        // `fromBlock` is the block number that the value was generated from
        uint128 fromBlock;

        // `value` is the amount of tokens at a specific block number
        uint128 value;

    // `parentToken` is the Token address that was cloned to produce this token;
    //  it will be 0x0 for a token that was not cloned
    MiniMeToken public parentToken;

    // `parentSnapShotBlock` is the block number from the Parent Token that was
    //  used to determine the initial distribution of the Clone Token
    uint public parentSnapShotBlock;

    // `creationBlock` is the block number that the Clone Token was created
    uint public creationBlock;

    // `balances` is the map that tracks the balance of each address, in this
    //  contract when the balance changes the block number that the change
    //  occurred is also included in the map
    mapping (address => Checkpoint[]) balances;

    // `allowed` tracks any extra transfer rights as in all ERC20 tokens
    mapping (address => mapping (address => uint256)) allowed;

    // Tracks the history of the `totalSupply` of the token
    Checkpoint[] totalSupplyHistory;

    // Flag that determines if the token is transferable or not.
    bool public transfersEnabled;

    // The factory used to create new clone tokens
    MiniMeTokenFactory public tokenFactory;

// Constructor

    /// @notice Constructor to create a MiniMeToken
    /// @param _tokenFactory The address of the MiniMeTokenFactory contract that
    ///  will create the Clone token contracts, the token factory needs to be
    ///  deployed first
    /// @param _parentToken Address of the parent token, set to 0x0 if it is a
    ///  new token
    /// @param _parentSnapShotBlock Block of the parent token that will
    ///  determine the initial distribution of the clone token, set to 0 if it
    ///  is a new token
    /// @param _tokenName Name of the new token
    /// @param _decimalUnits Number of decimals of the new token
    /// @param _tokenSymbol Token Symbol for the new token
    /// @param _transfersEnabled If true, tokens will be able to be transferred
    function MiniMeToken(
        address _tokenFactory,
        address _parentToken,
        uint _parentSnapShotBlock,
        string _tokenName,
        uint8 _decimalUnits,
        string _tokenSymbol,
        bool _transfersEnabled
    ) {
        tokenFactory = MiniMeTokenFactory(_tokenFactory);
        name = _tokenName;                                 // Set the name
        decimals = _decimalUnits;                          // Set the decimals
        symbol = _tokenSymbol;                             // Set the symbol
        parentToken = MiniMeToken(_parentToken);
        parentSnapShotBlock = _parentSnapShotBlock;
        transfersEnabled = _transfersEnabled;
        creationBlock = block.number;

// ERC20 Methods

    /// @notice Send `_amount` tokens to `_to` from `msg.sender`
    /// @param _to The address of the recipient
    /// @param _amount The amount of tokens to be transferred
    /// @return Whether the transfer was successful or not
    function transfer(address _to, uint256 _amount) returns (bool success) {
        return doTransfer(msg.sender, _to, _amount);

    /// @notice Send `_amount` tokens to `_to` from `_from` on the condition it
    ///  is approved by `_from`
    /// @param _from The address holding the tokens being transferred
    /// @param _to The address of the recipient
    /// @param _amount The amount of tokens to be transferred
    /// @return True if the transfer was successful
    function transferFrom(address _from, address _to, uint256 _amount
    ) returns (bool success) {

        // The controller of this contract can move tokens around at will,
        //  this is important to recognize! Confirm that you trust the
        //  controller of this contract, which in most situations should be
        //  another open source smart contract or 0x0
        if (msg.sender != controller) {

            // The standard ERC 20 transferFrom functionality
            if (allowed[_from][msg.sender] < _amount) return false;
            allowed[_from][msg.sender] -= _amount;
        return doTransfer(_from, _to, _amount);

    /// @dev This is the actual transfer function in the token contract, it can
    ///  only be called by other functions in this contract.
    /// @param _from The address holding the tokens being transferred
    /// @param _to The address of the recipient
    /// @param _amount The amount of tokens to be transferred
    /// @return True if the transfer was successful
    function doTransfer(address _from, address _to, uint _amount
    ) internal returns(bool) {

           if (_amount == 0) {
               return true;

           require(parentSnapShotBlock < block.number);

           // Do not allow transfer to 0x0 or the token contract itself
           require((_to != 0) && (_to != address(this)));

           // If the amount being transfered is more than the balance of the
           //  account the transfer returns false
           var previousBalanceFrom = balanceOfAt(_from, block.number);
           if (previousBalanceFrom < _amount) {
               return false;

           // Alerts the token controller of the transfer
           if (isContract(controller)) {
               require(TokenController(controller).onTransfer(_from, _to, _amount));

           // First update the balance array with the new value for the address
           //  sending the tokens
           updateValueAtNow(balances[_from], previousBalanceFrom - _amount);

           // Then update the balance array with the new value for the address
           //  receiving the tokens
           var previousBalanceTo = balanceOfAt(_to, block.number);
           require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
           updateValueAtNow(balances[_to], previousBalanceTo + _amount);

           // An event to make the transfer easy to find on the blockchain
           Transfer(_from, _to, _amount);

           return true;

    /// @param _owner The address that's balance is being requested
    /// @return The balance of `_owner` at the current block
    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balanceOfAt(_owner, block.number);

    /// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on
    ///  its behalf. This is a modified version of the ERC20 approve function
    ///  to be a little bit safer
    /// @param _spender The address of the account able to transfer the tokens
    /// @param _amount The amount of tokens to be approved for transfer
    /// @return True if the approval was successful
    function approve(address _spender, uint256 _amount) returns (bool success) {

        // To change the approve amount you first have to reduce the addresses`
        //  allowance to zero by calling `approve(_spender,0)` if it is not
        //  already 0 to mitigate the race condition described here:
        require((_amount == 0) || (allowed[msg.sender][_spender] == 0));

        // Alerts the token controller of the approve function call
        if (isContract(controller)) {
            require(TokenController(controller).onApprove(msg.sender, _spender, _amount));

        allowed[msg.sender][_spender] = _amount;
        Approval(msg.sender, _spender, _amount);
        return true;

    /// @dev This function makes it easy to read the `allowed[]` map
    /// @param _owner The address of the account that owns the token
    /// @param _spender The address of the account able to transfer the tokens
    /// @return Amount of remaining tokens of _owner that _spender is allowed
    ///  to spend
    function allowance(address _owner, address _spender
    ) constant returns (uint256 remaining) {
        return allowed[_owner][_spender];

    /// @notice `msg.sender` approves `_spender` to send `_amount` tokens on
    ///  its behalf, and then a function is triggered in the contract that is
    ///  being approved, `_spender`. This allows users to use their tokens to
    ///  interact with contracts in one function call instead of two
    /// @param _spender The address of the contract able to transfer the tokens
    /// @param _amount The amount of tokens to be approved for transfer
    /// @return True if the function call was successful
    function approveAndCall(address _spender, uint256 _amount, bytes _extraData
    ) returns (bool success) {
        require(approve(_spender, _amount));


        return true;

    /// @dev This function makes it easy to get the total number of tokens
    /// @return The total number of tokens
    function totalSupply() constant returns (uint) {
        return totalSupplyAt(block.number);

// Query balance and totalSupply in History

    /// @dev Queries the balance of `_owner` at a specific `_blockNumber`
    /// @param _owner The address from which the balance will be retrieved
    /// @param _blockNumber The block number when the balance is queried
    /// @return The balance at `_blockNumber`
    function balanceOfAt(address _owner, uint _blockNumber) constant
        returns (uint) {

        // These next few lines are used when the balance of the token is
        //  requested before a check point was ever created for this token, it
        //  requires that the `parentToken.balanceOfAt` be queried at the
        //  genesis block for that token as this contains initial balance of
        //  this token
        if ((balances[_owner].length == 0)
            || (balances[_owner][0].fromBlock > _blockNumber)) {
            if (address(parentToken) != 0) {
                return parentToken.balanceOfAt(_owner, min(_blockNumber, parentSnapShotBlock));
            } else {
                // Has no parent
                return 0;

        // This will return the expected balance during normal situations
        } else {
            return getValueAt(balances[_owner], _blockNumber);

    /// @notice Total amount of tokens at a specific `_blockNumber`.
    /// @param _blockNumber The block number when the totalSupply is queried
    /// @return The total amount of tokens at `_blockNumber`
    function totalSupplyAt(uint _blockNumber) constant returns(uint) {

        // These next few lines are used when the totalSupply of the token is
        //  requested before a check point was ever created for this token, it
        //  requires that the `parentToken.totalSupplyAt` be queried at the
        //  genesis block for this token as that contains totalSupply of this
        //  token at this block number.
        if ((totalSupplyHistory.length == 0)
            || (totalSupplyHistory[0].fromBlock > _blockNumber)) {
            if (address(parentToken) != 0) {
                return parentToken.totalSupplyAt(min(_blockNumber, parentSnapShotBlock));
            } else {
                return 0;

        // This will return the expected totalSupply during normal situations
        } else {
            return getValueAt(totalSupplyHistory, _blockNumber);

// Clone Token Method

    /// @notice Creates a new clone token with the initial distribution being
    ///  this token at `_snapshotBlock`
    /// @param _cloneTokenName Name of the clone token
    /// @param _cloneDecimalUnits Number of decimals of the smallest unit
    /// @param _cloneTokenSymbol Symbol of the clone token
    /// @param _snapshotBlock Block when the distribution of the parent token is
    ///  copied to set the initial distribution of the new clone token;
    ///  if the block is zero than the actual block, the current block is used
    /// @param _transfersEnabled True if transfers are allowed in the clone
    /// @return The address of the new MiniMeToken Contract
    function createCloneToken(
        string _cloneTokenName,
        uint8 _cloneDecimalUnits,
        string _cloneTokenSymbol,
        uint _snapshotBlock,
        bool _transfersEnabled
        ) returns(address) {
        if (_snapshotBlock == 0) _snapshotBlock = block.number;
        MiniMeToken cloneToken = tokenFactory.createCloneToken(


        // An event to make the token easy to find on the blockchain
        NewCloneToken(address(cloneToken), _snapshotBlock);
        return address(cloneToken);

// Generate and destroy tokens

    /// @notice Generates `_amount` tokens that are assigned to `_owner`
    /// @param _owner The address that will be assigned the new tokens
    /// @param _amount The quantity of tokens generated
    /// @return True if the tokens are generated correctly
    function generateTokens(address _owner, uint _amount
    ) onlyController returns (bool) {
        uint curTotalSupply = totalSupply();
        require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
        uint previousBalanceTo = balanceOf(_owner);
        require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
        updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
        updateValueAtNow(balances[_owner], previousBalanceTo + _amount);
        Transfer(0, _owner, _amount);
        return true;

    /// @notice Burns `_amount` tokens from `_owner`
    /// @param _owner The address that will lose the tokens
    /// @param _amount The quantity of tokens to burn
    /// @return True if the tokens are burned correctly
    function destroyTokens(address _owner, uint _amount
    ) onlyController returns (bool) {
        uint curTotalSupply = totalSupply();
        require(curTotalSupply >= _amount);
        uint previousBalanceFrom = balanceOf(_owner);
        require(previousBalanceFrom >= _amount);
        updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
        updateValueAtNow(balances[_owner], previousBalanceFrom - _amount);
        Transfer(_owner, 0, _amount);
        return true;

// Enable tokens transfers

    /// @notice Enables token holders to transfer their tokens freely if true
    /// @param _transfersEnabled True if transfers are allowed in the clone
    function enableTransfers(bool _transfersEnabled) onlyController {
        transfersEnabled = _transfersEnabled;

// Internal helper functions to query and set a value in a snapshot array

    /// @dev `getValueAt` retrieves the number of tokens at a given block number
    /// @param checkpoints The history of values being queried
    /// @param _block The block number to retrieve the value at
    /// @return The number of tokens being queried
    function getValueAt(Checkpoint[] storage checkpoints, uint _block
    ) constant internal returns (uint) {
        if (checkpoints.length == 0) return 0;

        // Shortcut for the actual value
        if (_block >= checkpoints[checkpoints.length-1].fromBlock)
            return checkpoints[checkpoints.length-1].value;
        if (_block < checkpoints[0].fromBlock) return 0;

        // Binary search of the value in the array
        uint min = 0;
        uint max = checkpoints.length-1;
        while (max > min) {
            uint mid = (max + min + 1)/ 2;
            if (checkpoints[mid].fromBlock<=_block) {
                min = mid;
            } else {
                max = mid-1;
        return checkpoints[min].value;

    /// @dev `updateValueAtNow` used to update the `balances` map and the
    ///  `totalSupplyHistory`
    /// @param checkpoints The history of data being updated
    /// @param _value The new number of tokens
    function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value
    ) internal  {
        if ((checkpoints.length == 0)
        || (checkpoints[checkpoints.length -1].fromBlock < block.number)) {
               Checkpoint storage newCheckPoint = checkpoints[ checkpoints.length++ ];
               newCheckPoint.fromBlock =  uint128(block.number);
               newCheckPoint.value = uint128(_value);
           } else {
               Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length-1];
               oldCheckPoint.value = uint128(_value);

    /// @dev Internal function to determine if an address is a contract
    /// @param _addr The address being queried
    /// @return True if `_addr` is a contract
    function isContract(address _addr) constant internal returns(bool) {
        uint size;
        if (_addr == 0) return false;
        assembly {
            size := extcodesize(_addr)
        return size>0;

    /// @dev Helper function to return a min betwen the two uints
    function min(uint a, uint b) internal returns (uint) {
        return a < b ? a : b;

    /// @notice The fallback function: If the contract's controller has not been
    ///  set to 0, then the `proxyPayment` method is called which relays the
    ///  ether and creates tokens as described in the token controller contract
    function ()  payable {

// Safety Methods

    /// @notice This method can be used by the controller to extract mistakenly
    ///  sent tokens to this contract.
    /// @param _token The address of the token contract that you want to recover
    ///  set to 0 in case you want to extract ether.
    function claimTokens(address _token) onlyController {
        if (_token == 0x0) {

        MiniMeToken token = MiniMeToken(_token);
        uint balance = token.balanceOf(this);
        token.transfer(controller, balance);
        ClaimedTokens(_token, controller, balance);

// Events
    event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount);
    event Transfer(address indexed _from, address indexed _to, uint256 _amount);
    event NewCloneToken(address indexed _cloneToken, uint _snapshotBlock);
    event Approval(
        address indexed _owner,
        address indexed _spender,
        uint256 _amount


contract MiniMeTokenFactory {

    /// @notice Update the DApp by creating a new token with new functionalities
    ///  the msg.sender becomes the controller of this clone token
    /// @param _parentToken Address of the token being cloned
    /// @param _snapshotBlock Block of the parent token that will
    ///  determine the initial distribution of the clone token
    /// @param _tokenName Name of the new token
    /// @param _decimalUnits Number of decimals of the new token
    /// @param _tokenSymbol Token Symbol for the new token
    /// @param _transfersEnabled If true, tokens will be able to be transferred
    /// @return The address of the new token contract
    function createCloneToken(
        address _parentToken,
        uint _snapshotBlock,
        string _tokenName,
        uint8 _decimalUnits,
        string _tokenSymbol,
        bool _transfersEnabled
    ) returns (MiniMeToken) {
        MiniMeToken newToken = new MiniMeToken(

        return newToken;

contract MiniMeVestedToken is MiniMeToken {
  using SafeMath for uint256;
  using Math for uint64;

  struct TokenGrant {
    address granter;     // 20 bytes
    uint256 value;       // 32 bytes
    uint64 cliff;
    uint64 vesting;
    uint64 start;        // 3 * 8 = 24 bytes
    bool revokable;
    bool burnsOnRevoke;  // 2 * 1 = 2 bits? or 2 bytes?
  } // total 78 bytes = 3 sstore per operation (32 per sstore)

  event NewTokenGrant(address indexed from, address indexed to, uint256 value, uint256 grantId);

  mapping (address => TokenGrant[]) public grants;

  mapping (address => bool) public canCreateGrants;
  address public vestingWhitelister;

  modifier canTransfer(address _sender, uint _value) {
    require(spendableBalanceOf(_sender) >= _value);

  modifier onlyVestingWhitelister {
    require(msg.sender == vestingWhitelister);

  function MiniMeVestedToken (
      address _tokenFactory,
      address _parentToken,
      uint _parentSnapShotBlock,
      string _tokenName,
      uint8 _decimalUnits,
      string _tokenSymbol,
      bool _transfersEnabled
  ) public
    MiniMeToken(_tokenFactory, _parentToken, _parentSnapShotBlock, _tokenName, _decimalUnits, _tokenSymbol, _transfersEnabled) {
    vestingWhitelister = msg.sender;
    doSetCanCreateGrants(vestingWhitelister, true);

  // @dev Add canTransfer modifier before allowing transfer and transferFrom to go through
  function transfer(address _to, uint _value)
           canTransfer(msg.sender, _value)
           returns (bool success) {
    return super.transfer(_to, _value);

  function transferFrom(address _from, address _to, uint _value)
           canTransfer(_from, _value)
           returns (bool success) {
    return super.transferFrom(_from, _to, _value);

  function spendableBalanceOf(address _holder) public constant returns (uint) {
    return transferableTokens(_holder, uint64(now)); // solhint-disable not-rely-on-time

   * @dev Grant tokens to a specified address
   * @param _to address The address which the tokens will be granted to.
   * @param _value uint256 The amount of tokens to be granted.
   * @param _start uint64 Time of the beginning of the grant.
   * @param _cliff uint64 Time of the cliff period.
   * @param _vesting uint64 The vesting period.
  function grantVestedTokens(
    address _to,
    uint256 _value,
    uint64 _start,
    uint64 _cliff,
    uint64 _vesting,
    bool _revokable,
    bool _burnsOnRevoke
  ) public {
    // Check start, cliff and vesting are properly order to ensure correct functionality of the formula.
    require(_cliff >= _start);
    require(_vesting >= _cliff);

    require(tokenGrantsCount(_to) < 20);   // To prevent a user being spammed and have his balance locked (out of gas attack when calculating vesting).

    TokenGrant memory grant = TokenGrant(
      _revokable ? msg.sender : 0,

    uint256 count = grants[_to].push(grant);

    assert(transfer(_to, _value));

    NewTokenGrant(msg.sender, _to, _value, count - 1);

  function setCanCreateGrants(address _addr, bool _allowed)
           public onlyVestingWhitelister {
    doSetCanCreateGrants(_addr, _allowed);

  function changeVestingWhitelister(address _newWhitelister) public onlyVestingWhitelister {
    require(_newWhitelister != 0);
    doSetCanCreateGrants(vestingWhitelister, false);
    vestingWhitelister = _newWhitelister;
    doSetCanCreateGrants(vestingWhitelister, true);

   * @dev Revoke the grant of tokens of a specifed address.
   * @param _holder The address which will have its tokens revoked.
   * @param _receiver Recipient of revoked tokens.
   * @param _grantId The id of the token grant.
  function revokeTokenGrant(address _holder, address _receiver, uint256 _grantId) public onlyVestingWhitelister {
    require(_receiver != 0);

    TokenGrant storage grant = grants[_holder][_grantId];

    require(grant.granter == msg.sender); // Only granter can revoke it

    address receiver = grant.burnsOnRevoke ? 0xdead : _receiver;

    uint256 nonVested = nonVestedTokens(grant, uint64(now));

    // remove grant from array
    delete grants[_holder][_grantId];
    grants[_holder][_grantId] = grants[_holder][grants[_holder].length.sub(1)];
    grants[_holder].length -= 1;

    doTransfer(_holder, receiver, nonVested);

   * @dev Check the amount of grants that an address has.
   * @param _holder The holder of the grants.
   * @return A uint256 representing the total amount of grants.
  function tokenGrantsCount(address _holder) public constant returns (uint index) {
    return grants[_holder].length;

   * @dev Get all information about a specific grant.
   * @param _holder The address which will have its tokens revoked.
   * @param _grantId The id of the token grant.
   * @return Returns all the values that represent a TokenGrant(address, value, start, cliff,
   * revokability, burnsOnRevoke, and vesting) plus the vested value at the current time.
  function tokenGrant(address _holder, uint256 _grantId) public constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) {
    TokenGrant storage grant = grants[_holder][_grantId];

    granter = grant.granter;
    value = grant.value;
    start = grant.start;
    cliff = grant.cliff;
    vesting = grant.vesting;
    revokable = grant.revokable;
    burnsOnRevoke = grant.burnsOnRevoke;

    vested = vestedTokens(grant, uint64(now));

  // @dev The date in which all tokens are transferable for the holder
  // Useful for displaying purposes (not used in any logic calculations)
  function lastTokenIsTransferableDate(address holder) public constant returns (uint64 date) {
    date = uint64(now);
    uint256 grantIndex = tokenGrantsCount(holder);
    for (uint256 i = 0; i < grantIndex; i++) {
      date = grants[holder][i].vesting.max64(date);
    return date;

  // @dev How many tokens can a holder transfer at a point in time
  function transferableTokens(address holder, uint64 time) public constant returns (uint256) {
    uint256 grantIndex = tokenGrantsCount(holder);

    if (grantIndex == 0) return balanceOf(holder); // shortcut for holder without grants

    // Iterate through all the grants the holder has, and add all non-vested tokens
    uint256 nonVested = 0;
    for (uint256 i = 0; i < grantIndex; i++) {
      nonVested = nonVested.add(nonVestedTokens(grants[holder][i], time));

    // Balance - totalNonVested is the amount of tokens a holder can transfer at any given time
    return balanceOf(holder).sub(nonVested);

  function doSetCanCreateGrants(address _addr, bool _allowed)
           internal {
    canCreateGrants[_addr] = _allowed;

   * @dev Calculate amount of vested tokens at a specific time
   * @param tokens uint256 The amount of tokens granted
   * @param time uint64 The time to be checked
   * @param start uint64 The time representing the beginning of the grant
   * @param cliff uint64  The cliff period, the period before nothing can be paid out
   * @param vesting uint64 The vesting period
   * @return An uint256 representing the amount of vested tokens of a specific grant
   *  transferableTokens
   *   |                         _/--------   vestedTokens rect
   *   |                       _/
   *   |                     _/
   *   |                   _/
   *   |                 _/
   *   |                /
   *   |              .|
   *   |            .  |
   *   |          .    |
   *   |        .      |
   *   |      .        |
   *   |    .          |
   *   +===+===========+---------+----------> time
   *      Start       Cliff    Vesting
  function calculateVestedTokens(
    uint256 tokens,
    uint256 time,
    uint256 start,
    uint256 cliff,
    uint256 vesting) internal constant returns (uint256)

    // Shortcuts for before cliff and after vesting cases.
    if (time < cliff) return 0;
    if (time >= vesting) return tokens;

    // Interpolate all vested tokens.
    // As before cliff the shortcut returns 0, we can use just this function to
    // calculate it.

    // vested = tokens * (time - start) / (vesting - start)
    uint256 vested = tokens.mul(

    return vested;

   * @dev Calculate the amount of non vested tokens at a specific time.
   * @param grant TokenGrant The grant to be checked.
   * @param time uint64 The time to be checked
   * @return An uint256 representing the amount of non vested tokens of a specific grant on the
   * passed time frame.
  function nonVestedTokens(TokenGrant storage grant, uint64 time) internal constant returns (uint256) {
    // Of all the tokens of the grant, how many of them are not vested?
    // grantValue - vestedTokens
    return grant.value.sub(vestedTokens(grant, time));

   * @dev Get the amount of vested tokens at a specific time.
   * @param grant TokenGrant The grant to be checked.
   * @param time The time to be checked
   * @return An uint256 representing the amount of vested tokens of a specific grant at a specific time.
  function vestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
    return calculateVestedTokens(

contract BLT is MiniMeVestedToken {
  function BLT(address _tokenFactory) public MiniMeVestedToken(
    0x0,           // no parent token
    0,             // no snapshot block number from parent
    "Bloom Token", // Token name
    18,            // Decimals
    "BLT",         // Symbol
    true           // Enable transfers
  ) {} // solhint-disable-line no-empty-blocks

Contract ABI

Contract Creation Code

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

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000005a1ee790
Arg [1] : 000000000000000000000000000000000000000000000000000000005a4a9340
Arg [2] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [3] : 0000000000000000000000009d217bcbd0bfae4d7f8f12c7702108d162e3ab79
Arg [4] : 0000000000000000000000000000000000000000000000000000000000002710

   Swarm Source:
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.