You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a Hardhat project, some of the default folders are:
@@ -197,6 +198,9 @@ contract defined, we can add the logic and the variables we need to store. As we
197
198
198
199
Let’s get started by inheriting OpenZeppelin's ERC721.sol like we did last time. We add a constructor to our contract, which will mirror the one from ERC721.sol.
199
200
201
+
{/* @wolovim optional line?: Unlike in our *Basic NFT* lesson, where we added a third parameter to the constructor for storing the token's baseURI, we will have a different approach this time, which we will come to later. */}
202
+
203
+
200
204
```solidity
201
205
// SPDX-License-Identifier: MIT
202
206
pragma solidity 0.8.12;
@@ -218,7 +222,7 @@ Now let’s go ahead and add a mint function which will call `_safeMint` from th
console.log(`Contract deployed to ${contract.address}`)
856
+
console.log("Contract deployed at ", awaitcontract.getAddress())
852
857
}
853
-
854
858
/** Run Main function - Do not change **/
855
859
main().catch((error) => {
856
860
console.error(error)
@@ -862,13 +866,13 @@ main().catch((error) => {
862
866
will tell Hardhat exactly **what** to deploy.
863
867
- With `const COLLECTION_NAME = "TierNFT"` and
864
868
`const COLLECTION_SYMBOL = "Tier"` - we define the *name* and *symbol* to pass to the constructor for the deployment.
865
-
-`hre.ethers.getContractFactory(CONTRACT_NAME)` - this asks Hardhat Runtime
866
-
Environment to get us a contract factory for our contract specified by `CONTRACT_NAME`. A contract factory is a template that allows us to deploy instances of that contract, which allows many advantages.
869
+
-`hre.ethers.getContractFactory(CONTRACT_NAME)` - this asks `hre` (Hardhat Runtime
870
+
Environment) to get us a contract factory for our contract specified by `CONTRACT_NAME`. A contract factory is a template that allows us to deploy instances of that contract, which allows many advantages.
867
871
-`contractFactory.deploy` - we are asking the contract factory to deploy an instance of our
868
872
contract. This is the deploy transaction!
869
873
-`COLLECTION_NAME, COLLECTION_SYMBOL` - these are the parameters for our
870
874
contract's constructor function to set up its initial state.
871
-
-`await contract.deployed()` - waits for the transaction to be approved by the network validators, and confirms that the deployment of the contract was successful, telling us that it's ready for use on the blockchain.
875
+
-`await contract.waitForDeployment()` - waits for the transaction to be approved by the network validators, and confirms that the deployment of the contract was successful, telling us that it's ready for use on the blockchain.
872
876
- Running the `main().catch( … )` script at the very end makes sure that all the previous
873
877
code is executed, and also logs any errors, and prints them to the console.
874
878
@@ -911,6 +915,8 @@ Note: **Always make sure to use a separate browser profile, with a separate wall
911
915
912
916
### Getting Some Testnet Funds
913
917
918
+
{/* @wolovim, maybe we should give a couple of testnet options, just in case. what do you think?*/}
919
+
914
920
A testnet is a sandbox environment where developers
915
921
can test, create and modify functionalities, monitor and simulate a mainnet blockchain's network
916
922
performance, fix bugs and other network failures without having to worry about breaking a main chain, and paying in real crypto coins to do so! Mainnets cost - testnets generally don't.
@@ -925,8 +931,7 @@ Note: Testnet and mainnet are separate networks. You can't for example send toke
925
931
### Personal Security
926
932
Take your time to understand the *good practices* in this section. Before we deploy, we need to add a `.env` file to our root folder to make sure we are **not pushing and therefore exposing our private keys in public repositories**.
927
933
928
-
For your wallet's private key, the most sensitive data of the project, you need to open Metamask. Click on the three dots next to your *Account Name*, and then on *Account Details*, click on *Export Private Key*. It will ask for your Metamask password, the one you use to log in to your wallet each session, not your seed phrase. It also shows you a
929
-
notice so you know that you are entering the *danger zone*. Confirm and you'll be able to copy your private key. Add your private key into the `.env` file like so:
934
+
For your wallet's private key, the most sensitive data of the project, you need to open Metamask. Click on the three dots next to your *Account Name*, and then on *Account Details*, click on *Show Private Key*. It will ask for your Metamask password, the one you use to log in to your wallet each session, not your seed phrase. It also shows you a warning to 'Never disclose this key'. Confirm and you'll be able to copy your private key. Add your private key into the `.env` file like so:
0 commit comments