Unicorn Ultra
  • Welcome to unicorn ultra — let’s build the future
  • Getting Started
    • Introduction
    • Environment Setup
    • Create an Account
    • Transfer U2U
    • Query Ledger Data
  • Tutorials
    • Smart Contracts
      • Deploy Your First Smart Contract
      • Deploy a Contract Using the Hedera Token Service
      • Send and Receive HBAR Using Solidity Smart Contracts
      • Create an HBAR Faucet App Using React and MetaMask
      • Deploy By Leveraging Ethereum Developer Tools On Hedera
      • Deploy a Smart Contract Using Hardhat
      • Deploy a Subgraph Using The Graph and JSON-RPC
      • How to Set Up Foundry to Test Smart Contracts on Hedera
      • Deploy Smart Contracts on Hedera Using Truffle
    • Consensus
      • Submit Your First Message
      • Submit Message to Private Topic
      • Query Messages with Mirror Node
    • Tokens
      • Create and Transfer Your First NFT
      • Create and Transfer Your First Fungible Token
      • Create and Transfer an NFT using a Solidity Contract
      • Structure Your Token Metadata Using JSON Schema V2
    • More Tutorials
      • How to Auto-Create Hedera Accounts with HBAR and Token Transfers
      • How to Configure a Mirror Node and Query Data
      • How to Generate a Random Number on Hedera
      • Get Started with the Hedera Consensus Service Fabric Plugin
        • Virtual Environment Setup
      • Schedule Your First Transaction
      • How to Connect to Hedera Networks Over RPC
        • Configuring Hashio RPC endpoints
        • Configuring Arkhia RPC endpoints
        • Configuring Hedera JSON-RPC Relay endpoints
    • Demo Applications
    • Starter Projects
  • Networks
    • Mainnet
      • Mainnet Accounts
      • Mainnet Consensus Nodes
        • Node Requirements
          • Reference Configuration
          • FAQ
      • Fees
        • Transaction Records
    • Testnets
      • Testnet Accounts
      • Testnet Consensus Nodes
    • Network Explorers and Tools
    • Release Notes
      • Hedera Services
      • Hedera Mirror Node
  • Core Concepts
    • Accounts
      • Account Creation
      • Auto Account Creation
      • Account Properties
    • Keys and Signatures
    • Scheduled Transaction
    • Smart Contracts
      • Hyperledger Besu EVM
      • Gas and Fees
      • Solidity Variables and Opcodes
      • Supported ERC Token Standards
      • Hedera Services Integration with Smart Contracts
      • JSON-RPC Relay
      • Hethers
      • Smart Contract Security
    • Staking
      • Staking Program
      • Stake HBAR
    • Hashgraph Consensus Algorithm
      • Gossip About Gossip
      • Virtual Voting
    • Transactions and Queries
    • State and History
    • Mirror Nodes
      • Hedera Mirror Node
      • One Click Mirror Node Deployment
      • Run Your Own Mirror Node
        • Run Your Own Mirror Node with Google Cloud Storage (GCS)
        • Run Your Mirror Node with Amazon Web Services S3 (AWS)
      • Hedera ETL
  • SDKs & APIs
    • SDKs
      • Build Your Hedera Client
      • Set Up Your Local Network
      • Network Address Book
      • Keys
        • Generate a new key pair
        • Import an existing key
        • Create a key list
        • Create a threshold key
        • Generate a mnemonic phrase
        • Recover keys from a mnemonic phrase
      • HBAR
      • Specialized Types
      • Pseudorandom Number Generator
      • Transactions
        • Transaction ID
        • Modify transaction fields
        • Create an unsigned transaction
        • Manually sign a transaction
        • Submit a transaction
        • Sign a multisignature transaction
        • Get a transaction receipt
        • Get a transaction record
      • Schedule Transaction
        • Schedule ID
        • Create a scheduled transaction
        • Sign a scheduled transaction
        • Delete a scheduled transaction
        • Get schedule info
        • Network Response Messages
        • Schedule FAQ
      • Queries
      • General Network Response Messages
      • Accounts and HBAR
        • Create an account
        • Update an account
        • Transfer cryptocurrency
        • Approve an allowance
        • Delete an allowance
        • Delete an account
        • Get account balance
        • Get account info
        • Network Response Messages
      • Consensus Service
        • Create a topic
        • Update a topic
        • Submit a message
        • Delete a topic
        • Get topic messages
        • Get topic info
        • Network Response
      • Token Service
        • Token ID
        • NFT ID
        • Token types
        • Create a token
        • Custom token fees
        • Update a token
        • Update token custom fees
        • Transfer tokens
        • Delete a token
        • Mint a token
        • Burn a token
        • Freeze an account
        • Unfreeze an account
        • Enable KYC account flag
        • Disable KYC account flag
        • Associate tokens to an account
        • Dissociate tokens from an account
        • Pause a token
        • Unpause a token
        • Wipe a token
        • Atomic swaps
        • Get account token balance
        • Get token info
        • Get NFT info
        • Network Response Messages
      • File Service
        • Create a file
        • Append to a file
        • Update a file
        • Delete a file
        • Get file contents
        • Get file info
        • Network Response Messages
      • Smart Contract Service
        • Delegate Contract ID
        • Create a smart contract
        • Update a smart contract
        • Delete a smart contract
        • Call a smart contract function
        • Ethereum transaction
        • Get a smart contract function
        • Get smart contract bytecode
        • Get smart contract info
        • Hedera Service Solidity Libraries
        • Network Response Messages
      • Signature Provider
        • Provider
        • Signer
        • Wallet
        • Local Provider
    • REST API
    • Hedera Consensus Service gRPC API
    • Hedera APIs
      • Basic Types
        • AccountAmount
        • AccountID
        • ContractID
        • CryptoAllowance
        • CurrentAndNextFeeSchedule
        • FeeComponents
        • FeeData
        • FeeSchedule
        • FileID
        • Fraction
        • HederaFunctionality
        • Key
        • KeyList
        • NftAllowance
        • NftTransfer
        • NodeAddress
        • NodeAddressBook
        • RealmID
        • ScheduleID
        • SemanticVersion
        • ServicesConfigurationList
        • ServiceEndpoint
        • Setting
        • ShardID
        • Signature
        • SignatureList
        • SignatureMap
        • SignaturePair
        • SubType
        • TransferList
        • TransactionID
        • ThresholdKey
        • ThresholdSignature
        • TokenAllowance
        • TokenBalance
        • TokenBalances
        • TokenFreezeStatus
        • TokenPauseStatus
        • TokenID
        • TokenKycStatus
        • TokenRelationship
        • TokenTransferList
        • TokenType
        • TokenSupplyType
        • TopicID
        • TransactionFeeSchedule
      • Cryptocurrency Accounts
        • CryptoService
        • CryptApproveAllowance
        • CryptoDeleteAllowance
        • CryptoCreate
        • CryptoTransfer
        • CryptoUpdate
        • CryptoDelete
        • CryptoGetAccountBalance
        • CryptoGetAccountRecords
        • CryptoGetInfo
        • CryptoGetStakers
      • Consensus Service
        • Consensus Service
        • ConsensusCreateTopic
        • ConsensusUpdateTopic
        • ConsensusSubmitMessage
        • ConsensusDeleteTopic
        • ConsensusTopicInfo
        • ConsensusGetTopicInfo
      • Schedule Service
        • ScheduleService
        • SchedulableTransactionBody
        • ScheduleCreate
        • ScheduleDelete
        • ScheduleSign
        • ScheduleGetInfo
      • Token Service
        • TokenService
        • CustomFees
          • AssessedCustomFee
          • CustomFee
          • FractionalFee
          • FixedFee
          • RoyaltyFee
        • TokenCreate
        • TokenUpdate
        • TokenFeeScheduleUpdate
        • TokenDelete
        • TokenMint
        • TokenBurn
        • TokenFreezeAccount
        • TokenUnfreezeAccount
        • TokenGrantKyc
        • TokenRevokeKyc
        • TokenAssociate
        • TokenDissociate
        • TokenWipeAccount
        • TokenPause
        • TokenUnpause
        • TokenGetInfo
        • TokenGetNftInfo
        • TokenGetNftInfos
        • TokenGetAccountNftInfo
      • File Service
        • FileService
        • FileCreate
        • FileAppend
        • FileUpdate
        • FileDelete
        • FileGetContents
        • FileGetInfo
      • Smart Contracts
        • SmartContractService
        • ContractCall
        • ContractCallLocal
        • ContractCreate
        • ContractUpdate
        • ContractDelete
        • ContractGetByteCode
        • ContractGetInfo
        • ContractGetRecords
      • Miscellaneous
        • Duration
        • ExchangeRate
        • Freeze
        • FreezeType
        • GetByKey
        • GetBySolidityID
        • NetworkGetVersionInfo
        • NetworkService
        • Query
        • QueryHeader
        • Response
        • ResponseCode
        • ResponseHeader
        • SystemDelete
        • SystemUndelete
        • TimeStamp
        • Transaction
        • TransactionBody
        • TransactionContents
        • TransactionGetFastRecord
        • TransactionGetReceipt
        • TransactionGetRecord
        • TransactionReceipt
        • TransactionRecord
        • TransactionResponse
        • UncheckedSubmit
    • Deprecated
      • SDKs (V1)
        • Build your Hedera client
        • Set-up Your Local Network
        • Network address book
        • Keys
          • Generate a new key pair
          • Import an existing key
          • Create a key list
          • Create a threshold key
          • Generate a mnemonic phrase
          • Recover keys from a mnemonic phrase
        • Hbars
        • Specialized Types
        • Pseudorandom Number Generator
        • Transactions
          • Transaction ID
          • Modify transaction fields
          • Create an unsigned transaction
          • Manually sign a transaction
          • Submit a transaction
          • Sign a multisignature transaction
          • Get a transaction receipt
          • Get a transaction record
        • Scheduled Transaction
          • Schedule ID
          • Create a scheduled transaction
          • Sign a scheduled transaction
          • Delete a scheduled transaction
          • Get schedule info
          • Network Response Messages
          • Schedule FAQ
        • Queries
        • General Network Response Messages
        • Accounts and hbar
          • Create an account
          • Update an Account
          • Transfer cryptocurrency
          • Approve an allowance
          • Delete an allowance
          • Delete an account
          • Get account balance
          • Get account info
          • Network Response Messages
        • Consensus Service
          • Create a topic
          • Update a topic
          • Submit a message
          • Delete a topic
          • Get topic messages
          • Get topic info
        • Token Service
          • Token ID
          • NFT ID
          • Token types
          • Create a token
          • Custom token fees
          • Update a token
          • Update token custom fees
          • Transfer tokens
          • Delete a token
          • Mint a token
          • Burn a token
          • Freeze an account
          • Unfreeze an account
          • Enable KYC account flag
          • Disable KYC account flag
          • Associate tokens to an account
          • Dissociate tokens from an account
          • Pause a token
          • Unpause a token
          • Wipe a token
          • Atomic swaps
          • Get account token balance
          • Get token info
          • Get NFT info
          • Network Response Messages
        • File Service
          • Create a file
          • Append to a file
          • Update a file
          • Delete a file
          • Get file contents
          • Get file info
          • Network Response Messages
  • Support & Community
    • Glossary
    • Discord
    • GitHub
    • Stack Overflow
    • Hedera Blog
    • Bug Bounty
    • Hedera Help
    • Meetups
    • Contributing Guide
    • Brand Guidelines
    • Status Page
