Request for ERC721 token

First of all, I have to say it’s a great work for you geeks building this huge project for ethereum ecosystem.

Now here is my questions,I have create a new ERC20Token on remix with an exist smart contract code downloaded from anwhere else.
But ,I could not find the one for ERC721 token deploy.(I mean the full code in one file without importing any *.sol files)

So,does it mean:
1.Do I have to install openzeppelin on my computer?
2.Could it be installed on win10 system?
3.Is there a step to step guideline (more details)to deploy ERC721 token?
4.Advantage course of setting more specifics for the ERC721 token……

Thanks for all your kindly replies!
Happy ThanksGiving day!

2 Likes

This is a good question for a newbie without coding skills.
yes,you can make a simple erc20 token with just one sol file on remix .
but it’s more complex to erc721 contract.
so you should learn more,anyway,it could be easier in the future IMO.
GOOD LUCK!

2 Likes

Hi @kate_king,

Welcome to the community :wave:

You can Deploy a simple ERC20 token in Remix. This token uses OpenZeppelin Contracts.

You can deploy the following SimpleERC721 using Remix, you can then call mintWithTokenURI to mint tokens.

Note: You should only use code published in an official release of OpenZeppelin Contracts, the latest release is 2.4. When importing via GitHub on Remix you can specify the release tag, (otherwise you will get the latest code in the master branch). The example below imports v2.4.0.

SimpleERC721

pragma solidity ^0.5.5;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/token/ERC721/ERC721Full.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/token/ERC721/ERC721MetadataMintable.sol";

contract SimpleERC721 is ERC721Full, ERC721MetadataMintable {
    constructor() ERC721Full("Token", "TKN") public {
    }
}

You can deploy an ERC721 token from Remix importing OpenZeppelin from GitHub.
Though for a production project, you need appropriate testing, so would likely want to use OpenZeppelin SDK or Truffle.

See OpenZeppelin Contracts getting started: https://docs.openzeppelin.com/contracts/2.x/

You can install OpenZeppelin Contracts on Windows 10, though I prefer to use Windows Subsystem for Linux.

There isn’t, but I am happy to help with information that you need.

I am not sure I understand what you mean. Are you talking about the metadata for an ERC721 token or something else?

1 Like

Big thanks for your reply,i think it will be helpful to someone like me.

1 Like

Thank for your kindly answer,I will do my best…

1 Like

For now I am a newbie,first step for me is to create a simple contract,so,how could I import all necessary files by a simple way,if I just create a simple erc721token contract with remix?

1 Like

Hi @kate_king,

For getting started with a testnet (not production), you can just compile and deploy the following ERC721 in Remix:

Remix will handle the importing from GitHub.

pragma solidity ^0.5.5;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/token/ERC721/ERC721Full.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/token/ERC721/ERC721MetadataMintable.sol";

contract SimpleERC721 is ERC721Full, ERC721MetadataMintable {
    constructor() ERC721Full("Token", "TKN") public {
    }
}

awesome,I have done it .
still,First I met a red error about compiler .
a bit issue confused me:the right compiler should be 0.5.5 ,but not the 0.5.0 mentioned in the code.

1 Like

A post was split to a new topic: Etherscan issue

Hi @kate_king,

Sorry about the pragma solidity ^0.5.0;, I was using the default compiler so didn’t have any issues. I have changed the code above to be pragma solidity ^0.5.5;

Welcome to the community @hibro :wave:

@hibro and @kate_king feel free to Introduce yourself here!

Many thanks,once I have done this,how could I mine it out?and is there a total cap of the erc 721 token?
sorry for ask so many questions.

1 Like

Hi @kate_king,

To mint an ERC721 token using the code above, call mintWithTokenURI in Remix and provide the:

  • address for the token holder
  • tokenID (needs to be unique) and
  • tokenURI for the location of the metadata.

It looks as follows in Remix:

Please ask all the questions that you need. Questions and answers increase the knowledge of the entire community :smile:

so cool you are!!I will have a try later.
could I mine more than one token in one contract?

1 Like

Hi @kate_king,

There is no cap on how many tokens you can mint in the one ERC721 contract (tokenID is uint256). (Though you could add a cap if required, e.g. only 10,000)

