Blockwell

Basic Attention Token

ERC20

This contract is an ERC20 token.

Name Basic Attention Token
Symbol BAT
Decimals 18
Total Supply 1,500,000,000 BAT

About link description

Basic Attention Token (BAT) is a cryptocurrency and operates on the Ethereum platform. Basic Attention Token has a current supply of 1,500,000,000 with 1,488,387,172.9673505 in circulation. The last known price of Basic Attention Token is 0.55297698 USD and is up 9.11 over the last 24 hours. It is currently trading on 247 active market(s) with $229,894,841.08 traded over the last 24 hours. More information can be found at https://basicattentiontoken.org/.

Stats

Public Functions 8
Event Types 4
Code Size 6,902 bytes

Events (4) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

CreateBAT Event

Parameters help
_to
address help
_value
uint256 help

LogRefund Event

Parameters help
_to
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

name Constant

string help
Basic Attention Token

symbol Constant

string help
BAT

decimals Constant

uint256 help
18

batFund Constant

uint256 help
500 * UNKNOWN VALUE * UNKNOWN VALUE

tokenExchangeRate Constant

uint256 help
6400

tokenCreationCap Constant

uint256 help
1500 * UNKNOWN VALUE * UNKNOWN VALUE

tokenCreationMin Constant

uint256 help
675 * UNKNOWN VALUE * UNKNOWN VALUE

version Variable

string help

ethFundDeposit Variable

address help

batFundDeposit Variable

address help

isFinalized Variable

bool help

fundingStartBlock Variable

uint256 help

fundingEndBlock Variable

uint256 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 (balances[msg.sender] >= _value && _value > 0) {
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    Transfer(msg.sender, _to, _value);
    return true;
  } else {
    return false;
  }
}

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) {
  if (
    balances[_from] >= _value &&
    allowed[_from][msg.sender] >= _value &&
    _value > 0
  ) {
    balances[_to] += _value;
    balances[_from] -= _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];
}

createTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function createTokens() external payable {
  if (isFinalized) throw;
  if (block.number < fundingStartBlock) throw;
  if (block.number > fundingEndBlock) throw;
  if (msg.value == 0) throw;

  uint256 tokens = safeMult(msg.value, tokenExchangeRate); // check that we're not over totals
  uint256 checkedSupply = safeAdd(totalSupply, tokens);

  // return money if something goes wrong
  if (tokenCreationCap < checkedSupply) throw; // odd fractions won't be found

  totalSupply = checkedSupply;
  balances[msg.sender] += tokens; // safeAdd not needed; bad semantics to use here
  CreateBAT(msg.sender, tokens); // logs token creation
}

finalize keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function finalize() external {
  if (isFinalized) throw;
  if (msg.sender != ethFundDeposit) throw; // locks finalize to the ultimate ETH owner
  if (totalSupply < tokenCreationMin) throw; // have to sell minimum to move to operational
  if (block.number <= fundingEndBlock && totalSupply != tokenCreationCap) throw;
  // move to operational
  isFinalized = true;
  if (!ethFundDeposit.send(this.balance)) throw; // send the eth to Brave International
}

refund keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function refund() external {
  if (isFinalized) throw; // prevents refund if operational
  if (block.number <= fundingEndBlock) throw; // prevents refund until sale period is over
  if (totalSupply >= tokenCreationMin) throw; // no refunds if we sold enough
  if (msg.sender == batFundDeposit) throw; // Brave Intl not entitled to a refund
  uint256 batVal = balances[msg.sender];
  if (batVal == 0) throw;
  balances[msg.sender] = 0;
  totalSupply = safeSubtract(totalSupply, batVal); // extra safe
  uint256 ethVal = batVal / tokenExchangeRate; // should be safe; previous throws covers edges
  LogRefund(msg.sender, ethVal); // log it
  if (!msg.sender.send(ethVal)) throw; // if you're using a contract; make sure it works with .send gas limits
}

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.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) && (z >= y));
  return z;
}

internal SafeMath.safeSubtract keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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

internal SafeMath.safeMult keyboard_arrow_up

Parameters help

Name Type
x
uint256 help
y
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

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