Coder Social home page Coder Social logo

hashlips_nft_contract's Introduction

Welcome to HashLips 👄

All the code in these repos was created and explained by HashLips on the main YouTube channel.

To find out more please visit:

📺 YouTube

👄 Discord

💬 Telegram

🐦 Twitter

ℹ️ Website

HashLips NFT contract 🔥

This repo provides a simple NFT smart contract.

Usage ℹ️

To make use of the NFT smart contract, simply copy the SimpleNft_flat.sol file in the contract folder and deploy it on remix after changing the parameters.

Disclaimer

These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review this code on your own before using any of
the following code for production.
HashLips will not be liable in any way if for the use
of the code. That being said, the code has been tested
to the best of the developers' knowledge to work as intended.

That's it! you're done.

hashlips_nft_contract's People

Contributors

hashlips avatar liarco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hashlips_nft_contract's Issues

Token ID

For some reason this keeps creating a new value next to the token ID name. Is there any way to hide that? Problem is when uploading onto opensea, it keeps displaying the 10 digits added to the token name. For example it reads "SAMPLE" as "SAMPLE 1234567890" when it should read "SAMPLE" , metadata and base uri are correct. Why does this keep happening?

Unable to set royalties on Opensea

I followed the video of ultimate guide. I managed to list some my nfts on Opensea. The problem is I can’t edit commission. Whenever I submit change, the error message 401 Not Authorized appears.
I really need your help

Simple NFT Contract for Just 2 NFTS

Hi , Friends
I want just to sell to 2 NFTs and i want you suggest me a simpe contract,
should i use that repo or is there any contract simple than that?

Thanks @HashLips Daniel <3
Waiting for help

Withdraw function doesn't work

I deployed on Mumbai testnet, everything seems okay, but when it comes to transacting withdraw I have that famous error message from remix "gas estimation errored. Blah blah blah -3200..."
I double checked everything.
The contract has value in it since I've used the mint fiction from another different wallet address other than the owner one.
I transact withdraw from owner address.
I tried with Goving a specific value
And with no value at all
Doesn't work anyways.
Can please someone help me figuring out what am I doing wrong 🙏♥️

Error: Unsupported image type

Error: Unsupported image type
at setSource (/Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/node_modules/canvas/lib/image.js:91:13)
at Image.set (/Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/node_modules/canvas/lib/image.js:62:9)
at /Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/node_modules/canvas/index.js:34:15
at new Promise ()
at loadImage (/Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/node_modules/canvas/index.js:23:10)
at /Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/src/main.js:184:25
at new Promise ()
at Usr (/Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/src/main.js:183:10)
at /Users/Usr/Documents/nft codiing/hashlips_art_engine-1.1.2_patch_v1/src/main.js:364:31
at Array.forEach ()

setCost() vs listing on Opensea

I am just a bit confused about these two and want to be sure that I understand it right.

When I set the cost inside the contract or change it later with setCost method on remix, this is the cost for minting (for example the cost to mint nft on the Dapp during pre-sale).

