Blockwell

Nexo

ERC20

This contract is an ERC20 token.

Name Nexo
Symbol NEXO
Decimals 18
Total Supply 1,000,000,000 NEXO

About

Stats

Public Functions 15
Event Types 4
Code Size 15,324 bytes

Events (4) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

NewOwner Event

Parameters help
old
address help
current
address help

NewPotentialOwner Event

Parameters help
old
address help
potential
address help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

name Constant

string help
Nexo

symbol Constant

string help
NEXO

decimals Constant

uint8 help
18

investorsAllocation Variable

address help

investorsTotal Variable

uint256 help

overdraftAllocation Variable

address help

overdraftTotal Variable

uint256 help

overdraftPeriodAmount Variable

uint256 help

overdraftUnvested Variable

uint256 help

overdraftCliff Variable

uint256 help

overdraftPeriodLength Variable

uint256 help

overdraftPeriodsNumber Variable

uint8 help

teamAllocation Variable

address help

teamTotal Variable

uint256 help

teamPeriodAmount Variable

uint256 help

teamUnvested Variable

uint256 help

teamCliff Variable

uint256 help

teamPeriodLength Variable

uint256 help

teamPeriodsNumber Variable

uint8 help

communityAllocation Variable

address help

communityTotal Variable

uint256 help

communityPeriodAmount Variable

uint256 help

communityUnvested Variable

uint256 help

communityCliff Variable

uint256 help

communityPeriodLength Variable

uint256 help

communityPeriodsNumber Variable

uint8 help

advisersAllocation Variable

address help

advisersTotal Variable

uint256 help

advisersPeriodAmount Variable

uint256 help

advisersUnvested Variable

uint256 help

advisersCliff Variable

uint256 help

advisersPeriodLength Variable

uint256 help

advisersPeriodsNumber Variable

uint8 help

creationTime Variable

uint256 help

totalSupply Variable

uint256 help

owner Variable

address help

potentialOwner Variable

address help

balances Variable

mapping(address => uint256) help
Internal Variable

allowed Variable

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

Functions Expand All Collapse All

setOwner keyboard_arrow_up

Parameters help

Name Type
_new
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setOwner(address _new) public onlyOwner {
  emit NewPotentialOwner(owner, _new);
  potentialOwner = _new;
}

confirmOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function confirmOwnership() public onlyPotentialOwner {
  // Forbid the old owner to distribute investors' tokens
  allowed[investorsAllocation][owner] = 0;

  // Allow the new owner to distribute investors' tokens
  allowed[investorsAllocation][msg.sender] = balanceOf(investorsAllocation);

  // Forbid the old owner to withdraw any tokens from the reserves
  allowed[overdraftAllocation][owner] = 0;
  allowed[teamAllocation][owner] = 0;
  allowed[communityAllocation][owner] = 0;
  allowed[advisersAllocation][owner] = 0;

  super.confirmOwnership();
}

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address _owner) public view returns (uint256 balance) {
  return balances[_owner];
}

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address _to, uint256 _value) public returns (bool success) {
  return _transfer(msg.sender, _to, _value);
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
) public returns (bool success) {
  require(allowed[_from][msg.sender] >= _value);
  allowed[_from][msg.sender] -= _value;

  return _transfer(_from, _to, _value);
}

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function approve(address _spender, uint256 _value)
  public
  returns (bool success)
{
  allowed[msg.sender][_spender] = _value;
  emit Approval(msg.sender, _spender, _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 remaining)
{
  if (_spender != owner) {
    return allowed[_owner][_spender];
  }

  uint256 unlockedTokens;
  uint256 spentTokens;

  if (_owner == overdraftAllocation) {
    unlockedTokens = _calculateUnlockedTokens(
      overdraftCliff,
      overdraftPeriodLength,
      overdraftPeriodAmount,
      overdraftPeriodsNumber,
      overdraftUnvested
    );
    spentTokens = sub(overdraftTotal, balanceOf(overdraftAllocation));
  } else if (_owner == teamAllocation) {
    unlockedTokens = _calculateUnlockedTokens(
      teamCliff,
      teamPeriodLength,
      teamPeriodAmount,
      teamPeriodsNumber,
      teamUnvested
    );
    spentTokens = sub(teamTotal, balanceOf(teamAllocation));
  } else if (_owner == communityAllocation) {
    unlockedTokens = _calculateUnlockedTokens(
      communityCliff,
      communityPeriodLength,
      communityPeriodAmount,
      communityPeriodsNumber,
      communityUnvested
    );
    spentTokens = sub(communityTotal, balanceOf(communityAllocation));
  } else if (_owner == advisersAllocation) {
    unlockedTokens = _calculateUnlockedTokens(
      advisersCliff,
      advisersPeriodLength,
      advisersPeriodAmount,
      advisersPeriodsNumber,
      advisersUnvested
    );
    spentTokens = sub(advisersTotal, balanceOf(advisersAllocation));
  } else {
    return allowed[_owner][_spender];
  }

  return sub(unlockedTokens, spentTokens);
}

transferERC20Token keyboard_arrow_up

Parameters help

Name Type
_token
AbstractToken help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferERC20Token(
  AbstractToken _token,
  address _to,
  uint256 _value
) public onlyOwner returns (bool success) {
  require(_token.balanceOf(address(this)) >= _value);
  uint256 receiverBalance = _token.balanceOf(_to);
  require(_token.transfer(_to, _value));

  uint256 receiverNewBalance = _token.balanceOf(_to);
  assert(receiverNewBalance == add(receiverBalance, _value));

  return true;
}

increaseApproval keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function increaseApproval(address _spender, uint256 _value)
  public
  returns (bool success)
{
  allowed[msg.sender][_spender] = add(allowed[msg.sender][_spender], _value);
  emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
  return true;
}

decreaseApproval keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function decreaseApproval(address _spender, uint256 _value)
  public
  returns (bool success)
{
  uint256 oldValue = allowed[msg.sender][_spender];
  if (_value > oldValue) {
    allowed[msg.sender][_spender] = 0;
  } else {
    allowed[msg.sender][_spender] = sub(oldValue, _value);
  }
  emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
  return true;
}

distributeInvestorsTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amountWithDecimals
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function distributeInvestorsTokens(address _to, uint256 _amountWithDecimals)
  public
  onlyOwner
{
  require(transferFrom(investorsAllocation, _to, _amountWithDecimals));
}

withdrawOverdraftTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amountWithDecimals
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function withdrawOverdraftTokens(address _to, uint256 _amountWithDecimals)
  public
  onlyOwner
{
  allowed[overdraftAllocation][msg.sender] = allowance(
    overdraftAllocation,
    msg.sender
  );
  require(transferFrom(overdraftAllocation, _to, _amountWithDecimals));
}

withdrawTeamTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amountWithDecimals
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function withdrawTeamTokens(address _to, uint256 _amountWithDecimals)
  public
  onlyOwner
{
  allowed[teamAllocation][msg.sender] = allowance(teamAllocation, msg.sender);
  require(transferFrom(teamAllocation, _to, _amountWithDecimals));
}

withdrawCommunityTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amountWithDecimals
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function withdrawCommunityTokens(address _to, uint256 _amountWithDecimals)
  public
  onlyOwner
{
  allowed[communityAllocation][msg.sender] = allowance(
    communityAllocation,
    msg.sender
  );
  require(transferFrom(communityAllocation, _to, _amountWithDecimals));
}

withdrawAdvisersTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amountWithDecimals
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function withdrawAdvisersTokens(address _to, uint256 _amountWithDecimals)
  public
  onlyOwner
{
  allowed[advisersAllocation][msg.sender] = allowance(
    advisersAllocation,
    msg.sender
  );
  require(transferFrom(advisersAllocation, _to, _amountWithDecimals));
}

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 NexoToken._calculateUnlockedTokens keyboard_arrow_up

Parameters help

Name Type
_cliff
uint256 help
_periodLength
uint256 help
_periodAmount
uint256 help
_periodsNumber
uint8 help
_unvestedAmount
uint256 help

Properties

Visibility help private
Mutability help view
Source Code
function _calculateUnlockedTokens(
  uint256 _cliff,
  uint256 _periodLength,
  uint256 _periodAmount,
  uint8 _periodsNumber,
  uint256 _unvestedAmount
) private view returns (uint256) {
  /* solium-disable-next-line security/no-block-members */
  if (now < add(creationTime, _cliff)) {
    return _unvestedAmount;
  }
  /* solium-disable-next-line security/no-block-members */
  uint256 periods = div(sub(now, add(creationTime, _cliff)), _periodLength);
  periods = periods > _periodsNumber ? _periodsNumber : periods;
  return add(_unvestedAmount, mul(periods, _periodAmount));
}

internal StandardToken._transfer keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _transfer(
  address _from,
  address _to,
  uint256 _value
) private returns (bool success) {
  require(_to != address(0));
  require(balances[_from] >= _value);
  balances[_from] -= _value;
  balances[_to] = add(balances[_to], _value);
  emit Transfer(_from, _to, _value);
  return true;
}

internal SafeMath.mul keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help pure
Source Code
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
  if (a == 0) {
    return 0;
  }
  uint256 c = a * b;
  assert(c / a == b);
  return c;
}

internal SafeMath.div keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help pure
Source Code
function div(uint256 a, uint256 b) internal pure returns (uint256) {
  return a / b;
}

internal SafeMath.sub keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help pure
Source Code
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
  assert(b <= a);
  return a - b;
}

internal SafeMath.add keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help pure
Source Code
function add(uint256 a, uint256 b) internal pure returns (uint256) {
  uint256 c = a + b;
  assert(c >= a);
  return c;
}

internal SafeMath.pow keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help pure

Requirements help

Source Code
function pow(uint256 a, uint256 b) internal pure returns (uint256) {
  uint256 c = a**b;
  assert(c >= a);
  return c;
}