Blockwell

CashBetCoin

ERC20

This contract is an ERC20 token.

Name CashBetCoin
Symbol CBC
Decimals 8
Total Supply 401,647,958 CBC

About link

CBC.network (CBC) is a cryptocurrency and operates on the Ethereum platform. CBC.network has a current supply of 401,647,957.75 with 155,864,700.786951 in circulation. The last known price of CBC.network is 0.0682146 USD and is up 11.23 over the last 24 hours. It is currently trading on 7 active market(s) with $376,551.45 traded over the last 24 hours. More information can be found at www.cbc.network.

Stats

Public Functions 22
Event Types 10
Code Size 15,049 bytes

Library Use

Uses SafeMath for uint256.

Events (10) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

Associate Event

Parameters help
user
address help
agent
address help
operatorId
bytes32 help
playerId
bytes32 help

Burn Event

Parameters help
owner
address help
value
uint256 help

Employee Event

Parameters help
empl
address help
operatorId
bytes32 help
allowed
bool help

LockDecrease Event

Parameters help
user
address help
employee
address help
amount
uint256 help
time
uint256 help

LockIncrease Event

Parameters help
user
address help
amount
uint256 help
time
uint256 help

Operator Event

Parameters help
operatorId
bytes32 help
allowed
bool help

OptIn Event

Parameters help
owner
address help
value
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

Vacate Event

Parameters help
owner
address help
value
uint256 help

User Struct

Members
balance
uint256 help
lock_value
uint256 help
lock_endTime
uint256 help
operatorId
bytes32 help
playerId
bytes32 help
authorized
mapping(address => uint256) help

name Constant

string help
CashBetCoin

symbol Constant

string help
CBC

decimals Constant

uint8 help
8

owner Variable

address help

migrateFrom Variable

address help

migrateTo Variable

address help

operators Variable

mapping(bytes32 => bool) help

totalSupply_ Variable

uint help
Internal Variable

users Variable

mapping(address => User) help
Internal Variable

employees Variable

mapping(address => mapping(bytes32 => bool)) help
Internal Variable

Functions Expand All Collapse All

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view returns (uint256) {
  return totalSupply_;
}

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address _addr) public view returns (uint256 balance) {
  return users[_addr].balance;
}

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address _to, uint256 _value)
  public
  value_less_than_unlocked_balance(msg.sender, _value)
  returns (bool success)
{
  User storage user = users[msg.sender];
  user.balance = user.balance.sub(_value);
  users[_to].balance = users[_to].balance.add(_value);
  Transfer(msg.sender, _to, _value);
  return true;
}

Parameters help

Name Type
_user
address help
_spender
address help

Properties

Visibility help public
Mutability help view
Source Code
function allowance(address _user, address _spender)
  public
  view
  returns (uint256)
{
  return users[_user].authorized[_spender];
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
)
  public
  value_less_than_unlocked_balance(_from, _value)
  returns (bool success)
{
  User storage user = users[_from];
  user.balance = user.balance.sub(_value);
  users[_to].balance = users[_to].balance.add(_value);
  user.authorized[msg.sender] = user.authorized[msg.sender].sub(_value);
  Transfer(_from, _to, _value);
  return true;
}

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

One or more of the following:
Source Code
function approve(address _spender, uint256 _value)
  public
  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:
  //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
  require((_value == 0) || (users[msg.sender].authorized[_spender] == 0));
  users[msg.sender].authorized[_spender] = _value;
  Approval(msg.sender, _spender, _value);
  return true;
}

vacate keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function vacate(address _addr)
  public
  returns (
    uint256 o_balance,
    uint256 o_lock_value,
    uint256 o_lock_endTime,
    bytes32 o_opId,
    bytes32 o_playerId
  )
{
  require(msg.sender == migrateTo);
  User storage user = users[_addr];
  require(user.balance > 0);

  o_balance = user.balance;
  o_lock_value = user.lock_value;
  o_lock_endTime = user.lock_endTime;
  o_opId = user.operatorId;
  o_playerId = user.playerId;

  totalSupply_ = totalSupply_.sub(user.balance);

  user.balance = 0;
  user.lock_value = 0;
  user.lock_endTime = 0;
  user.operatorId = bytes32(0);
  user.playerId = bytes32(0);

  Vacate(_addr, o_balance);
}

lockedValueOf keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help view
Source Code
function lockedValueOf(address _addr) public view returns (uint256 value) {
  User storage user = users[_addr];
  // Is the lock expired?
  if (user.lock_endTime < block.timestamp) {
    // Lock is expired, no locked value.
    return 0;
  } else {
    return user.lock_value;
  }
}

lockedEndTimeOf keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help view
Source Code
function lockedEndTimeOf(address _addr) public view returns (uint256 time) {
  return users[_addr].lock_endTime;
}

increaseLock keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help
_time
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function increaseLock(uint256 _value, uint256 _time)
  public
  returns (bool success)
{
  User storage user = users[msg.sender];

  // Is there a lock in effect?
  if (block.timestamp < user.lock_endTime) {
    // Lock in effect, ensure nothing gets smaller.
    require(_value >= user.lock_value);
    require(_time >= user.lock_endTime);
    // Ensure something has increased.
    require(_value > user.lock_value || _time > user.lock_endTime);
  }

  // Things we always require.
  require(_value <= user.balance);
  require(_time > block.timestamp);

  user.lock_value = _value;
  user.lock_endTime = _time;
  LockIncrease(msg.sender, _value, _time);
  return true;
}

