ERC20
This contract is an ERC20 token.
Name
MXCToken
Symbol
MXC
Decimals
18
Total Supply
2,664,965,800 MXC
About link
MXC (MXC) is a cryptocurrency and operates on the Ethereum platform. MXC has a current supply of 2,642,132,373 with 2,602,788,083.3783226 in circulation. The last known price of MXC is 0.02493048 USD and is down -6.21 over the last 24 hours. It is currently trading on 20 active market(s) with $15,014,142.12 traded over the last 24 hours. More information can be found at https://www.mxc.org/.
Stats
Public Functions
13
Event Types
5
Code Size
15,695 bytes
Events (5) keyboard_arrow_up
State Variables (4) keyboard_arrow_up
Functions
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
Source Code
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
allowance keyboard_arrow_up
transferFrom keyboard_arrow_up
Requirements help
Source Code
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
approve keyboard_arrow_up
Source Code
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
increaseApproval keyboard_arrow_up
Source Code
function increaseApproval(address _spender, uint256 _addedValue)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue)
);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
decreaseApproval keyboard_arrow_up
Source Code
function decreaseApproval(address _spender, uint256 _subtractedValue)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
vestBalanceOf keyboard_arrow_up
Source Code
function vestBalanceOf(address who)
public
view
returns (
uint256 amount,
uint256 vestedAmount,
uint256 start,
uint256 cliff,
uint256 vesting
)
{
require(who != address(0));
amount = timeLocks[who].amount;
vestedAmount = timeLocks[who].vestedAmount;
start = timeLocks[who].start;
cliff = timeLocks[who].cliff;
vesting = timeLocks[who].vesting;
}
grantToken keyboard_arrow_up
Parameters help
Requirements help
Source Code
function grantToken(
address _to,
uint256 _amount,
uint256 _start,
uint256 _cliff,
uint256 _vesting
) public returns (bool success) {
require(_to != address(0));
require(
_amount <= balances[msg.sender],
"Not enough balance to grant token."
);
require(_amount > 0, "Nothing to transfer.");
require(
(timeLocks[_to].amount.sub(timeLocks[_to].vestedAmount) == 0),
"The previous vesting should be completed."
);
require(_cliff >= _start, "_cliff must be >= _start");
require(_vesting > _start, "_vesting must be bigger than _start");
require(_vesting > _cliff, "_vesting must be bigger than _cliff");
balances[msg.sender] = balances[msg.sender].sub(_amount);
timeLocks[_to] = TimeLock(
_amount,
0,
0,
_start,
_cliff,
_vesting,
msg.sender
);
emit NewTokenGrant(msg.sender, _to, _amount, _start, _cliff, _vesting);
return true;
}
grantTokenStartNow keyboard_arrow_up
redeemVestableToken keyboard_arrow_up
Requirements help
Source Code
function redeemVestableToken(address _to) public returns (bool success) {
require(_to != address(0));
require(timeLocks[_to].amount > 0, "Nothing was granted to this address!");
require(
timeLocks[_to].vestedAmount < timeLocks[_to].amount,
"All tokens were vested!"
);
(uint256 amount, uint256 vestedMonths, uint256 curTime) = calcVestableToken(
_to
);
require(amount > 0, "Nothing to redeem now.");
TimeLock storage t = timeLocks[_to];
balances[_to] = balances[_to].add(amount);
t.vestedAmount = t.vestedAmount.add(amount);
t.vestedMonths = t.vestedMonths + uint16(vestedMonths);
t.cliff = curTime;
emit VestedTokenRedeemed(_to, amount, vestedMonths);
return true;
}
returnGrantedToken keyboard_arrow_up
Requirements help
Source Code
function returnGrantedToken(uint256 _amount) public returns (bool success) {
address to = timeLocks[msg.sender].from;
require(to != address(0));
require(_amount > 0, "Nothing to transfer.");
require(timeLocks[msg.sender].amount > 0, "Nothing to return.");
require(
_amount <=
timeLocks[msg.sender].amount.sub(timeLocks[msg.sender].vestedAmount),
"Not enough granted token to return."
);
timeLocks[msg.sender].amount = timeLocks[msg.sender].amount.sub(_amount);
balances[to] = balances[to].add(_amount);
emit GrantedTokenReturned(msg.sender, to, _amount);
return true;
}
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 MXCToken.calcVestableToken keyboard_arrow_up
Requirements help
Source Code
function calcVestableToken(address _to)
internal
view
returns (
uint256 amount,
uint256 vestedMonths,
uint256 curTime
)
{
uint256 vestTotalMonths;
uint256 vestedAmount;
uint256 vestPart;
amount = 0;
vestedMonths = 0;
curTime = now;
require(timeLocks[_to].amount > 0, "Nothing was granted to this address.");
if (curTime <= timeLocks[_to].cliff) {
return (0, 0, curTime);
}
vestedMonths = curTime.sub(timeLocks[_to].start) / MONTH;
vestedMonths = vestedMonths.sub(timeLocks[_to].vestedMonths);
if (curTime >= timeLocks[_to].vesting) {
return (
timeLocks[_to].amount.sub(timeLocks[_to].vestedAmount),
vestedMonths,
curTime
);
}
if (vestedMonths > 0) {
vestTotalMonths = timeLocks[_to].vesting.sub(timeLocks[_to].start) / MONTH;
vestPart = timeLocks[_to].amount.div(vestTotalMonths);
amount = vestedMonths.mul(vestPart);
vestedAmount = timeLocks[_to].vestedAmount.add(amount);
if (vestedAmount > timeLocks[_to].amount) {
amount = timeLocks[_to].amount.sub(timeLocks[_to].vestedAmount);
}
}
return (amount, vestedMonths, curTime);
}