Blockwell

Digg

ERC20

This contract is an ERC20 token.

Name Digg
Symbol DIGG
Decimals 9
Total Supply 441 DIGG

About link

DIGG (DIGG) is a cryptocurrency and operates on the Ethereum platform. DIGG has a current supply of 6,613.10392834 with 301.83737995 in circulation. The last known price of DIGG is 33,060.62998611 USD and is up 11.12 over the last 24 hours. It is currently trading on 6 active market(s) with $43,832.16 traded over the last 24 hours. More information can be found at https://badger.finance/.

Stats

Public Functions 27
Event Types 5
Code Size 244,145 bytes

Library Use

Uses SafeMath for uint256.
Uses TypedMemView for bytes.
Uses TypedMemView for bytes29.
Uses ViewBTC for bytes29.
Uses ViewSPV for bytes29.

Events (5) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

Crossing Event

Parameters help
btcTxHash
bytes32 help
receiver
address help
amount
uint256 help
outputIndex
uint32 help

FlashMint Event

Parameters help
src
address help
wad
uint256 help
data
bytes32 help
fee
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

ADDR_LEN Constant

uint8 help
20

BTC_CAP_SQRT Constant

uint256 help
4582575700000

PROTOCOL_ID Constant

bytes3 help
0x07ffff

PERMIT_TYPEHASH Constant

bytes32 help
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9

BTC_CAP Constant

uint256 help
21 * UNKNOWN VALUE

FEE_FACTOR Constant

uint256 help
100

_NOT_ENTERED Constant

uint256 help
1

_ENTERED Constant

uint256 help
2

DOMAIN_SEPARATOR Variable

bytes32 help

relay Variable

address help

numConfs Variable

uint256 help

relayReward Variable

uint256 help

devFundDivRate Variable

uint256 help

knownOutpoints Variable

mapping(bytes32 => bool) help

nonces Variable

mapping(address => uint256) help

strudel Variable

StrudelToken help
Internal Variable

_status Variable

uint256 help
Internal Variable

initialized Variable

bool help
Internal Variable

initializing Variable

bool help
Internal Variable

______gap Variable

uint256[] help
Internal Variable

__gap Variable

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

__gap Variable

uint256[] help
Internal Variable

_owner Variable

address help
Internal Variable

__gap Variable

uint256[] help
Internal Variable

_cap Variable

uint256 help
Internal Variable

__gap Variable

uint256[] 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 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;
}

cap keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function cap() public view returns (uint256) {
  return _cap;
}

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

renounceOwnership keyboard_arrow_up

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

transferOwnership keyboard_arrow_up

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

flashMint keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help
data
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function flashMint(uint256 amount, bytes32 data) external override lock {
  // do not exceed cap
  require(
    totalSupply().add(amount) <= BTC_CAP,
    "can not borrow more than BTC cap"
  );

  // mint tokens
  _mint(msg.sender, amount);

  // hand control to borrower
  IBorrower(msg.sender).executeOnFlashMint(amount, data);

  uint256 fee = amount.div(devFundDivRate.mul(FEE_FACTOR));

  // burn tokens
  _burn(msg.sender, amount.add(fee)); // reverts if `msg.sender` does not have enough
  _mint(owner(), fee);

  emit FlashMint(msg.sender, amount, data, fee);
}

setDevFundDivRate keyboard_arrow_up

Parameters help

Name Type
_devFundDivRate
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function setDevFundDivRate(uint256 _devFundDivRate) external onlyOwner {
  require(_devFundDivRate > 0, "!devFundDivRate-0");
  devFundDivRate = _devFundDivRate;
}

initialize keyboard_arrow_up

Parameters help

Name Type
_relay
address help
_strudel
address help
_minConfs
uint256 help
_relayReward
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function initialize(
  address _relay,
  address _strudel,
  uint256 _minConfs,
  uint256 _relayReward
) public initializer {
  relay = IRelay(_relay);
  strudel = StrudelToken(_strudel);
  numConfs = _minConfs;
  relayReward = _relayReward;
  // chain constructors?
  __Flash_init("Strudel BTC", "VBTC");
  __ERC20Capped_init(BTC_CAP);
  uint256 chainId;
  assembly {
    chainId := chainid()
  }
  DOMAIN_SEPARATOR = keccak256(
    abi.encode(
      keccak256(
        "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
      ),
      keccak256(bytes("Strudel BTC")),
      keccak256(bytes("1")),
      chainId,
      address(this)
    )
  );
}

