Skip to content

Commit

Permalink
Bundle ERC721 extensions into base contract (#2149)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
nventuro and frangio authored Mar 27, 2020
1 parent c8bef05 commit 24c37c1
Show file tree
Hide file tree
Showing 19 changed files with 1,148 additions and 1,300 deletions.
2 changes: 2 additions & 0 deletions contracts/mocks/ERC721BurnableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pragma solidity ^0.6.0;
import "../token/ERC721/ERC721Burnable.sol";

contract ERC721BurnableMock is ERC721Burnable {
constructor(string memory name, string memory symbol) public ERC721(name, symbol) { }

function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
}
Expand Down
37 changes: 0 additions & 37 deletions contracts/mocks/ERC721FullMock.sol

This file was deleted.

6 changes: 5 additions & 1 deletion contracts/mocks/ERC721GSNRecipientMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import "../GSN/GSNRecipientSignature.sol";
* A simple ERC721 mock that has GSN support enabled
*/
contract ERC721GSNRecipientMock is ERC721, GSNRecipient, GSNRecipientSignature {
constructor(address trustedSigner) public GSNRecipientSignature(trustedSigner) { }
constructor(string memory name, string memory symbol, address trustedSigner)
public
ERC721(name, symbol)
GSNRecipientSignature(trustedSigner)
{ }

function mint(uint256 tokenId) public {
_mint(_msgSender(), tokenId);
Expand Down
26 changes: 22 additions & 4 deletions contracts/mocks/ERC721Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,36 @@ import "../token/ERC721/ERC721.sol";
* This mock just provides a public safeMint, mint, and burn functions for testing purposes
*/
contract ERC721Mock is ERC721 {
function safeMint(address to, uint256 tokenId) public {
_safeMint(to, tokenId);
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }

function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}

function safeMint(address to, uint256 tokenId, bytes memory _data) public {
_safeMint(to, tokenId, _data);
function tokensOfOwner(address owner) public view returns (uint256[] memory) {
return _tokensOfOwner(owner);
}

function setTokenURI(uint256 tokenId, string memory uri) public {
_setTokenURI(tokenId, uri);
}

function setBaseURI(string memory baseURI) public {
_setBaseURI(baseURI);
}

function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
}

function safeMint(address to, uint256 tokenId) public {
_safeMint(to, tokenId);
}

function safeMint(address to, uint256 tokenId, bytes memory _data) public {
_safeMint(to, tokenId, _data);
}

function burn(uint256 tokenId) public {
_burn(tokenId);
}
Expand Down
2 changes: 2 additions & 0 deletions contracts/mocks/ERC721PausableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import "../token/ERC721/ERC721Pausable.sol";
* This mock just provides a public mint, burn and exists functions for testing purposes
*/
contract ERC721PausableMock is ERC721Pausable {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }

function mint(address to, uint256 tokenId) public {
super._mint(to, tokenId);
}
Expand Down
Loading

0 comments on commit 24c37c1

Please sign in to comment.