Blockwell

Neutrino USD

ERC20

This contract is an ERC20 token.

Name Neutrino USD
Symbol USDN
Decimals 18
Total Supply 309,281,087 USDN

About link description

Neutrino USD (USDN) is a cryptocurrency and operates on the Ethereum platform. Neutrino USD has a current supply of 397,595,858.8219527 with 397,595,282.279442 in circulation. The last known price of Neutrino USD is 0.99872197 USD and is up 0.19 over the last 24 hours. It is currently trading on 29 active market(s) with $13,231,386.98 traded over the last 24 hours. More information can be found at https://neutrino.at/.

Stats

Public Functions 16
Event Types 4
Code Size 11,580 bytes

Events (4) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

Deprecate Event

Parameters help
account
address help

Reward Event

Parameters help
id
uint256 help
amount
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

PERCENT_FACTOR Constant

uint256 help
UNKNOWN VALUE

_percents Variable

uint256[] help
Internal Variable

_liquidTotalSupply Variable

uint256 help
Internal Variable

_liquidDeposit Variable

uint256 help
Internal Variable

_balances Variable

mapping(address => uint256) help
Internal Variable

_deposits Variable

mapping(address => uint256) help
Internal Variable

_rewardIndexForAccount Variable

mapping(address => uint256) help
Internal Variable

_allowances Variable

mapping(address => mapping(address => uint256)) help
Internal Variable

_owner Variable

address help
Internal Variable

_admin Variable

address help
Internal Variable

deprecated Variable

bool help
Internal Variable

Functions Expand All Collapse All

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferOwnership(address newOwner) external virtual onlyOwner {
  require(newOwner != address(0), "Ownable: new owner is the zero address");
  _owner = newOwner;
}

deprecate keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function deprecate() external onlyOwner {
  deprecated = true;
  emit Deprecate(msg.sender);
}

deposit keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function deposit(address account, uint256 amount)
  external
  virtual
  override
  onlyOwner
  onlyNotDeprecated
  returns (bool)
{
  require(amount > 0, "amount should be > 0");
  require(account != address(0), "deposit to the zero address");

  uint256 liquidDeposit = _liquidDeposit;
  require(
    liquidDeposit + amount >= liquidDeposit,
    "addition overflow for deposit"
  );
  _liquidDeposit = liquidDeposit + amount;

  uint256 oldDeposit = _deposits[account];
  if (oldDeposit == 0) {
    _balances[account] = balanceOf(account);
    _rewardIndexForAccount[account] = _percents.length - 1;
    _deposits[account] = amount;
  } else {
    uint256 rewardIndex = _rewardIndexForAccount[account];
    if (rewardIndex == _percents.length - 1) {
      require(
        oldDeposit + amount >= oldDeposit,
        "addition overflow for deposit"
      );
      _deposits[account] = oldDeposit + amount;
    } else {
      _balances[account] = balanceOf(account);
      _rewardIndexForAccount[account] = _percents.length - 1;
      _deposits[account] = amount;
    }
  }

  emit Transfer(address(0), account, amount);
  return true;
}

stake keyboard_arrow_up

Parameters help

Name Type
reward
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function stake(uint256 reward)
  external
  virtual
  override
  onlyOwner
  onlyNotDeprecated
  returns (bool)
{
  require(reward > 0, "reward should be > 0");

  uint256 liquidTotalSupply = _liquidTotalSupply;
  uint256 liquidDeposit = _liquidDeposit;

  if (liquidTotalSupply == 0) {
    _percents.push(PERCENT_FACTOR);
  } else {
    uint256 oldPercent = _percents[_percents.length - 1];
    uint256 percent = (reward * PERCENT_FACTOR) / liquidTotalSupply;
    require(
      percent + PERCENT_FACTOR >= percent,
      "addition overflow for percent"
    );
    uint256 newPercent = percent + PERCENT_FACTOR;
    _percents.push((newPercent * oldPercent) / PERCENT_FACTOR);

    require(
      liquidTotalSupply + reward >= liquidTotalSupply,
      "addition overflow for total supply + reward"
    );
    liquidTotalSupply = liquidTotalSupply + reward;
  }

  require(
    liquidTotalSupply + liquidDeposit >= liquidTotalSupply,
    "addition overflow for total supply"
  );
  _liquidTotalSupply = liquidTotalSupply + liquidDeposit;
  _liquidDeposit = 0;

  emit Reward(_percents.length, reward);
  return true;
}

