Blockwell

Ultra Token

ERC20

This contract is an ERC20 token.

Name Ultra Token
Symbol UOS
Decimals 4
Total Supply 1,000,000,000 UOS

About link description

Ultra (UOS) is a cryptocurrency and operates on the Ethereum platform. Ultra has a current supply of 1,000,000,000 with 282,789,762.3439 in circulation. The last known price of Ultra is 0.50661333 USD and is up 0.54 over the last 24 hours. It is currently trading on 17 active market(s) with $1,783,331.17 traded over the last 24 hours. More information can be found at https://ultra.io/.

Stats

Public Functions 35
Event Types 12
Code Size 31,176 bytes

Library Use

Uses SafeMath for uint256.

Events (12) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

Claim Event

Parameters help
claimer
address help
claimed
uint256 help

ImportBalance Event

Parameters help
buyers
address[] help
tokens
uint256[] help
contractName
string help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Paused Event

Parameters help
account
address help

PauserAdded Event

Parameters help
account
address help

PauserRemoved Event

Parameters help
account
address help

SetKey Event

Parameters help
buyer
address help
EOSKey
string help

SetUpdateApproval Event

Parameters help
buyer
address help
isApproved
bool help

SetVestingContract Event

Parameters help
contractName
string help
basisPoints
uint256[] help
startMonth
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

Unpaused Event

Parameters help
account
address help

VestingContract Struct

Members
basisPoints
uint256[] help
startMonth
uint256 help
endMonth
uint256 help

BuyerInfo Struct

Members
total
uint256 help
claimed
uint256 help
contractName
string help

_name Variable

string help
Internal Variable

_symbol Variable

string help
Internal Variable

_decimals Variable

uint8 help
Internal Variable

_deployTime Variable

uint256 help
Internal Variable

_month Variable

uint256 help
Internal Variable

_vestingContracts Variable

mapping(string => VestingContract) help
Internal Variable

_buyerInfos Variable

mapping(address => BuyerInfo) help
Internal Variable

_keys Variable

mapping(address => string) help
Internal Variable

_updateApproval Variable

mapping(address => bool) help
Internal Variable

_balances Variable

mapping(address => uint256) help
Internal Variable

_allowances Variable

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

_totalSupply Variable

uint256 help
Internal Variable

_paused Variable

bool help
Internal Variable

_pausers Variable

Roles.Role help
Internal Variable

_owner Variable

address help
Internal Variable

Functions Expand All Collapse All

owner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function owner() public view returns (address) {
  return _owner;
}

isOwner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function isOwner() public view returns (bool) {
  return msg.sender == _owner;
}

renounceOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function renounceOwnership() public onlyOwner {
  emit OwnershipTransferred(_owner, address(0));
  _owner = address(0);
}

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function transferOwnership(address newOwner) public onlyOwner {
  _transferOwnership(newOwner);
}

isPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isPauser(address account) public view returns (bool) {
  return _pausers.has(account);
}

addPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null
Source Code
function addPauser(address account) public onlyPauser {
  _addPauser(account);
}

renouncePauser keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function renouncePauser() public {
  _removePauser(msg.sender);
}

