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
State Variables (6) keyboard_arrow_up
Functions
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Modifiers help
onlyPayloadSize checks for the following:
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);
}
allowance keyboard_arrow_up
transferFrom keyboard_arrow_up
Modifiers help
onlyPayloadSize checks for the following:
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);
}
approve keyboard_arrow_up
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
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
Requirements help
MAX_GRANTS_PER_ADDRESS
must be greater than or equal to
the result of calling tokenGrantsCount with _to
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
Requirements help
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
calculateVestedTokens keyboard_arrow_up
Parameters help
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
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
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
vestedBalanceOf keyboard_arrow_up
Internal Functions
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
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)
);
}