withdraw keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function withdraw(address account)
  external
  virtual
  override
  onlyOwner
  onlyNotDeprecated
  returns (bool)
{
  uint256 oldDeposit = _deposits[account];
  uint256 rewardIndex = _rewardIndexForAccount[account];

  if (rewardIndex == _percents.length - 1) {
    uint256 balance = _balances[account];
    require(
      balance <= _liquidTotalSupply,
      "subtraction overflow for total supply"
    );
    _liquidTotalSupply = _liquidTotalSupply - balance;

    require(
      oldDeposit <= _liquidDeposit,
      "subtraction overflow for liquid deposit"
    );
    _liquidDeposit = _liquidDeposit - oldDeposit;

    require(
      balance + oldDeposit >= balance,
      "addition overflow for total balance + oldDeposit"
    );
    emit Transfer(account, address(0), balance + oldDeposit);
  } else {
    uint256 balance = balanceOf(account);
    uint256 liquidTotalSupply = _liquidTotalSupply;
    require(
      balance <= liquidTotalSupply,
      "subtraction overflow for total supply"
    );
    _liquidTotalSupply = liquidTotalSupply - balance;
    emit Transfer(account, address(0), balance);
  }

  _balances[account] = 0;
  _deposits[account] = 0;
  return true;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() external view virtual override returns (uint256) {
  uint256 liquidTotalSupply = _liquidTotalSupply;
  uint256 liquidDeposit = _liquidDeposit;

  require(
    liquidTotalSupply + liquidDeposit >= liquidTotalSupply,
    "addition overflow for total supply"
  );
  return liquidTotalSupply + liquidDeposit;
}

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address account)
  public
  view
  virtual
  override
  returns (uint256)
{
  uint256 balance = _balances[account];
  uint256 oldDeposit = _deposits[account];

  if (balance == 0 && oldDeposit == 0) {
    return 0;
  }

  uint256 rewardIndex = _rewardIndexForAccount[account];
  if (rewardIndex == _percents.length - 1) {
    require(balance + oldDeposit >= balance, "addition overflow for balance");
    return balance + oldDeposit;
  }

  if (oldDeposit == 0) {
    uint256 profit = _percents[_percents.length - 1];
    return (profit * balance) / _percents[rewardIndex];
  } else {
    uint256 newBalance = (balance * _percents[_percents.length - 1]) /
      _percents[rewardIndex];
    uint256 profit = (oldDeposit * _percents[_percents.length - 1]) /
      _percents[rewardIndex + 1];
    require(profit + newBalance >= newBalance, "addition overflow for balance");
    return profit + newBalance;
  }
}

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)
  external
  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)
  external
  virtual
  override
  returns (bool)
{
  _approve(msg.sender, spender, amount);
  return true;
}

Parameters help

Name Type
spender
address help
addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function increaseAllowance(address spender, uint256 addedValue)
  external
  virtual
  override
  returns (bool)
{
  uint256 temp = _allowances[msg.sender][spender];
  require(temp + addedValue >= temp, "addition overflow");
  _approve(msg.sender, spender, temp + addedValue);
  return true;
}

Parameters help

Name Type
spender
address help
subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
  external
  virtual
  override
  returns (bool)
{
  uint256 temp = _allowances[msg.sender][spender];
  require(subtractedValue <= temp, "ERC20: decreased allowance below zero");
  _approve(msg.sender, spender, temp - subtractedValue);
  return true;
}

Parameters help

Name Type
recipient
address help
amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address recipient, uint256 amount)
  external
  virtual
  override
  returns (bool)
{
  _transfer(msg.sender, recipient, amount);
  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
) external virtual override returns (bool) {
  _transfer(sender, recipient, amount);

  uint256 temp = _allowances[sender][msg.sender];
  require(amount <= temp, "ERC20: transfer amount exceeds allowance");
  _approve(sender, msg.sender, temp - amount);
  return true;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
function name() external pure returns (string memory) {
  return "Neutrino USD";
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
function symbol() external pure returns (string memory) {
  return "USDN";
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
function decimals() external pure returns (uint8) {
  return 18;
}

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 StandartToken._approve keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Requirements help

Source Code
function _approve(
  address owner,
  address spender,
  uint256 amount
) internal virtual onlyNotDeprecated {
  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 StandartToken._transfer keyboard_arrow_up

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function _transfer(
  address sender,
  address recipient,
  uint256 amount
) internal virtual onlyNotDeprecated {
  require(amount > 0, "amount should be > 0");
  require(sender != address(0), "ERC20: transfer from the zero address");
  require(recipient != address(0), "ERC20: transfer to the zero address");

  uint256 oldDeposit = _deposits[sender];
  uint256 rewardIndex = _rewardIndexForAccount[sender];
  uint256 depositDiff = 0;

  if (oldDeposit == 0 || rewardIndex != _percents.length - 1) {
    uint256 senderBalance = balanceOf(sender);
    require(amount <= senderBalance, "ERC20: transfer amount exceeds balance");
    _balances[sender] = senderBalance - amount;

    _deposits[sender] = 0;
    _rewardIndexForAccount[sender] = _percents.length - 1;
  } else {
    if (amount <= oldDeposit) {
      _deposits[sender] = oldDeposit - amount;
      depositDiff = amount;
    } else {
      uint256 senderBalance = _balances[sender];
      require(
        amount - oldDeposit <= senderBalance,
        "ERC20: transfer amount exceeds balance"
      );
      _balances[sender] = senderBalance - (amount - oldDeposit);
      _deposits[sender] = 0;
      depositDiff = oldDeposit;
    }
  }

  oldDeposit = _deposits[recipient];
  rewardIndex = _rewardIndexForAccount[recipient];
  if (oldDeposit == 0 || rewardIndex != _percents.length - 1) {
    uint256 recipientBalance = balanceOf(recipient);
    require(
      (amount - depositDiff) + recipientBalance >= recipientBalance,
      "ERC20: addition overflow for recipient balance"
    );
    _balances[recipient] = recipientBalance + (amount - depositDiff);
    _rewardIndexForAccount[recipient] = _percents.length - 1;
    _deposits[recipient] = depositDiff;
  } else {
    uint256 recipientBalance = _balances[recipient];
    _balances[recipient] = recipientBalance + (amount - depositDiff);
    _deposits[recipient] = oldDeposit + depositDiff;
  }

  emit Transfer(sender, recipient, amount);
}