Improved ERC721 granularity (#1304)
* Split enumerable and metadata implementations. * Renamed ERC721Basic to ERC721, and ERC721 to ERC721Full. * Fixed linter errors.
This commit is contained in:
committed by
Francisco Giordano
parent
bafdcf0701
commit
4b33eaefa2
@ -1,18 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../token/ERC721/ERC721Basic.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title ERC721BasicMock
|
||||
* This mock just provides a public mint and burn functions for testing purposes
|
||||
*/
|
||||
contract ERC721BasicMock is ERC721Basic {
|
||||
function mint(address to, uint256 tokenId) public {
|
||||
_mint(to, tokenId);
|
||||
}
|
||||
|
||||
function burn(uint256 tokenId) public {
|
||||
_burn(ownerOf(tokenId), tokenId);
|
||||
}
|
||||
}
|
||||
30
contracts/mocks/ERC721FullMock.sol
Normal file
30
contracts/mocks/ERC721FullMock.sol
Normal file
@ -0,0 +1,30 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../token/ERC721/ERC721Full.sol";
|
||||
import "../token/ERC721/ERC721Mintable.sol";
|
||||
import "../token/ERC721/ERC721Burnable.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title ERC721Mock
|
||||
* 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 {
|
||||
constructor(string name, string symbol) public
|
||||
ERC721Mintable()
|
||||
ERC721Full(name, symbol)
|
||||
{}
|
||||
|
||||
function exists(uint256 tokenId) public view returns (bool) {
|
||||
return _exists(tokenId);
|
||||
}
|
||||
|
||||
function setTokenURI(uint256 tokenId, string uri) public {
|
||||
_setTokenURI(tokenId, uri);
|
||||
}
|
||||
|
||||
function removeTokenFrom(address from, uint256 tokenId) public {
|
||||
_removeTokenFrom(from, tokenId);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../token/ERC721/ERC721.sol";
|
||||
import "../token/ERC721/ERC721Full.sol";
|
||||
import "../token/ERC721/ERC721Mintable.sol";
|
||||
import "../token/ERC721/ERC721Burnable.sol";
|
||||
|
||||
@ -8,10 +8,12 @@ import "../token/ERC721/ERC721Burnable.sol";
|
||||
/**
|
||||
* @title ERC721MintableBurnableImpl
|
||||
*/
|
||||
contract ERC721MintableBurnableImpl is ERC721, ERC721Mintable, ERC721Burnable {
|
||||
contract ERC721MintableBurnableImpl
|
||||
is ERC721Full, ERC721Mintable, ERC721Burnable {
|
||||
|
||||
constructor()
|
||||
ERC721Mintable()
|
||||
ERC721("Test", "TEST")
|
||||
ERC721Full("Test", "TEST")
|
||||
public
|
||||
{
|
||||
}
|
||||
|
||||
@ -1,30 +1,18 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../token/ERC721/ERC721.sol";
|
||||
import "../token/ERC721/ERC721Mintable.sol";
|
||||
import "../token/ERC721/ERC721Burnable.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title ERC721Mock
|
||||
* This mock just provides a public mint and burn functions for testing purposes,
|
||||
* and a public setter for metadata URI
|
||||
* This mock just provides a public mint and burn functions for testing purposes
|
||||
*/
|
||||
contract ERC721Mock is ERC721, ERC721Mintable, ERC721Burnable {
|
||||
constructor(string name, string symbol) public
|
||||
ERC721Mintable()
|
||||
ERC721(name, symbol)
|
||||
{}
|
||||
|
||||
function exists(uint256 tokenId) public view returns (bool) {
|
||||
return _exists(tokenId);
|
||||
contract ERC721Mock is ERC721 {
|
||||
function mint(address to, uint256 tokenId) public {
|
||||
_mint(to, tokenId);
|
||||
}
|
||||
|
||||
function setTokenURI(uint256 tokenId, string uri) public {
|
||||
_setTokenURI(tokenId, uri);
|
||||
}
|
||||
|
||||
function removeTokenFrom(address from, uint256 tokenId) public {
|
||||
_removeTokenFrom(from, tokenId);
|
||||
function burn(uint256 tokenId) public {
|
||||
_burn(ownerOf(tokenId), tokenId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user