Powered by GitBook
On this page
  • Hedera Token Service
  • HederaTokenService.sol API Docs
  • Create Tokens
  • createFungibleToken(token, initialTotalSupply, decimals)
  • createFungibleTokenWithCustomFees(token, initialTotalSupply, decimals, fixedFees, fractionalFees)
  • createNonFungibleToken(token)
  • createNonFungibleTokenWithCustomFees(token, fixedFees, fractionalFees)
  • Transfer Tokens
  • cryptoTransfer(tokenTransfers)
  • transferToken(token, sender, receiver, amount)
  • transferTokens(token, accountIds, amount)
  • transferNFT(token, sender, receiver, serialNum)
  • transferNFTs(token, sender, receiver, serialNumber)
  • Mint Tokens
  • mintToken(token, amount, metadata)
  • Burn Tokens
  • burnToken(token, amount, serialNumbers)
  • Associate Tokens
  • associateToken(account, tokens)
  • Dissociate Tokens
  • dissociateToken(account, token)
  • dissociateTokens(account, tokens)
  • allowance(token, owner, spender)
  • approve(token, spender, amount)
  • approveNFT(token, approved, serialNumber)
  • getApproved(token, serialNumber)
  • isApprovedForAll(token, owner, operator)
  • setApprovalForAll(token, operator, approved)
  • isFrozen(token, account)
  • isKyc(token, account)
  • isToken(token)
  • deleteToken(token)
  • getTokenCustomFees(token)
  • getTokenDefaultFreezeStatus(token)
  • getTokenDefaultKycStatus(token)
  • getTokenExpiryInfo(token)
  • getTokenInfo(token)
  • getFungibleTokenInfo(token)
  • getNonFungibleTokenInfo(token)
  • getTokenKey(token, keyType)
  • getTokenType(token)
  • freezeToken(token, account)
  • unfreezeToken(token, account)
  • grantTokenKyc(token, account)
  • revokeTokenKyc(token, account)
  • pauseToken(token)
  • unpauseToken(token)
  • wipeTokenAccount(token, account, amount)
  • wipeTokenAccountNFT(token, token, serialNumbers)
  • updateTokenInfo(token, tokenInfo)
  • updateTokenExpiryInfo(token, expiryInfo)
  • updateTokenKeys(token, keys)
  • updateTokenKeys(token, keys)
  • Gas Cost
  • Examples
  1. SDKs & APIs
  2. SDKs
  3. Smart Contract Service

