Blockwell

CocosTokenV2

ERC20

This contract is an ERC20 token.

Name CocosTokenV2
Symbol COCOS
Decimals 18
Total Supply 100,000,000 COCOS

About link description

Cocos-BCX (COCOS) is a cryptocurrency and operates on the Ethereum platform. Cocos-BCX has a current supply of 100,000,000 with 42,015,868 in circulation. The last known price of Cocos-BCX is 0.57252135 USD and is down -14.89 over the last 24 hours. It is currently trading on 8 active market(s) with $9,410,352.59 traded over the last 24 hours. More information can be found at https://www.cocosbcx.io/.

Stats

Public Functions 27
Event Types 12
Code Size 31,962 bytes

Library Use

Uses SafeMath for uint.

Events (12) keyboard_arrow_up

AddBlackAccount Event

Parameters help
operator
address help
blackAccount
address help

AddWhiteAccount Event

Parameters help
operator
address help
whiteAccount
address help

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

DelBlackAccount Event

Parameters help
operator
address help
blackAccount
address help

DelWhiteAccount Event

Parameters help
operator
address help
whiteAccount
address help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Paused Event

Parameters help
account
address help

PauserAdded Event

Parameters help
account
address help

PauserRemoved Event

Parameters help
account
address help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

TransferMuti Event

Parameters help
len
uint256 help
amount
uint256 help

Unpaused Event

Parameters help
account
address help

DECIMALS Constant

uint8 help
18

INITIAL_SUPPLY Constant

uint256 help
100000000 * UNKNOWN VALUE

blackAccountMap Variable

mapping(address => uint) help
Internal Variable

blackAccounts Variable

address[] help
Internal Variable

whiteAccountMap Variable

mapping(address => uint) help
Internal Variable

whiteAccounts Variable

address[] help
Internal Variable

_balances Variable

mapping(address => uint256) help
Internal Variable

_allowances Variable

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

_totalSupply Variable

uint256 help
Internal Variable

_name Variable

string help
Internal Variable

_symbol Variable

string help
Internal Variable

_decimals Variable

uint8 help
Internal Variable

_paused Variable

bool help
Internal Variable

_pausers Variable

Roles.Role help
Internal Variable

_owner Variable

address help
Internal Variable

Functions Expand All Collapse All

owner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function owner() public view returns (address) {
  return _owner;
}

isOwner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function isOwner() public view returns (bool) {
  return _msgSender() == _owner;
}

renounceOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function renounceOwnership() public onlyOwner {
  emit OwnershipTransferred(_owner, address(0));
  _owner = address(0);
}

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function transferOwnership(address newOwner) public onlyOwner {
  _transferOwnership(newOwner);
}

isPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isPauser(address account) public view returns (bool) {
  return _pausers.has(account);
}

addPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null
Source Code
function addPauser(address account) public onlyPauser {
  _addPauser(account);
}

renouncePauser keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function renouncePauser() public {
  _removePauser(_msgSender());
}

