Skip to content

Commit 4b33eae

Browse files
nventurofrangio
authored andcommitted
Improved ERC721 granularity (#1304)
* Split enumerable and metadata implementations. * Renamed ERC721Basic to ERC721, and ERC721 to ERC721Full. * Fixed linter errors.
1 parent bafdcf0 commit 4b33eae

23 files changed

+879
-832
lines changed

contracts/mocks/ERC721BasicMock.sol

Lines changed: 0 additions & 18 deletions
This file was deleted.

contracts/mocks/ERC721FullMock.sol

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
pragma solidity ^0.4.24;
2+
3+
import "../token/ERC721/ERC721Full.sol";
4+
import "../token/ERC721/ERC721Mintable.sol";
5+
import "../token/ERC721/ERC721Burnable.sol";
6+
7+
8+
/**
9+
* @title ERC721Mock
10+
* This mock just provides a public mint and burn functions for testing purposes,
11+
* and a public setter for metadata URI
12+
*/
13+
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721Burnable {
14+
constructor(string name, string symbol) public
15+
ERC721Mintable()
16+
ERC721Full(name, symbol)
17+
{}
18+
19+
function exists(uint256 tokenId) public view returns (bool) {
20+
return _exists(tokenId);
21+
}
22+
23+
function setTokenURI(uint256 tokenId, string uri) public {
24+
_setTokenURI(tokenId, uri);
25+
}
26+
27+
function removeTokenFrom(address from, uint256 tokenId) public {
28+
_removeTokenFrom(from, tokenId);
29+
}
30+
}

contracts/mocks/ERC721MintableBurnableImpl.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
pragma solidity ^0.4.24;
22

3-
import "../token/ERC721/ERC721.sol";
3+
import "../token/ERC721/ERC721Full.sol";
44
import "../token/ERC721/ERC721Mintable.sol";
55
import "../token/ERC721/ERC721Burnable.sol";
66

77

88
/**
99
* @title ERC721MintableBurnableImpl
1010
*/
11-
contract ERC721MintableBurnableImpl is ERC721, ERC721Mintable, ERC721Burnable {
11+
contract ERC721MintableBurnableImpl
12+
is ERC721Full, ERC721Mintable, ERC721Burnable {
13+
1214
constructor()
1315
ERC721Mintable()
14-
ERC721("Test", "TEST")
16+
ERC721Full("Test", "TEST")
1517
public
1618
{
1719
}

contracts/mocks/ERC721Mock.sol

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
pragma solidity ^0.4.24;
22

33
import "../token/ERC721/ERC721.sol";
4-
import "../token/ERC721/ERC721Mintable.sol";
5-
import "../token/ERC721/ERC721Burnable.sol";
64

75

86
/**
97
* @title ERC721Mock
10-
* This mock just provides a public mint and burn functions for testing purposes,
11-
* and a public setter for metadata URI
8+
* This mock just provides a public mint and burn functions for testing purposes
129
*/
13-
contract ERC721Mock is ERC721, ERC721Mintable, ERC721Burnable {
14-
constructor(string name, string symbol) public
15-
ERC721Mintable()
16-
ERC721(name, symbol)
17-
{}
18-
19-
function exists(uint256 tokenId) public view returns (bool) {
20-
return _exists(tokenId);
21-
}
22-
23-
function setTokenURI(uint256 tokenId, string uri) public {
24-
_setTokenURI(tokenId, uri);
10+
contract ERC721Mock is ERC721 {
11+
function mint(address to, uint256 tokenId) public {
12+
_mint(to, tokenId);
2513
}
2614

27-
function removeTokenFrom(address from, uint256 tokenId) public {
28-
_removeTokenFrom(from, tokenId);
15+
function burn(uint256 tokenId) public {
16+
_burn(ownerOf(tokenId), tokenId);
2917
}
3018
}

0 commit comments

Comments
 (0)