271просмотров
19.0%от подписчиков
10 февраля 2026 г.
Score: 298
FUNGIBLE TOKENS Fungible tokens are a cornerstone of the value proposition of Ethereum and DeFi. Any Ethereum developer can create a token divisible to a certain decimal granularity and with units that are all identical and interchangeable. By way of example, USD is a fungible asset because one $100 bill is equivalent to a hundred $1 bills. As we mentioned in Chapter 3, the Ethereum blockchain token interface is ERC-20. An interface from an application developer’s perspective is the minimum required set of functionalities. When a token implements the ERC-20 interface, any application that generically handles the defined functionality can instantly and seamlessly integrate with the token. Using ERC-20 and similar interfaces, application developers can confidently support tokens that do not yet exist. The ERC-20 interface defines the following core functionality: • totalSupply() - read the token’s total supply • balanceOf(account) - read the balance of the token for a particular account • transfer(recipient address, amount) - send “amount” tokens from the transaction sender to “recipient
address” • transferFrom(sender address, recipient address,amount) - send “amount” tokens from the balance of tokens held at “sender address” to “recipient address” • approve(spender, amount) - allows “spender” to spend “amount” tokens on behalf of the account owner • allowance(owner address, spender address) - returns the number of tokens the “spender address” can
spend on behalf of the “owner address” The contract will reject transfers involving insufficient balances or unauthorized spending. The first four functions –
reading supply, balances, and sending tokens - are intuitive and expected. The last two functions – approve and allowance - are critical to understanding the power of the ERC-20 interface. Without these functions, users would be limited to directly transferring tokens to and from accounts. With approval functionality, contracts (or trusted accounts) can be whitelisted to act as custodians for a user’s tokens without directly holding the token balance. This widens the scope of possible applications because users retain full custody before an approved spender executes a transaction. There are three main ERC-20 token main categories, but tokens can be in more than one at the same time.