├── smartcontracts
├── .gitignore
├── test
│ └── sample-test.js
├── package.json
├── contracts
│ └── Greeter.sol
├── scripts
│ ├── deploy.js
│ └── sample-script.js
└── hardhat.config.js
├── dapp_dist
├── robots.txt
├── favicon.ico
├── logo192.png
├── logo512.png
├── manifest.json
├── static
│ ├── css
│ │ ├── main.8c8b27cf.chunk.css
│ │ └── main.8c8b27cf.chunk.css.map
│ └── js
│ │ ├── 2.df219a44.chunk.js.LICENSE.txt
│ │ ├── runtime-main.c763dcae.js
│ │ ├── main.f68ec644.chunk.js
│ │ ├── 3.d0cbb5ab.chunk.js
│ │ ├── main.f68ec644.chunk.js.map
│ │ ├── 3.d0cbb5ab.chunk.js.map
│ │ └── runtime-main.c763dcae.js.map
├── asset-manifest.json
└── index.html
├── go.mod
├── main.go
└── go.sum
/smartcontracts/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
3 | #Hardhat files
4 | cache
5 | artifacts
6 |
--------------------------------------------------------------------------------
/dapp_dist/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/dapp_dist/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/top-comengineer/eth-go-web3-react/HEAD/dapp_dist/favicon.ico
--------------------------------------------------------------------------------
/dapp_dist/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/top-comengineer/eth-go-web3-react/HEAD/dapp_dist/logo192.png
--------------------------------------------------------------------------------
/dapp_dist/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/top-comengineer/eth-go-web3-react/HEAD/dapp_dist/logo512.png
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/jeffprestes/eth-go-react/server
2 |
3 | go 1.15
4 |
5 | // +heroku goVersion go1.15
6 |
7 | require gopkg.in/macaron.v1 v1.4.0
8 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "gopkg.in/macaron.v1"
4 |
5 | func main() {
6 | m := macaron.Classic()
7 | m.Use(macaron.Static("dapp_dist"))
8 | m.Run()
9 | }
--------------------------------------------------------------------------------
/smartcontracts/test/sample-test.js:
--------------------------------------------------------------------------------
1 | const { expect } = require("chai");
2 |
3 | describe("Greeter", function() {
4 | it("Should return the new greeting once it's changed", async function() {
5 | const Greeter = await ethers.getContractFactory("Greeter");
6 | const greeter = await Greeter.deploy("Hello, world!");
7 |
8 | await greeter.deployed();
9 | expect(await greeter.greet()).to.equal("Hello, world!");
10 |
11 | await greeter.setGreeting("Hola, mundo!");
12 | expect(await greeter.greet()).to.equal("Hola, mundo!");
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/smartcontracts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "smartcontracts",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@nomiclabs/hardhat-ethers": "^2.0.0",
14 | "@nomiclabs/hardhat-etherscan": "^2.0.1",
15 | "@nomiclabs/hardhat-waffle": "^2.0.0",
16 | "chai": "^4.2.0",
17 | "ethereum-waffle": "^3.2.0",
18 | "ethers": "^5.0.21",
19 | "hardhat": "^2.0.3"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/dapp_dist/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/smartcontracts/contracts/Greeter.sol:
--------------------------------------------------------------------------------
1 | //SPDX-License-Identifier: Unlicense
2 | pragma solidity ^0.7.0;
3 |
4 | import "hardhat/console.sol";
5 |
6 |
7 | contract Greeter {
8 | string greeting;
9 |
10 | constructor(string memory _greeting) {
11 | console.log("Deploying a Greeter with greeting:", _greeting);
12 | greeting = _greeting;
13 | }
14 |
15 | function greet() public view returns (string memory) {
16 | return greeting;
17 | }
18 |
19 | function setGreeting(string memory _greeting) public {
20 | console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
21 | greeting = _greeting;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/dapp_dist/static/css/main.8c8b27cf.chunk.css:
--------------------------------------------------------------------------------
1 | body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}.App{text-align:center}.App-logo{height:40vmin;pointer-events:none}@media (prefers-reduced-motion:no-preference){.App-logo{animation:App-logo-spin 20s linear infinite}}.App-header{background-color:#282c34;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:calc(10px + 2vmin);color:#fff}.App-link{color:#61dafb}@keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
2 | /*# sourceMappingURL=main.8c8b27cf.chunk.css.map */
--------------------------------------------------------------------------------
/smartcontracts/scripts/deploy.js:
--------------------------------------------------------------------------------
1 | async function main() {
2 | const [deployer] = await ethers.getSigners();
3 |
4 | console.log("Deploying contracts with the account:", deployer.address);
5 |
6 | console.log("Account balance:", (await deployer.getBalance()).toString());
7 |
8 | const Greeter = await ethers.getContractFactory("Greeter");
9 | const greeter = await Greeter.deploy("Teste 123");
10 |
11 | console.log("Greeter address:", greeter.address);
12 | }
13 |
14 | main()
15 | .then(() => process.exit(0))
16 | .catch((error) => {
17 | console.error(error);
18 | process.exit(1);
19 | });
20 |
21 | //npx hardhat run scripts/deploy.js --network rinkeby
22 | //0xa4cC4C8d8f6bAeEEE6284326292B5314bDe8FF55
23 | //npx hardhat verify --network rinkeby 0xa4cC4C8d8f6bAeEEE6284326292B5314bDe8FF55 "Teste 123"
24 |
--------------------------------------------------------------------------------
/dapp_dist/asset-manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": {
3 | "main.css": "/static/css/main.8c8b27cf.chunk.css",
4 | "main.js": "/static/js/main.f68ec644.chunk.js",
5 | "main.js.map": "/static/js/main.f68ec644.chunk.js.map",
6 | "runtime-main.js": "/static/js/runtime-main.c763dcae.js",
7 | "runtime-main.js.map": "/static/js/runtime-main.c763dcae.js.map",
8 | "static/js/2.df219a44.chunk.js": "/static/js/2.df219a44.chunk.js",
9 | "static/js/2.df219a44.chunk.js.map": "/static/js/2.df219a44.chunk.js.map",
10 | "static/js/3.d0cbb5ab.chunk.js": "/static/js/3.d0cbb5ab.chunk.js",
11 | "static/js/3.d0cbb5ab.chunk.js.map": "/static/js/3.d0cbb5ab.chunk.js.map",
12 | "index.html": "/index.html",
13 | "static/css/main.8c8b27cf.chunk.css.map": "/static/css/main.8c8b27cf.chunk.css.map",
14 | "static/js/2.df219a44.chunk.js.LICENSE.txt": "/static/js/2.df219a44.chunk.js.LICENSE.txt"
15 | },
16 | "entrypoints": [
17 | "static/js/runtime-main.c763dcae.js",
18 | "static/js/2.df219a44.chunk.js",
19 | "static/css/main.8c8b27cf.chunk.css",
20 | "static/js/main.f68ec644.chunk.js"
21 | ]
22 | }
--------------------------------------------------------------------------------
/smartcontracts/hardhat.config.js:
--------------------------------------------------------------------------------
1 | require("@nomiclabs/hardhat-waffle");
2 | require("@nomiclabs/hardhat-etherscan");
3 |
4 | // This is a sample Hardhat task. To learn how to create your own go to
5 | // https://hardhat.org/guides/create-task.html
6 | task("accounts", "Prints the list of accounts", async () => {
7 | const accounts = await ethers.getSigners();
8 |
9 | for (const account of accounts) {
10 | console.log(account.address);
11 | }
12 | });
13 |
14 | const RINKEBY_PRIVATE_KEY = "3c0fc7d8c48c6b46ee9d62c0f66c161a99d5718bc1327bc8c489e3cfff8acd76";
15 | //Address 0x806D6b6725A21409B2FFF7B1D079a4c4c5EA8AD1
16 |
17 | const INFURA_PROJECT_ID = "27f3715e7c9b4bd8b5777d468e64c9a7";
18 |
19 | /**
20 | * @type import('hardhat/config').HardhatUserConfig
21 | */
22 | module.exports = {
23 | solidity: "0.7.4",
24 | networks: {
25 | rinkeby: {
26 | url: `https://rinkeby.infura.io/v3/${INFURA_PROJECT_ID}`,
27 | accounts: [`0x${RINKEBY_PRIVATE_KEY}`],
28 | },
29 | },
30 | etherscan: {
31 | // Your API key for Etherscan
32 | // Obtain one at https://etherscan.io/
33 | apiKey: "KP7XKBDKWU9CNCIAS5X96Y1YTFBT4I892F",
34 | },
35 | };
36 |
--------------------------------------------------------------------------------
/smartcontracts/scripts/sample-script.js:
--------------------------------------------------------------------------------
1 | // We require the Hardhat Runtime Environment explicitly here. This is optional
2 | // but useful for running the script in a standalone fashion through `node