Tokens Managed by Smart Contracts
Smart contracts can be used to create, manage, or serve as the description of tokens. A token is a digital representation of an asset that can include artwork, cryptocurrency, carbon credits, etc.
The ERC-20 and ERC-721 standards define a common interface for token contracts, enabling interoperability between wallets, exchanges, and standardized interaction between different smart contracts and decentralized applications (dApps) in the Ethereum ecosystem. ERC stands for Ethereum Request for Comments, where developers can propose improvements, new features, and protocols for the Ethereum blockchain.
Implementing these interfaces simplifies the process of integrating tokens into applications for developers and ensures consistent user interactions with token contracts. Hedera smart contracts support the following ERCs:
➡ ERC-721: Non-Fungible Tokens (NFTs)
Token Associations
Before sending a token to a smart contract, you need to confirm whether you need to associate the token with the smart contract before transferring it. The transfer will fail if you transfer a token to a smart contract that was not associated with it first or does not have an open auto-association slot.
You can associate a smart contract with a token in the following ways:
Use the
TokenAssociationTransaction
in the supported Hedera SDKsUse the
associateToken()
orassociateTokens()
from HIP-206.
Note: Token association
is for HTS tokens only.
Synthetic Events
Smart contract tokens like ERC-20 and ERC-721 emit events, creating contract logs that developers can query or subscribe to. Hedera Token Service (HTS) tokens are not inherently equipped with such event logs. As a solution to this limitation, Hedera Mirror Nodes now generates synthetic event logs for HTS tokens. Learn more here.
FAQs
Last updated
Was this helpful?