Hedera Service Solidity Libraries

PreviousGet smart contract infoNextNetwork Response Messages

Last updated 1 year ago

Hedera Token Service

Hedera Token Service integration allows you to write token transactions natively in Solidity smart contracts. There are a few Solidity source files available to developers.

The Hedera Token Service Solidity file provides the transactions to interact with tokens created on Hedera. The Hedera Response Codes contract provides the response codes associated with network errors. The IHedera Token Service is a supporting library for the Hedera Token Service Solidity file. You can grab these libraries to add to your project and import them to your Solidity contract. Please see the example file below.

ContractExample.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

import "./HederaTokenService.sol";
import "./HederaResponseCodes.sol";

contract contractExample is HederaTokenService {
...
int response = HederaTokenService.transferToken(tokenAddress, msg.sender, address(this), amount);
...
}

HederaTokenService.sol API Docs

Create Tokens

createFungibleToken(token, initialTotalSupply, decimals)

A transaction that creates a fungible token. Returns the new token address.

Param

Type

Description

token

IHederaTokenService.HederaToken memory

The basic properties of the token being created. This includes the token name, symbol, treasury account, keys, expiry, etc.

initialTotalSupply

uint

Specifies the initial supply of tokens to be put in circulation. The initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible.

decimals

uint

The number of decimal places a token is divisible by.

