Blockwell

Huobi BTC

ERC20

This contract is an ERC20 token.

Name Huobi BTC
Symbol HBTC
Decimals 18
Total Supply 39,906 HBTC

About link description

Huobi BTC (HBTC) is a cryptocurrency and operates on the Ethereum platform. Huobi BTC has a current supply of 39,906.36705999. The last known price of Huobi BTC is 32,135.4624152 USD and is up 2.01 over the last 24 hours. It is currently trading on 10 active market(s) with $11,721,689.21 traded over the last 24 hours. More information can be found at https://www.hbtc.finance/en-us/.

Stats

Public Functions 21
Event Types 10
Code Size 25,170 bytes

Events (10) keyboard_arrow_up

AdminChanged Event

Parameters help
TaskType
string help
class
string help
oldAddress
address help
newAddress
address help

AdminRequiredNumChanged Event

Parameters help
TaskType
string help
class
string help
previousNum
uint256 help
requiredNum
uint256 help

AdminTaskDropped Event

Parameters help
taskHash
bytes32 help

Approval Event

Parameters help
owner
address help
spender
address help
value
uint256 help

Burned Event

Parameters help
from
address help
value
uint256 help
proof
string help
btcAddress
string help

Burning Event

Parameters help
from
address help
value
uint256 help
proof
string help
btcAddress
string help
burner
address help

Minted Event

Parameters help
to
address help
value
uint256 help
proof
string help

Minting Event

Parameters help
to
address help
value
uint256 help
proof
string help
minter
address help

PauseChangedTo Event

Parameters help
pauseState
bool help

Transfer Event

Parameters help
from
address help
to
address help
value
uint256 help

name Constant

string help
Huobi BTC

symbol Constant

string help
HBTC

decimals Constant

uint8 help
18

OWNERHASH Constant

bytes32 help
0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0

OPERATORHASH Constant

bytes32 help
0x46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f622

PAUSERHASH Constant

bytes32 help
0x0cc58340b26c619cd4edc70f833d3f4d9d26f3ae7d5ef2965f81fe5495049a4f

STOREHASH Constant

bytes32 help
0xe41d88711b08bdcd7556c5d2d24e0da6fa1f614cf2055f4d7e10206017cd1680

LOGICHASH Constant

bytes32 help
0x397bc5b97f629151e68146caedba62f10b47e426b38db589771a288c0861f182

MAXUSERNUM Constant

uint256 help
255

logic Variable

HBTCLogic help
Internal Variable

pauseState Variable

bool help
Internal Variable

classHashArray Variable

bytes32[] help
Internal Variable

ownerRequireNum Variable

uint256 help
Internal Variable

operatorRequireNum Variable

uint256 help
Internal Variable

MaxItemAdressNum Variable

uint256 help
Internal Variable

container Variable

mapping(bytes32 => Item) help
Internal Variable

Functions Expand All Collapse All

getAdminAddresses keyboard_arrow_up

Parameters help

Name Type
class
string help

Properties

Visibility help public
Mutability help view
Source Code
function getAdminAddresses(string memory class)
  public
  view
  returns (address[] memory)
{
  bytes32 classHash = getClassHash(class);
  return getItemAddresses(classHash);
}

getOwnerRequiredNum keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

getOperatorRequiredNum keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

resetRequiredNum keyboard_arrow_up

Parameters help

Name Type
class
string help
requiredNum
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function resetRequiredNum(string memory class, uint256 requiredNum)
  public
  onlyOwner
  returns (bool)
{
  bytes32 classHash = getClassHash(class);
  require(
    (classHash == OPERATORHASH) || (classHash == OWNERHASH),
    "wrong class"
  );
  if (classHash == OWNERHASH)
    require(
      requiredNum <= getItemAddressCount(OWNERHASH),
      "num larger than existed owners"
    );

  bytes32 taskHash = keccak256(
    abi.encodePacked("resetRequiredNum", class, requiredNum)
  );
  addItemAddress(taskHash, msg.sender);

  if (getItemAddressCount(taskHash) >= ownerRequireNum) {
    removeItem(taskHash);
    uint256 previousNum = 0;
    if (classHash == OWNERHASH) {
      previousNum = ownerRequireNum;
      ownerRequireNum = requiredNum;
    } else if (classHash == OPERATORHASH) {
      previousNum = operatorRequireNum;
      operatorRequireNum = requiredNum;
    } else {
      revert("wrong class");
    }
    emit AdminRequiredNumChanged(
      "resetRequiredNum",
      class,
      previousNum,
      requiredNum
    );
  }
  return true;
}

