convert ERC721Full, ERC721Enumerable, ERC721Metadata to initializers
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
|
import "../Initializable.sol";
|
||||||
import "../token/ERC721/ERC721Full.sol";
|
import "../token/ERC721/ERC721Full.sol";
|
||||||
import "../token/ERC721/ERC721Mintable.sol";
|
import "../token/ERC721/ERC721Mintable.sol";
|
||||||
import "../token/ERC721/ERC721Burnable.sol";
|
import "../token/ERC721/ERC721Burnable.sol";
|
||||||
@ -10,11 +11,12 @@ import "../token/ERC721/ERC721Burnable.sol";
|
|||||||
* This mock just provides a public mint and burn functions for testing purposes,
|
* This mock just provides a public mint and burn functions for testing purposes,
|
||||||
* and a public setter for metadata URI
|
* and a public setter for metadata URI
|
||||||
*/
|
*/
|
||||||
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721Burnable {
|
contract ERC721FullMock is Initializable, ERC721Full, ERC721Mintable, ERC721Burnable {
|
||||||
constructor(string name, string symbol) public
|
constructor(string name, string symbol) public
|
||||||
ERC721Mintable()
|
{
|
||||||
ERC721Full(name, symbol)
|
ERC721Full.initialize(name, symbol);
|
||||||
{}
|
ERC721Mintable.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
function exists(uint256 tokenId) public view returns (bool) {
|
function exists(uint256 tokenId) public view returns (bool) {
|
||||||
return _exists(tokenId);
|
return _exists(tokenId);
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
|
import "../../Initializable.sol";
|
||||||
import "./IERC721Enumerable.sol";
|
import "./IERC721Enumerable.sol";
|
||||||
import "./ERC721.sol";
|
import "./ERC721.sol";
|
||||||
import "../../introspection/ERC165.sol";
|
import "../../introspection/ERC165.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
|
contract ERC721Enumerable is Initializable, ERC165, ERC721, IERC721Enumerable {
|
||||||
// Mapping from owner to list of owned token IDs
|
// Mapping from owner to list of owned token IDs
|
||||||
mapping(address => uint256[]) private _ownedTokens;
|
mapping(address => uint256[]) private _ownedTokens;
|
||||||
|
|
||||||
@ -29,7 +30,10 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
|
|||||||
/**
|
/**
|
||||||
* @dev Constructor function
|
* @dev Constructor function
|
||||||
*/
|
*/
|
||||||
constructor() public {
|
function initialize() public initializer {
|
||||||
|
ERC165.initialize();
|
||||||
|
ERC721.initialize();
|
||||||
|
|
||||||
// register the supported interface to conform to ERC721 via ERC165
|
// register the supported interface to conform to ERC721 via ERC165
|
||||||
_registerInterface(_InterfaceId_ERC721Enumerable);
|
_registerInterface(_InterfaceId_ERC721Enumerable);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
|
import "../../Initializable.sol";
|
||||||
import "./ERC721.sol";
|
import "./ERC721.sol";
|
||||||
import "./ERC721Enumerable.sol";
|
import "./ERC721Enumerable.sol";
|
||||||
import "./ERC721Metadata.sol";
|
import "./ERC721Metadata.sol";
|
||||||
@ -11,9 +12,13 @@ import "./ERC721Metadata.sol";
|
|||||||
* Moreover, it includes approve all functionality using operator terminology
|
* Moreover, it includes approve all functionality using operator terminology
|
||||||
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
|
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
|
||||||
*/
|
*/
|
||||||
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
|
contract ERC721Full is Initializable, ERC721, ERC721Enumerable, ERC721Metadata {
|
||||||
constructor(string name, string symbol) ERC721Metadata(name, symbol)
|
function initialize(string name, string symbol)
|
||||||
public
|
public
|
||||||
|
initializer
|
||||||
{
|
{
|
||||||
|
ERC721.initialize();
|
||||||
|
ERC721Enumerable.initialize();
|
||||||
|
ERC721Metadata.initialize(name, symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
|
import "../../Initializable.sol";
|
||||||
import "./ERC721.sol";
|
import "./ERC721.sol";
|
||||||
import "./IERC721Metadata.sol";
|
import "./IERC721Metadata.sol";
|
||||||
import "../../introspection/ERC165.sol";
|
import "../../introspection/ERC165.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
|
contract ERC721Metadata is Initializable, ERC165, ERC721, IERC721Metadata {
|
||||||
// Token name
|
// Token name
|
||||||
string internal _name;
|
string internal _name;
|
||||||
|
|
||||||
@ -26,7 +27,10 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
|
|||||||
/**
|
/**
|
||||||
* @dev Constructor function
|
* @dev Constructor function
|
||||||
*/
|
*/
|
||||||
constructor(string name, string symbol) public {
|
function initialize(string name, string symbol) public initializer {
|
||||||
|
ERC165.initialize();
|
||||||
|
ERC721.initialize();
|
||||||
|
|
||||||
_name = name;
|
_name = name;
|
||||||
_symbol = symbol;
|
_symbol = symbol;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user