Blockwell

Ethfinex Nectar Token

ERC20

This contract is an ERC20 token.

Name Ethfinex Nectar Token
Symbol NEC
Decimals 18
Total Supply 618,133,330 NEC

About link description

Nectar (NEC) is a cryptocurrency and operates on the Ethereum platform. Nectar has a current supply of 618,133,330.107871 with 0 in circulation. The last known price of Nectar is 0.05104487 USD and is up 0.97 over the last 24 hours. It is currently trading on 4 active market(s) with $6,667.20 traded over the last 24 hours. More information can be found at https://nectar.community/.

Stats

Public Functions 22
Event Types 5
Code Size 30,475 bytes

Events (5) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_amount
uint256 help

Burned Event

Parameters help
who
address help
_amount
uint256 help

ClaimedTokens Event

Parameters help
_token
address help
_controller
address help
_amount
uint help

NewCloneToken Event

Parameters help
_cloneToken
address help
_snapshotBlock
uint help

Transfer Event

Parameters help
_from
address help
_to
address help
_amount
uint256 help

MAX_UINT Constant

uint help
UNKNOWN VALUE - 1

burningEnabled Variable

bool help

name Variable

string help

decimals Variable

uint8 help

symbol Variable

string help

version Variable

string help

parentToken Variable

MiniMeToken help

parentSnapShotBlock Variable

uint help

creationBlock Variable

uint help

transfersEnabled Variable

bool help

tokenFactory Variable

MiniMeTokenFactory help

controller Variable

address help

balances Variable

mapping(address => Checkpoint[]) help
Internal Variable

allowed Variable

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

totalSupplyHistory Variable

Checkpoint[] help
Internal Variable

totalPledgedFeesHistory Variable

Checkpoint[] help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
_newController
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function changeController(address _newController) public onlyController {
  controller = _newController;
}

Parameters help

Name Type
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address _to, uint256 _amount) public returns (bool success) {
  require(transfersEnabled);
  doTransfer(msg.sender, _to, _amount);
  return true;
}

Parameters help

Name Type
_from
address help
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _amount
) public returns (bool success) {
  // The controller of this contract can move tokens around at will,
  //  this is important to recognize! Confirm that you trust the
  //  controller of this contract, which in most situations should be
  //  another open source smart contract or 0x0
  if (msg.sender != controller) {
    require(transfersEnabled);

    // The standard ERC 20 transferFrom functionality
    if (allowed[_from][msg.sender] < MAX_UINT) {
      require(allowed[_from][msg.sender] >= _amount);
      allowed[_from][msg.sender] -= _amount;
    }
  }
  doTransfer(_from, _to, _amount);
  return true;
}

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function balanceOf(address _owner) public constant returns (uint256 balance) {
  return balanceOfAt(_owner, block.number);
}

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
  returns (bool success)
{
  require(transfersEnabled);

  // To change the approve amount you first have to reduce the addresses`
  //  allowance to zero by calling `approve(_spender,0)` if it is not
  //  already 0 to mitigate the race condition described here:
  //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
  require((_amount == 0) || (allowed[msg.sender][_spender] == 0));

  // Alerts the token controller of the approve function call
  if (isContract(controller)) {
    require(
      TokenController(controller).onApprove(msg.sender, _spender, _amount)
    );
  }

  allowed[msg.sender][_spender] = _amount;
  Approval(msg.sender, _spender, _amount);
  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)
  public
  constant
  returns (uint256 remaining)
{
  return allowed[_owner][_spender];
}

Parameters help

