Blockwell

Dentacoin

ERC20

This contract is an ERC20 token.

Name Dentacoin
Symbol ٨
Decimals 0
Total Supply 8,000,000,000,000 ٨

About link description

Dentacoin (DCN) is a cryptocurrency and operates on the Ethereum platform. Dentacoin has a current supply of 7,899,848,965,678 with 548,105,296,887 in circulation. The last known price of Dentacoin is 0.00001912 USD and is down -10.93 over the last 24 hours. It is currently trading on 16 active market(s) with $335,573.70 traded over the last 24 hours. More information can be found at http://www.dentacoin.com/.

Stats

Public Functions 17
Event Types 2
Code Size 13,892 bytes

Events (2) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

name Variable

string help

symbol Variable

string help

DentacoinAddress Variable

address help

decimals Variable

uint8 help

totalSupply Variable

uint256 help

buyPriceEth Variable

uint256 help

sellPriceEth Variable

uint256 help

gasForDCN Variable

uint256 help

DCNForGas Variable

uint256 help

gasReserve Variable

uint256 help

minBalanceForAccounts Variable

uint256 help

directTradeAllowed Variable

bool help

owner Variable

address 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 (_value < DCNForGas) throw; // Prevents drain and spam
  if (msg.sender != owner && _to == DentacoinAddress && directTradeAllowed) {
    sellDentacoinsAgainstEther(_value); // Trade Dentacoins against eth by sending to the token contract
    return true;
  }

  if (
    balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]
  ) {
    // Check if sender has enough and for overflows
    balances[msg.sender] = safeSub(balances[msg.sender], _value); // Subtract DCN from the sender

    if (
      msg.sender.balance >= minBalanceForAccounts &&
      _to.balance >= minBalanceForAccounts
    ) {
      // Check if sender can pay gas and if recipient could
      balances[_to] = safeAdd(balances[_to], _value); // Add the same amount of DCN to the recipient
      Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
      return true;
    } else {
      balances[this] = safeAdd(balances[this], DCNForGas); // Pay DCNForGas to the contract
      balances[_to] = safeAdd(balances[_to], safeSub(_value, DCNForGas)); // Recipient balance -DCNForGas
      Transfer(msg.sender, _to, safeSub(_value, DCNForGas)); // Notify anyone listening that this transfer took place

      if (msg.sender.balance < minBalanceForAccounts) {
        if (!msg.sender.send(gasForDCN)) throw; // Send eth to sender
      }
      if (_to.balance < minBalanceForAccounts) {
        if (!_to.send(gasForDCN)) throw; // Send eth to recipient
      }
    }
  } else {
    throw;
  }
}

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) {
  //same as above. Replace this line with the following if you want to protect against wrapping uints.
  if (
    balances[_from] >= _value &&
    allowed[_from][msg.sender] >= _value &&
    balances[_to] + _value > balances[_to]
  ) {
    //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
    balances[_from] -= _value;
    balances[_to] += _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];
}

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function transferOwnership(address newOwner) onlyOwner {
  if (newOwner == 0x0) throw;
  owner = newOwner;
}

setEtherPrices keyboard_arrow_up

Parameters help

Name Type
newBuyPriceEth
uint256 help
newSellPriceEth
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function setEtherPrices(uint256 newBuyPriceEth, uint256 newSellPriceEth)
  onlyOwner
{
  buyPriceEth = newBuyPriceEth; // Set prices to buy and sell DCN
  sellPriceEth = newSellPriceEth;
}

setGasForDCN keyboard_arrow_up

Parameters help

Name Type
newGasAmountInWei
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function setGasForDCN(uint256 newGasAmountInWei) onlyOwner {
  gasForDCN = newGasAmountInWei;
}

setDCNForGas keyboard_arrow_up

Parameters help

Name Type
newDCNAmount
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function setDCNForGas(uint256 newDCNAmount) onlyOwner {
  DCNForGas = newDCNAmount;
}

