This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPDX-License-Identifier: Unlicense | |
| pragma solidity ^0.8.0; | |
| import "hardhat/console.sol"; | |
| import "@openzeppelin/contracts/utils/Counters.sol"; | |
| contract NewsFeed { | |
| uint256 totalFeeds; | |
| using Counters for Counters.Counter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const main = async () => { | |
| const [deployer] = await hre.ethers.getSigners(); | |
| const accountBalance = await deployer.getBalance(); | |
| console.log("Deploying contracts with account: ", deployer.address); | |
| console.log("Account balance: ", accountBalance.toString()); | |
| const Token = await hre.ethers.getContractFactory("CoffeePortal"); | |
| const portal = await Token.deploy({ | |
| value: hre.ethers.utils.parseEther("0.1"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const main = async () => { | |
| const coffeeContractFactory = await hre.ethers.getContractFactory( | |
| "CoffeePortal" | |
| ); | |
| const coffeeContract = await coffeeContractFactory.deploy({ | |
| value: hre.ethers.utils.parseEther("0.1"), | |
| }); | |
| await coffeeContract.deployed(); | |
| console.log("Coffee Contract deployed to:", coffeeContract.address); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.8.0; | |
| import "hardhat/console.sol"; | |
| contract CoffeePortal { | |
| uint256 totalCoffee; | |
| address payable public owner; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useEffect, useState } from "react"; | |
| import { ToastContainer, toast } from "react-toastify"; | |
| import { ethers } from "ethers"; | |
| import "react-toastify/dist/ReactToastify.css"; | |
| import Head from "next/head"; | |
| export default function Home() { | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REMIX EXAMPLE PROJECT | |
| Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer. | |
| It contains 3 directories: | |
| 1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name. | |
| 2. 'scripts': Holds two scripts to deploy a contract. It is explained below. | |
| 3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity. | |
| SCRIPTS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require('request'); | |
| var sendMessage = function(device, message){ | |
| var restKey = '****'; | |
| var appID = '****'; | |
| request( | |
| { | |
| method:'POST', | |
| uri:'https://onesignal.com/api/v1/notifications', | |
| headers: { |
NewerOlder