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
State Variables (36) keyboard_arrow_up
Functions
setOwner keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
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.
Modifiers help
onlyPotentialOwner checks for the following:
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();
}
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
Source Code
function transfer(address _to, uint256 _value) public returns (bool success) {
return _transfer(msg.sender, _to, _value);
}
transferFrom keyboard_arrow_up
Requirements help
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);
}
approve keyboard_arrow_up
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;
}
allowance keyboard_arrow_up
Requirements help
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
Modifiers help
onlyOwner checks for the following:
Requirements help
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
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
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
withdrawOverdraftTokens keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
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
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
Requirements help
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
Requirements help
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
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
internal SafeMath.sub keyboard_arrow_up
Requirements help
Source Code
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
internal SafeMath.add keyboard_arrow_up
Requirements help
Source Code
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}