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
Constants (1) keyboard_arrow_up
State Variables (15) keyboard_arrow_up
Functions
isUpgradeAgent keyboard_arrow_up
upgradeFrom keyboard_arrow_up
Modifiers help
Requirements 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);
}
owner keyboard_arrow_up
isOwner keyboard_arrow_up
transferOwnership keyboard_arrow_up
name keyboard_arrow_up
symbol keyboard_arrow_up
decimals keyboard_arrow_up
isPauser keyboard_arrow_up
addPauser keyboard_arrow_up
removePauser keyboard_arrow_up
paused keyboard_arrow_up
pause keyboard_arrow_up
unpause keyboard_arrow_up
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
allowance keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
Source Code
function transfer(address to, uint256 value)
public
whenNotPaused
returns (bool)
{
return super.transfer(to, value);
}
approve keyboard_arrow_up
Requirements help
One or more of the following:
Source Code
function approve(address spender, uint256 value)
public
whenNotPaused
returns (bool)
{
return super.approve(spender, value);
}
transferFrom keyboard_arrow_up
Requirements help
Source Code
function transferFrom(
address from,
address to,
uint256 value
) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
increaseAllowance keyboard_arrow_up
Requirements help
Source Code
function increaseAllowance(address spender, uint256 addedValue)
public
whenNotPaused
returns (bool)
{
return super.increaseAllowance(spender, addedValue);
}
decreaseAllowance keyboard_arrow_up
Requirements help
Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
public
whenNotPaused
returns (bool)
{
return super.decreaseAllowance(spender, subtractedValue);
}
upgrade keyboard_arrow_up
Requirements help
One or more of the following:
-
state
must be equal to
UpgradeState.Upgrading
- OR
state
must be equal to
UpgradeState.ReadyToUpgrade
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);
}
setUpgradeAgent keyboard_arrow_up
Modifiers help
onlyUpgradeMaster checks for the following:
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");
}
getUpgradeState keyboard_arrow_up
Parameters help
This function has no parameters.
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;
}
}
setUpgradeMaster keyboard_arrow_up
Modifiers help
onlyUpgradeMaster checks for the following:
Source Code
function setUpgradeMaster(address master)
external
onlyUpgradeMaster
validateAddress(master)
{
upgradeMaster = master;
}
recoverToken keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
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);
}
reclaimContract keyboard_arrow_up
tokenFallback keyboard_arrow_up
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");
}
recoverEther 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 ERC20._transfer keyboard_arrow_up
Requirements help
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
Requirements help
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
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
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
Requirements help
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
internal PauserRole.constructor keyboard_arrow_up
internal PauserRole._addPauser keyboard_arrow_up
internal PauserRole._removePauser keyboard_arrow_up
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
internal Ownable._transferOwnership keyboard_arrow_up
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;
}