Blockwell

CoinDash Token

ERC20

This contract is an ERC20 token.

Name CoinDash Token
Symbol CDT
Decimals 18
Total Supply 1,000,000,000 CDT

About link description

Blox (CDT) is a cryptocurrency and operates on the Ethereum platform. Blox has a current supply of 1,000,000,000. The last known price of Blox is 0.01510813 USD and is down -0.60 over the last 24 hours. It is currently trading on 12 active market(s) with $197,600.27 traded over the last 24 hours. More information can be found at https://www.bloxstaking.com/.

Stats

Public Functions 15
Event Types 3
Code Size 17,644 bytes

Library Use

Uses SafeMath for uint.

Events (3) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint help

NewTokenGrant Event

Parameters help
from
address help
to
address help
value
uint256 help
grantId
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint help

decimals Constant

uint help
18

name Constant

string help
CoinDash Token

symbol Constant

string help
CDT

creator Variable

address help

totalSupply Variable

uint help

MAX_GRANTS_PER_ADDRESS Variable

uint256 help
Internal Variable

grants Variable

mapping(address => TokenGrant[]) help
Internal Variable

allowed Variable

mapping(address => mapping(address => uint)) help
Internal Variable

balances Variable

mapping(address => uint) help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function balanceOf(address _owner) constant returns (uint256 balance) {
  return balances[_owner];
}

Parameters help

Name Type
_to
address help
_value
uint help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) {
  balances[msg.sender] = balances[msg.sender].sub(_value);
  balances[_to] = balances[_to].add(_value);
  Transfer(msg.sender, _to, _value);
}

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

Visibility help public
Mutability help constant
Source Code
function allowance(address _owner, address _spender)
  constant
  returns (uint256 remaining)
{
  return allowed[_owner][_spender];
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
) onlyPayloadSize(3 * 32) {
  var _allowance = allowed[_from][msg.sender];

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

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

Parameters help

Name Type
_spender
address help
_value
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

One or more of the following:
Source Code
function approve(address _spender, uint256 _value) {
  // 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:
  //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
  if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;

  allowed[msg.sender][_spender] = _value;
  Approval(msg.sender, _spender, _value);
}

transferableTokens keyboard_arrow_up

Parameters help

Name Type
holder
address help
time
uint64 help

Properties

Visibility help public
Mutability help constant
Source Code
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 = SafeMath.add(
      nonVested,
      nonVestedTokens(grants[holder][i], time)
    );
  }

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

  // Return the minimum of how many vested can transfer and other value
  // in case there are other limiting transferability factors (default is balanceOf)
  return
    SafeMath.min256(vestedTransferable, super.transferableTokens(holder, time));
}

grantVestedTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_value
uint256 help
_start
uint64 help
_cliff
uint64 help
_vesting
uint64 help
_revokable
bool help
_burnsOnRevoke
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function grantVestedTokens(
  address _to,
  uint256 _value,
  uint64 _start,
  uint64 _cliff,
  uint64 _vesting,
  bool _revokable,
  bool _burnsOnRevoke
) public {
  // Check for date inconsistencies that may cause unexpected behavior
  if (_cliff < _start || _vesting < _cliff) {
    throw;
  }

  if (tokenGrantsCount(_to) > MAX_GRANTS_PER_ADDRESS) throw; // To prevent a user being spammed and have his balance locked (out of gas attack when calculating vesting).

  uint256 count = grants[_to].push(
    TokenGrant(
      _revokable ? msg.sender : 0, // avoid storing an extra 20 bytes when it is non-revokable
      _value,
      _cliff,
      _vesting,
      _start,
      _revokable,
      _burnsOnRevoke
    )
  );

  transfer(_to, _value);

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

revokeTokenGrant keyboard_arrow_up

Parameters help

Name Type
_holder
address help
_grantId
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function revokeTokenGrant(address _holder, uint256 _grantId) public {
  TokenGrant grant = grants[_holder][_grantId];

  if (!grant.revokable) {
    // Check if grant was revokable
    throw;
  }

  if (grant.granter != msg.sender) {
    // Only granter can revoke it
    throw;
  }

  address receiver = grant.burnsOnRevoke ? 0xdead : msg.sender;

  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;

  balances[receiver] = balances[receiver].add(nonVested);
  balances[_holder] = balances[_holder].sub(nonVested);

  Transfer(_holder, receiver, nonVested);
}

tokenGrantsCount keyboard_arrow_up

Parameters help

Name Type
_holder
address help

Properties

Visibility help public
Mutability help constant
Source Code
function tokenGrantsCount(address _holder) constant returns (uint256 index) {
  return grants[_holder].length;
}

calculateVestedTokens keyboard_arrow_up

Parameters help

Name Type
tokens
uint256 help
time
uint256 help
start
uint256 help
cliff
uint256 help
vesting
uint256 help

Properties

Visibility help public
Mutability help constant
Source Code
function calculateVestedTokens(
  uint256 tokens,
  uint256 time,
  uint256 start,
  uint256 cliff,
  uint256 vesting
) 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 calculate a value
  // in the vesting rect (as shown in above's figure)

  // vestedTokens = tokens * (time - start) / (vesting - start)
  uint256 vestedTokens = SafeMath.div(
    SafeMath.mul(tokens, SafeMath.sub(time, start)),
    SafeMath.sub(vesting, start)
  );

  return vestedTokens;
}

tokenGrant keyboard_arrow_up

Parameters help

Name Type
_holder
address help
_grantId
uint help

Properties

Visibility help public
Mutability help constant
Source Code
function tokenGrant(address _holder, uint256 _grantId)
  constant
  returns (
    address granter,
    uint256 value,
    uint256 vested,
    uint64 start,
    uint64 cliff,
    uint64 vesting,
    bool revokable,
    bool burnsOnRevoke
  )
{
  TokenGrant 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));
}

lastTokenIsTransferableDate keyboard_arrow_up

Parameters help

Name Type
holder
address help

Properties

Visibility help public
Mutability help constant
Source Code
function lastTokenIsTransferableDate(address holder)
  public
  constant
  returns (uint64 date)
{
  date = uint64(now);
  uint256 grantIndex = grants[holder].length;
  for (uint256 i = 0; i < grantIndex; i++) {
    date = SafeMath.max64(grants[holder][i].vesting, date);
  }
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function() {
  throw;
}

vestedBalanceOf keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function vestedBalanceOf(address _owner) constant returns (uint256 balance) {
  return transferableTokens(_owner, uint64(now));
}

drain keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function drain() only_owner {
  if (!creator.send(this.balance)) throw;
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal VestedToken.vestedTokens keyboard_arrow_up

Parameters help

Name Type
grant
TokenGrant help
time
uint64 help

Properties

Visibility help private
Mutability help constant
Source Code
function vestedTokens(TokenGrant grant, uint64 time)
  private
  constant
  returns (uint256)
{
  return
    calculateVestedTokens(
      grant.value,
      uint256(time),
      uint256(grant.start),
      uint256(grant.cliff),
      uint256(grant.vesting)
    );
}

internal VestedToken.nonVestedTokens keyboard_arrow_up

Parameters help

Name Type
grant
TokenGrant help
time
uint64 help

Properties

Visibility help private
Mutability help constant
Source Code
function nonVestedTokens(TokenGrant grant, uint64 time)
  private
  constant
  returns (uint256)
{
  return grant.value.sub(vestedTokens(grant, time));
}