Time New Bank
ERC20
This contract is an ERC20 token.
Name
Time New Bank
Symbol
TNB
Decimals
18
Total Supply
4,415,707,418 TNB
About
link
description
Time New Bank (TNB) is a cryptocurrency and operates on the Ethereum platform. Time New Bank has a current supply of 4,415,707,418.218691 with 4,074,427,418.2186904 in circulation. The last known price of Time New Bank is 0.00241454 USD and is up 1.85 over the last 24 hours. It is currently trading on 10 active market(s) with $247,119.35 traded over the last 24 hours. More information can be found at http://tnb.fund/.
Stats
Public Functions
15
Event Types
5
Code Size
26,052 bytes
Events (5) keyboard_arrow_up
State Variables (18) keyboard_arrow_up
Functions
changeController keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function changeController(address _newController) onlyController {
controller = _newController;
}
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
transfersEnabled must be true
Source Code
function transfer(address _to, uint256 _amount) returns (bool success) {
require(transfersEnabled);
return doTransfer(msg.sender, _to, _amount);
}
transferFrom keyboard_arrow_up
Requirements help
Source Code
function transferFrom(
address _from,
address _to,
uint256 _amount
) returns (bool success) {
// The controller of this contract can move tokens around at will,
// this is important to recognize! Confirm that you trust the
// controller of this contract, which in most situations should be
// another open source smart contract or 0x0
if (msg.sender != controller) {
require(transfersEnabled);
// The standard ERC 20 transferFrom functionality
if (allowed[_from][msg.sender] < _amount) {
return false;
}
allowed[_from][msg.sender] -= _amount;
}
return doTransfer(_from, _to, _amount);
}
approve keyboard_arrow_up
Requirements help
transfersEnabled must be true
One or more of the following:
Source Code
function approve(address _spender, uint256 _amount) returns (bool success) {
require(transfersEnabled);
// 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((_amount == 0) || (allowed[msg.sender][_spender] == 0));
// Alerts the token controller of the approve function call
if (isContract(controller)) {
bool onApprove = TokenController(controller).onApprove(
msg.sender,
_spender,
_amount
);
require(onApprove);
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
allowance keyboard_arrow_up
approveAndCall keyboard_arrow_up
Requirements help
null
Source Code
function approveAndCall(
address _spender,
uint256 _amount,
bytes _extraData
) returns (bool success) {
require(approve(_spender, _amount));
ApproveAndCallReceiver(_spender).receiveApproval(
msg.sender,
_amount,
this,
_extraData
);
return true;
}
balanceOfAt keyboard_arrow_up
Source Code
function balanceOfAt(address _owner, uint256 _blockNumber)
constant
returns (uint256)
{
// These next few lines are used when the balance of the token is
// requested before a check point was ever created for this token, it
// requires that the `parentToken.balanceOfAt` be queried at the
// genesis block for that token as this contains initial balance of
// this token
if (
(balances[_owner].length == 0) ||
(balances[_owner][0].fromBlock > _blockNumber)
) {
//if (address(parentToken) != 0) {
// return parentToken.balanceOfAt(_owner, min(_blockNumber, parentSnapShotBlock));
//} else {
// Has no parent
return 0;
//}
// This will return the expected balance during normal situations
} else {
return getValueAt(balances[_owner], _blockNumber);
}
}
totalSupplyAt keyboard_arrow_up
Source Code
function totalSupplyAt(uint256 _blockNumber) constant returns (uint256) {
// These next few lines are used when the totalSupply of the token is
// requested before a check point was ever created for this token, it
// requires that the `parentToken.totalSupplyAt` be queried at the
// genesis block for this token as that contains totalSupply of this
// token at this block number.
if (
(totalSupplyHistory.length == 0) ||
(totalSupplyHistory[0].fromBlock > _blockNumber)
) {
//if (address(parentToken) != 0) {
// return parentToken.totalSupplyAt(min(_blockNumber, parentSnapShotBlock));
//} else {
return 0;
//}
// This will return the expected totalSupply during normal situations
} else {
return getValueAt(totalSupplyHistory, _blockNumber);
}
}
generateTokens keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Requirements help
Source Code
function generateTokens(address _owner, uint256 _amount)
onlyController
returns (bool)
{
uint256 curTotalSupply = totalSupply();
uint256 newTotalSupply = curTotalSupply + _amount;
require(newTotalSupply >= curTotalSupply); // Check for overflow
require(newTotalSupply <= maximumTNB);
uint256 previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
updateValueAtNow(totalSupplyHistory, newTotalSupply);
updateValueAtNow(balances[_owner], previousBalanceTo + _amount);
Transfer(0, _owner, _amount);
return true;
}
destroyTokens keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Requirements help
Source Code
function destroyTokens(address _owner, uint256 _amount)
onlyController
returns (bool)
{
uint256 curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint256 previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
updateValueAtNow(balances[_owner], previousBalanceFrom - _amount);
Transfer(_owner, 0, _amount);
return true;
}
enableTransfers keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function enableTransfers(bool _transfersEnabled) onlyController {
transfersEnabled = _transfersEnabled;
}
claimTokens keyboard_arrow_up
Modifiers help
onlyController checks for the following:
Source Code
function claimTokens(address _token) onlyController {
if (_token == 0x0) {
controller.transfer(this.balance);
return;
}
TNBToken token = TNBToken(_token);
uint256 balance = token.balanceOf(this);
token.transfer(controller, balance);
ClaimedTokens(_token, controller, balance);
}
constructor keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
null
proxyPayment must be true
Source Code
function() payable {
//屏蔽控制方的合约类型检查,以兼容发行方无控制合约的情况。
require(isContract(controller));
bool proxyPayment = TokenController(controller).proxyPayment.value(msg.value)(
msg.sender
);
require(proxyPayment);
}
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 TNBToken.doTransfer keyboard_arrow_up
Requirements help
Source Code
function doTransfer(
address _from,
address _to,
uint256 _amount
) internal returns (bool) {
if (_amount == 0) {
return true;
}
//require(parentSnapShotBlock < block.number);
// Do not allow transfer to 0x0 or the token contract itself
require((_to != 0) && (_to != address(this)));
// If the amount being transfered is more than the balance of the
// account the transfer returns false
var previousBalanceFrom = balanceOfAt(_from, block.number);
if (previousBalanceFrom < _amount) {
return false;
}
// Alerts the token controller of the transfer
if (isContract(controller)) {
bool onTransfer = TokenController(controller).onTransfer(
_from,
_to,
_amount
);
require(onTransfer);
}
// First update the balance array with the new value for the address
// sending the tokens
updateValueAtNow(balances[_from], previousBalanceFrom - _amount);
// Then update the balance array with the new value for the address
// receiving the tokens
var previousBalanceTo = balanceOfAt(_to, block.number);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
updateValueAtNow(balances[_to], previousBalanceTo + _amount);
// An event to make the transfer easy to find on the blockchain
Transfer(_from, _to, _amount);
return true;
}
internal TNBToken.getValueAt keyboard_arrow_up
Source Code
function getValueAt(Checkpoint[] storage checkpoints, uint256 _block)
internal
constant
returns (uint256)
{
if (checkpoints.length == 0) {
return 0;
}
// Shortcut for the actual value
if (_block >= checkpoints[checkpoints.length - 1].fromBlock)
return checkpoints[checkpoints.length - 1].value;
if (_block < checkpoints[0].fromBlock) {
return 0;
}
// Binary search of the value in the array
uint256 min = 0;
uint256 max = checkpoints.length - 1;
while (max > min) {
uint256 mid = (max + min + 1) / 2;
if (checkpoints[mid].fromBlock <= _block) {
min = mid;
} else {
max = mid - 1;
}
}
return checkpoints[min].value;
}
internal TNBToken.updateValueAtNow keyboard_arrow_up
Source Code
function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value)
internal
{
if (
(checkpoints.length == 0) ||
(checkpoints[checkpoints.length - 1].fromBlock < block.number)
) {
Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
newCheckPoint.fromBlock = uint128(block.number);
newCheckPoint.value = uint128(_value);
} else {
Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length - 1];
oldCheckPoint.value = uint128(_value);
}
}