Blockwell

VeChain Token

ERC20

This contract is an ERC20 token.

Name VeChain Token
Symbol VEN
Decimals 18
Total Supply 1,000,000,000 VEN

About

Stats

Public Functions 14
Event Types 2
Code Size 20,778 bytes

Library Use

Uses SafeMath for uint256.

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

Supplies Struct

Members
total
uint128 help
rawTokens
uint128 help

Account Struct

Members
balance
uint112 help
rawTokens
uint112 help
lastMintedTimestamp
uint32 help

name Constant

string help
VeChain Token

decimals Constant

uint8 help
18

symbol Constant

string help
VEN

owner Variable

address help

supplies Variable

Supplies help
Internal Variable

accounts Variable

mapping(address => Account) help
Internal Variable

allowed Variable

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

bonusOffered Variable

uint256 help
Internal Variable

Functions Expand All Collapse All

setOwner keyboard_arrow_up

Parameters help

Name Type
_newOwner
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setOwner(address _newOwner) onlyOwner {
  owner = _newOwner;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function totalSupply() constant returns (uint256 supply) {
  return supplies.total;
}

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function balanceOf(address _owner) constant returns (uint256 balance) {
  if (accounts[_owner].rawTokens == 0) return accounts[_owner].balance;

  if (bonusOffered > 0) {
    uint256 bonus = bonusOffered.mul(accounts[_owner].rawTokens).div(
      supplies.rawTokens
    );

    return bonus.add(accounts[_owner].balance).add(accounts[_owner].rawTokens);
  }

  return uint256(accounts[_owner].balance).add(accounts[_owner].rawTokens);
}

Parameters help

Name Type
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
null
null
Source Code
function transfer(address _to, uint256 _amount) returns (bool success) {
  require(isSealed());

  // implicitly claim bonus for both sender and receiver
  claimBonus(msg.sender);
  claimBonus(_to);

  // according to VEN's total supply, never overflow here
  if (accounts[msg.sender].balance >= _amount && _amount > 0) {
    accounts[msg.sender].balance -= uint112(_amount);
    accounts[_to].balance = _amount.add(accounts[_to].balance).toUINT112();
    Transfer(msg.sender, _to, _amount);
    return true;
  } else {
    return false;
  }
}

Parameters help

Name Type
_from
address help
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
null
null
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _amount
) returns (bool success) {
  require(isSealed());

  // implicitly claim bonus for both sender and receiver
  claimBonus(_from);
  claimBonus(_to);

  // according to VEN's total supply, never overflow here
  if (
    accounts[_from].balance >= _amount &&
    allowed[_from][msg.sender] >= _amount &&
    _amount > 0
  ) {
    accounts[_from].balance -= uint112(_amount);
    allowed[_from][msg.sender] -= _amount;
    accounts[_to].balance = _amount.add(accounts[_to].balance).toUINT112();
    Transfer(_from, _to, _amount);
    return true;
  } else {
    return false;
  }
}

Parameters help

Name Type
_spender
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function approve(address _spender, uint256 _amount) returns (bool success) {
  allowed[msg.sender][_spender] = _amount;
  Approval(msg.sender, _spender, _amount);
  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];
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function() {
  revert();
}

isSealed keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function isSealed() constant returns (bool) {
  return owner == 0;
}

lastMintedTimestamp keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help constant
Source Code
function lastMintedTimestamp(address _owner) constant returns (uint32) {
  return accounts[_owner].lastMintedTimestamp;
}

approveAndCall keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_value
uint256 help
_extraData
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function approveAndCall(
  address _spender,
  uint256 _value,
  bytes _extraData
) returns (bool success) {
  allowed[msg.sender][_spender] = _value;
  Approval(msg.sender, _spender, _value);

  //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
  //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
  //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
  //if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { revert(); }
  ApprovalReceiver(_spender).receiveApproval(
    msg.sender,
    _value,
    this,
    _extraData
  );
  return true;
}

mint keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_amount
uint256 help
_isRaw
bool help
timestamp
uint32 help

Properties

Visibility help public
Mutability help transaction
Source Code
function mint(
  address _owner,
  uint256 _amount,
  bool _isRaw,
  uint32 timestamp
) onlyOwner {
  if (_isRaw) {
    accounts[_owner].rawTokens = _amount
    .add(accounts[_owner].rawTokens)
    .toUINT112();
    supplies.rawTokens = _amount.add(supplies.rawTokens).toUINT128();
  } else {
    accounts[_owner].balance = _amount
    .add(accounts[_owner].balance)
    .toUINT112();
  }

  accounts[_owner].lastMintedTimestamp = timestamp;

  supplies.total = _amount.add(supplies.total).toUINT128();
  Transfer(0, _owner, _amount);
}

offerBonus keyboard_arrow_up

Parameters help

Name Type
_bonus
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function offerBonus(uint256 _bonus) onlyOwner {
  bonusOffered = bonusOffered.add(_bonus);
  supplies.total = _bonus.add(supplies.total).toUINT128();
  Transfer(0, this, _bonus);
}

seal keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function seal() onlyOwner {
  setOwner(0);
}

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 VEN.claimBonus keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

null
Source Code
function claimBonus(address _owner) internal {
  require(isSealed());
  if (accounts[_owner].rawTokens != 0) {
    uint256 realBalance = balanceOf(_owner);
    uint256 bonus = realBalance.sub(accounts[_owner].balance).sub(
      accounts[_owner].rawTokens
    );

    accounts[_owner].balance = realBalance.toUINT112();
    accounts[_owner].rawTokens = 0;
    if (bonus > 0) {
      Transfer(this, _owner, bonus);
    }
  }
}