Open hhstore opened 2 years ago
fallback() external payable virtual {
_fallback();
}
tokenURI()
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
}
safeTransferFrom():
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
_safeMint()
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
contract ERC721Mock is ERC721 {
function safeMint(address to, uint256 tokenId) public {
_safeMint(to, tokenId);
}
}
pause()
contract ERC721PresetMinterPauserAutoId is
Context,
AccessControlEnumerable,
ERC721Enumerable,
ERC721Burnable,
ERC721Pausable
{
function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
_pause();
}
}
mintBatch()
contract ERC1155Mock is ERC1155 {
function mintBatch(
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public {
_mintBatch(to, ids, values, data);
}
}
示例:
MerkleProof:
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
}
1
1
1
1
1
related: