ERC-721 with on-chain metadata & name feature

Name-Me Token

Here is a slightly more sophisticated demo.
This contract offers to mint a classical ERC-721 token, but this time all the metadata are 100% on chain!
There is no external dependency to retrieve the image, as it's SVG code generated on the fly.

Another feature, is to name and rename your token.
For this you have to pay a fee in an ERC-20 token.
The fee is arbitrary, it may very well be free, but we choose to add a fee to demonstrate the interaction between 2 contracts.

Icing on the cake, this name data is also 100% on chain and it's display in the art.
This is made possible because all the metadata are on chain including the image.

Note : this demo is focused on the technical part, not the artistic one

The Smart Contract

  • Allow anyone to mint one token for 0.05 Matic
  • Maximum of 30 tokens per wallet max
  • Owner of the contract can withdraw the fund in Matic (minting fee)
  • Owner of the contract can withdraw the fund in ERC-20 token used to name a token
  • Owner of the contract can change the currency (can use any ERC-20 token) and the fee to name a token
  • Owner of the contract can change the size max of the name
  • Owner of the contract can transfert ownership of the contract to another address, or renounce ownership
  • Allow anyone to get public information like the URL of the metadata of a token, supply, name, symbol, balance ...
  • All ERC165, IERC721, IERC721Metadata and IERC721Enumerable fonctionalities ( transfert, approval ...)
  • The art is fully onchain and dynamical.
  • Anyone can check if a name is already taken
  • Anyone can check if a name is valide
  • Owner of a token can name or rename his token for a fee in ERC-20 SWAG token
  • An NameChange event is emited when a token is named or renamed
See the contract on Polygonscan

Step 1 - Mint a Name-Me Token (NMT)

Data read from the contract

Token name :

Token symbol :

Max supply :

Current supply :

Max token per wallet :

Contract owner :

The NMT Token


STEP 2 - Get SWAG token

The SWAG token, is an ERC-20 token that is used as a currency to name or renamed a Name-Me Token.
You can get SWAG tokens for free on this page : ERC-20 Swag

You own

ΣWG Connect your wallet.

STEP 3 - Name & Re-Name tokens

Connect your wallet. Fetching data ... You don't own any NFT of this collection.

You own NFT from this collection

Under the hood of the UI

On page load :

  • Detects if a web3 wallet is connected to enable mint button
  • Fetch data about the contract on the blockchain (token supply, name, symbol...)

If your wallet is connected :

  • Fetch user data, like Name-me tokens and Swag Token balance
  • Mint button is available
  • If you own Name-Me token
  • Friendly message with the transaction identifier and a link to the explorer

If your own Name-me token

  • Fetch and display the SVG image of each of your token
  • Show button to rename your token.
  • Before to send a name transaction, the application do pre-check and validation