proofOpReturnAndMint keyboard_arrow_up

Parameters help

Name Type
_header
bytes help
_proof
bytes help
_version
bytes4 help
_locktime
bytes4 help
_index
uint256 help
_crossingOutputIndex
uint32 help
_vin
bytes help
_vout
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function proofOpReturnAndMint(
  bytes calldata _header,
  bytes calldata _proof,
  bytes4 _version,
  bytes4 _locktime,
  uint256 _index,
  uint32 _crossingOutputIndex,
  bytes calldata _vin,
  bytes calldata _vout
) external returns (bool) {
  return
    _provideProof(
      _header,
      _proof,
      _version,
      _locktime,
      _index,
      _crossingOutputIndex,
      _vin,
      _vout
    );
}

proofP2FSHAndMint keyboard_arrow_up

Parameters help

Name Type
_header
bytes help
_proof
bytes help
_index
uint256 help
_txid
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function proofP2FSHAndMint(
  bytes calldata _header,
  bytes calldata _proof,
  uint256 _index,
  bytes32 _txid
) external virtual returns (bool) {
  require(false, "not implemented");
}

burnFrom keyboard_arrow_up

Parameters help

Name Type
_account
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function burnFrom(address _account, uint256 _amount) external {
  uint256 decreasedAllowance = allowance(_account, _msgSender()).sub(
    _amount,
    "ERC20: burn amount exceeds allowance"
  );

  _approve(_account, _msgSender(), decreasedAllowance);
  _burn(_account, _amount);
}

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) external {
  _burn(msg.sender, _amount);
}

approveAndCall keyboard_arrow_up

Parameters help

Name Type
_spender
ITokenRecipient help
_value
uint256 help
_extraData
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function approveAndCall(
  ITokenRecipient _spender,
  uint256 _value,
  bytes calldata _extraData
) external returns (bool) {
  // not external to allow bytes memory parameters
  if (approve(address(_spender), _value)) {
    _spender.receiveApproval(msg.sender, _value, address(this), _extraData);
    return true;
  }
  return false;
}

permit keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
value
uint256 help
deadline
uint256 help
v
uint8 help
r
bytes32 help
s
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function permit(
  address owner,
  address spender,
  uint256 value,
  uint256 deadline,
  uint8 v,
  bytes32 r,
  bytes32 s
) external {
  require(deadline >= block.timestamp, "vBTC: EXPIRED");
  bytes32 digest = keccak256(
    abi.encodePacked(
      "\x19\x01",
      DOMAIN_SEPARATOR,
      keccak256(
        abi.encode(
          PERMIT_TYPEHASH,
          owner,
          spender,
          value,
          nonces[owner]++,
          deadline
        )
      )
    )
  );
  address recoveredAddress = ecrecover(digest, v, r, s);
  require(
    recoveredAddress != address(0) && recoveredAddress == owner,
    "VBTC: INVALID_SIGNATURE"
  );
  _approve(owner, spender, value);
}

setRelayReward keyboard_arrow_up

Parameters help

Name Type
_newRelayReward
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function setRelayReward(uint256 _newRelayReward) external onlyOwner {
  require(_newRelayReward > 0, "!newRelayReward-0");
  relayReward = _newRelayReward;
}

setRelayAddress keyboard_arrow_up

Parameters help

Name Type
_newRelayAddr
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function setRelayAddress(address _newRelayAddr) external onlyOwner {
  require(_newRelayAddr != address(0), "!newRelayAddr-0");
  relay = IRelay(_newRelayAddr);
}

setNumConfs keyboard_arrow_up

Parameters help

Name Type
_numConfs
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function setNumConfs(uint256 _numConfs) external onlyOwner {
  require(_numConfs > 0, "!newNumConfs-0");
  require(_numConfs < 100, "!newNumConfs-useless");
  numConfs = _numConfs;
}

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 VbtcToken._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 override(ERC20CappedUpgradeSafe, ERC20UpgradeSafe) {
  super._beforeTokenTransfer(from, to, amount);
}

internal VbtcToken.makeCompressedOutpoint keyboard_arrow_up

Parameters help

Name Type
_txid
bytes32 help
_index
uint32 help

Properties

Visibility help internal
Mutability help pure
Source Code
function makeCompressedOutpoint(bytes32 _txid, uint32 _index)
  internal
  pure
  returns (bytes32)
{
  // sacrifice 4 bytes instead of hashing
  return ((_txid >> 32) << 32) | bytes32(uint256(_index));
}