createFungibleTokenWithCustomFees(token, initialTotalSupply, decimals, fixedFees, fractionalFees)

A transaction that creates a fungible token with custom fees. Returns the new token address.

Param

Type

Description

token

IHederaTokenService.HederaToken memory

The basic properties of the token being created. This includes the token name, symbol, treasury account, keys, expiry, etc.

initialTotalSupply

uint

Specifies the initial supply of tokens to be put in circulation. The initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible.

decimals

uint

The number of decimal places a token is divisible by.

fixedFees

IHederaTokenService.FixedFee[]

List of fixed fees to apply to the token.

fractionalFees

IHederaTokenService.FractionalFee[]

List of fractional fees to apply to the token.

createNonFungibleToken(token)

Creates a non fungible token. Returns the new token address.

Param

Type

Description

token

IHederaTokenService.HederaToken memory

The basic properties of the token being created. This includes the token name, symbol, treasury account, keys, expiry, etc.

createNonFungibleTokenWithCustomFees(token, fixedFees, fractionalFees)

Creates a non fungible token with custom fees. Returns the new token address.

Param

Type

Description

token

IHederaTokenService.HederaToken memory

The basic properties of the token being created. This includes the token name, symbol, treasury account, keys, expiry, etc.

fixedFees

IHederaTokenService.FixedFee[]

List of fixed fees to apply to the token.

fractionalFees

IHederaTokenService.FractionalFee[]

List of fractional fees to apply to the token.

Transfer Tokens

cryptoTransfer(tokenTransfers)

A transaction that transfers the provided list of tokens.

ABI Version: 2

Param

Type

Description

tokenTransfers

The list of token transfers

transferToken(token, sender, receiver, amount)

Transfers tokens where the calling account/contract is implicitly the first entry in the token transfer list, where the amount is the value needed to zero balance the transfers. The account address sending the token is required to sign the transaction.

ABI Version: 1

Param

Type

Description

token

The token ID to transfer to/from. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

sender

The address sending the token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

receiver

The address of the receiver of the token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

amount

int64

Non-negative value of the token to send. A negative value will result in a failure.

transferTokens(token, accountIds, amount)

ABI Version: 1

Param

Type

Description

token

The token ID to transfer. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

accountIds

Hedera accounts to do a transfer to/from. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

amounts

int64[] memory

Non-negative value to send. A negative value will result in a failure.

transferNFT(token, sender, receiver, serialNum)

