Blockwell

Blockium Token

ERC20

This contract is an ERC20 token.

Name Blockium Token
Symbol BOK
Decimals 18
Total Supply 650,000,000 BOK

About

Stats

Public Functions 30
Event Types 9
Code Size 34,011 bytes

Library Use

Uses SafeMath for uint256.

Events (9) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

LogUpgrade Event

Parameters help
from
address help
to
address help
value
uint256 help

LogUpgradeAgentSet Event

Parameters help
agent
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

Unpaused Event

Parameters help
account
address help

MAX_UINT Constant

uint256 help
UNKNOWN VALUE - 1

upgradeMaster Variable

address help

upgradeAgent Variable

address help

totalUpgraded Variable

uint256 help

previousToken Variable

address help

version Variable

string help

_balances Variable

mapping(address => uint256) help
Internal Variable

_allowances Variable

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

_totalSupply Variable

uint256 help
Internal Variable

_paused Variable

bool help
Internal Variable

_pausers Variable

Roles.Role help
Internal Variable

_pausersCount Variable

uint256 help
Internal Variable

_name Variable

string help
Internal Variable

_symbol Variable

string help
Internal Variable

_decimals Variable

uint8 help
Internal Variable

_owner Variable

address help
Internal Variable

Functions Expand All Collapse All

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
function isUpgradeAgent() external pure returns (bool) {
  return true;
}

Parameters help

Name Type
_from
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function upgradeFrom(address _from, uint256 _value)
  external
  validateAddress(_from)
{
  require(previousToken != address(0), "previousToken was not set");
  require(
    msg.sender == previousToken,
    "upgradeFrom should only be called by previousToken"
  );
  _mint(_from, _value);
}

Parameters help

This function has no parameters.

Properties

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

Parameters help

This function has no parameters.

Properties

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

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);
}

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

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);
}

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);
}

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null

Requirements help

Source Code
function removePauser(address account) public onlyPauser {
  _removePauser(account);
}

Parameters help

This function has no parameters.

Properties

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

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(msg.sender);
}

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(msg.sender);
}

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

Properties

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

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
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function transfer(address to, uint256 value)
  public
  whenNotPaused
  returns (bool)
{
  return super.transfer(to, value);
}

Parameters help

Name Type
spender
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function approve(address spender, uint256 value)
  public
  whenNotPaused
  returns (bool)
{
  return super.approve(spender, value);
}

Parameters help

Name Type
from
address help
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function transferFrom(
  address from,
  address to,
  uint256 value
) public whenNotPaused returns (bool) {
  return super.transferFrom(from, to, value);
}

Parameters help

Name Type
spender
address help
addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function increaseAllowance(address spender, uint256 addedValue)
  public
  whenNotPaused
  returns (bool)
{
  return super.increaseAllowance(spender, addedValue);
}

Parameters help

Name Type
spender
address help
subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
  public
  whenNotPaused
  returns (bool)
{
  return super.decreaseAllowance(spender, subtractedValue);
}

Parameters help

Name Type
value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function upgrade(uint256 value) external {
  UpgradeState state = getUpgradeState();
  require(
    state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading,
    "upgrade state does not allow upgrade"
  );
  require(value != 0, "value must be non-zero");

  // Take tokens out from circulation
  _burn(msg.sender, value);
  totalUpgraded = totalUpgraded.add(value);
  emit LogUpgrade(msg.sender, address(upgradeAgent), value);

  // Upgrade agent reissues the tokens
  upgradeAgent.upgradeFrom(msg.sender, value);
}

Parameters help

Name Type
newUpgradeAgent
UpgradeAgent help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setUpgradeAgent(UpgradeAgent newUpgradeAgent)
  external
  onlyUpgradeMaster
  validateAddress(address(newUpgradeAgent))
{
  require(
    getUpgradeState() != UpgradeState.Upgrading,
    "upgrade already started"
  );

  upgradeAgent = newUpgradeAgent;
  emit LogUpgradeAgentSet(address(newUpgradeAgent));

  // Calling non-existent function will revert inside the call without this require error message
  require(newUpgradeAgent.isUpgradeAgent(), "Bad interface");
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function getUpgradeState() public view returns (UpgradeState) {
  if (address(upgradeAgent) == address(0)) {
    return UpgradeState.WaitingForAgent;
  } else if (totalUpgraded == 0) {
    return UpgradeState.ReadyToUpgrade;
  } else if (totalUpgraded < totalSupply()) {
    return UpgradeState.Upgrading;
  } else {
    return UpgradeState.UpgradeFinished;
  }
}

Parameters help

Name Type
master
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setUpgradeMaster(address master)
  external
  onlyUpgradeMaster
  validateAddress(master)
{
  upgradeMaster = master;
}

Parameters help

Name Type
_token
IERC20 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function recoverToken(IERC20 _token) external onlyOwner {
  uint256 balance = _token.balanceOf(address(this));
  require(balance > 0, "no tokens to recover for received token type");
  SafeERC20.safeTransfer(_token, _owner, balance);
}

Parameters help

Name Type
contractInst
Ownable help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function reclaimContract(Ownable contractInst) external onlyOwner {
  contractInst.transferOwnership(_owner);
}

Parameters help

Name Type
from
address help
value
uint256 help
data
bytes help

Properties

Visibility help public
Mutability help pure
Source Code
function tokenFallback(
  address from,
  uint256 value,
  bytes calldata data
) external pure {
  /* Use variables to remove warnings https://github.com/OpenZeppelin/openzeppelin-solidity/commit/b50391862c42857e3ff2388598e52ebab92fc9fa#diff-24aa1138eec9d5dd65b1a8a898e04dd2 */
  from;
  value;
  data;
  revert("this contract does not support receiving ERC223 tokens");
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function recoverEther() external onlyOwner {
  require(address(this).balance > 0, "no ether to recover");
  address(uint160(_owner)).transfer(address(this).balance);
}

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
from
address help
to
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transfer(
  address from,
  address to,
  uint256 value
) internal {
  require(from != address(0), "ERC20: transfer from the zero address");
  require(to != address(0), "ERC20: transfer to the zero address");
  require(to != address(this), "ERC20: transfer to the contract address");

  _balances[from] = _balances[from].sub(value);
  _balances[to] = _balances[to].add(value);
  emit Transfer(from, to, value);
}

internal ERC20._mint keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _mint(address account, uint256 value) internal {
  require(account != address(0), "ERC20: mint to the zero address");
  require(account != address(this), "ERC20: mint to the contract address");
  require(value != 0, "ERC20: mint value must be positive");

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

internal ERC20._burn keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

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

internal ERC20._approve keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

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

internal ERC20._burnFrom keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burnFrom(address account, uint256 value) internal {
  _burn(account, value);
  _approve(account, msg.sender, _allowances[account][msg.sender].sub(value));
}

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 PauserRole.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _addPauser(msg.sender);
}

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 {
  _pausersCount = _pausersCount.add(1);
  _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

Requirements help

Source Code
function _removePauser(address account) internal {
  require(
    _pausersCount > 1,
    "PauserRole: there should always be at least one pauser left"
  );
  _pausersCount = _pausersCount.sub(1);
  _pausers.remove(account);
  emit PauserRemoved(account);
}

internal Ownable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

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");
  require(
    newOwner != address(this),
    "Ownable: new owner is the contract address"
  );
  emit OwnershipTransferred(_owner, newOwner);
  _owner = newOwner;
}