Skip to content

Commit

Permalink
Add OperatorFilterer into ERC721MOnft (#95)
Browse files Browse the repository at this point in the history
* Clean up ERC721M and ERC721Onft

* fix tests

* Bump version from 0.0.10 to 0.0.11

* Fix comments
  • Loading branch information
channing-magiceden authored Aug 15, 2023
1 parent 10f9323 commit 95d4cdc
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 290 deletions.
55 changes: 6 additions & 49 deletions contracts/ERC721M.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
_;
}

/**
* @dev Returns whether NOT mintable.
*/
modifier cannotMint() {
if (_mintable) revert Mintable();
_;
}

/**
* @dev Returns whether it has enough supply for the given qty.
*/
Expand All @@ -110,13 +102,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
_;
}

/**
* @dev Returns cosigner address.
*/
function getCosigner() external view override returns (address) {
return _cosigner;
}

/**
* @dev Returns cosign nonce.
*/
Expand All @@ -132,13 +117,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
emit SetCosigner(cosigner);
}

/**
* @dev Returns expiry in seconds.
*/
function getTimestampExpirySeconds() public view override returns (uint64) {
return _timestampExpirySeconds;
}

/**
* @dev Sets expiry in seconds. This timestamp specifies how long a signature from cosigner is valid for.
*/
Expand All @@ -147,13 +125,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
emit SetTimestampExpirySeconds(expiry);
}

/**
* @dev Returns crossmint address.
*/
function getCrossmintAddress() external view override returns (address) {
return _crossmintAddress;
}

/**
* @dev Sets crossmint address if using crossmint. This allows the specified address to call `crossmint`.
*/
Expand Down Expand Up @@ -191,12 +162,11 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
_mintStages.pop();
}

uint64 timestampExpirySeconds = getTimestampExpirySeconds();
for (uint256 i = 0; i < newStages.length; i++) {
if (i >= 1) {
if (
newStages[i].startTimeUnixSeconds <
newStages[i - 1].endTimeUnixSeconds + timestampExpirySeconds
newStages[i - 1].endTimeUnixSeconds + _timestampExpirySeconds
) {
revert InsufficientStageTimeGap();
}
Expand Down Expand Up @@ -230,7 +200,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Gets whether mintable.
*/
function getMintable() external view override returns (bool) {
function getMintable() external view returns (bool) {
return _mintable;
}

Expand Down Expand Up @@ -344,7 +314,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
if (
startTimeUnixSeconds <
_mintStages[index - 1].endTimeUnixSeconds +
getTimestampExpirySeconds()
_timestampExpirySeconds
) {
revert InsufficientStageTimeGap();
}
Expand Down Expand Up @@ -374,7 +344,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
/**
* @dev Returns mint currency address.
*/
function getMintCurrency() external view override returns (address) {
function getMintCurrency() external view returns (address) {
return _mintCurrency;
}

Expand Down Expand Up @@ -535,18 +505,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
emit PermanentBaseURI(_currentBaseURI);
}

/**
* @dev Returns token URI suffix.
*/
function getTokenURISuffix()
external
view
override
returns (string memory)
{
return _tokenURISuffix;
}

/**
* @dev Sets token URI suffix. e.g. ".json".
*/
Expand Down Expand Up @@ -609,7 +567,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
uint32 qty,
uint64 timestamp,
bytes memory signature
) public view override {
) public view {
if (
!SignatureChecker.isValidSignatureNow(
_cosigner,
Expand All @@ -625,7 +583,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
function getActiveStageFromTimestamp(uint64 timestamp)
public
view
override
returns (uint256)
{
for (uint256 i = 0; i < _mintStages.length; i++) {
Expand All @@ -643,7 +600,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
* @dev Validates the timestamp is not expired.
*/
function _assertValidTimestamp(uint64 timestamp) internal view {
if (timestamp < block.timestamp - getTimestampExpirySeconds())
if (timestamp < block.timestamp - _timestampExpirySeconds)
revert TimestampExpired();
}

Expand Down
Loading

0 comments on commit 95d4cdc

Please sign in to comment.