Blockwell

STAKE

ERC20

This contract is an ERC20 token.

Name STAKE
Symbol STAKE
Decimals 18
Total Supply 8,642,506 STAKE

About link description

xDai (STAKE) is a cryptocurrency and operates on the Ethereum platform. xDai has a current supply of 8,382,505.79789401 with 5,931,767.74222667 in circulation. The last known price of xDai is 6.83034808 USD and is down -2.44 over the last 24 hours. It is currently trading on 23 active market(s) with $881,553.20 traded over the last 24 hours. More information can be found at http://xdaichain.com/.

Stats

Public Functions 27
Event Types 8
Code Size 43,915 bytes

Events (8) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

BridgeAdded Event

Parameters help
bridge
address help

BridgeRemoved Event

Parameters help
bridge
address help

ContractFallbackCallFailed Event

Parameters help
from
address help
to
address help
value
uint256 help

Mint Event

Parameters help
to
address help
amount
uint256 help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help
data
bytes help

F_ADDR Constant

address help

MAX_BRIDGES Constant

uint256 help
50

version Constant

string help
1

PERMIT_TYPEHASH Constant

bytes32 help
0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb

bridgeCount Variable

uint256 help

distributionAddress Variable

address help

privateOfferingDistributionAddress Variable

address help

advisorsRewardDistributionAddress Variable

address help

DOMAIN_SEPARATOR Variable

bytes32 help

bridgePointers Variable

mapping(address => address) help

nonces Variable

mapping(address => uint256) help

_owner Variable

address help
Internal Variable

expirations Variable

mapping(address => mapping(address => uint256)) 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

Functions Expand All Collapse All

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) {
  _superTransfer(_to, _value);
  _callAfterTransfer(msg.sender, _to, _value);
  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
_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) {
  _superTransferFrom(_from, _to, _value);
  _callAfterTransfer(_from, _to, _value);
  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;
}

push keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function push(address _to, uint256 _amount) public {
  transferFrom(msg.sender, _to, _amount);
}

pull keyboard_arrow_up

Parameters help

Name Type
_from
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function pull(address _from, uint256 _amount) public {
  transferFrom(_from, msg.sender, _amount);
}

move keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function move(
  address _from,
  address _to,
  uint256 _amount
) public {
  transferFrom(_from, _to, _amount);
}

permit keyboard_arrow_up

Parameters help

Name Type
_holder
address help
_spender
address help
_nonce
uint256 help
_expiry
uint256 help
_allowed
bool help
_v
uint8 help
_r
bytes32 help
_s
bytes32 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function permit(
  address _holder,
  address _spender,
  uint256 _nonce,
  uint256 _expiry,
  bool _allowed,
  uint8 _v,
  bytes32 _r,
  bytes32 _s
) external {
  require(_expiry == 0 || _now() <= _expiry, "invalid expiry");

  bytes32 digest = keccak256(
    abi.encodePacked(
      "\x19\x01",
      DOMAIN_SEPARATOR,
      keccak256(
        abi.encode(
          PERMIT_TYPEHASH,
          _holder,
          _spender,
          _nonce,
          _expiry,
          _allowed
        )
      )
    )
  );

  require(
    _holder == ecrecover(digest, _v, _r, _s),
    "invalid signature or parameters"
  );
  require(_nonce == nonces[_holder]++, "invalid nonce");

  uint256 amount = _allowed ? uint256(-1) : 0;
  _approve(_holder, _spender, amount);

  expirations[_holder][_spender] = _allowed ? _expiry : 0;
}

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 msg.sender == _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 {
  revert("not implemented");
}

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

isBridge keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help view
Source Code
function isBridge(address _address) public view returns (bool) {
  return _address != F_ADDR && bridgePointers[_address] != address(0);
}

transferAndCall keyboard_arrow_up

Parameters help

Name Type
_to
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transferAndCall(
  address _to,
  uint256 _value,
  bytes calldata _data
) external validRecipient(_to) returns (bool) {
  _superTransfer(_to, _value);
  emit Transfer(msg.sender, _to, _value, _data);

  if (_to.isContract()) {
    require(
      _contractFallback(msg.sender, _to, _value, _data),
      "contract call failed"
    );
  }
  return true;
}

transferDistribution keyboard_arrow_up

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferDistribution(address _to, uint256 _value)
  public
  returns (bool)
{
  require(
    msg.sender == distributionAddress ||
      msg.sender == privateOfferingDistributionAddress ||
      msg.sender == advisorsRewardDistributionAddress,
    "wrong sender"
  );
  _superTransfer(_to, _value);
  return true;
}

claimTokens keyboard_arrow_up

Parameters help

