LoginSignup
4
1

More than 5 years have passed since last update.

OpenZeppelinのERC721Full.solを調べてみた

Last updated at Posted at 2018-10-18

I am currently a student studying Blockchain. Recently, I studied ERC20, the next lesson I want to study is the opposite of ERC20 which is the ERC721. Let's discuss first the starting point of ERC721 which is the ERC721Full.sol.

ERC721トークンとは

ERC721 token is a template that shows how to build non-fungible or unique tokens on the Ethereum blockchain. It is a class of identical tokens.

OpenZeppelinとは

OpenZeppelin is an open-source battle-tested framework that contains reusable smart contracts for Ethereum and other blockchains. You can see more details about them in their website: https://openzeppelin.org/

ERC721Full.SOLとは

ERC721Full.Sol is the constructor of the ERC721 Token. This is what you import and call to initialize your ERC721 Token. It needs two strings, the name of the token and the symbol of that token. This is the code of the ERC721Full.sol from Github ( https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/ERC721Full.sol ):


pragma solidity ^0.4.24;
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./ERC721Metadata.sol";

/**
 * @title Full ERC721 Token
 * This implementation includes all the required and some optional functionality of the ERC721 standard
 * Moreover, it includes approve all functionality using operator terminology
 * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
 */
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
  constructor(string name, string symbol) ERC721Metadata(name, symbol)
    public
  {
  }
}

ERC721Full.SOLの使用

To use ERC721Full.sol, we have to import the file from Github. You can also install the OpenZeppelin Solidity into your local project. Please see the link on how to install: https://github.com/OpenZeppelin/openzeppelin-solidity

import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";

contract yourContract is ERC721Full {
  constructor() ERC721Full("token name", "token symbol") public {
  }
}

After importing it to your code, extend the ERC721Full to your contract.

contract yourContract is ERC721Full

Next is to inherit the constructor of the ERC721Full. You need to pass your token name and symbol as the parameters. You can also put your own code inside the constructor if you want to initialize something. The constructor only run once when the code is executed.

contract yourContract is ERC721Full {
constructor() ERC721Full("token name", "token symbol") public {
}

まとめ

ERC721Full.Sol is a simple code that lets you use the ERC721 template. It is the starting point of integrating the template into your contract. This is also where you initialize your token name and symbol. This token name and symbol will represent your token in the blockchain.

ソース:
http://erc721.org/
https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/ERC721Full.sol
https://github.com/OpenZeppelin/openzeppelin-solidity

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1