Name Type
_spender
address help
_amount
uint256 help
_extraData
bytes help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function approveAndCall(
  address _spender,
  uint256 _amount,
  bytes _extraData
) public returns (bool success) {
  require(approve(_spender, _amount));

  ApproveAndCallFallBack(_spender).receiveApproval(
    msg.sender,
    _amount,
    this,
    _extraData
  );

  return true;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function totalSupply() public constant returns (uint256) {
  return totalSupplyAt(block.number);
}

Parameters help

Name Type
_owner
address help
_blockNumber
uint help

Properties

Visibility help public
Mutability help constant
Source Code
function balanceOfAt(address _owner, uint256 _blockNumber)
  public
  constant
  returns (uint256)
{
  // These next few lines are used when the balance of the token is
  //  requested before a check point was ever created for this token, it
  //  requires that the `parentToken.balanceOfAt` be queried at the
  //  genesis block for that token as this contains initial balance of
  //  this token
  if (
    (balances[_owner].length == 0) ||
    (balances[_owner][0].fromBlock > _blockNumber)
  ) {
    if (address(parentToken) != 0) {
      return
        parentToken.balanceOfAt(_owner, min(_blockNumber, parentSnapShotBlock));
    } else {
      // Has no parent
      return 0;
    }

    // This will return the expected balance during normal situations
  } else {
    return getValueAt(balances[_owner], _blockNumber);
  }
}

Parameters help

Name Type
_blockNumber
uint help

Properties

Visibility help public
Mutability help constant
Source Code
function totalSupplyAt(uint256 _blockNumber) public constant returns (uint256) {
  // These next few lines are used when the totalSupply of the token is
  //  requested before a check point was ever created for this token, it
  //  requires that the `parentToken.totalSupplyAt` be queried at the
  //  genesis block for this token as that contains totalSupply of this
  //  token at this block number.
  if (
    (totalSupplyHistory.length == 0) ||
    (totalSupplyHistory[0].fromBlock > _blockNumber)
  ) {
    if (address(parentToken) != 0) {
      return parentToken.totalSupplyAt(min(_blockNumber, parentSnapShotBlock));
    } else {
      return 0;
    }

    // This will return the expected totalSupply during normal situations
  } else {
    return getValueAt(totalSupplyHistory, _blockNumber);
  }
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function totalPledgedFees() public constant returns (uint256) {
  return totalPledgedFeesAt(block.number);
}

Parameters help

Name Type
_blockNumber
uint help

Properties

Visibility help public
Mutability help constant
Source Code
function totalPledgedFeesAt(uint256 _blockNumber)
  public
  constant
  returns (uint256)
{
  // These next few lines are used when the totalPledgedFees of the token is
  //  requested before a check point was ever created for this token, it
  //  requires that the `parentToken.totalPledgedFeesAt` be queried at the
  //  genesis block for this token as that contains totalPledgedFees of this
  //  token at this block number.
  if (
    (totalPledgedFeesHistory.length == 0) ||
    (totalPledgedFeesHistory[0].fromBlock > _blockNumber)
  ) {
    if (address(parentToken) != 0) {
      return
        parentToken.totalPledgedFeesAt(min(_blockNumber, parentSnapShotBlock));
    } else {
      return 0;
    }

    // This will return the expected totalPledgedFees during normal situations
  } else {
    return getValueAt(totalPledgedFeesHistory, _blockNumber);
  }
}

Parameters help

Name Type
_value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function pledgeFees(uint256 _value) public onlyController returns (bool) {
  uint256 curTotalFees = totalPledgedFees();
  require(curTotalFees + _value >= curTotalFees); // Check for overflow
  updateValueAtNow(totalPledgedFeesHistory, curTotalFees + _value);
  return true;
}

Parameters help

Name Type
_value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function reducePledgedFees(uint256 _value)
  public
  onlyController
  returns (bool)
{
  uint256 curTotalFees = totalPledgedFees();
  require(curTotalFees >= _value);
  updateValueAtNow(totalPledgedFeesHistory, curTotalFees - _value);
  return true;
}

Parameters help

Name Type
_cloneTokenName
string help
_cloneDecimalUnits
uint8 help
_cloneTokenSymbol
string help
_snapshotBlock
uint help
_transfersEnabled
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function createCloneToken(
  string _cloneTokenName,
  uint8 _cloneDecimalUnits,
  string _cloneTokenSymbol,
  uint256 _snapshotBlock,
  bool _transfersEnabled
) public returns (address) {
  if (_snapshotBlock == 0) _snapshotBlock = block.number;
  MiniMeToken cloneToken = tokenFactory.createCloneToken(
    this,
    _snapshotBlock,
    _cloneTokenName,
    _cloneDecimalUnits,
    _cloneTokenSymbol,
    _transfersEnabled
  );

  cloneToken.changeController(msg.sender);

  // An event to make the token easy to find on the blockchain
  NewCloneToken(address(cloneToken), _snapshotBlock);
  return address(cloneToken);
}

Parameters help

Name Type
_owner
address help
_amount
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function generateTokens(address _owner, uint256 _amount)
  public
  onlyController
  returns (bool)
{
  uint256 curTotalSupply = totalSupply();
  require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
  uint256 previousBalanceTo = balanceOf(_owner);
  require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
  updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
  updateValueAtNow(balances[_owner], previousBalanceTo + _amount);
  Transfer(0, _owner, _amount);
  return true;
}

Parameters help

Name Type
_owner
address help
_amount
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function destroyTokens(address _owner, uint256 _amount)
  public
  onlyController
  returns (bool)
{
  uint256 curTotalSupply = totalSupply();
  require(curTotalSupply >= _amount);
  uint256 previousBalanceFrom = balanceOf(_owner);
  require(previousBalanceFrom >= _amount);
  updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
  updateValueAtNow(balances[_owner], previousBalanceFrom - _amount);
  Transfer(_owner, 0, _amount);
  return true;
}

Parameters help

Name Type
_transfersEnabled
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function enableTransfers(bool _transfersEnabled) public onlyController {
  transfersEnabled = _transfersEnabled;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

null
Source Code
function() public payable {
  require(isContract(controller));
  require(
    TokenController(controller).proxyPayment.value(msg.value)(msg.sender)
  );
}

Parameters help

Name Type
_token
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function claimTokens(address _token) public onlyController {
  if (_token == 0x0) {
    controller.transfer(this.balance);
    return;
  }

  MiniMeToken token = MiniMeToken(_token);
  uint256 balance = token.balanceOf(this);
  token.transfer(controller, balance);
  ClaimedTokens(_token, controller, balance);
}

Parameters help

Name Type
_burningEnabled
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function enableBurning(bool _burningEnabled) public onlyController {
  burningEnabled = _burningEnabled;
}

Parameters help

Name Type
_tokensToBurn
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function burnAndRetrieve(uint256 _tokensToBurn) public returns (bool success) {
  require(burningEnabled);

  var previousBalanceFrom = balanceOfAt(msg.sender, block.number);
  if (previousBalanceFrom < _tokensToBurn) {
    return false;
  }

  // Alerts the token controller of the burn function call
  // If enabled, controller will distribute fees and destroy tokens
  // Or any other logic chosen by controller
  if (isContract(controller)) {
    require(TokenController(controller).onBurn(msg.sender, _tokensToBurn));
  }

  Burned(msg.sender, _tokensToBurn);
  return true;
}

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 MiniMeToken.doTransfer keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_amount
uint help

Properties

Visibility help internal
Mutability help transaction
Source Code
function doTransfer(
  address _from,
  address _to,
  uint256 _amount
) internal {
  if (_amount == 0) {
    Transfer(_from, _to, _amount); // Follow the spec to louch the event when transfer 0
    return;
  }

  require(parentSnapShotBlock < block.number);

  // Do not allow transfer to 0x0 or the token contract itself
  require((_to != 0) && (_to != address(this)));

  // If the amount being transfered is more than the balance of the
  //  account the transfer throws
  var previousBalanceFrom = balanceOfAt(_from, block.number);

  require(previousBalanceFrom >= _amount);

  // Alerts the token controller of the transfer
  if (isContract(controller)) {
    require(TokenController(controller).onTransfer(_from, _to, _amount));
  }

  // First update the balance array with the new value for the address
  //  sending the tokens
  updateValueAtNow(balances[_from], previousBalanceFrom - _amount);

  // Then update the balance array with the new value for the address
  //  receiving the tokens
  var previousBalanceTo = balanceOfAt(_to, block.number);
  require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
  updateValueAtNow(balances[_to], previousBalanceTo + _amount);

  // An event to make the transfer easy to find on the blockchain
  Transfer(_from, _to, _amount);
}

internal MiniMeToken.getValueAt keyboard_arrow_up

Parameters help

Name Type
checkpoints
Checkpoint[] help
_block
uint help

Properties

Visibility help internal
Mutability help constant
Source Code
function getValueAt(Checkpoint[] storage checkpoints, uint256 _block)
  internal
  constant
  returns (uint256)
{
  if (checkpoints.length == 0) return 0;

  // Shortcut for the actual value
  if (_block >= checkpoints[checkpoints.length - 1].fromBlock)
    return checkpoints[checkpoints.length - 1].value;
  if (_block < checkpoints[0].fromBlock) return 0;

  // Binary search of the value in the array
  uint256 min = 0;
  uint256 max = checkpoints.length - 1;
  while (max > min) {
    uint256 mid = (max + min + 1) / 2;
    if (checkpoints[mid].fromBlock <= _block) {
      min = mid;
    } else {
      max = mid - 1;
    }
  }
  return checkpoints[min].value;
}

internal MiniMeToken.updateValueAtNow keyboard_arrow_up

Parameters help

Name Type
checkpoints
Checkpoint[] help
_value
uint help

Properties

Visibility help internal
Mutability help transaction
Source Code
function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value)
  internal
{
  if (
    (checkpoints.length == 0) ||
    (checkpoints[checkpoints.length - 1].fromBlock < block.number)
  ) {
    Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
    newCheckPoint.fromBlock = uint128(block.number);
    newCheckPoint.value = uint128(_value);
  } else {
    Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length - 1];
    oldCheckPoint.value = uint128(_value);
  }
}

internal MiniMeToken.isContract keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help internal
Mutability help constant
Source Code
function isContract(address _addr) internal constant returns (bool) {
  uint256 size;
  if (_addr == 0) return false;
  assembly {
    size := extcodesize(_addr)
  }
  return size > 0;
}

internal MiniMeToken.min keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

Visibility help internal
Mutability help pure
Source Code
function min(uint256 a, uint256 b) internal pure returns (uint256) {
  return a < b ? a : b;
}