Skip to main content

JBERC20

Git Source

Inherits: ERC20Votes, ERC20Permit, Ownable, IJBToken

An ERC-20 token that can be used by a project in JBTokens and JBController.

By default, a project uses "credits" to track balances. Once a project sets their IJBToken using JBController.deployERC20For(...) or JBController.setTokenFor(...), credits can be redeemed to claim tokens.

JBController.deployERC20For(...) deploys a JBERC20 contract and sets it as the project's token.

State Variables

_name

The token's name.

string private _name;

_symbol

The token's symbol.

string private _symbol;

Functions

constructor

constructor() Ownable(address(this)) ERC20("invalid", "invalid") ERC20Permit("JBToken");

balanceOf

The balance of the given address.

function balanceOf(address account) public view override(ERC20, IJBToken) returns (uint256);

Parameters

NameTypeDescription
accountaddressThe account to get the balance of.

Returns

NameTypeDescription
<none>uint256The number of tokens owned by the account, as a fixed point number with 18 decimals.

decimals

The number of decimals used for this token's fixed point accounting.

function decimals() public view override(ERC20, IJBToken) returns (uint8);

Returns

NameTypeDescription
<none>uint8The number of decimals.

name

The token's name.

function name() public view virtual override returns (string memory);

symbol

The token's symbol.

function symbol() public view virtual override returns (string memory);

totalSupply

The total supply of this ERC20 i.e. the total number of tokens in existence.

function totalSupply() public view override(ERC20, IJBToken) returns (uint256);

Returns

NameTypeDescription
<none>uint256The total supply of this ERC20, as a fixed point number.

burn

Burn some outstanding tokens.

Can only be called by this contract's owner.

function burn(address account, uint256 amount) external override onlyOwner;

Parameters

NameTypeDescription
accountaddressThe address to burn tokens from.
amountuint256The amount of tokens to burn, as a fixed point number with 18 decimals.

mint

Mints more of this token.

Can only be called by this contract's owner.

function mint(address account, uint256 amount) external override onlyOwner;

Parameters

NameTypeDescription
accountaddressThe address to mint the new tokens to.
amountuint256The amount of tokens to mint, as a fixed point number with 18 decimals.

initialize

Initializes the token.

function initialize(string memory name_, string memory symbol_, address owner) public override;

Parameters

NameTypeDescription
name_stringThe token's name.
symbol_stringThe token's symbol.
owneraddressThe token contract's owner.

nonces

Required override.

function nonces(address owner) public view virtual override(ERC20Permit, Nonces) returns (uint256);

_update

Required override.

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