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.
State Variables (5) keyboard_arrow_up
Functions
setOwner keyboard_arrow_up
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
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);
}
transfer keyboard_arrow_up
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;
}
}
transferFrom keyboard_arrow_up
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;
}
}
approve keyboard_arrow_up
Source Code
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
allowance keyboard_arrow_up
constructor keyboard_arrow_up
isSealed keyboard_arrow_up
lastMintedTimestamp keyboard_arrow_up
approveAndCall keyboard_arrow_up
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
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
Source Code
function offerBonus(uint256 _bonus) onlyOwner {
bonusOffered = bonusOffered.add(_bonus);
supplies.total = _bonus.add(supplies.total).toUINT128();
Transfer(0, this, _bonus);
}
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 VEN.claimBonus keyboard_arrow_up
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);
}
}
}