Blockwell

PTest2

ERC20

This contract is an ERC20 token.

Name PTest2
Symbol PT2
Decimals 18
Total Supply 250,000,000 PT2

About

Stats

Public Functions 26
Event Types 11
Code Size 14,514 bytes

Library Use

Uses SafeMath for uint256.

Events (11) keyboard_arrow_up

AdminAdded Event

Parameters help
account
address help

AdminRemoved Event

Parameters help
account
address help

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

Frozen Event

Parameters help
account
address help

Membership Event

Parameters help
account
address help
eth
uint256 help
tokens
uint256 help

MultiTransferPrevented Event

Parameters help
from
address help
to
address help
value
uint256 help

Paused Event

Parameters help
account
address help

PriceSet Event

Parameters help
price
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

Unfrozen Event

Parameters help
account
address help

Unpaused Event

Parameters help
account
address help

name Variable

string help

symbol Variable

string help

decimals Variable

uint8 help

price Variable

uint256 help

balances Variable

mapping(address => uint256) help
Internal Variable

allowed Variable

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

totalTokenSupply Variable

uint256 help
Internal Variable

admins Variable

Roles.Role help
Internal Variable

frozen Variable

Roles.Role help
Internal Variable

_paused Variable

bool help
Internal Variable

Functions Expand All Collapse All

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

isFrozen keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

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

isAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

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

addAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function addAdmin(address account) public onlyAdmin {
  _addAdmin(account);
}

removeAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function removeAdmin(address account) public onlyAdmin {
  _removeAdmin(account);
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() external payable {
  uint256 tokens = msg.value.div(price).mul(1 ether);

  _transfer(this, msg.sender, tokens);
  emit Membership(msg.sender, msg.value, tokens);
}

tokensAvailable keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function tokensAvailable() public view returns (uint256) {
  return balanceOf(this);
}

setPrice keyboard_arrow_up

Parameters help

Name Type
newPrice
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function setPrice(uint256 newPrice) public onlyAdmin {
  price = newPrice;
  emit PriceSet(price);
}

withdrawTokens keyboard_arrow_up

Parameters help

Name Type
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function withdrawTokens(uint256 value) public onlyAdmin {
  _transfer(this, msg.sender, value);
}

withdraw keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function withdraw() public onlyAdmin {
  msg.sender.transfer(address(this).balance);
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function pause() public whenNotPaused onlyAdmin {
  _pause();
}

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 whenPaused onlyAdmin {
  _unpause();
}

freeze keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function freeze(address account) public onlyAdmin {
  _freeze(account);
}

unfreeze keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null
Source Code
function unfreeze(address account) public onlyAdmin {
  _unfreeze(account);
}

multiFreeze keyboard_arrow_up

Parameters help

Name Type
account
address[] help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null

Requirements help

Source Code
function multiFreeze(address[] account) public onlyAdmin {
  require(account.length > 0, "Account array must not be empty");

  for (uint256 i = 0; i < account.length; i++) {
    _freeze(account[i]);
  }
}

multiUnfreeze keyboard_arrow_up

Parameters help

Name Type
account
address[] help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyAdmin checks for the following:
null

Requirements help

Source Code
function multiUnfreeze(address[] account) public onlyAdmin {
  require(account.length > 0, "Account array must not be empty");

  for (uint256 i = 0; i < account.length; i++) {
    _unfreeze(account[i]);
  }
}

Parameters help

This function has no parameters.

Properties

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

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
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
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

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

multiTransfer keyboard_arrow_up

Parameters help

Name Type
to
address[] help
value
uint256[] help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function multiTransfer(address[] to, uint256[] value)
  public
  whenNotPaused
  returns (bool)
{
  require(to.length > 0, "To array must not be empty");
  require(value.length == to.length, "Arrays must be of equal length");

  for (uint256 i = 0; i < to.length; i++) {
    if (!isFrozen(to[i])) {
      _transfer(msg.sender, to[i], value[i]);
    } else {
      emit MultiTransferPrevented(msg.sender, to[i], value[i]);
    }
  }

  return true;
}

Parameters help

Name Type
spender
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function approve(address spender, uint256 value)
  public
  isNotFrozen
  whenNotPaused
  returns (bool)
{
  require(spender != address(0));

  allowed[msg.sender][spender] = value;
  emit Approval(msg.sender, spender, value);
  return true;
}

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) {
  allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
  _transfer(from, to, value);
  return true;
}

multiTransferFrom keyboard_arrow_up

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 multiTransferFrom(
  address from,
  address[] to,
  uint256[] value
) public whenNotPaused returns (bool) {
  require(to.length > 0, "To array must not be empty");
  require(value.length == to.length, "Arrays must be of equal length");

  for (uint256 i = 0; i < to.length; i++) {
    if (!isFrozen(to[i])) {
      allowed[from][msg.sender] = allowed[from][msg.sender].sub(value[i]);
      _transfer(from, to[i], value[i]);
    } else {
      emit MultiTransferPrevented(from, to[i], value[i]);
    }
  }

  return true;
}

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
  isNotFrozen
  whenNotPaused
  returns (bool)
{
  require(spender != address(0));

  allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue);
  emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
  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
  isNotFrozen
  whenNotPaused
  returns (bool)
{
  require(spender != address(0));

  allowed[msg.sender][spender] = allowed[msg.sender][spender].sub(
    subtractedValue
  );
  emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
  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 PrideToken._transfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
value
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transfer(
  address from,
  address to,
  uint256 value
) internal {
  require(to != address(0));
  require(!isFrozen(from), "From must not be frozen");
  require(!isFrozen(to), "To must not be frozen");

  balances[from] = balances[from].sub(value);
  balances[to] = balances[to].add(value);
  emit Transfer(from, to, value);
}

internal AdminRole._addAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addAdmin(address account) internal {
  admins.add(account);
  emit AdminAdded(account);
}

internal AdminRole._removeAdmin keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _removeAdmin(address account) internal {
  admins.remove(account);
  emit AdminRemoved(account);
}

internal FrozenRole._freeze keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _freeze(address account) internal {
  frozen.add(account);
  emit Frozen(account);
}

internal FrozenRole._unfreeze keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _unfreeze(address account) internal {
  frozen.remove(account);
  emit Unfrozen(account);
}

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 Pausable._pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _pause() internal {
  _paused = true;
  emit Paused(msg.sender);
}

internal Pausable._unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function _unpause() internal {
  _paused = false;
  emit Unpaused(msg.sender);
}