Blockwell

PCHAIN

ERC20

This contract is an ERC20 token.

Name PCHAIN
Symbol PAI
Decimals 18
Total Supply 2,100,000,000 PAI

About

Stats

Public Functions 13
Event Types 9
Code Size 10,636 bytes

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

BlacklistEvent Event

Parameters help
_addr
address help
_b
uint256 help

CloseBlacklistSwitchEvent Event

Parameters help
_b
bool help

EthSweepSuccess Event

Parameters help
_addr
address help
_value
uint256 help

PurchaseSuccess Event

Parameters help
_addr
address help
_weiAmount
uint256 help
_crowdsaleEth
uint256 help
_balance
uint256 help

ReflectEvent Event

Parameters help
_addr
address help
_paiAddr
string help

SetReflectSwitchEvent Event

Parameters help
_b
bool help

SetTransferLockEvent Event

Parameters help
_b
bool help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

Functions Expand All Collapse All

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:
Source Code
  function transferOwnership(address _newOwner) onlyOwner {
    if (_newOwner != address(0)) {
      owner = _newOwner;
    }
  }

balanceOf keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

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

transfer keyboard_arrow_up

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPayloadSize checks for the following:
canTransfer checks for the following:
Source Code
  function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) canTransfer returns (bool success) {
    
    balances[msg.sender] = safeSub(balances[msg.sender], _value);
    balances[_to] = safeAdd(balances[_to], _value);
    Transfer(msg.sender, _to, _value);
    return true;
  }

transferFrom 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

onlyPayloadSize checks for the following:
canTransfer checks for the following:
Source Code
  function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) canTransfer returns (bool success) {
    uint256 _allowance = allowed[_from][msg.sender];
    allowed[_from][msg.sender] = safeSub(_allowance, _value);
    balances[_from] = safeSub(balances[_from], _value);
    balances[_to] = safeAdd(balances[_to], _value);
    Transfer(_from, _to, _value);
    return true;
  }

approve keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

canTransfer checks for the following:
Source Code
   function approve(address _spender, uint256 _value) canTransfer returns (bool success) {

    // To change the approve amount you first have to reduce the addresses`
    //  allowance to zero by calling `approve(_spender, 0)` if it is not
    //  already 0 to mitigate the race condition described here:
    //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) revert();

    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
  }

allowance keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

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

setTransferLock keyboard_arrow_up

Parameters help

Name Type
_lock
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
Source Code
  function setTransferLock(bool _lock) onlyOwner{
      transferLock = _lock;
      SetTransferLockEvent(_lock);
  }

closeBlacklistSwitch keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
Source Code
  function closeBlacklistSwitch() onlyOwner{
    blacklistSwitch = false;
    CloseBlacklistSwitchEvent(false);
  }

setBlacklist keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:

Requirements help

Source Code
  function setBlacklist(address _addr) onlyOwner{
      require(blacklistSwitch);
      uint256 tokenAmount = balances[_addr];             //calculate user token amount
      balances[_addr] = 0;//clear user‘s PAI balance
      balances[saleAddr] = safeAdd(balances[saleAddr],tokenAmount);  //add PAI tokenAmount to Sale
      Transfer(_addr, saleAddr, tokenAmount);
      BlacklistEvent(_addr,tokenAmount);
  }

setReflectSwitch keyboard_arrow_up

Parameters help

Name Type
_s
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
Source Code
  function setReflectSwitch(bool _s) onlyOwner{
      reflectSwitch = _s;
      SetReflectSwitchEvent(_s);
  }

reflect keyboard_arrow_up

Parameters help

Name Type
_paiAddress
string help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
  function reflect(string _paiAddress){
      require(reflectSwitch);
      reflects[msg.sender] = _paiAddress;
      ReflectEvent(msg.sender,_paiAddress);
  }

purchase keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
  function purchase() payable{
      require(block.timestamp <= deadline);                                 //the timestamp must be less than the deadline time
      require(tx.gasprice <= 60000000000);
      require(block.timestamp >= start);                                //the timestamp must be greater than the start time
      uint256 weiAmount = msg.value;                                    // The amount purchased by the current user
      require(weiAmount >= 0.1 ether);
      crowdETHTotal = safeAdd(crowdETHTotal,weiAmount);                 // Calculate the total amount purchased by all users
      require(crowdETHTotal <= crowdTarget);                            // The total amount is less than or equal to the target amount
      uint256 userETHTotal = safeAdd(crowdETHs[msg.sender],weiAmount);  // Calculate the total amount purchased by the current user
      if(block.timestamp <= end){                                       // whether the current timestamp is in the first phase
        require(userETHTotal <= 0.4 ether);                             // whether the total amount purchased by the current user is less than 0.4ETH
      }else{
        require(userETHTotal <= 10 ether);                              // whether the total amount purchased by the current user is less than 10ETH
      }      
      
      crowdETHs[msg.sender] = userETHTotal;                             // Record the total amount purchased by the current user

      uint256 tokenAmount = safeMul(weiAmount,crowdPrice);             //calculate user token amount
      balances[msg.sender] = safeAdd(tokenAmount,balances[msg.sender]);//recharge user‘s PAI balance
      balances[saleAddr] = safeSub(balances[saleAddr],tokenAmount);  //sub PAI tokenAmount from  Sale
      wallet.transfer(weiAmount);
      Transfer(saleAddr, msg.sender, tokenAmount);
      PurchaseSuccess(msg.sender,weiAmount,crowdETHs[msg.sender],tokenAmount); 
  }

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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