Blockwell

Nebulas Token

ERC20

This contract is an ERC20 token.

Name Nebulas Token
Symbol NAS
Decimals 18
Total Supply 100,000,000 NAS

About

Stats

Public Functions 16
Event Types 7
Code Size 8,736 bytes

Events (7) keyboard_arrow_up

AllocateToken Event

Parameters help
_to
address help
_value
uint256 help

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

DecreaseSupply Event

Parameters help
_value
uint256 help

IncreaseSupply Event

Parameters help
_value
uint256 help

IssueToken Event

Parameters help
_to
address help
_value
uint256 help

Migrate Event

Parameters help
_to
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

name Constant

string help
Nebulas Token

symbol Constant

string help
NAS

decimals Constant

uint256 help
18

version Variable

string help

ethFundDeposit Variable

address help

newContractAddr Variable

address help

isFunding Variable

bool help

fundingStartBlock Variable

uint256 help

fundingStopBlock Variable

uint256 help

currentSupply Variable

uint256 help

tokenRaised Variable

uint256 help

tokenMigrated Variable

uint256 help

tokenExchangeRate Variable

uint256 help

totalSupply Variable

uint256 help

balances Variable

mapping(address => uint256) help
Internal Variable

allowed Variable

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

Functions Expand All Collapse All

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function balanceOf(address _owner) constant 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) returns (bool success) {
  if (balances[msg.sender] >= _value && _value > 0) {
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    Transfer(msg.sender, _to, _value);
    return true;
  } else {
    return false;
  }
}

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
) returns (bool success) {
  if (
    balances[_from] >= _value &&
    allowed[_from][msg.sender] >= _value &&
    _value > 0
  ) {
    balances[_to] += _value;
    balances[_from] -= _value;
    allowed[_from][msg.sender] -= _value;
    Transfer(_from, _to, _value);
    return true;
  } else {
    return false;
  }
}

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) returns (bool success) {
  allowed[msg.sender][_spender] = _value;
  Approval(msg.sender, _spender, _value);
  return true;
}

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

Visibility help public
Mutability help constant
Source Code
function allowance(address _owner, address _spender)
  constant
  returns (uint256 remaining)
{
  return allowed[_owner][_spender];
}

Parameters help

Name Type
_tokenExchangeRate
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function setTokenExchangeRate(uint256 _tokenExchangeRate) external isOwner {
  if (_tokenExchangeRate == 0) throw;
  if (_tokenExchangeRate == tokenExchangeRate) throw;

  tokenExchangeRate = _tokenExchangeRate;
}

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function increaseSupply(uint256 _value) external isOwner {
  uint256 value = formatDecimals(_value);
  if (value + currentSupply > totalSupply) throw;
  currentSupply = safeAdd(currentSupply, value);
  IncreaseSupply(value);
}

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function decreaseSupply(uint256 _value) external isOwner {
  uint256 value = formatDecimals(_value);
  if (value + tokenRaised > currentSupply) throw;

  currentSupply = safeSubtract(currentSupply, value);
  DecreaseSupply(value);
}

Parameters help

Name Type
_fundingStartBlock
uint256 help
_fundingStopBlock
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function startFunding(uint256 _fundingStartBlock, uint256 _fundingStopBlock)
  external
  isOwner
{
  if (isFunding) throw;
  if (_fundingStartBlock >= _fundingStopBlock) throw;
  if (block.number >= _fundingStartBlock) throw;

  fundingStartBlock = _fundingStartBlock;
  fundingStopBlock = _fundingStopBlock;
  isFunding = true;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function stopFunding() external isOwner {
  if (!isFunding) throw;
  isFunding = false;
}

Parameters help

Name Type
_newContractAddr
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setMigrateContract(address _newContractAddr) external isOwner {
  if (_newContractAddr == newContractAddr) throw;
  newContractAddr = _newContractAddr;
}

Parameters help

Name Type
_newFundDeposit
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function changeOwner(address _newFundDeposit) external isOwner() {
  if (_newFundDeposit == address(0x0)) throw;
  ethFundDeposit = _newFundDeposit;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function migrate() external {
  if (isFunding) throw;
  if (newContractAddr == address(0x0)) throw;

  uint256 tokens = balances[msg.sender];
  if (tokens == 0) throw;

  balances[msg.sender] = 0;
  tokenMigrated = safeAdd(tokenMigrated, tokens);

  IMigrationContract newContract = IMigrationContract(newContractAddr);
  if (!newContract.migrate(msg.sender, tokens)) throw;

  Migrate(msg.sender, tokens); // log it
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferETH() external isOwner {
  if (this.balance == 0) throw;
  if (!ethFundDeposit.send(this.balance)) throw;
}

Parameters help

Name Type
_addr
address help
_eth
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function allocateToken(address _addr, uint256 _eth) external isOwner {
  if (_eth == 0) throw;
  if (_addr == address(0x0)) throw;

  uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate);
  if (tokens + tokenRaised > currentSupply) throw;

  tokenRaised = safeAdd(tokenRaised, tokens);
  balances[_addr] += tokens;

  AllocateToken(_addr, tokens); // logs token issued
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

Source Code
function() payable {
  if (!isFunding) throw;
  if (msg.value == 0) throw;

  if (block.number < fundingStartBlock) throw;
  if (block.number > fundingStopBlock) throw;

  uint256 tokens = safeMult(msg.value, tokenExchangeRate);
  if (tokens + tokenRaised > currentSupply) throw;

  tokenRaised = safeAdd(tokenRaised, tokens);
  balances[msg.sender] += tokens;

  IssueToken(msg.sender, tokens); // logs token issued
}

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 NebulasToken.formatDecimals keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function formatDecimals(uint256 _value) internal returns (uint256) {
  return _value * 10**decimals;
}

internal SafeMath.safeAdd keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function safeAdd(uint256 x, uint256 y) internal returns (uint256) {
  uint256 z = x + y;
  assert((z >= x) && (z >= y));
  return z;
}

internal SafeMath.safeSubtract keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function safeSubtract(uint256 x, uint256 y) internal returns (uint256) {
  assert(x >= y);
  uint256 z = x - y;
  return z;
}

internal SafeMath.safeMult keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

One or more of the following:
Source Code
function safeMult(uint256 x, uint256 y) internal returns (uint256) {
  uint256 z = x * y;
  assert((x == 0) || (z / x == y));
  return z;
}