dropAddress keyboard_arrow_up

Parameters help

Name Type
class
string help
oneAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

null
Source Code
function dropAddress(string memory class, address oneAddress)
  public
  onlyOwner
  returns (bool)
{
  bytes32 classHash = getClassHash(class);
  require(classHash != STOREHASH && classHash != LOGICHASH, "wrong class");
  require(itemAddressExists(classHash, oneAddress), "no such address exist");

  if (classHash == OWNERHASH)
    require(
      getItemAddressCount(classHash) > ownerRequireNum,
      "insuffience addresses"
    );

  bytes32 taskHash = keccak256(
    abi.encodePacked("dropAddress", class, oneAddress)
  );
  addItemAddress(taskHash, msg.sender);
  if (getItemAddressCount(taskHash) >= ownerRequireNum) {
    removeOneItemAddress(classHash, oneAddress);
    emit AdminChanged("dropAddress", class, oneAddress, oneAddress);
    removeItem(taskHash);
    return true;
  }
  return false;
}

addAddress keyboard_arrow_up

Parameters help

Name Type
class
string help
oneAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null

Requirements help

Source Code
function addAddress(string memory class, address oneAddress)
  public
  onlyOwner
  returns (bool)
{
  bytes32 classHash = getClassHash(class);
  require(classHash != STOREHASH && classHash != LOGICHASH, "wrong class");
  require(!itemAddressExists(classHash, oneAddress), "address existed already");

  bytes32 taskHash = keccak256(
    abi.encodePacked("addAddress", class, oneAddress)
  );
  addItemAddress(taskHash, msg.sender);
  if (getItemAddressCount(taskHash) >= ownerRequireNum) {
    addItemAddress(classHash, oneAddress);
    emit AdminChanged("addAddress", class, oneAddress, oneAddress);
    removeItem(taskHash);
    return true;
  }
  return false;
}

dropTask keyboard_arrow_up

Parameters help

Name Type
taskHash
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function dropTask(bytes32 taskHash) public onlyOwner returns (bool) {
  removeItem(taskHash);
  emit AdminTaskDropped(taskHash);
  return true;
}

