diff --git "a/Launch your own epic NFT marketplace/2. \360\237\216\211 Writing smart contract/4. \360\237\224\256 The deployment!.md" "b/Launch your own epic NFT marketplace/2. \360\237\216\211 Writing smart contract/4. \360\237\224\256 The deployment!.md" index 0c0c2a7f..4ba59301 100644 --- "a/Launch your own epic NFT marketplace/2. \360\237\216\211 Writing smart contract/4. \360\237\224\256 The deployment!.md" +++ "b/Launch your own epic NFT marketplace/2. \360\237\216\211 Writing smart contract/4. \360\237\224\256 The deployment!.md" @@ -1,56 +1,38 @@ -๏ปฟ# ๐ŸŽ‰ Writing smart contract +๐ŸŽ‰ Writing smart contract +========================= -## **๐Ÿ”ฎ The deployment!** +##### ๐Ÿ”ฎ The deployment! Go to the scripts folder and create a new file called deploy.js Copy the following boiler plate code into your file. -```js -async function main() { - const Collection = await ethers.getContractFactory("Collection") - const collection = await Collection.deploy() - await collection.deployed() - console.log("Contract deployed to address:", collection.address) - } - - main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error) - process.exit(1) - }) -``` + `async function main() { const Collection = await ethers.getContractFactory("Collection") const collection = await Collection.deploy() await collection.deployed() console.log("Contract deployed to address:", collection.address) } main() .then(() => process.exit(0)) .catch((error) => { console.error(error) process.exit(1) })` This is standard code that you would find in any ethers.js or hardhat documentation. You first create a contract factory called Collection. -```js -const Collection = await ethers.getContractFactory("Collection") -``` +`const Collection = await ethers.getContractFactory("Collection")` You can now use this contract factory to deploy as many contract as you want. But we only need to deploy one. (Goerli test eth is free, but why waste it ๐Ÿ˜) -```js -await collection.deployed() -console.log("Contract deployed to address:", collection.address) -``` +`await collection.deployed()` + +`console.log("Contract deployed to address:", collection.address)` From this one deployed smart contract we can mint as many NFTs as our heart pleases. -The smart contract is ready. -The hardhat config is ready. -The deploy script is ready. +The smart contract is ready.ย  +The hardhat config is ready.ย  +The deploy script is ready.ย  Are you readdyyyyyyyy? ๐Ÿš€๐Ÿš€๐Ÿš€๐Ÿš€๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ If yes, then just type this command into your command line, to deploy your contract on the goerli network. -```bash -npx hardhat run scripts/deploy.js --network goerli -``` + `npx hardhat run scripts/deploy.js --network goerli` Donโ€™t panic if you donโ€™t see anything for some time on your command line. You are now interacting with an ethereum network, so transactions might take some time. @@ -58,9 +40,7 @@ You can use this time to go the alchemy mempool from your dashboard and view you On a successful transaction confirmation you should see something like this. -``` -Contract deployed to address: -``` +`Contract deployed to address: ` Congratulations you have just deployed your own smart contract to the ethereum test network! @@ -68,21 +48,14 @@ Store this contract address somewhere. We will need it later. At this point I would recommend taking a step back and appreciating what you have done here. ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘ -Go to the [goerli etherscan](https://goerli.etherscan.io/) and paste in your contract address. View your transaction details here, click on your transaction hash to understand the elements that were involved in your transaction. +Go to the [goerli etherscan](https://goerli.etherscan.io/) and paste in your contract address. View your transaction details here, click on your transaction hash to understand the elements that were involved in your transaction. You will probably be using etherscan a lot in the future, so it would be helpful to get yourself familiar with it :) -## Summary +Summary +------- -You are now a very smart, smart contract developer. +You are now a very smart, smart contract developer.ย  But I promised you I would give you an NFT Marketplace by the end of this tutorial, and I intend to keep that promise. So letโ€™s move on to building a quick react frontend for our marketplace and then calling our deployed smart contract to mint for us, some awesome NFTs. - -### Assignment - -#### ๐Ÿšจ Progress Report - -Share your deployed smart contract address - -**Your response is**