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 was originally launched in 2017 by the Bitfinex spin-off exchange, Ethfinex — a team based out of London, UK — with the purpose of rewarding market makers for the value they create whilst simultaneously serving as the primary voting mechanism, allowing traders to govern the exchange and decide, among other things, which tokens they wish to see listed next. The project was designed to experiment with and develop novel governance processes with the aim of solving pain points seen with centralized exchanges including opaque and costly token listing procedures.
In August 2019, Ethfinex evolved into DeversiFi, bringing with it an overhaul of the Nectar token. Nectar now serves as the native utility and governance token of decentralised exchange DeversiFi. NEC 2.0 features a buy & burn mechanism, DeversiFi trading fee-discounts, and promotes participation from the wider Blockchain ecosystem through the NecDAO — launching in December 2019 with a reported ~ 17,500ETH constituted for the community-driven allocation of funds and governance of both DeversiFi and Nectar.community.
Stats
Public Functions
22
Event Types
5
Code Size
30,475 bytes
Events (5) keyboard_arrow_up
Functions
changeController keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function changeController(address _newController) public onlyController {
controller = _newController;
}
transfer keyboard_arrow_up
Requirements help
transfersEnabled must be true
Source Code
function transfer(address _to, uint256 _amount) public returns (bool success) {
require(transfersEnabled);
doTransfer(msg.sender, _to, _amount);
return true;
}
transferFrom keyboard_arrow_up
Requirements help
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;
}
balanceOf keyboard_arrow_up
approve keyboard_arrow_up
Requirements help
transfersEnabled must be true
One or more of the following:
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;
}
allowance keyboard_arrow_up
approveAndCall keyboard_arrow_up
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;
}
totalSupply keyboard_arrow_up
balanceOfAt keyboard_arrow_up
Source Code
function balanceOfAt(address _owner, uint _blockNumber) public constant
returns (uint) {
// 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);
}
}
totalSupplyAt keyboard_arrow_up
Source Code
function totalSupplyAt(uint _blockNumber) public constant returns(uint) {
// 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);
}
}
totalPledgedFees keyboard_arrow_up
totalPledgedFeesAt keyboard_arrow_up
Source Code
function totalPledgedFeesAt(uint _blockNumber) public constant returns(uint) {
// 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);
}
}
pledgeFees keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Requirements help
Source Code
function pledgeFees(uint _value) public onlyController returns (bool) {
uint curTotalFees = totalPledgedFees();
require(curTotalFees + _value >= curTotalFees); // Check for overflow
updateValueAtNow(totalPledgedFeesHistory, curTotalFees + _value);
return true;
}
reducePledgedFees keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Requirements help
Source Code
function reducePledgedFees(uint _value) public onlyController returns (bool) {
uint curTotalFees = totalPledgedFees();
require(curTotalFees >= _value);
updateValueAtNow(totalPledgedFeesHistory, curTotalFees - _value);
return true;
}
createCloneToken keyboard_arrow_up
Parameters help
Source Code
function createCloneToken(
string _cloneTokenName,
uint8 _cloneDecimalUnits,
string _cloneTokenSymbol,
uint _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);
}
generateTokens keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Requirements help
Source Code
function generateTokens(address _owner, uint _amount
) public onlyController returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
uint 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;
}
destroyTokens keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Requirements help
Source Code
function destroyTokens(address _owner, uint _amount
) onlyController public returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
updateValueAtNow(balances[_owner], previousBalanceFrom - _amount);
Transfer(_owner, 0, _amount);
return true;
}
enableTransfers keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function enableTransfers(bool _transfersEnabled) public onlyController {
transfersEnabled = _transfersEnabled;
}
constructor keyboard_arrow_up
claimTokens keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function claimTokens(address _token) public onlyController {
if (_token == 0x0) {
controller.transfer(this.balance);
return;
}
MiniMeToken token = MiniMeToken(_token);
uint balance = token.balanceOf(this);
token.transfer(controller, balance);
ClaimedTokens(_token, controller, balance);
}
enableBurning keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function enableBurning(bool _burningEnabled) public onlyController {
burningEnabled = _burningEnabled;
}
burnAndRetrieve keyboard_arrow_up
Requirements help
burningEnabled must be true
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;
}