Blockwell

SushiToken

ERC20

This contract is an ERC20 token.

Name SushiToken
Symbol SUSHI
Decimals 18
Total Supply 140,544,630 SUSHI

About link

SushiSwap (SUSHI) is a cryptocurrency and operates on the Ethereum platform. SushiSwap has a current supply of 228,198,226.43730047 with 127,244,443 in circulation. The last known price of SushiSwap is 6.60053212 USD and is down -1.90 over the last 24 hours. It is currently trading on 205 active market(s) with $159,626,088.33 traded over the last 24 hours. More information can be found at https://sushi.com/.

Stats

Public Functions 20
Event Types 5
Code Size 37,741 bytes

Events (5) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

DelegateChanged Event

Parameters help
delegator
address help
fromDelegate
address help
toDelegate
address help

DelegateVotesChanged Event

Parameters help
delegate
address help
previousBalance
uint help
newBalance
uint help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

Checkpoint Struct

Members
fromBlock
uint32 help
votes
uint256 help

DOMAIN_TYPEHASH Constant

bytes32 help
the result of calling keccak256 with "EIP712Domain(string name,uint256 chainId,address verifyingContract)"

DELEGATION_TYPEHASH Constant

bytes32 help
the result of calling keccak256 with "Delegation(address delegatee,uint256 nonce,uint256 expiry)"

numCheckpoints Variable

mapping(address => uint32) help

nonces Variable

mapping(address => uint) help

_delegates Variable

mapping(address => address) help
Internal Variable

checkpoints Variable

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

_owner Variable

