gitcoin-grants-conviction
gitcoin-grants-conviction copied to clipboard
Conviction Voting applied to Gitcoin Grants - built with ๐ scaffold-eth
๐ 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
- Clean up previous data:
yarn clean-graph-node
- Spin up a local graph node by running:
yarn run-graph-node
- Create your local subgraph by running:
yarn graph-create-local
<= this is only required once - Deploy your local subgraph by running:
yarn graph-ship-local
- Edit your local subgraph in packages/subgraph/src
- 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:
๐โโ๏ธ 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!
-
๐ซ Extend the NFT example to make a "buyer mints" marketplace
-
โ๏ธ Learn how ecrecover works
-
๐ฉโ๐ฉโ๐งโ๐ง Build a multi-sig that uses off-chain signatures
-
โ๏ธ Learn how a simple DEX works
-
๐ฆ Ape into learning!
๐ 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!