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
State Variables (16) keyboard_arrow_up
Functions
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
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;
}
}
transferFrom keyboard_arrow_up
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;
}
}
approve keyboard_arrow_up
Source Code
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
allowance keyboard_arrow_up
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function transferOwnership(address newOwner) onlyOwner {
if (newOwner == 0x0) throw;
owner = newOwner;
}
setEtherPrices keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setEtherPrices(uint256 newBuyPriceEth, uint256 newSellPriceEth)
onlyOwner
{
buyPriceEth = newBuyPriceEth; // Set prices to buy and sell DCN
sellPriceEth = newSellPriceEth;
}
setGasForDCN keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setGasForDCN(uint256 newGasAmountInWei) onlyOwner {
gasForDCN = newGasAmountInWei;
}
setDCNForGas keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setDCNForGas(uint256 newDCNAmount) onlyOwner {
DCNForGas = newDCNAmount;
}
setGasReserve keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setGasReserve(uint256 newGasReserveInWei) onlyOwner {
gasReserve = newGasReserveInWei;
}
setMinBalance keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setMinBalance(uint256 minimumBalanceInWei) onlyOwner {
minBalanceForAccounts = minimumBalanceInWei;
}
haltDirectTrade keyboard_arrow_up
unhaltDirectTrade keyboard_arrow_up
buyDentacoinsAgainstEther keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
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
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
Modifiers help
onlyOwner checks for the following:
Requirements help
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
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 SafeMath.safeMul keyboard_arrow_up
Requirements help
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
internal SafeMath.safeAdd keyboard_arrow_up
Source Code
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a && c >= b);
return c;
}