Meanwhile, I can only manually list for sale and set the cost on Opensea for those that are pre-minted (for example the rest of the nfts inside the same collection that weren't sold during pre-sale and that I have to pre-mint so they show up on Opensea).

The cost in the contract does not affect the cost I set on Opensea in any way (?)

Is my understanding correct?

List multiple NFTs for sale

I foolowed the newest video on how to generate and mint my collection, which was more than awesome and easy to follow.

I'm unsure if I missed something, but now do I need to go through every 1 of my 1000 NFTs and click Sell and put a price in?

I have put a number in the contract to 12 Ether. I also went back to the contract on polygonscan and set_Cost to 13,transaction goes through but no change on Opensea (people can only make an offer not buy now or bid).

Please can someone let me know how to fix this? Wouldn't mind setting up the same cost for every single NFT, as long as it's done in a batch.

Thank you kindly!

Not revealed uri

I have a problem.
When i deploy the contract and mint my NFTs the not revealed pictures are not showing up and i cant see them. Whats the issue?

NFT mint cost not propagating

I believe I've done everything correct, all I did was edit the mint price and change to Polygon testnet yet no price is coming up at all when I go to mint. Tried on Rinkeby too. It just wants to charge the gas fee but no NFT cost at mint. Any tips? Any thing I couldve forgot to edit?

Gas estimation failed

when mint nft some other wallets address rise this issue and but remix VM network nft create by other wallets successfullly.

SimpleNFT_flat.sol contract does not verify on test etherscan

Im trying to verify a smart contract on etherscan test net and will be deploying on polygon when i can get it to verify.
Ive followed the Hashlips guide exactly (https://www.youtube.com/watch?v=fzH7Gjadmj0&t=5922s) but the copy button in remix does not copy the abi and byte code.

Im using SimpleNFT_flat.sol by the way

I carried on anyway but the contract will not verify. Brings up the unable to generate contract ByteCode and ABI. It then lists possible matches that it doesnt match with, despite on the list is a matching bytecode. https://ibb.co/Ss49CZ5

I deployed to testnet, clicked abi to copy it in the image, pasted that into hash ex, clicked parse and filled in the info at the bottom and tthen copied that into the constructor argument section.

https://ibb.co/9nZkXHh
https://ibb.co/hKjbgNW
https://ibb.co/Z2L9skt

Ive gone through every answer on here and google and nothing is fixing this.
Ive tried starting it from scratch, re deploying over and over again. Same issue. I just cant verify this thing. Everything is matching, compiler version, whether its optimised or not, the optimisation.

Would love some help on this.

Gas estimation errored

I can't do too many Mint at once I get the following error.
Internal JSON-RPC error. { "code": -32000, "message": "gas required exceeds allowance (29970705)" }

I don't want to have to do 200 mint at a time.

To be faster, I'd like to mint the 10k in one go.

Detail: I am using the main polygon network, and the contract is below:
0xce55d7d4a457bb07b177acb43fe5d538028bf1c8

I'm also using the account responsible for creating the smart contract.

The max mint is set to 2000 and the cost is 11 matic.

I've already tried to do the same through polygonscan and with no success.

I hope someone responds as soon as possible, that would be of great help.

Thanks.

Potential security issue with baseURI

I found a potential issue, everything in the blockchain is public from outside even if the variables are set to private. The token constructor allows to set the baseURI before the tokens are revealed, in this case anyone could decode the contract storage and know in advance the tokens they will get before minting. Ideally the baseURI should not be allowed to be set until the tokens are revealed.

SetCost() doesnt work

Hi ,

When I am deploying on polygon testnet and trying to change the cost via the setcost function it doesn't work.

Ive first deploy the contract with the cost = 0.02 ether .
Once I 've verify and deploy the contract on polygonscan testnet Ive called the setCost function and put 1 and the transaction has been validated.

So when I try to mint , I can still mint with a value of 0.02 I am trying to understand but it should have rejected my transaction since Ive put 1 on the setCost function???

Moreover , Why do I have to specify the price of the mint item on polygonscan testnet and not on remix ?
image

Out of Gas Error on walletOfOwner function

I airdropped 1000 NFTs to the holders.
But when I tried to call walletOfOwner function to check holding NFTs, it raises Out of Gas Error.
It works for holders holding earlier NFTs (tokenIDs are not high) but doesn't for for others.
How can this be fixed?

Invalid JSON RPC response

Do I need to debug after I mint on remix? I have minted a couple NFTS and non show up on open sea test net. I ran debug and I got an " Invalid JSON RPC response" Anyone have the same or similar issue? If not any trouble shooting suggestions ? Im new to coding (actually this is my first coding project) so Im not really sure where to start. Any feedback would be great!

Implementing eip-2981 for royalties

Hello there

if you read about eip-2981, it allows the contract to signal the royalty fees to marketplaces, its not yet supported by opensea, but other marketplaces like looksrare, superrare and rariple do support it

I know you may see that OS is the leader and the one with the most volume, but missing the royalty fees usually happens with other marketplaces that sometimes the contract creator has no clue that his collection is being sold there.

I'll try to implement it in the low gas contract and push it for @HashLips for review, but implementation from the man himself gives it more credibility with the community IMO

Thanks for reading

help! stupidly deployed before flatten

So, any suggestions? After days of trying to get REMIX to let me select Injected Web3, I jumped the gun and hit deploy before realizing that I had just started a new contract without flattening it. I have only added the contract name and id. Now what? Is there anyway I can edit this and reuse it? I know I cannot delete it but do not know the ways that I have left myself vulnerable with this contract. Any suggestions appreciated. Thank you.

I have used and deployed this contract and the problem is when i mint the NFT with 0.1Matic if go through

Hi,
I have used and deployed this contract and the problem is when i mint the NFT with 0.1 Matic if go through
is there a way to update this with the existing contract ?

// SPDX-License-Identifier: MIT

// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review this code on your own before using any of
the following code for production.
HashLips will not be liable in any way if for the use
of the code. That being said, the code has been tested
to the best of the developers' knowledge to work as intended.
*/

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**

  • @dev Interface of the ERC165 standard, as defined in the
  • https://eips.ethereum.org/EIPS/eip-165[EIP].
  • Implementers can declare support of contract interfaces, which can then be
  • queried by others ({ERC165Checker}).
  • For an implementation, see {ERC165}.
    /
    interface IERC165 {
    /
    *

// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
pragma solidity ^0.8.0;
/**

  • @dev Required interface of an ERC721 compliant contract.
    /
    interface IERC721 is IERC165 {
    /
    *

    • @dev Emitted when tokenId token is transferred from from to to.
      */
      event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**

    • @dev Emitted when owner enables approved to manage the tokenId token.
      */
      event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**

    • @dev Emitted when owner enables or disables (approved) operator to manage all of its assets.
      */
      event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**

    • @dev Returns the number of tokens in owner's account.
      */
      function balanceOf(address owner) external view returns (uint256 balance);

    /**

    • @dev Returns the owner of the tokenId token.
    • Requirements:
      • tokenId must exist.
        */
        function ownerOf(uint256 tokenId) external view returns (address owner);

    /**

    • @dev Safely transfers tokenId token from from to to, checking first that contract recipients
    • are aware of the ERC721 protocol to prevent tokens from being forever locked.
    • Requirements:
      • from cannot be the zero address.
      • to cannot be the zero address.
      • tokenId token must exist and be owned by from.
      • If the caller is not from, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
      • If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    • Emits a {Transfer} event.
      */
      function safeTransferFrom(
      address from,
      address to,
      uint256 tokenId
      ) external;

    /**

    • @dev Transfers tokenId token from from to to.
    • WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
    • Requirements:
      • from cannot be the zero address.
      • to cannot be the zero address.
      • tokenId token must be owned by from.
      • If the caller is not from, it must be approved to move this token by either {approve} or {setApprovalForAll}.
    • Emits a {Transfer} event.
      */
      function transferFrom(
      address from,
      address to,
      uint256 tokenId
      ) external;

    /**

    • @dev Gives permission to to to transfer tokenId token to another account.
    • The approval is cleared when the token is transferred.
    • Only a single account can be approved at a time, so approving the zero address clears previous approvals.
    • Requirements:
      • The caller must own the token or be an approved operator.
      • tokenId must exist.
    • Emits an {Approval} event.
      */
      function approve(address to, uint256 tokenId) external;

    /**

    • @dev Returns the account approved for tokenId token.
    • Requirements:
      • tokenId must exist.
        */
        function getApproved(uint256 tokenId) external view returns (address operator);

    /**

    • @dev Approve or remove operator as an operator for the caller.
    • Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
    • Requirements:
      • The operator cannot be the caller.
    • Emits an {ApprovalForAll} event.
      */
      function setApprovalForAll(address operator, bool _approved) external;

    /**

    • @dev Returns if the operator is allowed to manage all of the assets of owner.
    • See {setApprovalForAll}
      */
      function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**

    • @dev Safely transfers tokenId token from from to to.
    • Requirements:
      • from cannot be the zero address.
      • to cannot be the zero address.
      • tokenId token must exist and be owned by from.
      • If the caller is not from, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      • If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    • Emits a {Transfer} event.
      */
      function safeTransferFrom(
      address from,
      address to,
      uint256 tokenId,
      bytes calldata data
      ) external;
      }

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
pragma solidity ^0.8.0;
/**

  • @title ERC-721 Non-Fungible Token Standard, optional enumeration extension

  • @dev See https://eips.ethereum.org/EIPS/eip-721
    /
    interface IERC721Enumerable is IERC721 {
    /
    *

    • @dev Returns the total amount of tokens stored by the contract.
      */
      function totalSupply() external view returns (uint256);

    /**

    • @dev Returns a token ID owned by owner at a given index of its token list.
    • Use along with {balanceOf} to enumerate all of owner's tokens.
      */
      function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**

    • @dev Returns a token ID at a given index of all the tokens stored by the contract.
    • Use along with {totalSupply} to enumerate all tokens.
      */
      function tokenByIndex(uint256 index) external view returns (uint256);
      }

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
pragma solidity ^0.8.0;
/**

  • @dev Implementation of the {IERC165} interface.
  • Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
  • for the additional interface id that will be supported. For example:
  • function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
  • return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
    
  • }
  • Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
    /
    abstract contract ERC165 is IERC165 {
    /
    *
    • @dev See {IERC165-supportsInterface}.
      */
      function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
      return interfaceId == type(IERC165).interfaceId;
      }
      }

