Blockwell

V-ID Token

ERC20

This contract is an ERC20 token.

Name V-ID Token
Symbol VIDT
Decimals 18
Total Supply 57,563,931 VIDT

About

Stats

Public Functions 22
Event Types 10
Code Size 9,673 bytes

Library Use

Uses SafeMath for uint256.
Uses SafeERC20 for ERC20.

Events (10) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

Burn Event

Parameters help
burner
address help
value
uint256 help

Freeze Event

Parameters help
target
address help
frozen
bool help

LogEvent Event

Parameters help
index
uint256 help
data
string help

Pause Event

Parameters help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

Unpause Event

Parameters help

ValidateFile Event

Parameters help
index
uint256 help
data
string help

ValidatePublisher Event

Parameters help
publisherAddress
address help
state
bool help
publisherName
string help

ValidateWallet Event

Parameters help
walletAddress
address help
state
bool help
walletName
string help

fStruct Struct

Members
index
uint256 help

TKN Struct

Members
sender
address help
value
uint256 help
data
bytes help
sig
bytes4 help

name Constant

string help
V-ID Token

decimals Constant

uint8 help
18

symbol Constant

string help
VIDT

initialSupply Constant

uint256 help
100000000

validationPrice Variable

uint256 help

validationWallet Variable

address help

owner Variable

address help

paused Variable

bool help

totalSupply Variable

uint256 help

balances Variable

mapping(address => uint256) help

frozenAccount Variable

mapping(address => bool) help

verifyPublisher Variable

mapping(address => bool) help

verifyWallet Variable

mapping(address => bool) help

allowed Variable

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

fileHashes Variable

mapping(string => fStruct) help
Internal Variable

fileIndex Variable

string[] help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
_owner
address help