Transfers tokens where the calling account/contract is implicitly the first entry in the token transfer list, where the amount is the value needed to zero balance the transfers. The address sending the token is required to sign the transaction.

ABI Version: 1

Param

Type

Description

token

The token to transfer to/from.

sender

The address sending the token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

receiver

The address of the receiver of the token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

serialNum

int64

The serial number of the NFT to transfer.

transferNFTs(token, sender, receiver, serialNumber)

Initiates a non-fungible token transfer

ABI Version: 1

Param

Type

Description

token

The ID of the token to transfer. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

sender

The address sending the token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

receiver

The address of the receiver of the token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

serialNumber

int64

The serial number of the NFT is sent by the same index of the sender.

Mint Tokens

mintToken(token, amount, metadata)

ABI Version: 2

Param

Type

Description

token

The Hedera token to mint. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

amount

uint64

Applicable to FUNGIBLE TOKENS ONLY. The amount to mint to the Treasury Account. Amount must be a positive non-zero number represented in the lowest denomination of the token. The new supply must be lower than 2^63.

metadata

bytes[] memory

Applicable to NON-FUNGIBLE TOKENS ONLY. Maximum allowed size of each metadata is 100 bytes

Burn Tokens

burnToken(token, amount, serialNumbers)

ABI Version: 2

Param

Type

Description

token

The token to burn. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

amount

uint64

Applicable to FUNGIBLE TOKENS ONLY. The amount to burn from the Treasury Account. Amount must be a positive non-zero number, not bigger than the token balance of the treasury account (0; balance], represented in the lowest denomination.

serialNumbers

int64[]

Applicable to NON-FUNGIBLE TOKENS ONLY.

The list of serial numbers to be burned.

Associate Tokens

associateToken(account, tokens)

Associates the provided account with the provided tokens. Must be signed by the account that is associated with the token.

ABI Version: 2

Param

Type

Description

account

The account to be associated with the provided tokens. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

token

The list of tokens to be associated with the provided account.

In the case of non-fungible tokens, once an account is associated, it can hold any number of NFTs (serial numbers) of that token type. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

Dissociate Tokens

dissociateToken(account, token)

Dissociates the provided account with the provided token. Must be signed by the provided Account's key.

ABI Version: 2

Param

Type

Description

account

The Hedera account to be dissociated from the provided token. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

token

The token to be dissociated from the provided account. The address is a mapping of shard.realm.number (0.0.x) into a 20 byte Solidity address.

dissociateTokens(account, tokens)

Dissociates the provided account with the provided token. Must be signed by the account the token is being dissociated from.

ABI Version: 2

Param

Type

Description

account

The account is to be dissociated from the provided tokens.

tokens

The list of tokens to be dissociated from the provided account. The address is a mapping of shard.realm.number (0.0.x) into a 20-byte Solidity address.

allowance(token, owner, spender)

Returns the amount the spender is still allowed to withdraw from the owner. Only applicable to fungible tokens.

Param

Type

Description

token

address

The Hedera token ID in Solidity format to check the allowance of.

owner

address

The owner account in Solidity format of the tokens to be spent.

spender

address

The spender account in Solidity format.

approve(token, spender, amount)

Allows spender to withdraw from your account multiple times, up to the value amount. If this function is called again it overwrites the current allowance.

Param

Type

Description

token

address

The Hedera token ID to approve in Solidity format.

spender

address

The spender account ID authorized to spend in Solidity format.

amount

uint256

The amount of tokens the spender is authorized to spend.

approveNFT(token, approved, serialNumber)

Allow or reaffirm the approved address to transfer an NFT the approved address does not own. Applicable to non-fungible tokens (NFTs).

Param

Type

Description

token

address

The Hedera NFT token ID in solidity format to approve.

approved

address

The Hedera account ID to approve in Solidity format. To revoke approvals pass in the zero address.

serialNumber

uint256

The NFT serial number to approve.

getApproved(token, serialNumber)

Get the approved Hedera accounts for a single NFT. Applicable to non-fungible tokens (NFTs).

Param

Type

Description

token

address

The Hedera token ID for the NFT in Solidity format.

serialNumber

int64

The NFT serial number.

isApprovedForAll(token, owner, operator)

Returns whether or not the operator account is approved to spend on behalf of the owner.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

owner

address

The Hedera account ID in Solidity format

operator

address

The Hedera account ID in Solidity format

setApprovalForAll(token, operator, approved)

Enable or disable approval for a third party ("operator") to manage all of msg.sender's assets.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