isPaused keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view returns (uint256 supply) {
  return logic.getTotalSupply();
}

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 logic.balanceOf(owner);
}

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)
{
  bool flag = logic.transferLogic(msg.sender, to, value);
  require(flag, "transfer failed");
  emit Transfer(msg.sender, to, 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) {
  bool flag = logic.transferFromLogic(msg.sender, from, to, value);
  require(flag, "transferFrom failed");
  emit Transfer(from, 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

Source Code
function approve(address spender, uint256 value)
  public
  whenNotPaused
  returns (bool)
{
  bool flag = logic.approveLogic(msg.sender, spender, value);
  require(flag, "approve failed");
  emit Approval(msg.sender, spender, 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 remaining)
{
  return logic.getAllowed(owner, spender);
}

mint keyboard_arrow_up

Parameters help

Name Type
to
address help
value
uint256 help
proof
string help
taskHash
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
function mint(
  address to,
  uint256 value,
  string memory proof,
  bytes32 taskHash
) public whenNotPaused returns (bool) {
  require(itemAddressExists(OPERATORHASH, msg.sender), "wrong operator");
  uint256 status = logic.mintLogic(
    value,
    to,
    proof,
    taskHash,
    msg.sender,
    operatorRequireNum
  );
  if (status == 1) {
    emit Minting(to, value, proof, msg.sender);
  } else if (status == 3) {
    emit Minting(to, value, proof, msg.sender);
    emit Minted(to, value, proof);
    emit Transfer(address(0x0), to, value);
  }
  return true;
}

burn keyboard_arrow_up

Parameters help

Name Type
from
address help
value
uint256 help
btcAddress
string help
proof
string help
taskHash
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
function burn(
  address from,
  uint256 value,
  string memory btcAddress,
  string memory proof,
  bytes32 taskHash
) public whenNotPaused returns (bool) {
  require(itemAddressExists(OPERATORHASH, msg.sender), "wrong operator");
  uint256 status = logic.burnLogic(
    from,
    value,
    btcAddress,
    proof,
    taskHash,
    msg.sender,
    operatorRequireNum
  );
  if (status == 1) {
    emit Burning(from, value, proof, btcAddress, msg.sender);
  } else if (status == 3) {
    emit Burning(from, value, proof, btcAddress, msg.sender);
    emit Burned(from, value, proof, btcAddress);
    emit Transfer(from, address(0x0), value);
  }
  return true;
}

cancelTask keyboard_arrow_up

Parameters help

Name Type
taskHash
bytes32 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function cancelTask(bytes32 taskHash) public returns (uint256) {
  require(itemAddressExists(OPERATORHASH, msg.sender), "wrong operator");
  return logic.cancelTask(taskHash);
}

modifyAdminAddress keyboard_arrow_up

Parameters help

Name Type
class
string help
oldAddress
address help
newAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function modifyAdminAddress(
  string memory class,
  address oldAddress,
  address newAddress
) public whenPaused {
  require(newAddress != address(0x0), "wrong address");
  bool flag = modifyAddress(class, oldAddress, newAddress);
  if (flag) {
    bytes32 classHash = keccak256(abi.encodePacked(class));
    if (classHash == LOGICHASH) {
      logic = HBTCLogic(newAddress);
    } else if (classHash == STOREHASH) {
      logic.resetStoreLogic(newAddress);
    }
  }
}

getLogicAddress keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

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

getStoreAddress keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function getStoreAddress() public view returns (address) {
  return logic.getStoreAddress();
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function pause() public {
  require(itemAddressExists(PAUSERHASH, msg.sender), "wrong user to pauser");
  doPause();
}

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

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
function doPause() internal {
  pauseState = !pauseState;
  emit PauseChangedTo(pauseState);
}

internal HBTCAdmin.initAdmin keyboard_arrow_up

Parameters help

Name Type
owner0
address help
owner1
address help
owner2
address help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function initAdmin(
  address owner0,
  address owner1,
  address owner2
) internal {
  addItemAddress(OWNERHASH, owner0);
  addItemAddress(OWNERHASH, owner1);
  addItemAddress(OWNERHASH, owner2);
  addItemAddress(LOGICHASH, address(0x0));
  addItemAddress(STOREHASH, address(0x1));

  classHashArray.push(OWNERHASH);
  classHashArray.push(OPERATORHASH);
  classHashArray.push(PAUSERHASH);
  classHashArray.push(STOREHASH);
  classHashArray.push(LOGICHASH);
  ownerRequireNum = 2;
  operatorRequireNum = 2;
}

internal HBTCAdmin.classHashExist keyboard_arrow_up

Parameters help

Name Type
aHash
bytes32 help

Properties

Visibility help private
Mutability help view
Source Code
function classHashExist(bytes32 aHash) private view returns (bool) {
  for (uint256 i = 0; i < classHashArray.length; i++)
    if (classHashArray[i] == aHash) return true;
  return false;
}

internal HBTCAdmin.modifyAddress keyboard_arrow_up

Parameters help

Name Type
class
string help
oldAddress
address help
newAddress
address help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
null
Source Code
function modifyAddress(
  string memory class,
  address oldAddress,
  address newAddress
) internal onlyOwner returns (bool) {
  bytes32 classHash = getClassHash(class);
  require(!itemAddressExists(classHash, newAddress), "address existed already");
  require(itemAddressExists(classHash, oldAddress), "address not existed");
  bytes32 taskHash = keccak256(
    abi.encodePacked("modifyAddress", class, oldAddress, newAddress)
  );
  addItemAddress(taskHash, msg.sender);
  if (getItemAddressCount(taskHash) >= ownerRequireNum) {
    replaceItemAddress(classHash, oldAddress, newAddress);
    emit AdminChanged("modifyAddress", class, oldAddress, newAddress);
    removeItem(taskHash);
    return true;
  }
  return false;
}

internal HBTCAdmin.getClassHash keyboard_arrow_up

Parameters help

Name Type
class
string help

Properties

Visibility help private
Mutability help view

Requirements help

null
Source Code
function getClassHash(string memory class) private view returns (bytes32) {
  bytes32 classHash = keccak256(abi.encodePacked(class));
  require(classHashExist(classHash), "invalid class");
  return classHash;
}

internal Container.itemAddressExists keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help
oneAddress
address help

Properties

Visibility help internal
Mutability help view
Source Code
function itemAddressExists(bytes32 id, address oneAddress)
  internal
  view
  returns (bool)
{
  for (uint256 i = 0; i < container[id].addresses.length; i++) {
    if (container[id].addresses[i] == oneAddress) return true;
  }
  return false;
}

internal Container.getItemAddresses keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help

Properties

Visibility help internal
Mutability help view
Source Code
function getItemAddresses(bytes32 id) internal view returns (address[] memory) {
  return container[id].addresses;
}

internal Container.getItemInfo keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help

Properties

Visibility help internal
Mutability help view
Source Code
function getItemInfo(bytes32 id)
  internal
  view
  returns (
    uint256,
    uint256,
    uint256
  )
{
  return (
    container[id].itemType,
    container[id].status,
    container[id].addresses.length
  );
}

internal Container.getItemAddressCount keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help

Properties

Visibility help internal
Mutability help view
Source Code
function getItemAddressCount(bytes32 id) internal view returns (uint256) {
  return container[id].addresses.length;
}

internal Container.setItemInfo keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help
itemType
uint256 help
status
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function setItemInfo(
  bytes32 id,
  uint256 itemType,
  uint256 status
) internal {
  container[id].itemType = itemType;
  container[id].status = status;
}

internal Container.addItemAddress keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help
oneAddress
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function addItemAddress(bytes32 id, address oneAddress) internal {
  require(!itemAddressExists(id, oneAddress), "dup address added");
  require(
    container[id].addresses.length < MaxItemAdressNum,
    "too many addresses"
  );
  container[id].addresses.push(oneAddress);
}

internal Container.removeItemAddresses keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function removeItemAddresses(bytes32 id) internal {
  container[id].addresses.length = 0;
}

internal Container.removeOneItemAddress keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help
oneAddress
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function removeOneItemAddress(bytes32 id, address oneAddress) internal {
  for (uint256 i = 0; i < container[id].addresses.length; i++) {
    if (container[id].addresses[i] == oneAddress) {
      container[id].addresses[i] = container[id].addresses[
        container[id].addresses.length - 1
      ];
      container[id].addresses.length--;
      return;
    }
  }
  revert("not exist address");
}

internal Container.removeItem keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function removeItem(bytes32 id) internal {
  delete container[id];
}

internal Container.replaceItemAddress keyboard_arrow_up

Parameters help

Name Type
id
bytes32 help
oneAddress
address help
anotherAddress
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function replaceItemAddress(
  bytes32 id,
  address oneAddress,
  address anotherAddress
) internal {
  require(!itemAddressExists(id, anotherAddress), "dup address added");
  for (uint256 i = 0; i < container[id].addresses.length; i++) {
    if (container[id].addresses[i] == oneAddress) {
      container[id].addresses[i] = anotherAddress;
      return;
    }
  }
  revert("not exist address");
}