Separate ERC721Mintable (#1365)

* separate part of ERC721Mintable into ERC721MetadataMintable

* remove mint and burn from 721 tests

* Fixed linter error.

* fix ERC721 mint tests

* Minor fixes.
This commit is contained in:
Francisco Giordano
2018-10-04 11:10:08 -03:00
committed by Nicolás Venturo
parent b41b125c15
commit 744f567f40
6 changed files with 43 additions and 23 deletions

View File

@ -2,14 +2,17 @@ pragma solidity ^0.4.24;
import "../token/ERC721/ERC721Full.sol";
import "../token/ERC721/ERC721Mintable.sol";
import "../token/ERC721/ERC721MetadataMintable.sol";
import "../token/ERC721/ERC721Burnable.sol";
/**
* @title ERC721Mock
* @title ERC721FullMock
* This mock just provides a public mint and burn functions for testing purposes,
* and a public setter for metadata URI
*/
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721Burnable {
contract ERC721FullMock
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor(string name, string symbol) public
ERC721Mintable()
ERC721Full(name, symbol)

View File

@ -2,13 +2,14 @@ pragma solidity ^0.4.24;
import "../token/ERC721/ERC721Full.sol";
import "../token/ERC721/ERC721Mintable.sol";
import "../token/ERC721/ERC721MetadataMintable.sol";
import "../token/ERC721/ERC721Burnable.sol";
/**
* @title ERC721MintableBurnableImpl
*/
contract ERC721MintableBurnableImpl
is ERC721Full, ERC721Mintable, ERC721Burnable {
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor()
ERC721Mintable()

View File

@ -0,0 +1,32 @@
pragma solidity ^0.4.24;
import "./ERC721Metadata.sol";
import "../../access/roles/MinterRole.sol";
/**
* @title ERC721MetadataMintable
* @dev ERC721 minting logic with metadata
*/
contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param tokenId The token id to mint.
* @param tokenURI The token URI of the minted token.
* @return A boolean that indicates if the operation was successful.
*/
function mintWithTokenURI(
address to,
uint256 tokenId,
string tokenURI
)
public
onlyMinter
returns (bool)
{
_mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
return true;
}
}

View File

@ -1,13 +1,13 @@
pragma solidity ^0.4.24;
import "./ERC721Full.sol";
import "./ERC721.sol";
import "../../access/roles/MinterRole.sol";
/**
* @title ERC721Mintable
* @dev ERC721 minting logic
*/
contract ERC721Mintable is ERC721Full, MinterRole {
contract ERC721Mintable is ERC721, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
@ -25,18 +25,4 @@ contract ERC721Mintable is ERC721Full, MinterRole {
_mint(to, tokenId);
return true;
}
function mintWithTokenURI(
address to,
uint256 tokenId,
string tokenURI
)
public
onlyMinter
returns (bool)
{
mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
return true;
}
}