// File: @openzeppelin/contracts/utils/Strings.sol

pragma solidity ^0.8.0;

/**

  • @dev String operations.
    */
    library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**

    • @dev Converts a uint256 to its ASCII string decimal representation.
      */
      function toString(uint256 value) internal pure returns (string memory) {
      // Inspired by OraclizeAPI's implementation - MIT licence
      // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

      if (value == 0) {
      return "0";
      }
      uint256 temp = value;
      uint256 digits;
      while (temp != 0) {
      digits++;
      temp /= 10;
      }
      bytes memory buffer = new bytes(digits);
      while (value != 0) {
      digits -= 1;
      buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
      value /= 10;
      }
      return string(buffer);
      }

    /**

    • @dev Converts a uint256 to its ASCII string hexadecimal representation.
      */
      function toHexString(uint256 value) internal pure returns (string memory) {
      if (value == 0) {
      return "0x00";
      }
      uint256 temp = value;
      uint256 length = 0;
      while (temp != 0) {
      length++;
      temp >>= 8;
      }
      return toHexString(value, length);
      }

    /**

    • @dev Converts a uint256 to its ASCII string hexadecimal representation with fixed length.
      */
      function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
      bytes memory buffer = new bytes(2 * length + 2);
      buffer[0] = "0";
      buffer[1] = "x";
      for (uint256 i = 2 * length + 1; i > 1; --i) {
      buffer[i] = _HEX_SYMBOLS[value & 0xf];
      value >>= 4;
      }
      require(value == 0, "Strings: hex length insufficient");
      return string(buffer);
      }
      }

// File: @openzeppelin/contracts/utils/Address.sol

pragma solidity ^0.8.0;