Name Type
_token
address help
_to
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function claimTokens(address _token, address payable _to)
  public
  onlyOwner
  validRecipient(_to)
{
  if (_token == address(0)) {
    uint256 value = address(this).balance;
    if (!_to.send(value)) {
      // solium-disable-line security/no-send
      // We use the `Sacrifice` trick to be sure the coins can be 100% sent to the receiver.
      // Otherwise, if the receiver is a contract which has a revert in its fallback function,
      // the sending will fail.
      (new Sacrifice).value(value)(_to);
    }
  } else {
    ERC20 token = ERC20(_token);
    uint256 balance = token.balanceOf(address(this));
    token.safeTransfer(_to, balance);
  }
}

mint keyboard_arrow_up

Parameters help

Name Type
_account
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyBridge checks for the following:
null

Requirements help

Source Code
function mint(address _account, uint256 _amount)
  external
  onlyBridge
  returns (bool)
{
  _mint(_account, _amount);
  emit Mint(_account, _amount);
  return true;
}

addBridge keyboard_arrow_up

Parameters help

Name Type
_bridge
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function addBridge(address _bridge) external onlyOwner {
  require(
    bridgeCount < MAX_BRIDGES,
    "can't add one more bridge due to a limit"
  );
  require(_bridge.isContract(), "not a contract address");
  require(!isBridge(_bridge), "bridge already exists");

  address firstBridge = bridgePointers[F_ADDR];
  require(firstBridge != address(0), "first bridge is zero address");
  bridgePointers[F_ADDR] = _bridge;
  bridgePointers[_bridge] = firstBridge;
  bridgeCount = bridgeCount.add(1);

  emit BridgeAdded(_bridge);
}

removeBridge keyboard_arrow_up

Parameters help

Name Type
_bridge
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function removeBridge(address _bridge) external onlyOwner {
  require(isBridge(_bridge), "bridge isn't existed");

  address nextBridge = bridgePointers[_bridge];
  address index = F_ADDR;
  address next = bridgePointers[index];
  require(next != address(0), "zero address found");

  while (next != _bridge) {
    index = next;
    next = bridgePointers[index];

    require(next != F_ADDR && next != address(0), "invalid address found");
  }

  bridgePointers[index] = nextBridge;
  delete bridgePointers[_bridge];
  bridgeCount = bridgeCount.sub(1);

  emit BridgeRemoved(_bridge);
}

bridgeList keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function bridgeList() external view returns (address[] memory) {
  address[] memory list = new address[](bridgeCount);
  uint256 counter = 0;
  address nextBridge = bridgePointers[F_ADDR];
  require(nextBridge != address(0), "zero address found");

  while (nextBridge != F_ADDR) {
    list[counter] = nextBridge;
    nextBridge = bridgePointers[nextBridge];
    counter++;

    require(nextBridge != address(0), "zero address found");
  }

  return list;
}

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 ERC677BridgeToken._superTransfer keyboard_arrow_up

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _superTransfer(address _to, uint256 _value) internal {
  bool success;
  if (
    msg.sender == distributionAddress ||
    msg.sender == privateOfferingDistributionAddress ||
    msg.sender == advisorsRewardDistributionAddress
  ) {
    // Allow sending tokens to `address(0)` by
    // Distribution, PrivateOffering, or AdvisorsReward contract
    _balances[msg.sender] = _balances[msg.sender].sub(_value);
    _balances[_to] = _balances[_to].add(_value);
    emit Transfer(msg.sender, _to, _value);
    success = true;
  } else {
    success = super.transfer(_to, _value);
  }
  require(success, "transfer failed");
}

internal ERC677BridgeToken._superTransferFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _superTransferFrom(
  address _from,
  address _to,
  uint256 _value
) internal {
  bool success = super.transferFrom(_from, _to, _value);
  require(success, "transfer failed");
}

internal ERC677BridgeToken._callAfterTransfer 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 _callAfterTransfer(
  address _from,
  address _to,
  uint256 _value
) internal {
  if (
    _to.isContract() && !_contractFallback(_from, _to, _value, new bytes(0))
  ) {
    require(!isBridge(_to), "you can't transfer to bridge contract");
    require(
      _to != distributionAddress,
      "you can't transfer to Distribution contract"
    );
    require(
      _to != privateOfferingDistributionAddress,
      "you can't transfer to PrivateOffering contract"
    );
    require(
      _to != advisorsRewardDistributionAddress,
      "you can't transfer to AdvisorsReward contract"
    );
    emit ContractFallbackCallFailed(_from, _to, _value);
  }
}

internal ERC677BridgeToken._contractFallback keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help private
Mutability help transaction
Source Code
function _contractFallback(
  address _from,
  address _to,
  uint256 _value,
  bytes memory _data
) private returns (bool) {
  string memory signature = "onTokenTransfer(address,uint256,bytes)";
  // solium-disable-next-line security/no-low-level-calls
  (bool success, ) = _to.call(
    abi.encodeWithSignature(signature, _from, _value, _data)
  );
  return success;
}

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");
  emit OwnershipTransferred(_owner, newOwner);
  _owner = newOwner;
}

internal ERC20Permittable._now keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _now() internal view returns (uint256) {
  return now;
}

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