let’s consider in our application the users have ideas as NFT on which they will get funding. Each idea should be unique So people can send funds to NFT as ERC 20 tokens. Now i want to make the contract in which i can use both standards how is it possible kindly please tell?

Description: I want to create a contract in which user upload his idea as NFT and these NFT's can get fund from different users and users must send erc20 token as fund. and we know that there are some common functions in ERC20 and 721 so that we cannot use both in single cotract like i.e.

contract idea is ERC20,ERC721{

 So what i did for that purpose
    I have 3 contracts '1' is main.sol  where i'm importing my '2' other contracts Erc.sol and NFT.sol
    ------- main.sol -------

    SPDX-License-Identifier: Unlicense
    pragma solidity 'some version';
    import "./NFT.sol";
    import "./ERc.sol";
    contract main  {
          ERc erc =new ERc();
       constructor(uint256 _initialSupply)  {
        NFT nft = new NFT();
     //by using nft instance i can call the NFT contract functions

------- NFT.sol -------

pragma solidity 'some version';

import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

// SPDX-License-Identifier: Unlicense
contract NFT is ERC721URIStorage{
//_minting will be here and constructor will overide ERC721

//get fund on nftIdea
function fund () public view returns(bool) {

bool res=erc.fundidea('address',value)
return res;

------- ERC20.sol -------

// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./NFT.sol";

    contract ERc is ERC20 {
    constructor() ERC20('','') {
    function addInitialSupply(uint256 _initialSupply)  public {
            _mint(msg.sender, _initialSupply * 10 );
        function fundIdea(address _author, uint value) public returns(bool){
             transfer(address(_author), value);
             return true;
  • You don't because there are a lot of function that use the same name. You make 2 contract and one own the other. Commented Oct 26, 2021 at 20:25
  • thanks for your response kindly can you please share some source from where i can understand better Commented Oct 26, 2021 at 20:31
  • Can you show us what you have done and research so far? Commented Oct 26, 2021 at 20:31
  • Actually i can start when i will understand about how can i use erc 20 and 721 combined presently i just want to know how can i use Commented Oct 26, 2021 at 20:34
  • because i'm confused so i don't know what will be the exact approach Commented Oct 26, 2021 at 20:34

1 Answer 1


Use the ERC-1155 standard for this: https://eips.ethereum.org/EIPS/eip-1155

Core Idea: Aims to be a combination of the ERC721 and ERC20 standards. Enables batch transfers (to multiple parties!) to make stuff cheaper. Combination explanation here, but general idea is to have another mapping:

💩 ERC721: mapping id ⇒ owner

🧠 ERC1155: mapping owneridbalance

Ex: me ⇒ 0 ⇒ 200

OpenZeppelin has a ERC1155 contract that might be useful. In order to be compatible with ERC20 and ERC721 schemes, you might need to add some functions, but the basic structure is here

  • Thanks for your response dear but how can it differentiate i'm creating nft721 or erc 20 token. erc20 token needs initial supply in minting Commented Oct 28, 2021 at 22:39
  • Yep so idea here is that you can store multiple different currencies, each with their own id (this is what id stands for). You can mint an initial supply to some base account -- if that base supply is 1, it's an NFT. If it's more, it's a normal ERC20. Video I linked to explains this really well Commented Oct 28, 2021 at 22:47
  • here it is minting one question constructor() public ERC1155("game.example/api/item{id}.json") { _mint(msg.sender, GOLD, 1018, ""); _mint(msg.sender, SILVER, 1027, ""); _mint(msg.sender, THORS_HAMMER, 1, ""); _mint(msg.sender, SWORD, 109, ""); _mint(msg.sender, SHIELD, 109, ""); } Commented Oct 29, 2021 at 5:59
  • kindly tell in the video he said that for thor hammer is NFT because of 1 i think one demonstrate to supply if we add more than 1 then is it make erc20 instead it is confusing. so how can i use it if i want to make the function for users to call it with idea description and make nft? Commented Oct 29, 2021 at 6:00
  • and the ids for gold (FT) and the thor hammeer(NFT) can we deal it with seperate counters and is it the solution i will make a createNFT function in which i will pass the address incremented id and supply 1 and will handle their id's seperate? Commented Oct 29, 2021 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.