diff --git a/wave-portal/LICENSE b/LICENSE similarity index 100% rename from wave-portal/LICENSE rename to LICENSE diff --git a/README.md b/README.md index 279c351..78a9786 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ # Wave Portal -This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. +This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample +script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. -## Screenshots -[Frontend available](https://waveportal-starter-project.rjnemo.repl.co) +## Screenshots + +[Frontend available](https://waveportal-starter-project.rjnemo.repl.co) [![screenshot](./docs/homepage.png)](https://waveportal-starter-project.rjnemo.repl.co) - - + [![NFT](https://lh3.googleusercontent.com/JdpzIf6XyZuG48Ki2vTDP7FwH1ezrhaW4Dt5lT9AlaX9ntMkHTUjcriPWJG7CW1THcXHdN92JPktNwC9wBJVUUcHgOVAj6BKN8Fo5g=w600)](https://opensea.io/assets/matic/0x3cd266509d127d0eac42f4474f57d0526804b44e/16450) - - Try running some of the following tasks: ```shell diff --git a/contracts/WavePortal.sol b/contracts/WavePortal.sol index 4c749af..70d0ded 100644 --- a/contracts/WavePortal.sol +++ b/contracts/WavePortal.sol @@ -42,8 +42,9 @@ contract WavePortal { console.log("%s won!", msg.sender); uint256 prizeAmount = 0.001 ether; require(prizeAmount <= address(this).balance); - (bool success, ) = (msg.sender).call{value: prizeAmount}(""); - require(success, "Failed to withdraw from the contract"); // mark the transaction as an error if it failed + (bool success,) = (msg.sender).call{value : prizeAmount}(""); + // mark the transaction as an error if it failed + require(success, "Failed to withdraw from the contract"); } emit NewWave(msg.sender, block.timestamp, _message); diff --git a/docs/Screenshot 2022-04-03 at 16.45.14.png b/docs/Screenshot 2022-04-03 at 16.45.14.png new file mode 100644 index 0000000..85edef8 Binary files /dev/null and b/docs/Screenshot 2022-04-03 at 16.45.14.png differ diff --git a/docs/Screenshot 2022-04-03 at 16.50.45.png b/docs/Screenshot 2022-04-03 at 16.50.45.png new file mode 100644 index 0000000..3e9ea5d Binary files /dev/null and b/docs/Screenshot 2022-04-03 at 16.50.45.png differ diff --git a/docs/Screenshot 2022-04-03 at 16.58.44.png b/docs/Screenshot 2022-04-03 at 16.58.44.png new file mode 100644 index 0000000..c682969 Binary files /dev/null and b/docs/Screenshot 2022-04-03 at 16.58.44.png differ diff --git a/docs/Screenshot 2022-04-04 at 05.16.37.png b/docs/Screenshot 2022-04-04 at 05.16.37.png new file mode 100644 index 0000000..87a54a0 Binary files /dev/null and b/docs/Screenshot 2022-04-04 at 05.16.37.png differ diff --git a/docs/Screenshot 2022-04-04 at 07.20.07.png b/docs/Screenshot 2022-04-04 at 07.20.07.png new file mode 100644 index 0000000..e2fbdd8 Binary files /dev/null and b/docs/Screenshot 2022-04-04 at 07.20.07.png differ diff --git a/docs/Screenshot 2022-04-04 at 12.23.38.png b/docs/Screenshot 2022-04-04 at 12.23.38.png new file mode 100644 index 0000000..383c849 Binary files /dev/null and b/docs/Screenshot 2022-04-04 at 12.23.38.png differ diff --git a/docs/Screenshot 2022-04-07 at 06.41.28.png b/docs/Screenshot 2022-04-07 at 06.41.28.png new file mode 100644 index 0000000..3b06499 Binary files /dev/null and b/docs/Screenshot 2022-04-07 at 06.41.28.png differ diff --git a/docs/Screenshot 2022-04-07 at 06.59.43.png b/docs/Screenshot 2022-04-07 at 06.59.43.png new file mode 100644 index 0000000..ee9b881 Binary files /dev/null and b/docs/Screenshot 2022-04-07 at 06.59.43.png differ diff --git a/hardhat.config.js b/hardhat.config.js index ae6c5a9..a9fe620 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -2,26 +2,26 @@ require("@nomiclabs/hardhat-waffle"); require("dotenv").config(); task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { - const accounts = await hre.ethers.getSigners(); + const accounts = await hre.ethers.getSigners(); - for (const account of accounts) { - console.log(account.address); - } + for (const account of accounts) { + console.log(account.address); + } }); /** * @type import('hardhat/config').HardhatUserConfig */ module.exports = { - solidity: "0.8.4", - networks: { - rinkeby: { - url: STAGING_ALCHEMY_URL, - accounts: [PRIVATE_KEY], + solidity: "0.8.4", + networks: { + rinkeby: { + url: process.env.STAGING_ALCHEMY_URL, + accounts: [process.env.PRIVATE_KEY], + }, + mainnet: { + url: process.env.PROD_ALCHEMY_URL, + accounts: [process.env.PRIVATE_KEY], + }, }, - mainnet: { - url: PROD_ALCHEMY_URL, - accounts: [PRIVATE_KEY], - }, - }, }; diff --git a/scripts/deploy.js b/scripts/deploy.js index dfcede3..7e21bd5 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -1,24 +1,24 @@ const main = async () => { - const [deployer] = await hre.ethers.getSigners(); - const accountBalance = await deployer.getBalance(); + const [deployer] = await hre.ethers.getSigners(); + const accountBalance = await deployer.getBalance(); - console.log(`Deploying contracts with address: ${deployer.address}`); - console.log(`Account balance: ${accountBalance.toString()}`); + console.log(`Deploying contracts with address: ${deployer.address}`); + console.log(`Account balance: ${accountBalance.toString()}`); - const Token = await hre.ethers.getContractFactory("WavePortal"); - const portal = await Token.deploy({ value: hre.ethers.utils.parseEther("0.01") }); - await portal.deployed(); - console.log("WavePortal address: ", portal.address); + const Token = await hre.ethers.getContractFactory("WavePortal"); + const portal = await Token.deploy({value: hre.ethers.utils.parseEther("0.01")}); + await portal.deployed(); + console.log("WavePortal address: ", portal.address); }; const runMain = async () => { - try { - await main(); - process.exit(0); - } catch (error) { - console.log(error); - process.exit(1); - } + try { + await main(); + process.exit(0); + } catch (error) { + console.log(error); + process.exit(1); + } }; runMain(); diff --git a/scripts/run.js b/scripts/run.js index f00eeee..4e37340 100644 --- a/scripts/run.js +++ b/scripts/run.js @@ -1,46 +1,46 @@ const main = async () => { - const [owner, randomPerson] = await hre.ethers.getSigners(); - const waveContractFactory = await hre.ethers.getContractFactory("WavePortal"); - const waveContract = await waveContractFactory.deploy({ - value: hre.ethers.utils.parseEther("0.1"), - }); - await waveContract.deployed(); - console.log(`Contract deployed to: ${waveContract.address}`); - console.log(`Contract deployed by: ${owner.address}`); + const [owner, randomPerson] = await hre.ethers.getSigners(); + const waveContractFactory = await hre.ethers.getContractFactory("WavePortal"); + const waveContract = await waveContractFactory.deploy({ + value: hre.ethers.utils.parseEther("0.1"), + }); + await waveContract.deployed(); + console.log(`Contract deployed to: ${waveContract.address}`); + console.log(`Contract deployed by: ${owner.address}`); - let contractBalance = await hre.ethers.provider.getBalance(waveContract.address); - console.log(`Contract balance: ${hre.ethers.utils.formatEther(contractBalance)}`); + let contractBalance = await hre.ethers.provider.getBalance(waveContract.address); + console.log(`Contract balance: ${hre.ethers.utils.formatEther(contractBalance)}`); - let waveCount; - waveCount = await waveContract.getTotalWaves(); + let waveCount; + waveCount = await waveContract.getTotalWaves(); - let waveTxn = await waveContract.wave("A message"); - await waveTxn.wait(); + let waveTxn = await waveContract.wave("A message"); + await waveTxn.wait(); - waveTxn = await waveContract.wave("Hi!"); - await waveTxn.wait(); + waveTxn = await waveContract.wave("Hi!"); + await waveTxn.wait(); - waveCount = await waveContract.getTotalWaves(); + waveCount = await waveContract.getTotalWaves(); - waveTxn = await waveContract.connect(randomPerson).wave("another one"); - await waveTxn.wait(); + waveTxn = await waveContract.connect(randomPerson).wave("another one"); + await waveTxn.wait(); - contractBalance = await hre.ethers.provider.getBalance(waveContract.address); - console.log(`Contract balance: ${hre.ethers.utils.formatEther(contractBalance)}`); + contractBalance = await hre.ethers.provider.getBalance(waveContract.address); + console.log(`Contract balance: ${hre.ethers.utils.formatEther(contractBalance)}`); - let allWaves = await waveContract.getAllWaves(); - console.log(allWaves); - waveCount = await waveContract.getTotalWaves(); + let allWaves = await waveContract.getAllWaves(); + console.log(allWaves); + waveCount = await waveContract.getTotalWaves(); }; const runMain = async () => { - try { - await main(); - process.exit(0); - } catch (error) { - console.log(error); - process.exit(1); - } + try { + await main(); + process.exit(0); + } catch (error) { + console.log(error); + process.exit(1); + } }; runMain();