setGasReserve keyboard_arrow_up

Parameters help

Name Type
newGasReserveInWei
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function setGasReserve(uint256 newGasReserveInWei) onlyOwner {
  gasReserve = newGasReserveInWei;
}

setMinBalance keyboard_arrow_up

Parameters help

Name Type
minimumBalanceInWei
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function setMinBalance(uint256 minimumBalanceInWei) onlyOwner {
  minBalanceForAccounts = minimumBalanceInWei;
}

haltDirectTrade keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function haltDirectTrade() onlyOwner {
  directTradeAllowed = false;
}

unhaltDirectTrade keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function unhaltDirectTrade() onlyOwner {
  directTradeAllowed = true;
}

buyDentacoinsAgainstEther keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function buyDentacoinsAgainstEther() payable returns (uint256 amount) {
  if (buyPriceEth == 0 || msg.value < buyPriceEth) throw; // Avoid dividing 0, sending small amounts and spam
  amount = msg.value / buyPriceEth; // Calculate the amount of Dentacoins
  if (balances[this] < amount) throw; // Check if it has enough to sell
  balances[msg.sender] = safeAdd(balances[msg.sender], amount); // Add the amount to buyer's balance
  balances[this] = safeSub(balances[this], amount); // Subtract amount from Dentacoin balance
  Transfer(this, msg.sender, amount); // Execute an event reflecting the change
  return amount;
}

sellDentacoinsAgainstEther keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function sellDentacoinsAgainstEther(uint256 amount) returns (uint256 revenue) {
  if (sellPriceEth == 0 || amount < DCNForGas) throw; // Avoid selling and spam
  if (balances[msg.sender] < amount) throw; // Check if the sender has enough to sell
  revenue = safeMul(amount, sellPriceEth); // Revenue = eth that will be send to the user
  if (safeSub(this.balance, revenue) < gasReserve) throw; // Keep min amount of eth in contract to provide gas for transactions
  if (!msg.sender.send(revenue)) {
    // Send ether to the seller. It's important
    throw; // To do this last to avoid recursion attacks
  } else {
    balances[this] = safeAdd(balances[this], amount); // Add the amount to Dentacoin balance
    balances[msg.sender] = safeSub(balances[msg.sender], amount); // Subtract the amount from seller's balance
    Transfer(this, msg.sender, revenue); // Execute an event reflecting on the change
    return revenue; // End function and returns
  }
}

refundToOwner keyboard_arrow_up

Parameters help

Name Type
amountOfEth
uint256 help
dcn
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function refundToOwner(uint256 amountOfEth, uint256 dcn) onlyOwner {
  uint256 eth = safeMul(amountOfEth, 1 ether);
  if (!msg.sender.send(eth)) {
    // Send ether to the owner. It's important
    throw; // To do this last to avoid recursion attacks
  } else {
    Transfer(this, msg.sender, eth); // Execute an event reflecting on the change
  }
  if (balances[this] < dcn) throw; // Check if it has enough to sell
  balances[msg.sender] = safeAdd(balances[msg.sender], dcn); // Add the amount to buyer's balance
  balances[this] = safeSub(balances[this], dcn); // Subtract amount from seller's balance
  Transfer(this, msg.sender, dcn); // Execute an event reflecting the change
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() payable {
  if (msg.sender != owner) {
    if (!directTradeAllowed) throw;
    buyDentacoinsAgainstEther(); // Allow direct trades by sending eth to the contract
  }
}

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 SafeMath.safeMul keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

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

internal SafeMath.safeSub keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function safeSub(uint256 a, uint256 b) internal returns (uint256) {
  assert(b <= a);
  return a - b;
}

internal SafeMath.safeAdd keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

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

internal SafeMath.assert keyboard_arrow_up

Parameters help

Name Type
assertion
bool help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function assert(bool assertion) internal {
  if (!assertion) throw;
}