decreaseLock keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help
_time
uint256 help
_user
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

only_employees checks for the following:
Source Code
function decreaseLock(
  uint256 _value,
  uint256 _time,
  address _user
) public only_employees(_user) returns (bool success) {
  User storage user = users[_user];

  // We don't modify expired locks (they are already 0)
  require(user.lock_endTime > block.timestamp);
  // Ensure nothing gets bigger.
  require(_value <= user.lock_value);
  require(_time <= user.lock_endTime);
  // Ensure something has decreased.
  require(_value < user.lock_value || _time < user.lock_endTime);

  user.lock_value = _value;
  user.lock_endTime = _time;
  LockDecrease(_user, msg.sender, _value, _time);
  return true;
}

associate keyboard_arrow_up

Parameters help

Name Type
_opId
bytes32 help
_playerId
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function associate(bytes32 _opId, bytes32 _playerId)
  public
  playerid_iff_operatorid(_opId, _playerId)
  returns (bool success)
{
  User storage user = users[msg.sender];

  // Players can associate their playerId once while the token is
  // locked.  They can't change this association until the lock
  // expires ...
  require(
    user.lock_value == 0 ||
      user.lock_endTime < block.timestamp ||
      user.playerId == 0
  );

  // OperatorId argument must be empty or in the approved operators set.
  require(_opId == bytes32(0) || operators[_opId]);

  user.operatorId = _opId;
  user.playerId = _playerId;
  Associate(msg.sender, msg.sender, _opId, _playerId);
  return true;
}

associationOf keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help view
Source Code
function associationOf(address _addr)
  public
  view
  returns (bytes32 opId, bytes32 playerId)
{
  return (users[_addr].operatorId, users[_addr].playerId);
}

setAssociation keyboard_arrow_up

Parameters help

Name Type
_user
address help
_opId
bytes32 help
_playerId
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

only_employees checks for the following:

Requirements help

Source Code
function setAssociation(
  address _user,
  bytes32 _opId,
  bytes32 _playerId
)
  public
  only_employees(_user)
  playerid_iff_operatorid(_opId, _playerId)
  returns (bool success)
{
  User storage user = users[_user];

  // Employees may only set opId to empty or something they are an
  // employee of.
  require(_opId == bytes32(0) || employees[msg.sender][_opId]);

  user.operatorId = _opId;
  user.playerId = _playerId;
  Associate(_user, msg.sender, _opId, _playerId);
  return true;
}

setEmployee keyboard_arrow_up

Parameters help

Name Type
_addr
address help
_opId
bytes32 help
_allowed
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setEmployee(
  address _addr,
  bytes32 _opId,
  bool _allowed
) public only_owner {
  employees[_addr][_opId] = _allowed;
  Employee(_addr, _opId, _allowed);
}

setOperator keyboard_arrow_up

Parameters help

Name Type
_opId
bytes32 help
_allowed
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setOperator(bytes32 _opId, bool _allowed) public only_owner {
  operators[_opId] = _allowed;
  Operator(_opId, _allowed);
}

setOwner keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setOwner(address _addr) public only_owner {
  owner = _addr;
}

burnTokens keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function burnTokens(uint256 _value)
  public
  value_less_than_unlocked_balance(msg.sender, _value)
  returns (bool success)
{
  User storage user = users[msg.sender];
  user.balance = user.balance.sub(_value);
  totalSupply_ = totalSupply_.sub(_value);
  Burn(msg.sender, _value);
  return true;
}

setMigrateFrom keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setMigrateFrom(address _addr) public only_owner {
  require(migrateFrom == MigrationSource(0));
  migrateFrom = MigrationSource(_addr);
}

setMigrateTo keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setMigrateTo(address _addr) public only_owner {
  migrateTo = _addr;
}

optIn keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function optIn() public returns (bool success) {
  require(migrateFrom != MigrationSource(0));
  User storage user = users[msg.sender];
  uint256 balance;
  uint256 lock_value;
  uint256 lock_endTime;
  bytes32 opId;
  bytes32 playerId;
  (balance, lock_value, lock_endTime, opId, playerId) = migrateFrom.vacate(
    msg.sender
  );

  OptIn(msg.sender, balance);

  user.balance = user.balance.add(balance);

  bool lockTimeIncreased = false;
  user.lock_value = user.lock_value.add(lock_value);
  if (user.lock_endTime < lock_endTime) {
    user.lock_endTime = lock_endTime;
    lockTimeIncreased = true;
  }
  if (lock_value > 0 || lockTimeIncreased) {
    LockIncrease(msg.sender, user.lock_value, user.lock_endTime);
  }

  if (user.operatorId == bytes32(0) && opId != bytes32(0)) {
    user.operatorId = opId;
    user.playerId = playerId;
    Associate(msg.sender, msg.sender, opId, playerId);
  }

  totalSupply_ = totalSupply_.add(balance);

  return true;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() public payable {
  revert();
}

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.