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
Constants (9) keyboard_arrow_up
OPERATORHASH Constant
bytes32 help
0x46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f622
State Variables (7) keyboard_arrow_up
Functions
getAdminAddresses keyboard_arrow_up
getOwnerRequiredNum keyboard_arrow_up
getOperatorRequiredNum keyboard_arrow_up
resetRequiredNum keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Requirements help
One or more of the following:
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
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
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
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
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Modifiers help
whenNotPaused checks for the following:
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;
}
transferFrom keyboard_arrow_up
Modifiers help
whenNotPaused checks for the following:
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;
}
approve keyboard_arrow_up
Modifiers help
whenNotPaused checks for the following:
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;
}
allowance keyboard_arrow_up
mint keyboard_arrow_up
Parameters help
Modifiers help
whenNotPaused checks for the following:
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
Modifiers help
whenNotPaused checks for the following:
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
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
Modifiers help
whenPaused checks for the following:
pauseState must be true
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
getStoreAddress keyboard_arrow_up
Internal Functions
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
internal HBTCAdmin.initAdmin keyboard_arrow_up
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
internal HBTCAdmin.modifyAddress keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
null
Requirements help
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
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
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
internal Container.getItemInfo keyboard_arrow_up
internal Container.getItemAddressCount keyboard_arrow_up
internal Container.setItemInfo keyboard_arrow_up
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
Requirements help
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
internal Container.removeOneItemAddress keyboard_arrow_up
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
internal Container.replaceItemAddress keyboard_arrow_up
Requirements help
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");
}