Blockwell

SWARM

ERC20

This contract is an ERC20 token.

Name SWARM
Symbol SWM
Decimals 18
Total Supply 100,000,000 SWM

About link description

Swarm (SWM) is a cryptocurrency and operates on the Ethereum platform. Swarm has a current supply of 99,535,052.4739791 with 78,189,670.12433334 in circulation. The last known price of Swarm is 0.06169954 USD and is up 4.85 over the last 24 hours. It is currently trading on 9 active market(s) with $20,215.36 traded over the last 24 hours. More information can be found at https://www.swarmnetwork.org.

Stats

Public Functions 21
Event Types 6
Code Size 9,215 bytes

Events (6) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

ClaimedEther Event

Parameters help
controller
address help
amount
uint256 help

ClaimedTokens Event

Parameters help
token
address help
controller
address help
amount
uint256 help

ControllerTransferred Event

Parameters help
recipient
address help

DocumentUpdated Event

Parameters help
hash
bytes32 help
url
string help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

Document Struct

Members
hash
bytes32 help
url
string help

_document Variable

Document 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

_controller Variable

address help
Internal Variable

Functions Expand All Collapse All

controller keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

transferController keyboard_arrow_up

Parameters help

Name Type
recipient
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferController(address recipient) public onlyController {
  require(
    recipient != address(0),
    "Controlled: new controller is the zero address"
  );
  _controller = recipient;
  emit ControllerTransferred(_controller);
}

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
recipient
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transfer(address recipient, uint256 amount) public returns (bool) {
  _transfer(msg.sender, recipient, amount);
  return true;
}

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

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function approve(address spender, uint256 value) public returns (bool) {
  _approve(msg.sender, spender, value);
  return true;
}

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address sender,
  address recipient,
  uint256 amount
) public returns (bool) {
  _transfer(sender, recipient, amount);
  _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
  return true;
}

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(
    msg.sender,
    spender,
    _allowances[msg.sender][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(
    msg.sender,
    spender,
    _allowances[msg.sender][spender].sub(subtractedValue)
  );
  return true;
}

burn keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function burn(uint256 amount) public {
  _burn(msg.sender, amount);
}

burnFrom keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function burnFrom(address account, uint256 amount) public {
  _burnFrom(account, amount);
}

approveAndCall keyboard_arrow_up

Parameters help

Name Type
spender
address help
value
uint256 help
extraData
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function approveAndCall(
  address spender,
  uint256 value,
  bytes memory extraData
) public returns (bool) {
  require(
    value == 0 || allowance(msg.sender, spender) == 0,
    "SwarmToken: not clean allowance state"
  );

  _approve(msg.sender, spender, value);
  ISwarmTokenRecipient(spender).receiveApproval(
    msg.sender,
    value,
    address(this),
    extraData
  );
  return true;
}

getDocument keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function getDocument() external view returns (bytes32, string memory) {
  return (_document.hash, _document.url);
}

updateDocument keyboard_arrow_up

Parameters help

Name Type
hash
bytes32 help
url
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateDocument(bytes32 hash, string calldata url)
  external
  onlyController
  returns (bool)
{
  return _updateDocument(hash, url);
}

claimTokens keyboard_arrow_up

Parameters help

Name Type
token
IERC20 help

Properties

Visibility help public
Mutability help transaction
Source Code
function claimTokens(IERC20 token) external onlyController returns (bool) {
  uint256 balance = token.balanceOf(address(this));
  token.transfer(msg.sender, balance);

  emit ClaimedTokens(address(token), msg.sender, balance);

  return true;
}

claimEther keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function claimEther() external onlyController returns (bool) {
  uint256 balance = address(this).balance;
  msg.sender.transfer(balance);

  emit ClaimedEther(msg.sender, balance);

  return true;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

Source Code
function() external payable {
  require(msg.data.length == 0);
}

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 SwarmToken._updateDocument keyboard_arrow_up

Parameters help

Name Type
hash
bytes32 help
url
string help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _updateDocument(bytes32 hash, string memory url)
  internal
  returns (bool)
{
  _document.hash = hash;
  _document.url = url;

  emit DocumentUpdated(hash, url);

  return true;
}

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);
  _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
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");

  _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
amount
uint256 help

Properties

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

internal Controlled.constructor keyboard_arrow_up

Parameters help

Name Type
controller
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor(address controller) internal {
  _controller = controller;
  emit ControllerTransferred(_controller);
}