1 Like

I’ve been able to replicate the SimpleERC721 code example from above with Remix, therefore I will try to keep it as close to that as possible while trying to get that contract to complie with ZepplinOS and Embark.
I’m using solc 0.5.13

ZeppelinOS:
I change the code to import from @openzeppelin/contracts
oz push gives the following error:

- Contract SimpleERC721 has an explicit constructor. Change it to an initializer function. See https://docs.openzeppelin.com/sdk/2.5/writing_contracts.html#initializers.
One or more contracts have validation errors. Please review the items listed above and fix them, or run this command again with the --force option.

oz push --force works and I can compile and submit to ganache cli

Proper way to handle this with upgradeable contracts, thanks @abcoathup:

Embark:
Using the exact same code that ran on Remix, pulling the same repo From Github, this is the error from the Embark console:

change: contracts/SimpleERC721.sol

embark-solc:

assuming Context to be an interface

assuming MinterRole to be an interface

assuming ERC165 to be an interface

assuming IERC165 to be an interface

assuming ERC721MetadataMintable to be an interface

assuming IERC721 to be an interface

assuming IERC721Enumerable to be an interface

assuming IERC721Metadata to be an interface

assuming IERC721Receiver to be an interface

To get more details on interface Smart contracts, go here: https://embark.status.im/docs/troubleshooting.html#Assuming-Contract-to-be-an-interface

deploying contracts

Executing pre-deploy actions...

Pre-deploy actions done. Deploying contracts

[ERC721Full]: Error: attempted to deploy ERC721Full without specifying parameters. check if there are any params defined for this contract in this environment in the contracts configuration file

[ERC721Metadata]: Error: attempted to deploy ERC721Metadata without specifying parameters. check if there are any params defined for this contract in this environment in the contracts configuration file

[SimpleERC721]: Failing call, this could be because of invalid inputs or function guards that may have been triggered, or an unknown error.

deploying SafeMath with 82470 gas at the price of 1 Wei, estimated cost: 82470 Wei (txHash: 0x0c42958f6240833872d389d1c2644a20530399fc3ce8731d2c0ca963e3e54719)

deploying Counters with 81887 gas at the price of 1 Wei, estimated cost: 81887 Wei (txHash: 0x3e3066dc0eb095a044591410a599a297ebe9729d705b33a99aad2966031f0769)

deploying Roles with 78968 gas at the price of 1 Wei, estimated cost: 78968 Wei (txHash: 0x6197f331403e84deba9aeec1087c077c5bf0ec0b625b4de502bfe5620b7f0fc8)

deploying Address with 84189 gas at the price of 1 Wei, estimated cost: 84189 Wei (txHash: 0x17e79b6fc897b91371f2fbb9ad865ed2264fa674aa0ca1f7d00b987d6331808b)

[ERC721]: Failing call, this could be because of invalid inputs or function guards that may have been triggered, or an unknown error.

[ERC721Enumerable]: Failing call, this could be because of invalid inputs or function guards that may have been triggered, or an unknown error.

SafeMath deployed at 0x5Ab333bdE4378939eCE590705D5524e436956a69 using 76654 gas (txHash: 0x0c42958f6240833872d389d1c2644a20530399fc3ce8731d2c0ca963e3e54719)

Roles deployed at 0x229C4CB3071DC0458fA87eEa31AC73Ad5257Bf3a using 76590 gas (txHash: 0x6197f331403e84deba9aeec1087c077c5bf0ec0b625b4de502bfe5620b7f0fc8)

Counters deployed at 0x1EC4B2Bc96FB8C24De8b73719A7E982B7EF2fd7b using 76654 gas (txHash: 0x3e3066dc0eb095a044591410a599a297ebe9729d705b33a99aad2966031f0769)

Address deployed at 0x34B645744Fd871CeBE2a3bA0493528F5F83c1abe using 76654 gas (txHash: 0x17e79b6fc897b91371f2fbb9ad865ed2264fa674aa0ca1f7d00b987d6331808b)

Error deploying contracts. Please fix errors to continue.

Error deploying contracts. Please fix errors to continue.