Blockwell

XinFin XDCE

ERC20

This contract is an ERC20 token.

Name XinFin XDCE
Symbol XDCE
Decimals 18
Total Supply 15,000,000,000 XDCE

About

Stats

Public Functions 34
Event Types 6
Code Size 17,570 bytes

Events (6) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint help

OwnershipTransferred Event

Parameters help
_from
address help
_to
address help

Transfer Event

Parameters help
from
address help
to
address help
value
uint help

UpdatedTokenInformation Event

Parameters help
newName
string help
newSymbol
string help

Upgrade Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

UpgradeAgentSet Event

Parameters help
agent
address help

name Variable

string help

symbol Variable

string help

decimals Variable

uint help

isCrowdsaleOpen Variable

bool help

totalSupply Variable

uint help

onSaleTokens Variable

uint help

upgradeMaster Variable

address help

upgradeAgent Variable

address help

totalUpgraded Variable

uint256 help

totalSupply Variable

uint help

decimals Variable

uint help

releaseAgent Variable

address help

released Variable

bool help

owner Variable

address help

newOwner Variable

address help

transferAgents Variable

mapping(address => bool) help

tokensForPublicSale Variable

uint help
Internal Variable

contractAddress Variable

address help
Internal Variable

pricePerToken Variable

uint256 help
Internal Variable

minETH Variable

uint help
Internal Variable

maxETH Variable

uint help
Internal Variable

balances Variable

mapping(address => uint) help
Internal Variable

allowed Variable

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

Functions Expand All Collapse All

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 {
  require(_newOwner != address(0));
  newOwner = _newOwner;
}

acceptOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function acceptOwnership() {
  require(msg.sender == newOwner);
  OwnershipTransferred(owner, newOwner);
  owner = newOwner;
}

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
_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
_to
address help
_value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address _to, uint256 _value) returns (bool success) {
  // SafMaths will automatically handle the overflow checks
  balances[msg.sender] = safeSub(balances[msg.sender], _value);
  balances[_to] = safeAdd(balances[_to], _value);
  Transfer(msg.sender, _to, _value);
  return true;
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
) returns (bool success) {
  uint256 _allowance = allowed[_from][msg.sender];

  // Check is not needed because safeSub(_allowance, _value) will already throw if this condition is not met
  balances[_to] = safeAdd(balances[_to], _value);
  balances[_from] = safeSub(balances[_from], _value);
  allowed[_from][msg.sender] = safeSub(_allowance, _value);
  Transfer(_from, _to, _value);
  return true;
}

Parameters help

Name Type
_spender
address help
_value
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

UNKNOWN VALUE must not be true
Source Code
function approve(address _spender, uint256 _value) returns (bool success) {
  // 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(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));

  allowed[msg.sender][_spender] = _value;
  Approval(msg.sender, _spender, _value);
  return true;
}

setReleaseAgent keyboard_arrow_up

Parameters help

Name Type
addr
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setReleaseAgent(address addr) public onlyOwner inReleaseState(false) {
  // We don't do interface check here as we might want to a normal wallet address to act as a release agent
  releaseAgent = addr;
}

setTransferAgent keyboard_arrow_up

Parameters help

Name Type
addr
address help
state
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setTransferAgent(address addr, bool state)
  public
  onlyOwner
  inReleaseState(false)
{
  transferAgents[addr] = state;
}

releaseTokenTransfer keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function releaseTokenTransfer() public onlyReleaseAgent {
  released = true;
}

safeMul keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

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

safeSub keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

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

safeAdd keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function safeAdd(uint256 a, uint256 b) returns (uint256) {
  uint256 c = a + b;
  assert(c >= a);
  return c;
}

upgrade keyboard_arrow_up

Parameters help

Name Type
value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function upgrade(uint256 value) public {
  UpgradeState state = getUpgradeState();
  require(
    state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading
  );

  // Validate input value.
  require(value != 0);

  balances[msg.sender] = safeSub(balances[msg.sender], value);

  // Take tokens out from circulation
  totalSupply = safeSub(totalSupply, value);
  totalUpgraded = safeAdd(totalUpgraded, value);

  // Upgrade agent reissues the tokens
  upgradeAgent.upgradeFrom(msg.sender, value);
  Upgrade(msg.sender, upgradeAgent, value);
}

setUpgradeAgent keyboard_arrow_up

Parameters help

Name Type
agent
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setUpgradeAgent(address agent) external {
  // The token is not yet in a state that we could think upgrading
  require(canUpgrade());

  require(agent != 0x0);
  // Only a master can designate the next agent
  require(msg.sender == upgradeMaster);
  // Upgrade has already begun for an agent
  require(getUpgradeState() != UpgradeState.Upgrading);

  upgradeAgent = UpgradeAgent(agent);

  // Bad interface
  require(upgradeAgent.isUpgradeAgent());
  // Make sure that token supplies match in source and target
  require(upgradeAgent.originalSupply() == totalSupply);

  UpgradeAgentSet(upgradeAgent);
}