internal VbtcToken._checkInclusion keyboard_arrow_up

Parameters help

Name Type
_header
bytes29 help
_proof
bytes29 help
_index
uint256 help
_txid
bytes32 help

Properties

Visibility help internal
Mutability help view
Source Code
function _checkInclusion(
  bytes29 _header, // Header
  bytes29 _proof, // MerkleArray
  uint256 _index,
  bytes32 _txid
) internal view returns (bool) {
  // check the txn is included in the header
  require(
    ViewSPV.prove(_txid, _header.merkleRoot(), _proof, _index),
    "Bad inclusion proof"
  );

  // check the header is included in the chain
  bytes32 headerHash = _header.hash256();
  bytes32 GCD = relay.getLastReorgCommonAncestor();
  require(
    relay.isAncestor(headerHash, GCD, 2500),
    "GCD does not confirm header"
  );

  // check offset to tip
  bytes32 bestKnownDigest = relay.getBestKnownDigest();
  uint256 height = relay.findHeight(headerHash);
  require(height > 0, "height not found in relay");
  uint256 offset = relay.findHeight(bestKnownDigest).sub(height);
  require(offset >= numConfs, "Insufficient confirmations");

  return true;
}

internal VbtcToken._provideProof keyboard_arrow_up

Parameters help

Name Type
_header
bytes help
_proof
bytes help
_version
bytes4 help
_locktime
bytes4 help
_index
uint256 help
_crossingOutputIndex
uint32 help
_vin
bytes help
_vout
bytes help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _provideProof(
  bytes memory _header,
  bytes memory _proof,
  bytes4 _version,
  bytes4 _locktime,
  uint256 _index,
  uint32 _crossingOutputIndex,
  bytes memory _vin,
  bytes memory _vout
) internal returns (bool) {
  bytes32 txId = abi
  .encodePacked(_version, _vin, _vout, _locktime)
  .ref(0)
  .hash256();
  bytes32 outpoint = makeCompressedOutpoint(txId, _crossingOutputIndex);
  require(!knownOutpoints[outpoint], "already processed outputs");

  _checkInclusion(
    _header.ref(0).tryAsHeader().assertValid(),
    _proof.ref(0).tryAsMerkleArray().assertValid(),
    _index,
    txId
  );

  // mark processed
  knownOutpoints[outpoint] = true;

  // do payouts
  address account;
  uint256 amount;
  (account, amount) = doPayouts(_vout.ref(0).tryAsVout(), _crossingOutputIndex);
  emit Crossing(txId, account, amount, _crossingOutputIndex);
  return true;
}

internal VbtcToken.doPayouts keyboard_arrow_up

Parameters help

Name Type
_vout
bytes29 help
_crossingOutputIndex
uint32 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function doPayouts(bytes29 _vout, uint32 _crossingOutputIndex)
  internal
  returns (address account, uint256 amount)
{
  bytes29 output = _vout.indexVout(_crossingOutputIndex);

  // extract receiver and address
  amount = output.value() * 10**10; // wei / satosh = 10^18 / 10^8 = 10^10
  require(amount > 0, "output has 0 value");

  bytes29 opReturnPayload = output.scriptPubkey().opReturnPayload();
  require(
    opReturnPayload.len() == ADDR_LEN + 3,
    "invalid op-return payload length"
  );
  require(
    bytes3(opReturnPayload.index(0, 3)) == PROTOCOL_ID,
    "invalid protocol id"
  );
  account = address(bytes20(opReturnPayload.index(3, ADDR_LEN)));

  uint256 sqrtVbtcBefore = Babylonian.sqrt(totalSupply());
  _mint(account, amount);
  uint256 sqrtVbtcAfter = Babylonian.sqrt(totalSupply());

  // calculate the reward as area h(x) = f(x) - g(x), where f(x) = x^2 and g(x) = |minted|
  // pay out only the delta to the previous claim: H(after) - H(before)
  // this caps all minting rewards to 2/3 of BTC_CAP
  uint256 rewardAmount = BTC_CAP
  .mul(3)
  .mul(sqrtVbtcAfter)
  .add(sqrtVbtcBefore**3)
  .sub(BTC_CAP.mul(3).mul(sqrtVbtcBefore))
  .sub(sqrtVbtcAfter**3)
  .div(3)
  .div(BTC_CAP_SQRT);
  strudel.mint(account, rewardAmount);
  strudel.mint(owner(), rewardAmount.div(devFundDivRate));
}

internal FlashERC20.__Flash_init keyboard_arrow_up

