Token Standards and Creation Flashcards
6 cards from real Blockchain Technology practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Token Standards and Creation flashcards as text
A developer is creating a decentralized application for a video game that includes both a fungible in-game currency (like 'gold coins') and unique, non-fungible in-game items (like a 'legendary sword'). To optimize for gas fees and contract management, which token standard would be the most efficient choice for this scenario?
Answer: ERC-1155, which can manage multiple token types (both fungible and non-fungible) within a single contract.
ERC-1155 is a multi-token standard specifically designed to handle both fungible and non-fungible tokens within one smart contract. This is highly efficient for applications like games, as it allows for batch transfers of different token types in a single transaction, significantly reducing gas costs compared to managing separate ERC-20 and ERC-721 contracts.
When a user interacts with a DeFi protocol to stake their ERC-20 tokens, they typically must first call the `approve()` function on the token contract. What is the primary purpose of this function call?
Answer: To grant the staking contract permission to transfer a specified number of tokens on the user's behalf.
The `approve()` function in the ERC-20 standard does not move any tokens itself. Instead, it gives a designated address (the 'spender', which in this case is the DeFi staking contract) an allowance, permitting it to withdraw up to a certain number of tokens from the user's address using the `transferFrom()` function. This two-step process is a core security feature of the ERC-20 standard.
Which of the following statements accurately describes a key characteristic of the ERC-721 token standard?
Answer: Every token is uniquely identifiable by a `tokenId` and represents a single, distinct asset.
The core feature of the ERC-721 standard is non-fungibility. Each token created under this standard is unique and not interchangeable with others, even within the same contract. This uniqueness is managed through a specific `tokenId`, making it the ideal standard for representing one-of-a-kind assets like digital art, collectibles, or real estate.
In the context of creating a new ERC-20 token using a standard library like OpenZeppelin, what is the process of generating the initial set of tokens and assigning them to a specific address called?
Answer: Minting
Minting is the process of creating new tokens and adding them to the total supply. When deploying a new ERC-20 contract, the `_mint` function is typically called within the constructor to create the initial supply and assign it to the deployer's address or another designated owner.
A developer is creating a token contract and wants to implement a mechanism to decrease the total supply over time, potentially to increase the token's scarcity. What is the standard term for the action of permanently removing tokens from circulation?
Answer: Burning
Burning tokens means permanently removing them from circulation, which reduces the total supply. This is typically achieved by sending the tokens to an unspendable address (an address with no known private key, like the zero address), effectively destroying them.
Which function is mandatory in a compliant ERC-20 token contract and is used to retrieve the token balance of a specific address?
Answer: `balanceOf(address owner)`
The ERC-20 standard specifies a set of mandatory functions that a contract must implement to be compliant. The `balanceOf(address owner)` function is one of these core functions, and it returns the number of tokens held by a given address.