address 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 owner() public view returns (address) {
  return _owner;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function renounceOwnership() public virtual onlyOwner {
  emit OwnershipTransferred(_owner, address(0));
  _owner = address(0);
}

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transferOwnership(address newOwner) public virtual onlyOwner {
  require(newOwner != address(0), "Ownable: new owner is the zero address");
  emit OwnershipTransferred(_owner, newOwner);
  _owner = 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

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view override 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 override 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
  virtual
  override
  returns (bool)
{
  _transfer(_msgSender(), 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
  virtual
  override
  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
  virtual
  override
  returns (bool)
{
  _approve(_msgSender(), spender, amount);
  return true;
}

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferFrom(
  address sender,
  address recipient,
  uint256 amount
) public virtual override returns (bool) {
  _transfer(sender, recipient, amount);
  _approve(
    sender,
    _msgSender(),
    _allowances[sender][_msgSender()].sub(
      amount,
      "ERC20: transfer amount exceeds allowance"
    )
  );
  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
  virtual
  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
  virtual
  returns (bool)
{
  _approve(
    _msgSender(),
    spender,
    _allowances[_msgSender()][spender].sub(
      subtractedValue,
      "ERC20: decreased allowance below zero"
    )
  );
  return true;
}

Parameters help

Name Type
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function mint(address _to, uint256 _amount) public onlyOwner {
  _mint(_to, _amount);
  _moveDelegates(address(0), _delegates[_to], _amount);
}

Parameters help

Name Type
delegator
address help

Properties

Visibility help public
Mutability help view
Source Code
function delegates(address delegator) external view returns (address) {
  return _delegates[delegator];
}

Parameters help

Name Type
delegatee
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function delegate(address delegatee) external {
  return _delegate(msg.sender, delegatee);
}

Parameters help

Name Type
delegatee
address help
nonce
uint help
expiry
uint help
v
uint8 help
r
bytes32 help
s
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function delegateBySig(
  address delegatee,
  uint256 nonce,
  uint256 expiry,
  uint8 v,
  bytes32 r,
  bytes32 s
) external {
  bytes32 domainSeparator = keccak256(
    abi.encode(
      DOMAIN_TYPEHASH,
      keccak256(bytes(name())),
      getChainId(),
      address(this)
    )
  );

  bytes32 structHash = keccak256(
    abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
  );

  bytes32 digest = keccak256(
    abi.encodePacked("\x19\x01", domainSeparator, structHash)
  );

  address signatory = ecrecover(digest, v, r, s);
  require(signatory != address(0), "SUSHI::delegateBySig: invalid signature");
  require(nonce == nonces[signatory]++, "SUSHI::delegateBySig: invalid nonce");
  require(now <= expiry, "SUSHI::delegateBySig: signature expired");
  return _delegate(signatory, delegatee);
}

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function getCurrentVotes(address account) external view returns (uint256) {
  uint32 nCheckpoints = numCheckpoints[account];
  return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}

Parameters help

Name Type
account
address help
blockNumber
uint help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function getPriorVotes(address account, uint256 blockNumber)
  external
  view
  returns (uint256)
{
  require(
    blockNumber < block.number,
    "SUSHI::getPriorVotes: not yet determined"
  );

  uint32 nCheckpoints = numCheckpoints[account];
  if (nCheckpoints == 0) {
    return 0;
  }

  // First check most recent balance
  if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
    return checkpoints[account][nCheckpoints - 1].votes;
  }

  // Next check implicit zero balance
  if (checkpoints[account][0].fromBlock > blockNumber) {
    return 0;
  }

  uint32 lower = 0;
  uint32 upper = nCheckpoints - 1;
  while (upper > lower) {
    uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
    Checkpoint memory cp = checkpoints[account][center];
    if (cp.fromBlock == blockNumber) {
      return cp.votes;
    } else if (cp.fromBlock < blockNumber) {
      lower = center;
    } else {
      upper = center - 1;
    }
  }
  return checkpoints[account][lower].votes;
}

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 SushiToken._delegate keyboard_arrow_up

Parameters help

Name Type
delegator
address help
delegatee
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _delegate(address delegator, address delegatee) internal {
  address currentDelegate = _delegates[delegator];
  uint256 delegatorBalance = balanceOf(delegator); // balance of underlying SUSHIs (not scaled);
  _delegates[delegator] = delegatee;

  emit DelegateChanged(delegator, currentDelegate, delegatee);

  _moveDelegates(currentDelegate, delegatee, delegatorBalance);
}

internal SushiToken._moveDelegates keyboard_arrow_up

Parameters help

Name Type
srcRep
address help
dstRep
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _moveDelegates(
  address srcRep,
  address dstRep,
  uint256 amount
) internal {
  if (srcRep != dstRep && amount > 0) {
    if (srcRep != address(0)) {
      // decrease old representative
      uint32 srcRepNum = numCheckpoints[srcRep];
      uint256 srcRepOld = srcRepNum > 0
        ? checkpoints[srcRep][srcRepNum - 1].votes
        : 0;
      uint256 srcRepNew = srcRepOld.sub(amount);
      _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
    }

    if (dstRep != address(0)) {
      // increase new representative
      uint32 dstRepNum = numCheckpoints[dstRep];
      uint256 dstRepOld = dstRepNum > 0
        ? checkpoints[dstRep][dstRepNum - 1].votes
        : 0;
      uint256 dstRepNew = dstRepOld.add(amount);
      _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
    }
  }
}

internal SushiToken._writeCheckpoint keyboard_arrow_up

Parameters help

Name Type
delegatee
address help
nCheckpoints
uint32 help
oldVotes
uint256 help
newVotes
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _writeCheckpoint(
  address delegatee,
  uint32 nCheckpoints,
  uint256 oldVotes,
  uint256 newVotes
) internal {
  uint32 blockNumber = safe32(
    block.number,
    "SUSHI::_writeCheckpoint: block number exceeds 32 bits"
  );

  if (
    nCheckpoints > 0 &&
    checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber
  ) {
    checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
  } else {
    checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
    numCheckpoints[delegatee] = nCheckpoints + 1;
  }

  emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}

internal SushiToken.safe32 keyboard_arrow_up

Parameters help

Name Type
n
uint help
errorMessage
string help

Properties

Visibility help internal
Mutability help pure

Requirements help

Source Code
function safe32(uint256 n, string memory errorMessage)
  internal
  pure
  returns (uint32)
{
  require(n < 2**32, errorMessage);
  return uint32(n);
}

internal SushiToken.getChainId keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help pure
Source Code
function getChainId() internal pure returns (uint256) {
  uint256 chainId;
  assembly {
    chainId := chainid()
  }
  return chainId;
}

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 virtual {
  require(sender != address(0), "ERC20: transfer from the zero address");
  require(recipient != address(0), "ERC20: transfer to the zero address");

  _beforeTokenTransfer(sender, recipient, amount);

  _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 virtual {
  require(account != address(0), "ERC20: mint to the zero address");

  _beforeTokenTransfer(address(0), account, amount);

  _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 virtual {
  require(account != address(0), "ERC20: burn from the zero address");

  _beforeTokenTransfer(account, address(0), amount);

  _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 virtual {
  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._setupDecimals keyboard_arrow_up

Parameters help

Name Type
decimals_
uint8 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setupDecimals(uint8 decimals_) internal {
  _decimals = decimals_;
}

internal ERC20._beforeTokenTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _beforeTokenTransfer(
  address from,
  address to,
  uint256 amount
) internal virtual {}

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 virtual 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 virtual 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 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 virtual 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 virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}