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

ERC20Capped

Inherits: ERC20

Extension of {ERC20} that adds a cap to the supply of tokens.

State Variables

_cap

uint256 private immutable _cap;

Functions

constructor

Sets the value of the cap. This value is immutable, it can only be set once during construction.

constructor(uint256 cap_);

cap

Returns the cap on the token's total supply.

function cap() public view virtual returns (uint256);

_update

Transfers a value amount of tokens from from to to, or alternatively mints (or burns) if from (or to) is the zero address. All customizations to transfers, mints, and burns should be done by overriding this function. Emits a {Transfer} event.

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

Errors

ERC20ExceededCap

Total supply cap has been exceeded.

error ERC20ExceededCap(uint256 increasedSupply, uint256 cap);

ERC20InvalidCap

The supplied cap is not a valid cap.

error ERC20InvalidCap(uint256 cap);