Skip to content

Latest commit

 

History

History
90 lines (56 loc) · 2.21 KB

contract.TokenboundERC20.md

File metadata and controls

90 lines (56 loc) · 2.21 KB

TokenboundERC20

Git Source

Inherits: ERC20

Author: Moonstream Engineering ([email protected])

This is an ERC20 contract on which the owner of the bound ERC721 token can mint tokens, and anyone can burn tokens they hold. The mint authority is immutably and irrevocably tied to an ERC6551 tokenbound account connected to the ERC721 token.

The name, symbol, decimals, and address of the account with minting authority are set in the constructor and can never be changed after the contract is deployed.

State Variables

minter

The address of the account with minting authority on this contract. Once set, this address can never be changed.

address public minter;

_decimals

The number of decimals on

uint8 private _decimals;

Functions

constructor

constructor(string memory name_, string memory symbol_, uint8 decimals_, address _minter) ERC20(name_, symbol_);

Parameters

Name Type Description
name_ string The name of the ERC20 token (this is what callers of the name() method will see).
symbol_ string The symbol of the ERC20 token (this is what callers of the symbol() method will see).
decimals_ uint8 The number of decimal digits that make up the fractional part of token amounts.
_minter address The address of the account with minting authority on this contract.

decimals

The number of decimal digits that make up the fractional part of token amounts. If decimals

function decimals() public view override returns (uint8);

burn

Allows holders of tokens on this contract to burn any amount of tokens up to their balance.

function burn(uint256 value) external;

mint

Allows the holder of the bound ERC721 token to mint additional ERC20 tokens on this contract.

function mint(address account, uint256 value) external;

Errors

InvalidMinter

This error is raised when an account which is not the minter attempts to mint tokens on this contract.

error InvalidMinter(address sender);