Blockwell

MXCToken

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

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

GrantedTokenReturned Event

Parameters help
_from
address help
_to
address help
_amount
uint256 help

NewTokenGrant Event

Parameters help
_from
address help
_to
address help
_amount
uint256 help
_start
uint256 help
_cliff
uint256 help
_vesting
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

VestedTokenRedeemed Event

Parameters help
_to
address help
_amount
uint256 help
_vestedMonths
uint256 help

TimeLock Struct

Members
amount
uint256 help
vestedAmount
uint256 help
vestedMonths
uint16 help
start
uint256 help
cliff
uint256 help
vesting
uint256 help
from
address help

name Constant

string help
MXCToken

symbol Constant

string help
MXC

decimals Constant

uint8 help
18

MONTH Constant

uint256 help
3600 * 24 * 30

timeLocks Variable

mapping(address => TimeLock) help
Internal Variable

allowed Variable

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

balances Variable

mapping(address => uint256) help
Internal Variable

totalSupply_ Variable

uint256 help
Internal Variable

Functions Expand All Collapse All

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view returns (uint256) {
  return totalSupply_;
}

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address _owner) public view returns (uint256) {
  return balances[_owner];
}

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
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;
}

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

Visibility help public
Mutability help view
Source Code
function allowance(address _owner, address _spender)
  public
  view
  returns (uint256)
{
  return allowed[_owner][_spender];
}

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
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;
}

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
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

Parameters help

Name Type
_spender
address help
_addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction
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

Parameters help

Name Type
_spender
address help
_subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction
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

Parameters help

Name Type
who
address help

Properties

Visibility help public
Mutability help view

Requirements help

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

Name Type
_to
address help
_amount
uint256 help
_start
uint256 help
_cliff
uint256 help
_vesting
uint256 help

Properties

Visibility help public
Mutability help transaction

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

Parameters help

Name Type
_to
address help
_amount
uint256 help
_cliffMonths
uint256 help
_vestingMonths
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function grantTokenStartNow(
  address _to,
  uint256 _amount,
  uint256 _cliffMonths,
  uint256 _vestingMonths
) public returns (bool success) {
  return
    grantToken(
      _to,
      _amount,
      now,
      now.add(_cliffMonths.mul(MONTH)),
      now.add(_vestingMonths.mul(MONTH))
    );
}

redeemVestableToken keyboard_arrow_up

Parameters help

Name Type
_to
address help

Properties

Visibility help public
Mutability help transaction
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

Parameters help

Name Type
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
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 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 MXCToken.calcVestableToken keyboard_arrow_up

Parameters help

Name Type
_to
address help

Properties

Visibility help internal
Mutability help view

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);
}