/**

  • @dev Collection of functions related to the address type
    /
    library Address {
    /
    *

    • @dev Returns true if account is a contract.

    • [IMPORTANT]

    • ====

    • It is unsafe to assume that an address for which this function returns

    • false is an externally-owned account (EOA) and not a contract.

    • Among others, isContract will return false for the following

    • types of addresses:

      • an externally-owned account
      • a contract in construction
      • an address where a contract will be created
      • an address where a contract lived, but was destroyed
    • ====
      */
      function isContract(address account) internal view returns (bool) {
      // This method relies on extcodesize, which returns 0 for contracts in
      // construction, since the code is only stored at the end of the
      // constructor execution.

      uint256 size;
      assembly {
      size := extcodesize(account)
      }
      return size > 0;
      }

    /**

    /**

    • @dev Performs a Solidity function call using a low level call. A
    • plain call is an unsafe replacement for a function call: use this
    • function instead.
    • If target reverts with a revert reason, it is bubbled up by this
    • function (like regular Solidity function calls).
    • Returns the raw returned data. To convert to the expected return value,
    • use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
    • Requirements:
      • target must be a contract.
      • calling target with data must not revert.
    • Available since v3.1.
      */
      function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
      }

    /**

    • @dev Same as {xref-Address-functionCall-address-bytes-}[functionCall], but with
    • errorMessage as a fallback revert reason when target reverts.
    • Available since v3.1.
      */
      function functionCall(
      address target,
      bytes memory data,
      string memory errorMessage
      ) internal returns (bytes memory) {
      return functionCallWithValue(target, data, 0, errorMessage);
      }

    /**

    • @dev Same as {xref-Address-functionCall-address-bytes-}[functionCall],
    • but also transferring value wei to target.
    • Requirements:
      • the calling contract must have an ETH balance of at least value.
      • the called Solidity function must be payable.
    • Available since v3.1.
      */
      function functionCallWithValue(
      address target,
      bytes memory data,
      uint256 value
      ) internal returns (bytes memory) {
      return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
      }

    /**

    • @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[functionCallWithValue], but

    • with errorMessage as a fallback revert reason when target reverts.

    • Available since v3.1.
      */
      function functionCallWithValue(
      address target,
      bytes memory data,
      uint256 value,
      string memory errorMessage
      ) internal returns (bytes memory) {
      require(address(this).balance >= value, "Address: insufficient balance for call");
      require(isContract(target), "Address: call to non-contract");

      (bool success, bytes memory returndata) = target.call{value: value}(data);
      return verifyCallResult(success, returndata, errorMessage);
      }

    /**

    • @dev Same as {xref-Address-functionCall-address-bytes-}[functionCall],
    • but performing a static call.
    • Available since v3.3.
      */
      function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
      return functionStaticCall(target, data, "Address: low-level static call failed");
      }

    /**

    • @dev Same as {xref-Address-functionCall-address-bytes-string-}[functionCall],

    • but performing a static call.

    • Available since v3.3.
      */
      function functionStaticCall(
      address target,
      bytes memory data,
      string memory errorMessage
      ) internal view returns (bytes memory) {
      require(isContract(target), "Address: static call to non-contract");

      (bool success, bytes memory returndata) = target.staticcall(data);
      return verifyCallResult(success, returndata, errorMessage);
      }

    /**

    • @dev Same as {xref-Address-functionCall-address-bytes-}[functionCall],
    • but performing a delegate call.
    • Available since v3.4.
      */
      function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionDelegateCall(target, data, "Address: low-level delegate call failed");
      }

    /**

    • @dev Same as {xref-Address-functionCall-address-bytes-string-}[functionCall],

    • but performing a delegate call.

    • Available since v3.4.
      */
      function functionDelegateCall(
      address target,
      bytes memory data,
      string memory errorMessage
      ) internal returns (bytes memory) {
      require(isContract(target), "Address: delegate call to non-contract");

      (bool success, bytes memory returndata) = target.delegatecall(data);
      return verifyCallResult(success, returndata, errorMessage);
      }

    /**

    • @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the

    • revert reason using the provided one.

    • Available since v4.3.
      */
      function verifyCallResult(
      bool success,
      bytes memory returndata,
      string memory errorMessage
      ) internal pure returns (bytes memory) {
      if (success) {
      return returndata;
      } else {
      // Look for revert reason and bubble it up if present
      if (returndata.length > 0) {
      // The easiest way to bubble the revert reason is using memory via assembly

           assembly {
               let returndata_size := mload(returndata)
               revert(add(32, returndata), returndata_size)
           }
       } else {
           revert(errorMessage);
       }
      

      }
      }
      }

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol

pragma solidity ^0.8.0;

/**

  • @title ERC-721 Non-Fungible Token Standard, optional metadata extension

  • @dev See https://eips.ethereum.org/EIPS/eip-721
    /
    interface IERC721Metadata is IERC721 {
    /
    *

    • @dev Returns the token collection name.
      */
      function name() external view returns (string memory);

    /**

    • @dev Returns the token collection symbol.
      */
      function symbol() external view returns (string memory);

    /**

    • @dev Returns the Uniform Resource Identifier (URI) for tokenId token.
      */
      function tokenURI(uint256 tokenId) external view returns (string memory);
      }

// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol

pragma solidity ^0.8.0;

/**

  • @title ERC721 token receiver interface
  • @dev Interface for any contract that wants to support safeTransfers
  • from ERC721 asset contracts.
    /
    interface IERC721Receiver {
    /
    *
    • @dev Whenever an {IERC721} tokenId token is transferred to this contract via {IERC721-safeTransferFrom}
    • by operator from from, this function is called.
    • It must return its Solidity selector to confirm the token transfer.
    • If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
    • The selector can be obtained in Solidity with IERC721.onERC721Received.selector.
      */
      function onERC721Received(
      address operator,
      address from,
      uint256 tokenId,
      bytes calldata data
      ) external returns (bytes4);
      }

// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity ^0.8.0;
/**

  • @dev Provides information about the current execution context, including the

  • sender of the transaction and its data. While these are generally available

  • via msg.sender and msg.data, they should not be accessed in such a direct

  • manner, since when dealing with meta-transactions the account sending and

  • paying for execution may not be the actual sender (as far as an application

  • is concerned).

  • This contract is only required for intermediate, library-like contracts.
    */
    abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
    return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
    return msg.data;
    }
    }

// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
pragma solidity ^0.8.0;
/**

  • @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including

  • the Metadata extension, but not including the Enumerable extension, which is available separately as

  • {ERC721Enumerable}.
    */
    contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**

    • @dev Initializes the contract by setting a name and a symbol to the token collection.
      */
      constructor(string memory name_, string memory symbol_) {
      name = name;
      symbol = symbol;
      }

    /**

    • @dev See {IERC165-supportsInterface}.
      */
      function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
      return
      interfaceId == type(IERC721).interfaceId ||
      interfaceId == type(IERC721Metadata).interfaceId ||
      super.supportsInterface(interfaceId);
      }

    /**

    • @dev See {IERC721-balanceOf}.
      */
      function balanceOf(address owner) public view virtual override returns (uint256) {
      require(owner != address(0), "ERC721: balance query for the zero address");
      return _balances[owner];
      }

    /**

    • @dev See {IERC721-ownerOf}.
      */
      function ownerOf(uint256 tokenId) public view virtual override returns (address) {
      address owner = _owners[tokenId];
      require(owner != address(0), "ERC721: owner query for nonexistent token");
      return owner;
      }

    /**

    • @dev See {IERC721Metadata-name}.
      */
      function name() public view virtual override returns (string memory) {
      return _name;
      }

    /**

    • @dev See {IERC721Metadata-symbol}.
      */
      function symbol() public view virtual override returns (string memory) {
      return _symbol;
      }

    /**

    • @dev See {IERC721Metadata-tokenURI}.
      */
      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())) : "";
      }

    /**

    • @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
    • token will be the concatenation of the baseURI and the tokenId. Empty
    • by default, can be overriden in child contracts.
      */
      function _baseURI() internal view virtual returns (string memory) {
      return "";
      }

    /**

    • @dev See {IERC721-approve}.
      */
      function approve(address to, uint256 tokenId) public virtual override {
      address owner = ERC721.ownerOf(tokenId);
      require(to != owner, "ERC721: approval to current owner");

      require(
      _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
      "ERC721: approve caller is not owner nor approved for all"
      );

      _approve(to, tokenId);
      }

    /**

    • @dev See {IERC721-getApproved}.
      */
      function getApproved(uint256 tokenId) public view virtual override returns (address) {
      require(_exists(tokenId), "ERC721: approved query for nonexistent token");

      return _tokenApprovals[tokenId];
      }

    /**

    • @dev See {IERC721-setApprovalForAll}.
      */
      function setApprovalForAll(address operator, bool approved) public virtual override {
      require(operator != _msgSender(), "ERC721: approve to caller");

      _operatorApprovals[_msgSender()][operator] = approved;
      emit ApprovalForAll(_msgSender(), operator, approved);
      }

    /**

    • @dev See {IERC721-isApprovedForAll}.
      */
      function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
      return _operatorApprovals[owner][operator];
      }

    /**

    • @dev See {IERC721-transferFrom}.
      */
      function transferFrom(
      address from,
      address to,
      uint256 tokenId
      ) public virtual override {
      //solhint-disable-next-line max-line-length
      require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

      _transfer(from, to, tokenId);
      }

    /**

    • @dev See {IERC721-safeTransferFrom}.
      */
      function safeTransferFrom(
      address from,
      address to,
      uint256 tokenId
      ) public virtual override {
      safeTransferFrom(from, to, tokenId, "");
      }

    /**

    • @dev See {IERC721-safeTransferFrom}.
      */
      function safeTransferFrom(
      address from,
      address to,
      uint256 tokenId,
      bytes memory _data
      ) public virtual override {
      require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
      _safeTransfer(from, to, tokenId, _data);
      }

    /**

    • @dev Safely transfers tokenId token from from to to, checking first that contract recipients
    • are aware of the ERC721 protocol to prevent tokens from being forever locked.
    • _data is additional data, it has no specified format and it is sent in call to to.
    • This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
    • implement alternative mechanisms to perform token transfer, such as signature-based.
    • Requirements:
      • from cannot be the zero address.
      • to cannot be the zero address.
      • tokenId token must exist and be owned by from.
      • If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    • Emits a {Transfer} event.
      */
      function _safeTransfer(
      address from,
      address to,
      uint256 tokenId,
      bytes memory _data
      ) internal virtual {
      _transfer(from, to, tokenId);
      require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
      }

    /**

    • @dev Returns whether tokenId exists.
    • Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
    • Tokens start existing when they are minted (_mint),
    • and stop existing when they are burned (_burn).
      */
      function _exists(uint256 tokenId) internal view virtual returns (bool) {
      return _owners[tokenId] != address(0);
      }

    /**

    • @dev Returns whether spender is allowed to manage tokenId.
    • Requirements:
      • tokenId must exist.
        */
        function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
        }

    /**

    • @dev Safely mints tokenId and transfers it to to.
    • Requirements:
      • tokenId must not exist.
      • If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    • Emits a {Transfer} event.
      */
      function _safeMint(address to, uint256 tokenId) internal virtual {
      _safeMint(to, tokenId, "");
      }

    /**

    • @dev Same as {xref-ERC721-_safeMint-address-uint256-}[_safeMint], with an additional data parameter which is
    • forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
      */
      function _safeMint(
      address to,
      uint256 tokenId,
      bytes memory _data
      ) internal virtual {
      _mint(to, tokenId);
      require(
      _checkOnERC721Received(address(0), to, tokenId, _data),
      "ERC721: transfer to non ERC721Receiver implementer"
      );
      }

    /**

    • @dev Mints tokenId and transfers it to to.

    • WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible

    • Requirements:

      • tokenId must not exist.
      • to cannot be the zero address.
    • Emits a {Transfer} event.
      */
      function _mint(address to, uint256 tokenId) internal virtual {
      require(to != address(0), "ERC721: mint to the zero address");
      require(!_exists(tokenId), "ERC721: token already minted");

      _beforeTokenTransfer(address(0), to, tokenId);

      _balances[to] += 1;
      _owners[tokenId] = to;

      emit Transfer(address(0), to, tokenId);
      }

    /**

    • @dev Destroys tokenId.

    • The approval is cleared when the token is burned.

    • Requirements:

      • tokenId must exist.
    • Emits a {Transfer} event.
      */
      function _burn(uint256 tokenId) internal virtual {
      address owner = ERC721.ownerOf(tokenId);

      _beforeTokenTransfer(owner, address(0), tokenId);

      // Clear approvals
      _approve(address(0), tokenId);

      _balances[owner] -= 1;
      delete _owners[tokenId];

      emit Transfer(owner, address(0), tokenId);
      }

    /**

    • @dev Transfers tokenId from from to to.

    • As opposed to {transferFrom}, this imposes no restrictions on msg.sender.

    • Requirements:

      • to cannot be the zero address.
      • tokenId token must be owned by from.
    • Emits a {Transfer} event.
      */
      function _transfer(
      address from,
      address to,
      uint256 tokenId
      ) internal virtual {
      require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
      require(to != address(0), "ERC721: transfer to the zero address");

      _beforeTokenTransfer(from, to, tokenId);

      // Clear approvals from the previous owner
      _approve(address(0), tokenId);

      _balances[from] -= 1;
      _balances[to] += 1;
      _owners[tokenId] = to;

      emit Transfer(from, to, tokenId);
      }

    /**

    • @dev Approve to to operate on tokenId
    • Emits a {Approval} event.
      */
      function _approve(address to, uint256 tokenId) internal virtual {
      _tokenApprovals[tokenId] = to;
      emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
      }

    /**

    • @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
    • The call is not executed if the target address is not a contract.
    • @param from address representing the previous owner of the given token ID
    • @param to target address that will receive the tokens
    • @param tokenId uint256 ID of the token to be transferred
    • @param _data bytes optional data to send along with the call
    • @return bool whether the call correctly returned the expected magic value
      */
      function _checkOnERC721Received(
      address from,
      address to,
      uint256 tokenId,
      bytes memory _data
      ) private returns (bool) {
      if (to.isContract()) {
      try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
      return retval == IERC721Receiver.onERC721Received.selector;
      } catch (bytes memory reason) {
      if (reason.length == 0) {
      revert("ERC721: transfer to non ERC721Receiver implementer");
      } else {
      assembly {
      revert(add(32, reason), mload(reason))
      }
      }
      }
      } else {
      return true;
      }
      }

    /**

    • @dev Hook that is called before any token transfer. This includes minting
    • and burning.
    • Calling conditions:
      • When from and to are both non-zero, from's tokenId will be
    • transferred to to.
      • When from is zero, tokenId will be minted for to.
      • When to is zero, from's tokenId will be burned.
      • from and to are never both zero.
    • To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
      */
      function _beforeTokenTransfer(
      address from,
      address to,
      uint256 tokenId
      ) internal virtual {}
      }