paused keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function paused() public view returns (bool) {
  return _paused;
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null
Source Code
function pause() public onlyPauser whenNotPaused {
  _paused = true;
  emit Paused(_msgSender());
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function unpause() public onlyPauser whenPaused {
  _paused = false;
  emit Unpaused(_msgSender());
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function name() public view returns (string memory) {
  return _name;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function symbol() public view returns (string memory) {
  return _symbol;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function decimals() public view returns (uint8) {
  return _decimals;
}

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
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address account) public view returns (uint256) {
  return _balances[account];
}

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transfer(address _to, uint256 _value) public returns (bool) {
  if (paused() == true) {
    // , only white list pass
    require(
      whiteAccountMap[msg.sender] != 0,
      "contract is in paused, only in white list can transfer"
    );
  } else {
    // check black list
    require(
      blackAccountMap[msg.sender] == 0,
      "address in black list, can't transfer"
    );
  }
  return super.transfer(_to, _value);
}

Parameters help

Name Type
owner
address help
spender
address help

Properties

Visibility help public
Mutability help view
Source Code
function allowance(address owner, address spender)
  public
  view
  returns (uint256)
{
  return _allowances[owner][spender];
}

Parameters help

Name Type
spender
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function approve(address spender, uint256 amount) public returns (bool) {
  _approve(_msgSender(), spender, amount);
  return true;
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
) public returns (bool) {
  if (paused() == true) {
    // frozen contract , only white list pass
    require(
      whiteAccountMap[msg.sender] != 0,
      "contract is in  paused, can't transfer"
    );
    if (msg.sender != _from) {
      require(
        whiteAccountMap[_from] != 0,
        "contract is in  paused, can't transfer"
      );
    }
  } else {
    // check black list
    require(
      blackAccountMap[msg.sender] == 0,
      "address in black list, can't transfer"
    );
    if (msg.sender != _from) {
      require(
        blackAccountMap[_from] == 0,
        "address in black list, can't transfer"
      );
    }
  }

  return super.transferFrom(_from, _to, _value);
}

Parameters help

Name Type
spender
address help
addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function increaseAllowance(address spender, uint256 addedValue)
  public
  returns (bool)
{
  _approve(
    _msgSender(),
    spender,
    _allowances[_msgSender()][spender].add(addedValue)
  );
  return true;
}

Parameters help

Name Type
spender
address help
subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
  public
  returns (bool)
{
  _approve(
    _msgSender(),
    spender,
    _allowances[_msgSender()][spender].sub(
      subtractedValue,
      "ERC20: decreased allowance below zero"
    )
  );
  return true;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

withdrawFromContract keyboard_arrow_up

Parameters help

Name Type
_to
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function withdrawFromContract(address _to)
  public
  onlyOwner
  validAddress(_to)
  returns (bool)
{
  uint256 contractBalance = balanceOf(address(this));
  require(contractBalance > 0, "not enough balance");

  _transfer(address(this), _to, contractBalance);
  return true;
}

addWhiteAccount keyboard_arrow_up

Parameters help

Name Type
_whiteAccount
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function addWhiteAccount(address _whiteAccount)
  public
  onlyOwner
  validAddress(_whiteAccount)
{
  require(whiteAccountMap[_whiteAccount] == 0, "has in white list");

  uint256 index = whiteAccounts.length;
  require(index < 4294967296, "white list is too long");

  whiteAccounts.length += 1;
  whiteAccounts[index] = _whiteAccount;

  whiteAccountMap[_whiteAccount] = index + 1;
  emit AddWhiteAccount(msg.sender, _whiteAccount);
}

delWhiteAccount keyboard_arrow_up

Parameters help

Name Type
_whiteAccount
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function delWhiteAccount(address _whiteAccount)
  public
  onlyOwner
  validAddress(_whiteAccount)
{
  require(whiteAccountMap[_whiteAccount] != 0, "not in white list");

  uint256 index = whiteAccountMap[_whiteAccount];
  if (index == whiteAccounts.length) {
    whiteAccounts.length -= 1;
  } else {
    address lastaddress = whiteAccounts[whiteAccounts.length - 1];
    whiteAccounts[index - 1] = lastaddress;
    whiteAccounts.length -= 1;
    whiteAccountMap[lastaddress] = index;
  }
  delete whiteAccountMap[_whiteAccount];
  emit DelWhiteAccount(msg.sender, _whiteAccount);
}

addBlackAccount keyboard_arrow_up

Parameters help

Name Type
_blackAccount
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function addBlackAccount(address _blackAccount)
  public
  onlyOwner
  validAddress(_blackAccount)
{
  require(blackAccountMap[_blackAccount] == 0, "has in black list");

  uint256 index = blackAccounts.length;
  require(index < 4294967296, "black list is too long");

  blackAccounts.length += 1;
  blackAccounts[index] = _blackAccount;
  blackAccountMap[_blackAccount] = index + 1;

  emit AddBlackAccount(msg.sender, _blackAccount);
}

delBlackAccount keyboard_arrow_up

Parameters help

Name Type
_blackAccount
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function delBlackAccount(address _blackAccount)
  public
  onlyOwner
  validAddress(_blackAccount)
{
  require(blackAccountMap[_blackAccount] != 0, "not in black list");

  uint256 index = blackAccountMap[_blackAccount];
  if (index == blackAccounts.length) {
    blackAccounts.length -= 1;
  } else {
    address lastaddress = blackAccounts[blackAccounts.length - 1];
    blackAccounts[index - 1] = lastaddress;
    blackAccounts.length -= 1;
    blackAccountMap[lastaddress] = index;
  }

  delete blackAccountMap[_blackAccount];
  emit DelBlackAccount(msg.sender, _blackAccount);
}

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 ERC20._transfer keyboard_arrow_up

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transfer(
  address sender,
  address recipient,
  uint256 amount
) internal {
  require(sender != address(0), "ERC20: transfer from the zero address");
  require(recipient != address(0), "ERC20: transfer to the zero address");

  _balances[sender] = _balances[sender].sub(
    amount,
    "ERC20: transfer amount exceeds balance"
  );
  _balances[recipient] = _balances[recipient].add(amount);
  emit Transfer(sender, recipient, amount);
}

internal ERC20._mint keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _mint(address account, uint256 amount) internal {
  require(account != address(0), "ERC20: mint to the zero address");

  _totalSupply = _totalSupply.add(amount);
  _balances[account] = _balances[account].add(amount);
  emit Transfer(address(0), account, amount);
}

internal ERC20._burn keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _burn(address account, uint256 amount) internal {
  require(account != address(0), "ERC20: burn from the zero address");

  _balances[account] = _balances[account].sub(
    amount,
    "ERC20: burn amount exceeds balance"
  );
  _totalSupply = _totalSupply.sub(amount);
  emit Transfer(account, address(0), amount);
}

internal ERC20._approve keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _approve(
  address owner,
  address spender,
  uint256 amount
) internal {
  require(owner != address(0), "ERC20: approve from the zero address");
  require(spender != address(0), "ERC20: approve to the zero address");

  _allowances[owner][spender] = amount;
  emit Approval(owner, spender, amount);
}

internal ERC20._burnFrom keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _burnFrom(address account, uint256 amount) internal {
  _burn(account, amount);
  _approve(
    account,
    _msgSender(),
    _allowances[account][_msgSender()].sub(
      amount,
      "ERC20: burn amount exceeds allowance"
    )
  );
}

internal Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal Pausable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _paused = false;
}

internal Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal PauserRole.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _addPauser(_msgSender());
}

internal PauserRole._addPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addPauser(address account) internal {
  _pausers.add(account);
  emit PauserAdded(account);
}

internal PauserRole._removePauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _removePauser(address account) internal {
  _pausers.remove(account);
  emit PauserRemoved(account);
}

internal Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal Ownable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  address msgSender = _msgSender();
  _owner = msgSender;
  emit OwnershipTransferred(address(0), msgSender);
}

internal Ownable._transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transferOwnership(address newOwner) internal {
  require(newOwner != address(0), "Ownable: new owner is the zero address");
  emit OwnershipTransferred(_owner, newOwner);
  _owner = newOwner;
}

internal Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}