Skip to content

Commit

Permalink
Better way of testing for contract-ness
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerPodacter committed May 5, 2022
1 parent fbdcf8f commit 36c3c6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/ERC721R.sol
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ contract ERC721r is Context, ERC165, IERC721, IERC721Metadata {
}

function _mintRandom(address to, uint _numToMint) internal virtual {
require(!_msgSender().isContract(), "Contracts cannot mint");
require(_msgSender() == tx.origin, "Contracts cannot mint");
require(to != address(0), "ERC721: mint to the zero address");
require(_numToMint > 0, "ERC721r: need to mint at least one token");

Expand Down Expand Up @@ -336,7 +336,7 @@ contract ERC721r is Context, ERC165, IERC721, IERC721Metadata {
// Not as good as minting a specific tokenId, but will behave the same at the start
// allowing you to explicitly mint some tokens at launch.
function _mintAtIndex(address to, uint index) internal virtual {
require(!_msgSender().isContract(), "Contracts cannot mint");
require(_msgSender() == tx.origin, "Contracts cannot mint");
require(to != address(0), "ERC721: mint to the zero address");
require(_numAvailableTokens >= 1, "ERC721r: minting more tokens than available");

Expand Down

0 comments on commit 36c3c6f

Please sign in to comment.