@perfect-abstractions/compose/token/ERC20/Data/ERC20DataFacet.solRead-only ERC-20 token data access for diamonds
totalSupply(), balanceOf() and allowance().ERC20Storage at erc8042:erc20 with every other ERC-20 facet and module.STORAGE_POSITIONbytes32keccak256("erc20"))Returns the total number of tokens in circulation.
Returns:
-uint2560 if no tokens have been minted.Returns the token balance held by an account.
Parameters:
_accountaddress0.Returns:
-uint256_account.Returns how many tokens a spender may still move on an owner's behalf.
Parameters:
_owneraddress_spenderaddressReturns:
-uint256type(uint256).max is treated as unlimited and is never decremented on transfer.totalSupply(), balanceOf() and allowance() are what integrators expect from any ERC-20.ERC20MetadataFacet so name(), symbol() and decimals() are available too. That pair is the minimum most integrations assume.erc20 so every facet observes the same numbers.allowance() before calling transferFrom does not guarantee the value still holds at execution time. Treat it as informational, not as a lock.This facet only reads storage, so it cannot corrupt token state on its own. Two things are still worth knowing:
balanceOf() reflects whatever the write-side facets recorded. A custom facet that writes to the erc20 slot with an incompatible struct layout makes these reads report wrong values with no error.type(uint256).max is a deliberate sentinel for "unlimited" in ERC20TransferFacet. Interfaces that render the raw number should special-case it rather than showing the full integer.