getUpgradeState keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function getUpgradeState() public constant returns (UpgradeState) {
  if (!canUpgrade()) return UpgradeState.NotAllowed;
  else if (address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
  else if (totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
  else return UpgradeState.Upgrading;
}

setUpgradeMaster keyboard_arrow_up

Parameters help

Name Type
master
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setUpgradeMaster(address master) public {
  require(master != 0x0);
  require(msg.sender == upgradeMaster);
  upgradeMaster = master;
}

canUpgrade keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function canUpgrade() public constant returns (bool) {
  return true;
}

updateTokenInformation keyboard_arrow_up

Parameters help

Name Type
_name
string help
_symbol
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function updateTokenInformation(string _name, string _symbol) onlyOwner {
  name = _name;
  symbol = _symbol;
  UpdatedTokenInformation(name, symbol);
}

sendTokensToOwner keyboard_arrow_up

Parameters help

Name Type
_tokens
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function sendTokensToOwner(uint256 _tokens) onlyOwner returns (bool ok) {
  require(balances[contractAddress] >= _tokens);
  balances[contractAddress] = safeSub(balances[contractAddress], _tokens);
  balances[owner] = safeAdd(balances[owner], _tokens);
  return true;
}

sendTokensToInvestors keyboard_arrow_up

Parameters help

Name Type
_investor
address help
_tokens
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function sendTokensToInvestors(address _investor, uint256 _tokens)
  onlyOwner
  returns (bool ok)
{
  require(balances[contractAddress] >= _tokens);
  onSaleTokens = safeSub(onSaleTokens, _tokens);
  balances[contractAddress] = safeSub(balances[contractAddress], _tokens);
  balances[_investor] = safeAdd(balances[_investor], _tokens);
  return true;
}

dispenseTokensToInvestorAddressesByValue keyboard_arrow_up

Parameters help

Name Type
_addresses
address[] help
_value
uint[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function dispenseTokensToInvestorAddressesByValue(
  address[] _addresses,
  uint256[] _value
) onlyOwner returns (bool ok) {
  require(_addresses.length == _value.length);
  for (uint256 i = 0; i < _addresses.length; i++) {
    onSaleTokens = safeSub(onSaleTokens, _value[i]);
    balances[_addresses[i]] = safeAdd(balances[_addresses[i]], _value[i]);
    balances[contractAddress] = safeSub(balances[contractAddress], _value[i]);
  }
  return true;
}

startCrowdSale keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

stopCrowdSale keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

setPublicSaleParams keyboard_arrow_up

Parameters help

Name Type
_tokensForPublicSale
uint help
_min
uint help
_max
uint help
_crowdsaleStatus
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function setPublicSaleParams(
  uint256 _tokensForPublicSale,
  uint256 _min,
  uint256 _max,
  bool _crowdsaleStatus
) onlyOwner {
  require(_tokensForPublicSale != 0);
  require(_tokensForPublicSale <= onSaleTokens);
  tokensForPublicSale = _tokensForPublicSale;
  isCrowdsaleOpen = _crowdsaleStatus;
  require(_min >= 0);
  require(_max > 0);
  minETH = _min;
  maxETH = _max;
}

setTotalTokensForPublicSale keyboard_arrow_up

Parameters help

Name Type
_value
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setTotalTokensForPublicSale(uint256 _value) onlyOwner {
  require(_value != 0);
  tokensForPublicSale = _value;
}

increaseSupply keyboard_arrow_up

Parameters help

Name Type
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function increaseSupply(uint256 value) onlyOwner returns (bool) {
  totalSupply = safeAdd(totalSupply, value);
  balances[contractAddress] = safeAdd(balances[contractAddress], value);
  Transfer(0x0, contractAddress, value);
  return true;
}

decreaseSupply keyboard_arrow_up

Parameters help

Name Type
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function decreaseSupply(uint256 value) onlyOwner returns (bool) {
  balances[contractAddress] = safeSub(balances[contractAddress], value);
  totalSupply = safeSub(totalSupply, value);
  Transfer(contractAddress, 0x0, value);
  return true;
}

setMinAndMaxEthersForPublicSale keyboard_arrow_up

Parameters help

Name Type
_min
uint help
_max
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setMinAndMaxEthersForPublicSale(uint256 _min, uint256 _max) onlyOwner {
  require(_min >= 0);
  require(_max > 0);
  minETH = _min;
  maxETH = _max;
}

updateTokenPrice keyboard_arrow_up

Parameters help

Name Type
_value
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function updateTokenPrice(uint256 _value) onlyOwner {
  require(_value != 0);
  pricePerToken = _value;
}

updateOnSaleSupply keyboard_arrow_up

Parameters help

Name Type
_newSupply
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function updateOnSaleSupply(uint256 _newSupply) onlyOwner {
  require(_newSupply != 0);
  onSaleTokens = _newSupply;
}

buyTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function buyTokens() public payable returns (uint256 tokenAmount) {
  uint256 _tokenAmount;
  uint256 multiplier = (10**decimals);
  uint256 weiAmount = msg.value;

  require(isCrowdsaleOpen);
  //require(whitelistedAddress[msg.sender]);

  require(weiAmount >= minETH);
  require(weiAmount <= maxETH);

  _tokenAmount = safeMul(weiAmount, multiplier) / pricePerToken;

  require(_tokenAmount > 0);

  //safe sub will automatically handle overflows
  tokensForPublicSale = safeSub(tokensForPublicSale, _tokenAmount);
  onSaleTokens = safeSub(onSaleTokens, _tokenAmount);
  balances[contractAddress] = safeSub(balances[contractAddress], _tokenAmount);
  //assign tokens
  balances[msg.sender] = safeAdd(balances[msg.sender], _tokenAmount);

  //send money to the owner
  require(owner.send(weiAmount));

  return _tokenAmount;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() payable {
  buyTokens();
}

destroyToken keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function destroyToken() public onlyOwner {
  selfdestruct(msg.sender);
}

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.