thirdweb

Dynamic NFT Based on ERC-20 Balance

Create an NFT whose image is different depending on the amount of ERC-20 tokens held by the NFT owner!

This contract is soulbound and only one can be minted by each wallet.

The token's image will be dependent on the amount of ERC-20 tokens that the NFT owner holds at any given moment.

You as the NFT contract owner set the address of the ERC-20 token that will determine the image of the NFTs (the ERC-20 token must live on the same blockchain as your NFT).

You also set the tokenURIs in a tuple that looks like this: [[amount1, ipfsLink1],[amount2, ipfsLink2]...]

If the user's ERC-20 token balance is greater than amount1, it will show the image as defined in the ipfsLink2 json as their NFT image! If the user does not hold any of the ERC-20 token, it will show imgUrl1.

Amounts are set in wei so make sure you add the correct amount of zeros to the end of your amounts! (Most ERC-20 tokens use 18 or 9 decimals).

You can use Thirdweb storage to upload your JSON to IPFS

1.0.4 Release Notes


remove unused mapping


DEFAULT_ADMIN_ROLE

(DEFAULT_ADMIN_ROLE)

view

Published by

View all contracts

Details

  • Publish Date

    Apr 24, 2023

  • Licenses

    Apache-2.0, MIT

  • Learn more about Publish