change some comment text

This commit is contained in:
zhl 2023-02-21 13:33:12 +08:00
parent 560d6d91ed
commit 349485dc58
2 changed files with 6 additions and 12 deletions

View File

@ -89,10 +89,10 @@ contract HasSignature is Ownable, Approval {
bytes32 structHash, bytes32 structHash,
bytes memory signature bytes memory signature
) public view { ) public view {
require(signer != address(0), "[BE] invalid signer");
bytes32 digest = _hashTypedDataV4(structHash); bytes32 digest = _hashTypedDataV4(structHash);
address recovered = ECDSA.recover(digest, signature); address recovered = ECDSA.recover(digest, signature);
require(recovered == signer, "[BE] invalid signature"); require(recovered == signer, "[BE] invalid signature");
require(signer != address(0), "ECDSA: invalid signature");
} }
function checkSigner( function checkSigner(
@ -100,6 +100,7 @@ contract HasSignature is Ownable, Approval {
bytes32 hash, bytes32 hash,
bytes memory signature bytes memory signature
) public pure { ) public pure {
require(signer != address(0), "[BE] invalid signer");
require(signature.length == 65, "[BE] invalid signature length"); require(signature.length == 65, "[BE] invalid signature length");
bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(hash); bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(hash);
@ -110,7 +111,7 @@ contract HasSignature is Ownable, Approval {
modifier signatureValid(bytes calldata signature) { modifier signatureValid(bytes calldata signature) {
require( require(
!_usedSignatures[signature], !_usedSignatures[signature],
"signature used. please send another transaction with new signature" "[BE] signature used. please send another transaction with new signature"
); );
_; _;
} }

View File

@ -1,15 +1,10 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.10; pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/AccessControl.sol";
import "../../interfaces/IBEERC1155.sol";
abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
using Strings for uint256;
abstract contract BEBase is AccessControl, ERC721Enumerable, Ownable {
mapping(uint256 => bool) public lockedTokens; mapping(uint256 => bool) public lockedTokens;
string private _baseTokenURI = "https://market.cebg.games/api/nft/info/"; string private _baseTokenURI = "https://market.cebg.games/api/nft/info/";
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
@ -40,8 +35,6 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
onlyRole(MINTER_ROLE) onlyRole(MINTER_ROLE)
{ {
require(!_exists(tokenId), "Must have unique tokenId"); require(!_exists(tokenId), "Must have unique tokenId");
// We cannot just use balanceOf to create the new tokenId because tokens
// can be burned (destroyed), so we need a separate counter.
_mint(to, tokenId); _mint(to, tokenId);
} }
@ -128,7 +121,7 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
address from, address from,
address to, address to,
uint256 tokenId uint256 tokenId
) internal virtual override(ERC721, ERC721Enumerable) { ) internal virtual override(ERC721Enumerable) {
require(!lockedTokens[tokenId], "Can not transfer locked token"); require(!lockedTokens[tokenId], "Can not transfer locked token");
super._beforeTokenTransfer(from, to, tokenId); super._beforeTokenTransfer(from, to, tokenId);
} }
@ -140,7 +133,7 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
public public
view view
virtual virtual
override(AccessControl, ERC721, ERC721Enumerable) override(AccessControl, ERC721Enumerable)
returns (bool) returns (bool)
{ {
return super.supportsInterface(interfaceId); return super.supportsInterface(interfaceId);