update initializableERC721 && ERC1155
This commit is contained in:
1
cn
1
cn
Submodule cn deleted from dde6d47d3b
@@ -77,8 +77,8 @@ module.exports = {
|
||||
|
||||
|
||||
//================= MysteryBox =================
|
||||
MysteryBoxV1: "",
|
||||
RandomGenerator: "",
|
||||
MysteryBoxV1: "0xC3745Dd86bcAAA1263ce444ef9C87efEAc1e720A",
|
||||
RandomGenerator: "0x0E45F7C5419aD9cb096b535C8498de18638BE42e",
|
||||
RandomPool: [
|
||||
"0xa2e0ef85618732d80e5ef362773da1c92e8b1c57",
|
||||
"0xaCfc959e0E85726d09A36E6DFdD56FB2e5dB8F77",
|
||||
|
||||
@@ -46,20 +46,20 @@ contract NFTTokenFactory {
|
||||
}
|
||||
|
||||
function createERC721(
|
||||
string memory baseUrl
|
||||
string memory uri
|
||||
) external returns (address newERC721) {
|
||||
newERC721 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC721_TEMPLATE_);
|
||||
InitializableERC721(newERC721).init(msg.sender, "DODONFT", "DODONFT", baseUrl);
|
||||
InitializableERC721(newERC721).init(msg.sender, "DODONFT", "DODONFT", uri);
|
||||
_USER_ERC721_REGISTRY_[msg.sender].push(newERC721);
|
||||
emit NewERC721(newERC721, msg.sender);
|
||||
}
|
||||
|
||||
function createERC1155(
|
||||
uint256 amount,
|
||||
string memory baseUrl
|
||||
string memory uri
|
||||
) external returns (address newERC1155) {
|
||||
newERC1155 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC1155_TEMPLATE_);
|
||||
InitializableERC1155(newERC1155).init(msg.sender, amount, baseUrl);
|
||||
InitializableERC1155(newERC1155).init(msg.sender, amount, uri);
|
||||
_USER_ERC1155_REGISTRY_[msg.sender].push(newERC1155);
|
||||
emit NewERC1155(newERC1155, msg.sender);
|
||||
}
|
||||
|
||||
@@ -8,14 +8,40 @@
|
||||
pragma solidity 0.6.9;
|
||||
|
||||
import {ERC1155} from "./ERC1155.sol";
|
||||
import {Strings} from "../utils/Strings.sol";
|
||||
|
||||
contract InitializableERC1155 is ERC1155 {
|
||||
using Strings for uint256;
|
||||
|
||||
mapping (uint256 => string) private _tokenURIs;
|
||||
string internal _baseUri = "";
|
||||
|
||||
function init(
|
||||
address creator,
|
||||
uint256 amount,
|
||||
string memory baseUrI
|
||||
string memory uri
|
||||
) public {
|
||||
_setURI(baseUrI);
|
||||
_mint(creator, 0, amount ,"");
|
||||
_setTokenURI(0, uri);
|
||||
}
|
||||
|
||||
function uri(uint256 tokenId) public view override returns (string memory) {
|
||||
string memory _tokenURI = _tokenURIs[tokenId];
|
||||
string memory base = _baseUri;
|
||||
|
||||
if (bytes(base).length == 0) {
|
||||
return _tokenURI;
|
||||
}
|
||||
|
||||
if (bytes(_tokenURI).length > 0) {
|
||||
return string(abi.encodePacked(base, _tokenURI));
|
||||
}
|
||||
|
||||
return super.uri(tokenId);
|
||||
}
|
||||
|
||||
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
|
||||
_tokenURIs[tokenId] = _tokenURI;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
|
||||
import {ERC721} from "./ERC721.sol";
|
||||
import {ERC721URIStorage} from "./ERC721URIStorage.sol";
|
||||
|
||||
contract InitializableERC721 is ERC721 {
|
||||
contract InitializableERC721 is ERC721URIStorage {
|
||||
function init(
|
||||
address creator,
|
||||
string memory name,
|
||||
string memory symbol,
|
||||
string memory baseUri
|
||||
string memory uri
|
||||
) public {
|
||||
_name = name;
|
||||
_symbol = symbol;
|
||||
_baseUri = baseUri;
|
||||
_mint(creator, 0);
|
||||
_setTokenURI(0, uri);
|
||||
}
|
||||
}
|
||||
@@ -140,3 +140,10 @@ FragmentAddress: 0x40F3bBe2f8C5F2E5f4adFf7d51f652F2B9F77315
|
||||
DODOApproveProxy unlockAddProxy tx: 0x78c7557de3325d8471bce3715070509a57b9db94e035178b8c65261393f463e1
|
||||
DODOApproveProxy addDODOProxy tx: 0x81723112e50c67f5bb6291bcbf52c8ea8f98c881185bcbf23a763aff29602ee9
|
||||
Add AdminList on DODONFTRegistry Tx: 0x72c664e55a09c59fbd46bd754482b4e56dd04560071e262253b7f7929a76ccb1
|
||||
====================================================
|
||||
network type: kovan
|
||||
Deploy time: 2021/4/15 上午11:19:44
|
||||
Deploy type: MysteryBoxV1
|
||||
RandomGeneratorAddress: 0x0E45F7C5419aD9cb096b535C8498de18638BE42e
|
||||
MysteryBoxV1Address: 0xC3745Dd86bcAAA1263ce444ef9C87efEAc1e720A
|
||||
Init MysteryBoxV1 Tx: 0x9e767f2f7930985ba2b186021683380b7ed0dd5b6495d96b19373aad8cbb4cbb
|
||||
|
||||
Reference in New Issue
Block a user