update
This commit is contained in:
@@ -242,6 +242,13 @@ contract DODODrops is InitializableMintableERC20, ReentrancyGuard {
|
||||
_setFixedAmountInfo(tokenIdList);
|
||||
}
|
||||
|
||||
function addFixedAmountInfo(uint256[] memory addTokenIdList) external notStart() onlyOwner {
|
||||
for (uint256 i = 0; i < addTokenIdList.length; i++) {
|
||||
_TOKEN_ID_LIST_.push(addTokenIdList[i]);
|
||||
}
|
||||
emit SetFixedAmountInfo();
|
||||
}
|
||||
|
||||
function setTokenIdMapByIndex(uint256 index, uint256[] memory tokenIds) external notStart() onlyOwner {
|
||||
require(_IS_PROB_MODE_, "ONLY_ALLOW_PROB_MODE");
|
||||
require(tokenIds.length > 0 && index < _TOKEN_ID_MAP_.length,"PARAM_NOT_INVALID");
|
||||
|
||||
@@ -10,10 +10,12 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
import {ERC1155} from "../../external/ERC1155/ERC1155.sol";
|
||||
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
|
||||
import {Strings} from "../../external/utils/Strings.sol";
|
||||
|
||||
contract DropsERC1155 is ERC1155, InitializableOwnable {
|
||||
using Strings for uint256;
|
||||
|
||||
mapping (address => bool) public _IS_ALLOWED_MINT_;
|
||||
mapping (uint256 => string) private _tokenURIs;
|
||||
string internal _baseUri = "";
|
||||
|
||||
// ============ Event =============
|
||||
@@ -43,25 +45,11 @@ contract DropsERC1155 is ERC1155, InitializableOwnable {
|
||||
_mint(account, id, amount, data);
|
||||
}
|
||||
|
||||
function batchSetTokenURI(uint256[] calldata ids, string[] calldata urls) external onlyOwner {
|
||||
require(ids.length == urls.length, "NOT_MATCH");
|
||||
for(uint256 i = 0; i < ids.length; i++) {
|
||||
_setTokenURI(ids[i], urls[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function uri(uint256 tokenId) public view override returns (string memory) {
|
||||
string memory _tokenURI = _tokenURIs[tokenId];
|
||||
string memory base = _baseUri;
|
||||
string memory baseURI = _baseUri;
|
||||
|
||||
if (bytes(base).length == 0) {
|
||||
return _tokenURI;
|
||||
}
|
||||
|
||||
return string(abi.encodePacked(base, _tokenURI));
|
||||
}
|
||||
|
||||
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
|
||||
_tokenURIs[tokenId] = _tokenURI;
|
||||
return bytes(baseURI).length > 0
|
||||
? string(abi.encodePacked(baseURI, tokenId.toString()))
|
||||
: '';
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {ERC721URIStorage} from "../../external/ERC721/ERC721URIStorage.sol";
|
||||
import {ERC721Enumerable} from "../../external/ERC721/ERC721Enumerable.sol";
|
||||
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
|
||||
|
||||
contract DropsERC721 is ERC721URIStorage, InitializableOwnable {
|
||||
contract DropsERC721 is ERC721Enumerable, InitializableOwnable {
|
||||
mapping (address => bool) public _IS_ALLOWED_MINT_;
|
||||
|
||||
// ============ Event =============
|
||||
@@ -44,11 +44,4 @@ contract DropsERC721 is ERC721URIStorage, InitializableOwnable {
|
||||
require(_IS_ALLOWED_MINT_[msg.sender], "restricted");
|
||||
_mint(to, tokenId);
|
||||
}
|
||||
|
||||
function batchSetTokenURI(uint256[] calldata ids, string[] calldata urls) external onlyOwner {
|
||||
require(ids.length == urls.length, "NOT_MATCH");
|
||||
for(uint256 i = 0; i < ids.length; i++) {
|
||||
_setTokenURI(ids[i], urls[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user