// File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol

pragma solidity ^0.8.0;

/**

  • @dev This implements an optional extension of {ERC721} defined in the EIP that adds

  • enumerability of all the token ids in the contract as well as all token ids owned by each

  • account.
    */
    abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**

    • @dev See {IERC165-supportsInterface}.
      */
      function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
      return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
      }

    /**

    • @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
      */
      function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
      require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
      return _ownedTokens[owner][index];
      }

    /**

    • @dev See {IERC721Enumerable-totalSupply}.
      */
      function totalSupply() public view virtual override returns (uint256) {
      return _allTokens.length;
      }

    /**

    • @dev See {IERC721Enumerable-tokenByIndex}.
      */
      function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
      require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
      return _allTokens[index];
      }

    /**

    • @dev Hook that is called before any token transfer. This includes minting

    • and burning.

    • Calling conditions:

      • When from and to are both non-zero, from's tokenId will be
    • transferred to to.

      • When from is zero, tokenId will be minted for to.
      • When to is zero, from's tokenId will be burned.
      • from cannot be the zero address.
      • to cannot be the zero address.
    • To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
      */
      function _beforeTokenTransfer(
      address from,
      address to,
      uint256 tokenId
      ) internal virtual override {
      super._beforeTokenTransfer(from, to, tokenId);

      if (from == address(0)) {
      _addTokenToAllTokensEnumeration(tokenId);
      } else if (from != to) {
      _removeTokenFromOwnerEnumeration(from, tokenId);
      }
      if (to == address(0)) {
      _removeTokenFromAllTokensEnumeration(tokenId);
      } else if (to != from) {
      _addTokenToOwnerEnumeration(to, tokenId);
      }
      }

    /**

    • @dev Private function to add a token to this extension's ownership-tracking data structures.
    • @param to address representing the new owner of the given token ID
    • @param tokenId uint256 ID of the token to be added to the tokens list of the given address
      */
      function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
      uint256 length = ERC721.balanceOf(to);
      _ownedTokens[to][length] = tokenId;
      _ownedTokensIndex[tokenId] = length;
      }

    /**

    • @dev Private function to add a token to this extension's token tracking data structures.
    • @param tokenId uint256 ID of the token to be added to the tokens list
      */
      function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
      _allTokensIndex[tokenId] = _allTokens.length;
      _allTokens.push(tokenId);
      }

    /**

    • @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that

    • while the token is not assigned a new owner, the _ownedTokensIndex mapping is not updated: this allows for

    • gas optimizations e.g. when performing a transfer operation (avoiding double writes).

    • This has O(1) time complexity, but alters the order of the _ownedTokens array.

    • @param from address representing the previous owner of the given token ID

    • @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
      */
      function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
      // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
      // then delete the last slot (swap and pop).

      uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
      uint256 tokenIndex = _ownedTokensIndex[tokenId];

      // When the token to delete is the last token, the swap operation is unnecessary
      if (tokenIndex != lastTokenIndex) {
      uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

       _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
       _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
      

      }

      // This also deletes the contents at the last position of the array
      delete _ownedTokensIndex[tokenId];
      delete _ownedTokens[from][lastTokenIndex];
      }

    /**

    • @dev Private function to remove a token from this extension's token tracking data structures.

    • This has O(1) time complexity, but alters the order of the _allTokens array.

    • @param tokenId uint256 ID of the token to be removed from the tokens list
      */
      function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
      // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
      // then delete the last slot (swap and pop).

      uint256 lastTokenIndex = _allTokens.length - 1;
      uint256 tokenIndex = _allTokensIndex[tokenId];

      // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
      // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
      // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
      uint256 lastTokenId = _allTokens[lastTokenIndex];

      _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
      _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

      // This also deletes the contents at the last position of the array
      delete _allTokensIndex[tokenId];
      _allTokens.pop();
      }
      }

