Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ERC20FreezeableUpgradable

Git Source

Inherits: Initializable, ERC20Upgradeable

State Variables

FREEZEABLE_STORAGE_LOC

bytes32 private constant FREEZEABLE_STORAGE_LOC =
    0xe66b3d99be4f71ea7aa9cf2bc9a8a4827bbe4f718fcfa5d183e05f8945211500

Functions

_getFreezeableStorage

function _getFreezeableStorage() private pure returns (FreezeableStorage storage $);

isFrozen

Allows for checking if an address is frozen

function isFrozen(address target) public view returns (bool);

Parameters

NameTypeDescription
targetaddressThe address to check

Returns

NameTypeDescription
<none>boolbool True if the address is frozen

_freeze

Freezes an address, stopping transfers to or from the address

Emits Frozen(target)

Reverts with ZeroAddress if target is address(0)

Note: Frozen addresses cannot burn tokens as burning involves transferring to address(0)

function _freeze(address target) internal virtual;

Parameters

NameTypeDescription
targetaddressThe address to freeze

_unfreeze

Unfreezes an address, allowing transfers to or from the address

Emits Unfrozen(target)

function _unfreeze(address target) internal virtual;

Parameters

NameTypeDescription
targetaddressThe address to unfreeze

_update

Overrides the default ERC20 _update to enforce freezing

Note: This prevents frozen addresses from burning tokens (burning = transfer to address(0))

Note: This prevents minting to frozen addresses (minting = transfer from address(0))

function _update(address from, address to, uint256 value) internal virtual override;

Events

Frozen

Emitted when an address is frozen.

event Frozen(address target);

Unfrozen

Emitted when an address is unfrozen.

event Unfrozen(address target);

Errors

FromFrozen

The transfer failed because the address transferring from is frozen.

error FromFrozen();

ToFrozen

The transfer failed because the address transferring to is frozen.

error ToFrozen();

ZeroAddress

Cannot freeze the zero address.

error ZeroAddress();

Structs

FreezeableStorage

Note: storage-location: erc7201:apyx.storage.Freezeable

struct FreezeableStorage {
    mapping(address => bool) _frozen;
}