Properties

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

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 remaining)
{
  return allowed[_owner][_spender];
}

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 success)
{
  require(_to != msg.sender, "T1- Recipient can not be the same as sender");
  require(_to != address(0), "T2- Please check the recipient address");
  require(
    balances[msg.sender] >= _value,
    "T3- The balance of sender is too low"
  );
  require(!frozenAccount[msg.sender], "T4- The wallet of sender is frozen");
  require(!frozenAccount[_to], "T5- The wallet of recipient is frozen");

  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
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

One or more of the following:
Source Code
function approve(address _spender, uint256 _value)
  public
  whenNotPaused
  returns (bool success)
{
  require(
    (_value == 0) || (allowed[msg.sender][_spender] == 0),
    "A1- Reset allowance to 0 first"
  );

  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

Requirements help

Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _value
) public whenNotPaused returns (bool success) {
  require(_to != address(0), "TF1- Please check the recipient address");
  require(balances[_from] >= _value, "TF2- The balance of sender is too low");
  require(
    allowed[_from][msg.sender] >= _value,
    "TF3- The allowance of sender is too low"
  );
  require(!frozenAccount[_from], "TF4- The wallet of sender is frozen");
  require(!frozenAccount[_to], "TF5- The wallet of recipient is frozen");

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

setOwner keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setOwner(address newOwner) public onlyOwner {
  owner = newOwner;
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function pause() public onlyOwner whenNotPaused {
  paused = true;
  emit Pause();
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function unpause() public onlyOwner whenPaused {
  paused = false;
  emit Unpause();
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
function() public payable {
  revert();
}

increaseApproval keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_addedValue
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function increaseApproval(address _spender, uint256 _addedValue)
  public
  whenNotPaused
  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

Modifiers help

Source Code
function decreaseApproval(address _spender, uint256 _subtractedValue)
  public
  whenNotPaused
  returns (bool)
{
  allowed[msg.sender][_spender] = allowed[msg.sender][_spender].sub(
    _subtractedValue
  );

  emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);

  return true;
}

tokenFallback keyboard_arrow_up

Parameters help

Name Type
_from
address help
_value
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help pure
Source Code
function tokenFallback(
  address _from,
  uint256 _value,
  bytes _data
) public pure returns (bool) {
  TKN memory tkn;
  tkn.sender = _from;
  tkn.value = _value;
  tkn.data = _data;
  uint32 u = uint32(_data[3]) +
    (uint32(_data[2]) << 8) +
    (uint32(_data[1]) << 16) +
    (uint32(_data[0]) << 24);
  tkn.sig = bytes4(u);
  return true;
}

transferToken keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help
tokens
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferToken(address tokenAddress, uint256 tokens) public onlyOwner {
  ERC20(tokenAddress).safeTransfer(owner, tokens);
}

burn keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function burn(uint256 _value) public onlyOwner returns (bool) {
  require(
    _value <= balances[msg.sender],
    "B1- The balance of burner is too low"
  );

  balances[msg.sender] = balances[msg.sender].sub(_value);
  totalSupply = totalSupply.sub(_value);

  emit Burn(msg.sender, _value);

  emit Transfer(msg.sender, address(0), _value);

  return true;
}

freeze keyboard_arrow_up

Parameters help

Name Type
_address
address help
_state
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
function freeze(address _address, bool _state) public onlyOwner returns (bool) {
  frozenAccount[_address] = _state;

  emit Freeze(_address, _state);

  return true;
}

validatePublisher keyboard_arrow_up

Parameters help

Name Type
Address
address help
State
bool help
Publisher
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function validatePublisher(
  address Address,
  bool State,
  string Publisher
) public onlyOwner returns (bool) {
  verifyPublisher[Address] = State;

  emit ValidatePublisher(Address, State, Publisher);

  return true;
}

validateWallet keyboard_arrow_up

Parameters help

Name Type
Address
address help
State
bool help
Wallet
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function validateWallet(
  address Address,
  bool State,
  string Wallet
) public onlyOwner returns (bool) {
  verifyWallet[Address] = State;

  emit ValidateWallet(Address, State, Wallet);

  return true;
}

validateFile keyboard_arrow_up

Parameters help

Name Type
To
address help
Payment
uint256 help
Data
bytes help
cStore
bool help
eLog
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function validateFile(
  address To,
  uint256 Payment,
  bytes Data,
  bool cStore,
  bool eLog
) public whenNotPaused returns (bool) {
  require(Payment >= validationPrice, "V1- Insufficient payment provided");
  require(verifyPublisher[msg.sender], "V2- Unverified publisher address");
  require(!frozenAccount[msg.sender], "V3- The wallet of publisher is frozen");
  require(Data.length == 64, "V4- Invalid hash provided");

  if (!verifyWallet[To] || frozenAccount[To]) {
    To = validationWallet;
  }

  uint256 index = 0;
  string memory fileHash = string(Data);

  if (cStore) {
    if (fileIndex.length > 0) {
      require(
        fileHashes[fileHash].index == 0,
        "V5- This hash was previously validated"
      );
    }

    fileHashes[fileHash].index = fileIndex.push(fileHash) - 1;
    index = fileHashes[fileHash].index;
  }

  if (allowed[To][msg.sender] >= Payment) {
    allowed[To][msg.sender] = allowed[To][msg.sender].sub(Payment);
  } else {
    balances[msg.sender] = balances[msg.sender].sub(Payment);
    balances[To] = balances[To].add(Payment);
  }

  emit Transfer(msg.sender, To, Payment);

  if (eLog) {
    emit ValidateFile(index, fileHash);
  }

  return true;
}

verifyFile keyboard_arrow_up

Parameters help

Name Type
fileHash
string help

Properties

Visibility help public
Mutability help view
Source Code
function verifyFile(string fileHash) public view returns (bool) {
  if (fileIndex.length == 0) {
    return false;
  }

  bytes memory a = bytes(fileIndex[fileHashes[fileHash].index]);
  bytes memory b = bytes(fileHash);

  if (a.length != b.length) {
    return false;
  }

  for (uint256 i = 0; i < a.length; i++) {
    if (a[i] != b[i]) {
      return false;
    }
  }

  return true;
}

setPrice keyboard_arrow_up

Parameters help

Name Type
newPrice
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function setPrice(uint256 newPrice) public onlyOwner {
  validationPrice = newPrice;
}

setWallet keyboard_arrow_up

Parameters help

Name Type
newWallet
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setWallet(address newWallet) public onlyOwner {
  validationWallet = newWallet;
}

listFiles keyboard_arrow_up

Parameters help

Name Type
startAt
uint256 help
stopAt
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function listFiles(uint256 startAt, uint256 stopAt)
  public
  onlyOwner
  returns (bool)
{
  if (fileIndex.length == 0) {
    return false;
  }

  require(startAt <= fileIndex.length - 1, "L1- Please select a valid start");

  if (stopAt > 0) {
    require(
      stopAt > startAt && stopAt <= fileIndex.length - 1,
      "L2- Please select a valid stop"
    );
  } else {
    stopAt = fileIndex.length - 1;
  }

  for (uint256 i = startAt; i <= stopAt; i++) {
    emit LogEvent(i, fileIndex[i]);
  }

  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.