operator

address

The Hedera account ID in Solidity format.

approved

bool

The Hedera account ID in Solidity format.

isFrozen(token, account)

Returns whether or not the account was frozen. The response will return true is the account is frozen. This means the token cannot be transferred from the account until the account is unfrozen.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

isKyc(token, account)

Returns whether or not the token has been granted KYC.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

isToken(token)

Returns whether or not the token exists on Hedera.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

deleteToken(token)

Deletes the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

getTokenCustomFees(token)

Returns the custom fees for the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

getTokenDefaultFreezeStatus(token)

Returns the token freeze status on the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

getTokenDefaultKycStatus(token)

Returns the KYC status on the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

getTokenExpiryInfo(token)

Returns the token expiration for the specified token.

Param

Type

Description

token

address

The ID of the Hedera token in Solidity format.

getTokenInfo(token)

Retrieves general token entity information for the specified token.

Param

Type

Description

token

address

The ID of the Hedera token in Solidity format.

getFungibleTokenInfo(token)

Retrieves fungible specific token property information for a fungible token.

Param

Type

Description

token

address

The Hedera token ID of the fungible token in Solidity format.

getNonFungibleTokenInfo(token)

Retrieves non-fungible specific token info for a given NFT.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

getTokenKey(token, keyType)

Returns the token key for the specified key type. A key type can be be the KYC key, pause key, freeze key, etc.

Param

Type

Description

token

address

The ID of the token in solidity format to return the key value.

keyType

uint

The keyType of the desired key value.

getTokenType(token)

Returns the token type (fungible or non-fungible) for the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

freezeToken(token, account)

Freezes the account from transacting the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

unfreezeToken(token, account)

Unfreezes the account from transacting the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

grantTokenKyc(token, account)

Grants KYC to the Hedera account for the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

revokeTokenKyc(token, account)

Revokes KYC to the Hedera account for the specified token.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

pauseToken(token)

Prevents a token from being transacted if set.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

unpauseToken(token)

Unpauses a token from a previously paused state.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

wipeTokenAccount(token, account, amount)

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

amount

uint32

The amount of fungible tokens to wipe.

wipeTokenAccountNFT(token, token, serialNumbers)

Wipes a non-fungible token from the specified account.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

account

address

The Hedera account ID in Solidity format.

serialNumbers

int64[] memory

The NFT serial numbers to wipe from the account.

updateTokenInfo(token, tokenInfo)

Updates the properties of a token including the name, symbol, treasury account, memo, etc.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

tokenInfo

The token properties to update.

updateTokenExpiryInfo(token, expiryInfo)

Update the token expiration time.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

expiryInfo

The expiry properties of a token.

updateTokenKeys(token, keys)

Update the keys set on a token. The key type is defined in the key parameter.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

keys

The token key type.

updateTokenKeys(token, keys)

Update the keys set on a token. The key type is defined in the key parameter.

Param

Type

Description

token

address

The Hedera token ID in Solidity format.

keys

The token key type.

Gas Cost

Examples

Note: Although the file is not imported in the contract, you will need it in your project directory for the supporting libraries to reference.

: Token create precompile is live on previewnet and testnet. The example contains four examples of how to create a token using the token create solidity libraries.

memory

Initiates a fungible token transfer. This transaction accepts zero unit token transfer operations for fungible tokens (). Not applicable to non-fungible tokens.

[] memory

[] memory

[] memory

Mints an amount of the token to the defined treasury account. This transaction accepts zero-amount token mint operations for fungible tokens ().

Burns an amount of the token from the defined treasury account. This transaction accepts zero amount token burn operations for fungible tokens ().

[] memory

[] memory

Wipes fungible tokens from the specified account. This transaction accepts zero amount token wipe operations for fungible tokens ().

memory

memory

memory

memory

HederaTokenService.sol
HederaResponseCodes.sol
IHederaTokenService.sol
ExpiryHelper.sol
FeeHelper.sol
KeyHelper.sol
here
IHederaTokenService.sol
HIP-358
TokenCreateContract
HIP-564
HIP-564
HIP-564
HIP-564
Gas and Fees
Deploy a Contract Using the Hedera Token Service
IHederaTokenService.TokenTransferList[]
address
address
address
address
address
address
address
address
address
address
address
address
address
address
address
address
address
address
address
IHederaTokenService.HederaToken
IHederaTokenService.Expiry
IHederaTokenService.TokenKey[]
IHederaTokenService.TokenKey[]