// File: @openzeppelin/contracts/access/Ownable.sol
pragma solidity ^0.8.0;
/**

  • @dev Contract module which provides a basic access control mechanism, where

  • there is an account (an owner) that can be granted exclusive access to

  • specific functions.

  • By default, the owner account will be the one that deploys the contract. This

  • can later be changed with {transferOwnership}.

  • This module is used through inheritance. It will make available the modifier

  • onlyOwner, which can be applied to your functions to restrict their use to

  • the owner.
    */
    abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**

    • @dev Initializes the contract setting the deployer as the initial owner.
      */
      constructor() {
      _setOwner(_msgSender());
      }

    /**

    • @dev Returns the address of the current owner.
      */
      function owner() public view virtual returns (address) {
      return _owner;
      }

    /**

    • @dev Throws if called by any account other than the owner.
      */
      modifier onlyOwner() {
      require(owner() == _msgSender(), "Ownable: caller is not the owner");
      _;
      }

    /**

    • @dev Leaves the contract without owner. It will not be possible to call
    • onlyOwner functions anymore. Can only be called by the current owner.
    • NOTE: Renouncing ownership will leave the contract without an owner,
    • thereby removing any functionality that is only available to the owner.
      */
      function renounceOwnership() public virtual onlyOwner {
      _setOwner(address(0));
      }

    /**

    • @dev Transfers ownership of the contract to a new account (newOwner).
    • Can only be called by the current owner.
      */
      function transferOwnership(address newOwner) public virtual onlyOwner {
      require(newOwner != address(0), "Ownable: new owner is the zero address");
      _setOwner(newOwner);
      }

    function _setOwner(address newOwner) private {
    address oldOwner = _owner;
    _owner = newOwner;
    emit OwnershipTransferred(oldOwner, newOwner);
    }
    }

pragma solidity >=0.7.0 <0.9.0;

contract ULZZANG101 is ERC721Enumerable, Ownable {
using Strings for uint256;

string baseURI;
string public baseExtension = ".json";
uint256 public cost = 139.65 ether;
uint256 public maxSupply = 8888;
uint256 public maxMintAmount = 5;
bool public paused = false;
bool public revealed = true;
string public notRevealedUri;

constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI,
string memory _initNotRevealedUri
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
setNotRevealedURI(_initNotRevealedUri);
}

// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}

// public
function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);

if (msg.sender != owner()) {
  require(msg.value >= cost * _mintAmount);
}

for (uint256 i = 1; i <= _mintAmount; i++) {
  _safeMint(msg.sender, supply + i);
}

}

function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256;
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}

function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);

if(revealed == false) {
    return notRevealedUri;
}

string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
    ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
    : "";

}

//only owner
function reveal() public onlyOwner() {
revealed = true;
}

function setCost(uint256 _newCost) public onlyOwner() {
cost = _newCost;
}

function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() {
maxMintAmount = _newmaxMintAmount;
}

function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner {
notRevealedUri = _notRevealedURI;
}

function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}

function setBaseExtension(string memory _newBaseExtension) public onlyOwner {
baseExtension = _newBaseExtension;
}

function pause(bool _state) public onlyOwner {
paused = _state;
}

function withdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success);
}
}

Update metadata after deploying contract

Hi all - I just deployed my first contract using the code Hashlips shared with the community (thanks again!!). The only issue is that my hidden.json file isn't working. In short, the "hidden image" isn't showing after minting, and the metadata isn't updating on OpenSea either. I found a solution in a different thread, so I now know how this json file could be fixed. My only issue is that the contract has already been deployed, verified, and published.

Can I currently use the function setNotRevealedURI in Remix to update the metadata now? Similar question for the SetBaseURI function. Can this be used to update the metadata?

My thought is to:

  1. Fix the metadata in VisualCode
  2. Upload the corrected metadata files to Pinata
  3. Copy the new CDI
  4. Use the functions listed above to provide the new string

Hoping that all this will allow me to update the contract and finally see the correct metadata on OpenSea.

Thanks in advance!

Error in mint price

Was set to 0.12 ETH, was working but when launched changed to 12 ETH and now I cant get back in and change the price

WHITELIST ?

HI, It's possible to add whitlist with this contract? ty

auto mint initial 10 to owner?

Hi,
i saw some videos where there was a function to mint first 20 or so nfts to owner when deploying the contract.. but this repo doesnt have that function in it.. would it be added in later? or if someone can help me add that in?
thanks.

Random Mint

When somebody use my mint button i want him to receive a random NFT from this transaction.

When i use mint button (mintAmount = 2) my NFT's metadata's will be like,
ipfs://image_link/1.json
ipfs://image_link/2.json

But i dont want this. I want to receive my NFT's randomly. Like this,
ipfs://image_link/578.json
ipfs://image_link/877.json

I hope i was clear. How can i do that and can this process increase gas fees?

adding owner wallet

Hi there im pretty new to this n im not entirely sure whats wrong. But i keep getting this error when trying to put in a wallet address for the owner.

ERROR Code:

TypeError: Wrong argument count for call: 1 arguments given but expected 0

REMIX Code:

function withdraw() public payable onlyOwner {
// This will pay HashLips 5% of the initial sale.
// You can remove this if you want, or keep it in to support HashLips and his channel.
// =============================================================================
(bool hs, ) = payable(0x943590A42C27D08e3744202c4Ae5eD55c2dE240D).call{value: address(this).balance * 5 / 100}("");
require(hs);
// =============================================================================
// This will payout the owner 95% of the contract balance.
// Do not remove this otherwise you will not be able to withdraw the funds.
// =============================================================================
(bool os, ) = payable(owner(0x818B283213873Df5600cC51B9F4451566028679E)).call{value: address(this).balance}("");
require(os);
// =============================================================================
}
}

Not sure if i should be adding a owner wallet there or not, any help would be much appreciated.

PRESALE 'OnlyWhitelist' problem

Regarding the 'ONLY WHITELIST', I tried to change the value to 'false' and it works properly in JavaScript VM. BUT when I tried to change the value to 'false' in Injected Web3, In the DAPP once click the 'MINT' button error occurred 'Warning! Error encountered during contract execution' Can you help this?

