Blockwell

Divi Exchange Token

ERC20

This contract is an ERC20 token.

Name Divi Exchange Token
Symbol DIVX
Decimals 18
Total Supply 6,171,607 DIVX

About

Stats

Public Functions 13
Event Types 5
Code Size 11,184 bytes

Events (5) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

LogCreate Event

Parameters help
_to
address help
_value
uint256 help
_tokenValue
uint256 help

LogRedeem Event

Parameters help
_to
address help
_value
uint256 help
_diviAddress
bytes32 help

LogRefund Event

Parameters help
_to
address help
_value
uint256 help
_tokenValue
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

name Constant

string help
Divi Exchange Token

symbol Constant

string help
DIVX

decimals Constant

uint256 help
18

privateExchangeRate Constant

uint256 help
1000

firstExchangeRate Constant

uint256 help
650

secondExchangeRate Constant

uint256 help
575

thirdExchangeRate Constant

uint256 help
500

receivedWeiCap Constant

uint256 help
100 * UNKNOWN VALUE * UNKNOWN VALUE

receivedWeiMin Constant

uint256 help
5 * UNKNOWN VALUE * UNKNOWN VALUE

version Variable

string help

fundDeposit Variable

address help

isPaused Variable

bool help

isRedeeming Variable

bool help

fundingStartBlock Variable

uint256 help

firstXRChangeBlock Variable

uint256 help

secondXRChangeBlock Variable

uint256 help

thirdXRChangeBlock Variable

uint256 help

fundingEndBlock Variable

uint256 help

totalReceivedWei Variable

uint256 help

totalSupply Variable

uint256 help

weiBalances Variable

mapping(address => uint256) help
Internal Variable

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) {
  require(totalReceivedWei >= receivedWeiMin);
  return super.transfer(_to, _value);
}

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) {
  require(totalReceivedWei >= receivedWeiMin);
  return super.transferFrom(_from, _to, _value);
}

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];
}

createTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Modifiers help

Source Code
function createTokens() external payable isNotPaused {
  require(block.number >= fundingStartBlock);
  require(block.number <= fundingEndBlock);
  require(msg.value > 0);

  // Check that this transaction wouldn't exceed the ETH cap
  uint256 checkedReceivedWei = safeAdd(totalReceivedWei, msg.value);
  require(checkedReceivedWei <= receivedWeiCap);

  // Calculate how many tokens (in units of Wei) should be awarded
  // on this transaction
  uint256 tokens = safeMult(msg.value, getCurrentTokenPrice());

  // Calculate how many tokens (in units of Wei) should be awarded to the project (20%)
  uint256 projectTokens = safeDiv(tokens, 5);

  // Increment the total received ETH
  totalReceivedWei = checkedReceivedWei;

  // Only update our accounting of how much ETH this contributor has sent us if
  // we're already on the public sale (since private sale contributions are going
  // to be used before the end of end of the sale period, they don't get a refund)
  if (block.number >= firstXRChangeBlock) weiBalances[msg.sender] += msg.value;

  // Increment the total supply of tokens and then deposit the tokens
  // to the contributor
  totalSupply = safeAdd(totalSupply, tokens);
  balances[msg.sender] += tokens;

  // Increment the total supply of tokens and then deposit the tokens
  // to the project
  totalSupply = safeAdd(totalSupply, projectTokens);
  balances[fundDeposit] += projectTokens;

  LogCreate(msg.sender, msg.value, tokens); // logs token creation
}

withdrawWei keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function withdrawWei(uint256 _value) external onlyOwner isNotPaused {
  require(_value <= this.balance);

  // Allow withdrawal during the private sale, but after that, only allow
  // withdrawal if we already met the minimum
  require(
    (block.number < firstXRChangeBlock) || (totalReceivedWei >= receivedWeiMin)
  );

  // send the eth to the project multisig wallet
  fundDeposit.transfer(_value);
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function pause() external onlyOwner isNotPaused {
  // Move the contract to Paused state
  isPaused = true;
}

resume keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function resume() external onlyOwner {
  // Move the contract out of the Paused state
  isPaused = false;
}

startRedeeming keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function startRedeeming() external onlyOwner isNotPaused {
  // Move the contract to Redeeming state
  isRedeeming = true;
}

stopRedeeming keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function stopRedeeming() external onlyOwner isNotPaused {
  // Move the contract out of the Redeeming state
  isRedeeming = false;
}

refund keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function refund() external {
  // prevents refund until sale period is over
  require(block.number > fundingEndBlock);
  // Refunds are only available if the minimum was not reached
  require(totalReceivedWei < receivedWeiMin);

  // Retrieve how much DIVX (in units of Wei) this account has
  uint256 divxVal = balances[msg.sender];
  require(divxVal > 0);

  // Retrieve how much ETH (in units of Wei) this account contributed
  uint256 weiVal = weiBalances[msg.sender];
  require(weiVal > 0);

  // Destroy this contributor's tokens and reduce the total supply
  balances[msg.sender] = 0;
  totalSupply = safeSubtract(totalSupply, divxVal);

  // Log this refund operation
  LogRefund(msg.sender, weiVal, divxVal);

  // Send the money back
  msg.sender.transfer(weiVal);
}

redeem keyboard_arrow_up

Parameters help

Name Type
diviAddress
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function redeem(bytes32 diviAddress) external {
  // Only allow this function to be called when on the redeeming state
  require(isRedeeming);

  // Retrieve how much DIVX (in units of Wei) this account has
  uint256 divxVal = balances[msg.sender];
  require(divxVal > 0);

  // Move the tokens of the caller to the project's address
  assert(super.transfer(fundDeposit, divxVal));

  // Log the redeeming of this tokens
  LogRedeem(msg.sender, divxVal, diviAddress);
}

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 DIVXToken.getCurrentTokenPrice keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help private
Mutability help constant
Source Code
function getCurrentTokenPrice()
  private
  constant
  returns (uint256 currentPrice)
{
  if (block.number < firstXRChangeBlock) {
    return privateExchangeRate;
  } else if (block.number < secondXRChangeBlock) {
    return firstExchangeRate;
  } else if (block.number < thirdXRChangeBlock) {
    return secondExchangeRate;
  } else {
    return thirdExchangeRate;
  }
}

internal SafeMath.safeAdd keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function safeAdd(uint256 x, uint256 y) internal returns (uint256) {
  uint256 z = x + y;
  assert((z >= x));
  return z;
}

internal SafeMath.safeSubtract keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help constant

Requirements help

Source Code
function safeSubtract(uint256 x, uint256 y)
  internal
  constant
  returns (uint256)
{
  assert(x >= y);
  return x - y;
}

internal SafeMath.safeMult keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help constant

Requirements help

One or more of the following:
Source Code
function safeMult(uint256 x, uint256 y) internal constant returns (uint256) {
  uint256 z = x * y;
  assert((x == 0) || (z / x == y));
  return z;
}

internal SafeMath.safeDiv keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help constant
Source Code
function safeDiv(uint256 x, uint256 y) internal constant returns (uint256) {
  uint256 z = x / y;
  return z;
}