ERC20
This contract is an ERC20 token.
Name
TrueFi
Symbol
TRU
Decimals
8
Total Supply
1,441,129,427 TRU
About link
TrueFi (TRU) is a cryptocurrency and operates on the Ethereum platform. TrueFi has a current supply of 1,446,312,655 with 140,608,485 in circulation. The last known price of TrueFi is 0.1507301 USD and is up 8.20 over the last 24 hours. It is currently trading on 16 active market(s) with $3,833,276.19 traded over the last 24 hours. More information can be found at https://truefi.io/.
Stats
Public Functions
27
Event Types
3
Code Size
49,309 bytes
Library Use
Uses SafeMath for uint256.
State Variables (10) keyboard_arrow_up
Functions
owner keyboard_arrow_up
pendingOwner keyboard_arrow_up
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function transferOwnership(address newOwner) public onlyOwner {
pendingOwner_ = newOwner;
}
claimOwnership keyboard_arrow_up
Parameters help
This function has no parameters.
Modifiers help
onlyPendingOwner checks for the following:
Source Code
function claimOwnership() public onlyPendingOwner {
address _pendingOwner = pendingOwner_;
emit OwnershipTransferred(owner_, _pendingOwner);
owner_ = _pendingOwner;
pendingOwner_ = address(0);
}
name keyboard_arrow_up
symbol keyboard_arrow_up
decimals keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
Source Code
function transfer(address recipient, uint256 amount)
public
virtual
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
approve keyboard_arrow_up
Requirements help
Source Code
function approve(address spender, uint256 amount)
public
virtual
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
transferFrom keyboard_arrow_up
Requirements help
Source Code
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
allowance[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
increaseAllowance keyboard_arrow_up
Requirements help
Source Code
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
allowance[_msgSender()][spender].add(addedValue)
);
return true;
}
decreaseAllowance keyboard_arrow_up
Requirements help
Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
allowance[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
setTimeLockRegistry keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Requirements help
Source Code
function setTimeLockRegistry(address newTimeLockRegistry) external onlyOwner {
require(newTimeLockRegistry != address(0), "cannot be zero address");
require(
newTimeLockRegistry != timeLockRegistry,
"must be new TimeLockRegistry"
);
timeLockRegistry = newTimeLockRegistry;
}
lockReturns keyboard_arrow_up
registerLockup keyboard_arrow_up
Modifiers help
onlyTimeLockRegistry checks for the following:
Requirements help
amount
must be less than or equal to
the result of calling unlockedBalance with the sender's address
Source Code
function registerLockup(address receiver, uint256 amount)
external
onlyTimeLockRegistry
{
require(balanceOf[msg.sender] >= amount, "insufficient balance");
// add amount to locked distribution
distribution[receiver] = distribution[receiver].add(amount);
// transfer to recipient
_transfer(msg.sender, receiver, amount);
}
lockedBalance keyboard_arrow_up
unlockedBalance keyboard_arrow_up
epochsPassed keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function epochsPassed() public view returns (uint256) {
// return 0 if timestamp is lower than start time
if (block.timestamp < LOCK_START) {
return 0;
}
// how long it has been since the beginning of lockup period
uint256 timePassed = block.timestamp.sub(LOCK_START);
// 1st epoch is FIRST_EPOCH_DELAY longer; we check to prevent subtraction underflow
if (timePassed < FIRST_EPOCH_DELAY) {
return 0;
}
// subtract the FIRST_EPOCH_DELAY, so that we can count all epochs as lasting EPOCH_DURATION
uint256 totalEpochsPassed = timePassed.sub(FIRST_EPOCH_DELAY).div(
EPOCH_DURATION
);
// epochs don't count over TOTAL_EPOCHS
if (totalEpochsPassed > TOTAL_EPOCHS) {
return TOTAL_EPOCHS;
}
return totalEpochsPassed;
}
epochsLeft keyboard_arrow_up
nextEpoch keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function nextEpoch() public view returns (uint256) {
// get number of epochs passed
uint256 passed = epochsPassed();
// if all epochs passed, return
if (passed == TOTAL_EPOCHS) {
// return INT_MAX
return uint256(-1);
}
// if no epochs passed, return latest epoch + delay + standard duration
if (passed == 0) {
return latestEpoch().add(FIRST_EPOCH_DELAY).add(EPOCH_DURATION);
}
// otherwise return latest epoch + epoch duration
return latestEpoch().add(EPOCH_DURATION);
}
latestEpoch keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function latestEpoch() public view returns (uint256) {
// get number of epochs passed
uint256 passed = epochsPassed();
// if no epochs passed, return lock start time
if (passed == 0) {
return LOCK_START;
}
// accounts for first epoch being longer
// lockStart + firstEpochDelay + (epochsPassed * epochDuration)
return LOCK_START.add(FIRST_EPOCH_DELAY).add(passed.mul(EPOCH_DURATION));
}
finalEpoch keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function finalEpoch() public pure returns (uint256) {
// lockStart + firstEpochDelay + (epochDuration * totalEpochs)
return
LOCK_START.add(FIRST_EPOCH_DELAY).add(EPOCH_DURATION.mul(TOTAL_EPOCHS));
}
lockStart keyboard_arrow_up
initialize keyboard_arrow_up
mint keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function mint(address _to, uint256 _amount) external onlyOwner {
if (totalSupply.add(_amount) <= MAX_SUPPLY) {
_mint(_to, _amount);
} else {
revert("Max supply exceeded");
}
}
burn keyboard_arrow_up
Requirements help
amount
must be less than or equal to
the result of calling unlockedBalance with the sender's address
amount
must be less than or equal to
the result of calling unlockedBalance with the sender's address
Source Code
function burn(uint256 amount) external {
_burn(msg.sender, amount);
}
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 TimeLockedToken._transfer keyboard_arrow_up
Requirements help
amount
must be less than or equal to
the result of calling unlockedBalance with the sender's address
Source Code
function _transfer(
address _from,
address _to,
uint256 _value
) internal override {
require(balanceOf[_from] >= _value, "insufficient balance");
// transfers to owner proceed as normal when returns allowed
if (!returnsLocked && _to == owner_) {
transferToOwner(_from, _value);
return;
}
// check if enough unlocked balance to transfer
require(
unlockedBalance(_from) >= _value,
"attempting to transfer locked funds"
);
super._transfer(_from, _to, _value);
}
internal TimeLockedToken.transferToOwner keyboard_arrow_up
Requirements help
Source Code
function transferToOwner(address _from, uint256 _value) internal {
uint256 unlocked = unlockedBalance(_from);
if (unlocked < _value) {
// We want to have unlocked = value, i.e.
// value = balance - distribution * epochsLeft / totalEpochs
// distribution = (balance - value) * totalEpochs / epochsLeft
distribution[_from] = balanceOf[_from].sub(_value).mul(TOTAL_EPOCHS).div(
epochsLeft()
);
}
super._transfer(_from, owner_, _value);
}
internal TimeLockedToken._burn keyboard_arrow_up
Requirements help
amount
must be less than or equal to
the result of calling unlockedBalance with the sender's address
Source Code
function _burn(address _from, uint256 _value) internal override {
require(balanceOf[_from] >= _value, "insufficient balance");
require(unlockedBalance(_from) >= _value, "attempting to burn locked funds");
super._burn(_from, _value);
}
internal ERC20._transfer keyboard_arrow_up
Requirements help
Source Code
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
balanceOf[sender] = balanceOf[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
balanceOf[recipient] = balanceOf[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
internal ERC20._mint keyboard_arrow_up
Source Code
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
totalSupply = totalSupply.add(amount);
balanceOf[account] = balanceOf[account].add(amount);
emit Transfer(address(0), account, amount);
}
internal ERC20._burn keyboard_arrow_up
Source Code
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
balanceOf[account] = balanceOf[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
totalSupply = totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
internal ERC20._approve keyboard_arrow_up
Requirements help
Source Code
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
internal ERC20._beforeTokenTransfer keyboard_arrow_up
internal Context._msgSender keyboard_arrow_up
internal Context._msgData keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}