Skip to content

DanieleSalatti/gitcoin-grants-conviction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ— Scaffold-ETH

Mainnet

% yarn deploy --network mainnet
yarn run v1.22.15
$ yarn workspace @scaffold-eth/hardhat deploy --network mainnet
$ hardhat deploy --export-all ../react-app/src/contracts/hardhat_contracts.json --network mainnet
Nothing to compile
chainId: 1
deploying "GTCStaking" (tx: 0x6e216e10215a4d505ab622e2cc81df9e3a45c8d77f22368f4e73ded745c13538)...: deployed at 0x195acfcF9f06e43410a3ad177665F358E659cDA6 with 880762 gas
$ hardhat run scripts/publish.js
βœ…  Published contracts to the subgraph package.
✨  Done in 18.08s.

Verified here on Etherscan

Mainnet subgraph: https://thegraph.com/studio/subgraph/gtc-conviction-voting-mainnet/

Temporary query URL: https://api.studio.thegraph.com/query/20308/gtc-conviction-voting-mainnet/v0.0.2

The permanent query URL is: https://gateway.thegraph.com/api/[api-key]/subgraphs/id/27N5qfvJ7eRS3aD2yWs9ey8FEffd3Ssow8aUM3Q3wdbF

Optimism

% yarn deploy --network optimism
yarn run v1.22.15
$ yarn workspace @scaffold-eth/hardhat deploy --network optimism
$ hardhat deploy --export-all ../react-app/src/contracts/hardhat_contracts.json --network optimism
Nothing to compile
chainId: 10
deploying "GTCStaking" (tx: 0xd4156fec20b7314c93e83b6e39a06db28635e4040f4d06dc1ffefa364c123db3)...: deployed at 0xbBb02E07bd83947e920D746b25a067B9424537b7 with 880762 gas
$ hardhat run scripts/publish.js
βœ…  Published contracts to the subgraph package.
✨  Done in 7.19s.

Verified here on Etherscan

The graph endpoint: https://api.thegraph.com/subgraphs/name/danielesalatti/gtc-conviction-voting-optimism

Rinkeby

% yarn deploy --network rinkeby
yarn run v1.22.15
$ yarn workspace @scaffold-eth/hardhat deploy --network rinkeby
$ hardhat deploy --export-all ../react-app/src/contracts/hardhat_contracts.json --network rinkeby
Compiling 6 files with 0.8.4
Compilation finished successfully
chainId: 4
Not on mainnet
reusing "GTC" at 0x67775cBe9e73aa255Fc8e6A992Ed340e3b28D926
Sending GTC...
GTC address is 0x67775cBe9e73aa255Fc8e6A992Ed340e3b28D926
deploying "GTCStaking" (tx: 0xc35f94a47a9a00d63f418328d471e8f396b02eb2b3d5e5311650d5812954a570)...: deployed at 0x51250297F56779a86B15046bEf38f75Fa05266ba with 880762 gas
$ hardhat run scripts/publish.js
βœ…  Published contracts to the subgraph package.
✨  Done in 61.68s.

Local subgraph endpoint: http://localhost:8000/subgraphs/name/gtc-conviction-subgraph-eth

On the graph: https://api.thegraph.com/subgraphs/name/danielesalatti/gtc-conviction-voting-rinkeby

Subgraph raw notes

  1. Clean up previous data: yarn clean-graph-node
  2. Spin up a local graph node by running: yarn run-graph-node
  3. Create your local subgraph by running: yarn graph-create-local <= this is only required once
  4. Deploy your local subgraph by running: yarn graph-ship-local
  5. Edit your local subgraph in packages/subgraph/src
  6. Deploy your contracts and your subgraph in one go by running: yarn deploy-and-graph

Sample GraphQL Queries

query getVoterById {
  voter(id: "0x523d007855b3543797e0d3d462cb44b601274819") {
    id
  }
}

query getRunningRecordsByVoterId {
  runningVoteRecords(
    where: { voter: "0x523d007855b3543797e0d3d462cb44b601274819" }
  ) {
    id
    voter {
      id
    }
    votes {
      id
      voteId
    }
    grantId
    voteCount
    totalStaked
    createdAt
    updatedAt
  }
}

query getVotesByVoterId {
  votes(where: { voter: "0x523d007855b3543797e0d3d462cb44b601274819" }) {
    id
    voteId
    voter {
      id
    }
    amount
    grantId
    createdAt
  }
}

query getVotesByGrantId {
  votes(where: { grantId: 2062 }) {
    id
    voteId
    voter {
      id
    }
    amount
    grantId
    createdAt
  }
}

query getRunningRecordsByGrantId {
  runningVoteRecords(where: { grantId: 2062 }) {
    id
    voter {
      id
    }
    grantId
    voteCount
    totalStaked
    createdAt
    updatedAt
  }
}

query getReleasesByVoterId {
  releases(where: { voter: "0x523d007855b3543797e0d3d462cb44b601274819" }) {
    id
    voter {
      id
    }
    voteId
    amount
    createdAt
  }
}

query getReleases {
  releases {
    id
    voter {
      id
    }
    voteId
    amount
    createdAt
  }
}

everything you need to build on Ethereum! πŸš€

πŸ§ͺ Quickly experiment with Solidity using a frontend that adapts to your smart contract:

image

πŸ„β€β™‚οΈ Quick Start

Prerequisites: Node (v16 LTS) plus Yarn and Git

clone/fork πŸ— scaffold-eth:

git clone https://github.com/scaffold-eth/scaffold-eth.git

install and start your πŸ‘·β€ Hardhat chain:

cd scaffold-eth
yarn install
yarn chain

in a second terminal window, start your πŸ“± frontend:

cd scaffold-eth
yarn start

in a third terminal window, πŸ›° deploy your contract:

cd scaffold-eth
yarn deploy

πŸ” Edit your smart contract YourContract.sol in packages/hardhat/contracts

πŸ“ Edit your frontend App.jsx in packages/react-app/src

πŸ’Ό Edit your deployment scripts in packages/hardhat/deploy

πŸ“± Open http://localhost:3000 to see the app

πŸ“š Documentation

Documentation, tutorials, challenges, and many more resources, visit: docs.scaffoldeth.io

🍦 Other Flavors

πŸ”­ Learning Solidity

πŸ“• Read the docs: https://docs.soliditylang.org

πŸ“š Go through each topic from solidity by example editing YourContract.sol in πŸ— scaffold-eth

πŸ“§ Learn the Solidity globals and units

πŸ›  Buidl

Check out all the active branches, open issues, and join/fund the 🏰 BuidlGuidl!

πŸ’Œ P.S.

🌍 You need an RPC key for testnets and production deployments, create an Alchemy account and replace the value of ALCHEMY_KEY = xxx in packages/react-app/src/constants.js with your new key.

πŸ“£ Make sure you update the InfuraID before you go to production. Huge thanks to Infura for our special account that fields 7m req/day!

πŸƒπŸ’¨ Speedrun Ethereum

Register as a builder here and start on some of the challenges and build a portfolio.

πŸ’¬ Support Chat

Join the telegram support chat πŸ’¬ to ask questions and find others building with πŸ— scaffold-eth!


πŸ™ Please check out our Gitcoin grant too!

Automated with Gitpod

Open in Gitpod