Parameters help

Name Type
name
string help
symbol
string help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Flash_init(string memory name, string memory symbol)
  internal
  initializer
{
  devFundDivRate = 17;
  _status = _NOT_ENTERED;
  __ERC20_init(name, symbol);
  __Ownable_init();
}

internal Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ContextUpgradeSafe.__Context_init keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init() internal initializer {
  __Context_init_unchained();
}

internal ContextUpgradeSafe.__Context_init_unchained keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init_unchained() internal initializer {}

internal ContextUpgradeSafe._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 ContextUpgradeSafe._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 Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ERC20UpgradeSafe.__ERC20_init keyboard_arrow_up

Parameters help

Name Type
name
string help
symbol
string help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __ERC20_init(string memory name, string memory symbol)
  internal
  initializer
{
  __Context_init_unchained();
  __ERC20_init_unchained(name, symbol);
}

internal ERC20UpgradeSafe.__ERC20_init_unchained keyboard_arrow_up

Parameters help

Name Type
name
string help
symbol
string help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __ERC20_init_unchained(string memory name, string memory symbol)
  internal
  initializer
{
  _name = name;
  _symbol = symbol;
  _decimals = 18;
}

internal ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ContextUpgradeSafe.__Context_init keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init() internal initializer {
  __Context_init_unchained();
}

internal ContextUpgradeSafe.__Context_init_unchained keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init_unchained() internal initializer {}

internal ContextUpgradeSafe._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 ContextUpgradeSafe._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 Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal OwnableUpgradeSafe.__Ownable_init keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Ownable_init() internal initializer {
  __Context_init_unchained();
  __Ownable_init_unchained();
}

internal OwnableUpgradeSafe.__Ownable_init_unchained keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Ownable_init_unchained() internal initializer {
  address msgSender = _msgSender();
  _owner = msgSender;
  emit OwnershipTransferred(address(0), msgSender);
}

internal Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ContextUpgradeSafe.__Context_init keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init() internal initializer {
  __Context_init_unchained();
}

internal ContextUpgradeSafe.__Context_init_unchained keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init_unchained() internal initializer {}

internal ContextUpgradeSafe._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 ContextUpgradeSafe._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 Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ERC20CappedUpgradeSafe.__ERC20Capped_init keyboard_arrow_up

Parameters help

Name Type
cap
uint256 help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Requirements help

Source Code
function __ERC20Capped_init(uint256 cap) internal initializer {
  __Context_init_unchained();
  __ERC20Capped_init_unchained(cap);
}

internal ERC20CappedUpgradeSafe.__ERC20Capped_init_unchained keyboard_arrow_up

Parameters help

Name Type
cap
uint256 help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Requirements help

Source Code
function __ERC20Capped_init_unchained(uint256 cap) internal initializer {
  require(cap > 0, "ERC20Capped: cap is 0");
  _cap = cap;
}

internal ERC20CappedUpgradeSafe._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 override {
  super._beforeTokenTransfer(from, to, amount);

  if (from == address(0)) {
    // When minting tokens
    require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
  }
}

internal Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ERC20UpgradeSafe.__ERC20_init keyboard_arrow_up

Parameters help

Name Type
name
string help
symbol
string help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __ERC20_init(string memory name, string memory symbol)
  internal
  initializer
{
  __Context_init_unchained();
  __ERC20_init_unchained(name, symbol);
}

internal ERC20UpgradeSafe.__ERC20_init_unchained keyboard_arrow_up

Parameters help

Name Type
name
string help
symbol
string help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __ERC20_init_unchained(string memory name, string memory symbol)
  internal
  initializer
{
  _name = name;
  _symbol = symbol;
  _decimals = 18;
}

internal ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 ERC20UpgradeSafe._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 Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}

internal ContextUpgradeSafe.__Context_init keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init() internal initializer {
  __Context_init_unchained();
}

internal ContextUpgradeSafe.__Context_init_unchained keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function __Context_init_unchained() internal initializer {}

internal ContextUpgradeSafe._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 ContextUpgradeSafe._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 Initializable.isConstructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help view
Source Code
function isConstructor() private view returns (bool) {
  // extcodesize checks the size of the code stored in an address, and
  // address returns the current address. Since the code is still not
  // deployed when running a constructor, any checks on its code size will
  // yield zero, making it an effective way to detect if a contract is
  // under construction or not.
  address self = address(this);
  uint256 cs;
  assembly {
    cs := extcodesize(self)
  }
  return cs == 0;
}