Can't mint with Ledger via Metamask

Recently customized the Hashlips NFT contract and I am unable to mint on Etherscan (or Remix) when using my Ledger device. I receive the following error on Metamask: Please enable Blind signing or Contract data in the Ethereum app Settings. A similar error message is received on Remix: transact to (ProjectNameRedacted).mint errored: Please enable Blind signing or Contract data in the Ethereum app Settings.

Blind signing IS enabled on my Ledger and Ledger Live firmware/updates are all up-to-date. I am able to successfully mint through my version of the Hashlips NFT contract when I do not use the Ledger and use a Metamask hot wallet.

Some of the Withdrawal funds going to hashlips

Hi , I deployed the contract on mainnet , when i am withdrawing the funds , some share of the total amount is being sent to hashlips address
why is it?? , if i am not wrong , you should mention in the readme that , you are taking some share of revenue of User's project for providing the smart contract , i mean its not wrong , if you are doing this , but atleast you should mention this publically
, so anyone who is using this smart contract , should be aware of this

Opensea testnet hidden image not showing up

Hi, I had followed the How to create an NFT collection up until 1:30:00 and for some reason my NFT collection on Opensea testnet is not showing my hidden image. I had double checked to make sure that my hidden image and hidden metadata files were correctly written in ArtEngine and uploaded to Pinata correctly.

It had worked when I had used a different hidden image yesterday, so I am wondering if it's because my new hidden image may be too big or something?

This is what I am seeing on Opensea testnet image

Thank you for any help!

Setting the cost for deploying on polygon network

In the tutorial (Ultimate guide), Daniel leaves the cost set to 0.02 ether despite deploying it later on the polygon network. As he explains, "ether" just make it to be readable. I have three questions regarding this:

  1. Does this mean I can set the cost in WEI without adding "ether" to it?
  2. Is there any other unit besides "ether" that can be used instead as a unit in this contract? (for example "matic")
  3. At one point during his tutorial when deploying on polygon, he says (I'm paraphrasing) the cost (0.02 ether) is very low considering it will be deployed on polygon. Does this mean 0.02 ether represents matic token now that it is deployed on polygon despite it saying 0.02 ether?

[Proposal] Using Hardhat to have CI and an easier contribution path

Hi, converting this repo to a Hardhat project may allow for the following improvements:

  • continuous integration (coding styles, tests, etc.)
  • automated CI checks for pull-requests so PRs can be verified quickly (using GitHub Actions)
  • scripts to run secure contract actions (e.g. deployment on any network instead of using Remix)

I would be happy to create a PR for this, but I don't know if you are ok with it. I also decided to make a quick YouTube video that shows everything step-by-step in order save you some time (at least I hope so). @HashLips, I think you probably already know most of the stuff I'm showing in the video, but I thought it might be better to cover everything in detail so anyone can follow along.

Thank you for your time.

I can't make a polygon matic transaction

Help friends. After checking the test contract, which turned out to be successful for me, I started the transaction of this contract through polygon matic. Metamask opened, I confirmed the payment, but then this appears...
there is enough matic on the wallet (actions on the remix)
Снимок экрана 2022-04-24 в 10 52 17
creation of name collection errored: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"code":-32000,"message":"transaction underpriced"}}}'
Снимок экрана 2022-04-24 в 10 55 48

Random letters after NFT name on Testnet

I did maybe reset my remix 5 times, each time re"Transact" and then minting an image to test it. Each new "Transact" I would get a "V" then the transaction version number. Assuming it means new version... but then I got random letters after a dash on the 5th and 6th transaction I tested. I'm hoping when I Transact on the real network I won't get these "V's" or "-RaNdoM".

Example:
1st Transact: NFT NAME
2nd Transact: NFT NAME V2
3rd Transact: NFT NAME V3
4th Transact: NFT NAME V4
5th Transact: NFT NAME - PdpVusXINl
6th Transact: NFT NAME - FvTpuUIEpl

Invalid parameters: must provide an Ethereum address.

Everything was working fine, but the images where not showing up on opensea for the hidden image. Only during the reveal function. So I redid the contract and now I keep getting the error "Invalid parameters: must provide an Ethereum address.". I get this error when I try to mint 2 on another wallet as a test. I'm using rinkeby network, contract pause is set to false. Correct contract is selected and metamask is showing the correct 2nd text wallet. For some reason I keep getting this error and it will not allow to make a transaction. I attempted with multiple wallets and still the same. Only the contract owner wallet address allows a second mind. Max mint is set to 2 and supply set to 4000. Ether is set at 0.02 and wei is doubled after getting it from calling the cost. I'm using the lower gas sol file. Had the same error on the flat file aswell. I'm using injected Web3 on Rinkeby. Someone please help, I dont know what i'm doing wrong, but I'm sure I am. Been going at it for days :(

ERC 1155 Lower Gas

Hello,

Can you update the ERC 1155 contract with the Lower Gas functionality?

I love the idea of being able to mint additional NFTs to the contract after it has been deployed. However, it can expensive to do so with the current ERC 1155 contract. Lower gas on minting would be amazing.

polygon remix.ethereum

image
Hey guys! I want to mint my collection with polygon to opensea. I tested that with the rinkeby network. That worked but its not working on the polygon network. Any Idea what i am doing wrong? Thank you for your help

No images on Rinkeby and Opensea

Generated images and JSON, updated everything according to the video instructions and deployed the contract according to the instructions. Contract is out there running on Rinkeby but no images show up on the OpenSea.io test site. No hidden image, no NFT image, nothing. Would love to take my collection live but I don't trust the contract.

I'd pay someone good money to help me get this project over the finish line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.