paused keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function paused() public view returns (bool) {
  return _paused;
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null
Source Code
function pause() public onlyPauser whenNotPaused {
  _paused = true;
  emit Paused(msg.sender);
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function unpause() public onlyPauser whenPaused {
  _paused = false;
  emit Unpaused(msg.sender);
}

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
account
address help

Properties

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

Parameters help

Name Type
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transfer(address to, uint256 value)
  public
  whenNotPaused
  returns (bool)
{
  return super.transfer(to, value);
}

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 _allowances[owner][spender];
}

Parameters help

Name Type
spender
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function approve(address spender, uint256 value)
  public
  whenNotPaused
  returns (bool)
{
  return super.approve(spender, value);
}

Parameters help

Name Type
from
address help
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function transferFrom(
  address from,
  address to,
  uint256 value
) public whenNotPaused returns (bool) {
  return super.transferFrom(from, to, value);
}

Parameters help

Name Type
spender
address help
addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function increaseAllowance(address spender, uint256 addedValue)
  public
  returns (bool)
{
  _approve(
    msg.sender,
    spender,
    _allowances[msg.sender][spender].add(addedValue)
  );
  return true;
}

Parameters help

Name Type
spender
address help
subtractedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
  public
  returns (bool)
{
  _approve(
    msg.sender,
    spender,
    _allowances[msg.sender][spender].sub(subtractedValue)
  );
  return true;
}

Parameters help

Name Type
spender
address help
addedValue
uint help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function increaseAllowance(address spender, uint256 addedValue)
  public
  whenNotPaused
  returns (bool)
{
  return super.increaseAllowance(spender, addedValue);
}

Parameters help

Name Type
spender
address help
subtractedValue
uint help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function decreaseAllowance(address spender, uint256 subtractedValue)
  public
  whenNotPaused
  returns (bool)
{
  return super.decreaseAllowance(spender, subtractedValue);
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function name() public view returns (string memory) {
  return _name;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function symbol() public view returns (string memory) {
  return _symbol;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function decimals() public view returns (uint8) {
  return _decimals;
}

deployTime keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

buyerInformation keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function buyerInformation()
  public
  view
  returns (
    uint256,
    uint256,
    string memory
  )
{
  BuyerInfo storage buyerInfo = _buyerInfos[msg.sender];
  return (buyerInfo.total, buyerInfo.claimed, buyerInfo.contractName);
}

nextVestingDate keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function nextVestingDate() public view returns (uint256) {
  BuyerInfo storage buyerInfo = _buyerInfos[msg.sender];
  require(buyerInfo.total > 0, "Buyer does not exist");
  VestingContract storage vestingContract = _vestingContracts[
    buyerInfo.contractName
  ];
  uint256 currentMonth = block.timestamp.sub(_deployTime).div(_month);
  if (currentMonth < vestingContract.startMonth) {
    return _deployTime.add(vestingContract.startMonth.mul(_month));
  } else if (currentMonth >= vestingContract.endMonth) {
    return _deployTime.add(vestingContract.endMonth.mul(_month));
  } else {
    return _deployTime.add(currentMonth.add(1).mul(_month));
  }
}

setVestingContract keyboard_arrow_up

Parameters help

Name Type
contractName
string help
basisPoints
uint256[] help
startMonth
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function setVestingContract(
  string memory contractName,
  uint256[] memory basisPoints,
  uint256 startMonth
) public onlyOwner whenNotPaused returns (bool) {
  VestingContract storage vestingContract = _vestingContracts[contractName];
  require(
    vestingContract.basisPoints.length == 0,
    "can't change an existing contract"
  );
  uint256 totalBPs = 0;
  for (uint256 i = 0; i < basisPoints.length; i++) {
    totalBPs = totalBPs.add(basisPoints[i]);
  }
  require(totalBPs == 10000, "invalid basis points array"); // this also ensures array length is not zero

  vestingContract.basisPoints = basisPoints;
  vestingContract.startMonth = startMonth;
  vestingContract.endMonth = startMonth.add(basisPoints.length).sub(1);

  emit SetVestingContract(contractName, basisPoints, startMonth);
  return true;
}

importBalance keyboard_arrow_up

Parameters help

Name Type
buyers
address[] help
tokens
uint256[] help
contractName
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function importBalance(
  address[] memory buyers,
  uint256[] memory tokens,
  string memory contractName
) public onlyOwner whenNotPaused returns (bool) {
  require(buyers.length == tokens.length, "buyers and balances mismatch");

  VestingContract storage vestingContract = _vestingContracts[contractName];
  require(vestingContract.basisPoints.length > 0, "contract does not exist");

  for (uint256 i = 0; i < buyers.length; i++) {
    require(tokens[i] > 0, "cannot import zero balance");
    BuyerInfo storage buyerInfo = _buyerInfos[buyers[i]];
    require(
      buyerInfo.total == 0,
      "have already imported balance for this buyer"
    );
    buyerInfo.total = tokens[i];
    buyerInfo.contractName = contractName;
  }

  emit ImportBalance(buyers, tokens, contractName);
  return true;
}

claim keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function claim() public whenNotPaused returns (bool) {
  uint256 canClaim = claimableToken();

  require(canClaim > 0, "No token is available to claim");

  _buyerInfos[msg.sender].claimed = _buyerInfos[msg.sender].claimed.add(
    canClaim
  );
  _transfer(address(this), msg.sender, canClaim);

  emit Claim(msg.sender, canClaim);
  return true;
}

claimableToken keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function claimableToken() public view returns (uint256) {
  BuyerInfo storage buyerInfo = _buyerInfos[msg.sender];

  if (buyerInfo.claimed < buyerInfo.total) {
    VestingContract storage vestingContract = _vestingContracts[
      buyerInfo.contractName
    ];
    uint256 currentMonth = block.timestamp.sub(_deployTime).div(_month);

    if (currentMonth < vestingContract.startMonth) {
      return uint256(0);
    }

    if (currentMonth >= vestingContract.endMonth) {
      // vest the unclaimed token all at once so there's no remainder
      return buyerInfo.total.sub(buyerInfo.claimed);
    } else {
      uint256 claimableIndex = currentMonth.sub(vestingContract.startMonth);
      uint256 canClaim = 0;
      for (uint256 i = 0; i <= claimableIndex; ++i) {
        canClaim = canClaim.add(vestingContract.basisPoints[i]);
      }
      return canClaim.mul(buyerInfo.total).div(10000).sub(buyerInfo.claimed);
    }
  }
  return uint256(0);
}

register keyboard_arrow_up

Parameters help

Name Type
EOSKey
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function register(string memory EOSKey) public whenNotPaused returns (bool) {
  _register(EOSKey);
  return true;
}

keyOf keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function keyOf() public view returns (string memory) {
  return _keys[msg.sender];
}

setUpdateApproval keyboard_arrow_up

Parameters help

Name Type
buyer
address help
isApproved
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function setUpdateApproval(address buyer, bool isApproved)
  public
  onlyOwner
  returns (bool)
{
  require(
    balanceOf(buyer) > 0 || _buyerInfos[buyer].total > 0,
    "This account has no token"
  ); // allowance will not be considered
  _updateApproval[buyer] = isApproved;

  emit SetUpdateApproval(buyer, isApproved);
  return true;
}

updateApproved keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function updateApproved() public view returns (bool) {
  return _updateApproval[msg.sender];
}

update keyboard_arrow_up

Parameters help

Name Type
EOSKey
string help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function update(string memory EOSKey) public returns (bool) {
  require(
    _updateApproval[msg.sender],
    "Need approval from ultra after contract is frozen"
  );
  _register(EOSKey);
  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 UltraToken._register keyboard_arrow_up

Parameters help

Name Type
EOSKey
string help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _register(string memory EOSKey) internal {
  require(
    bytes(EOSKey).length > 0 && bytes(EOSKey).length <= 64,
    "EOS public key length should be less than 64 characters"
  );
  _keys[msg.sender] = EOSKey;

  emit SetKey(msg.sender, EOSKey);
}

internal ERC20._transfer keyboard_arrow_up

Parameters help

Name Type
sender
address help
recipient
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transfer(
  address sender,
  address recipient,
  uint256 amount
) internal {
  require(sender != address(0), "ERC20: transfer from the zero address");
  require(recipient != address(0), "ERC20: transfer to the zero address");

  _balances[sender] = _balances[sender].sub(amount);
  _balances[recipient] = _balances[recipient].add(amount);
  emit Transfer(sender, recipient, amount);
}

internal ERC20._mint keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _mint(address account, uint256 amount) internal {
  require(account != address(0), "ERC20: mint to the zero address");

  _totalSupply = _totalSupply.add(amount);
  _balances[account] = _balances[account].add(amount);
  emit Transfer(address(0), account, amount);
}

internal ERC20._burn keyboard_arrow_up

Parameters help

Name Type
account
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _burn(address account, uint256 value) internal {
  require(account != address(0), "ERC20: burn from the zero address");

  _totalSupply = _totalSupply.sub(value);
  _balances[account] = _balances[account].sub(value);
  emit Transfer(account, address(0), value);
}

internal ERC20._approve keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _approve(
  address owner,
  address spender,
  uint256 value
) internal {
  require(owner != address(0), "ERC20: approve from the zero address");
  require(spender != address(0), "ERC20: approve to the zero address");

  _allowances[owner][spender] = value;
  emit Approval(owner, spender, value);
}

internal ERC20._burnFrom keyboard_arrow_up

Parameters help

Name Type
account
address help
amount
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burnFrom(address account, uint256 amount) internal {
  _burn(account, amount);
  _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}

internal Pausable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _paused = false;
}

internal PauserRole.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _addPauser(msg.sender);
}

internal PauserRole._addPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addPauser(address account) internal {
  _pausers.add(account);
  emit PauserAdded(account);
}

internal PauserRole._removePauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _removePauser(address account) internal {
  _pausers.remove(account);
  emit PauserRemoved(account);
}

internal Ownable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _owner = msg.sender;
  emit OwnershipTransferred(address(0), _owner);
}

internal Ownable._transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _transferOwnership(address newOwner) internal {
  require(newOwner != address(0), "Ownable: new owner is the zero address");
  emit OwnershipTransferred(_owner, newOwner);
  _owner = newOwner;
}