Skip to content

Commit 24c37c1

Browse files
nventurofrangio
andauthored
Bundle ERC721 extensions into base contract (#2149)
* Add IERC721Metadata implementation into ERC721 * Add IERC721Enumerable into ERC721 * Update ERC721Pausable and ERC721Burnable * Delete ERC721Metadata, ERC721Enumerable and ERC721 (now ERC721) * Update mocks * Update tests * Update contracts/token/ERC721/ERC721.sol Co-Authored-By: Francisco Giordano <[email protected]> * Make ERC721Pausable and ERC721Burnable abstract Co-authored-by: Francisco Giordano <[email protected]>
1 parent c8bef05 commit 24c37c1

19 files changed

+1148
-1300
lines changed

contracts/mocks/ERC721BurnableMock.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ pragma solidity ^0.6.0;
33
import "../token/ERC721/ERC721Burnable.sol";
44

55
contract ERC721BurnableMock is ERC721Burnable {
6+
constructor(string memory name, string memory symbol) public ERC721(name, symbol) { }
7+
68
function mint(address to, uint256 tokenId) public {
79
_mint(to, tokenId);
810
}

contracts/mocks/ERC721FullMock.sol

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

contracts/mocks/ERC721GSNRecipientMock.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import "../GSN/GSNRecipientSignature.sol";
99
* A simple ERC721 mock that has GSN support enabled
1010
*/
1111
contract ERC721GSNRecipientMock is ERC721, GSNRecipient, GSNRecipientSignature {
12-
constructor(address trustedSigner) public GSNRecipientSignature(trustedSigner) { }
12+
constructor(string memory name, string memory symbol, address trustedSigner)
13+
public
14+
ERC721(name, symbol)
15+
GSNRecipientSignature(trustedSigner)
16+
{ }
1317

1418
function mint(uint256 tokenId) public {
1519
_mint(_msgSender(), tokenId);

contracts/mocks/ERC721Mock.sol

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,36 @@ import "../token/ERC721/ERC721.sol";
77
* This mock just provides a public safeMint, mint, and burn functions for testing purposes
88
*/
99
contract ERC721Mock is ERC721 {
10-
function safeMint(address to, uint256 tokenId) public {
11-
_safeMint(to, tokenId);
10+
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
11+
12+
function exists(uint256 tokenId) public view returns (bool) {
13+
return _exists(tokenId);
1214
}
1315

14-
function safeMint(address to, uint256 tokenId, bytes memory _data) public {
15-
_safeMint(to, tokenId, _data);
16+
function tokensOfOwner(address owner) public view returns (uint256[] memory) {
17+
return _tokensOfOwner(owner);
18+
}
19+
20+
function setTokenURI(uint256 tokenId, string memory uri) public {
21+
_setTokenURI(tokenId, uri);
22+
}
23+
24+
function setBaseURI(string memory baseURI) public {
25+
_setBaseURI(baseURI);
1626
}
1727

1828
function mint(address to, uint256 tokenId) public {
1929
_mint(to, tokenId);
2030
}
2131

32+
function safeMint(address to, uint256 tokenId) public {
33+
_safeMint(to, tokenId);
34+
}
35+
36+
function safeMint(address to, uint256 tokenId, bytes memory _data) public {
37+
_safeMint(to, tokenId, _data);
38+
}
39+
2240
function burn(uint256 tokenId) public {
2341
_burn(tokenId);
2442
}

contracts/mocks/ERC721PausableMock.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import "../token/ERC721/ERC721Pausable.sol";
77
* This mock just provides a public mint, burn and exists functions for testing purposes
88
*/
99
contract ERC721PausableMock is ERC721Pausable {
10+
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
11+
1012
function mint(address to, uint256 tokenId) public {
1113
super._mint(to, tokenId);
1214
}

0 commit comments

Comments
 (0)