Hey Patrick, like to say watching your videos make me uplifted, you're a really gifted teacher. Thanks for all that you do, your constant hard work is inspiring.
Amazing! Things can become very confusing as a beginner dev taking a stab at web3 projects. A big source of ambiguity comes from a lack of knowledge in how things work on ethereum itself, as well as common practices, but videos like this that thoroughly go through a lot of the process are a huge help. Thank you Patrick!!
Secureum Bootcamp vids on youtube are a great fast-track (although you will need to do your own research/reading supplemental to the vids.. but the vids will show you the initial nodes on the tree of blockchain knowledge from where to dig deeper)
Thank you for this content Patrick. I spent 3 hours yesterday making a DAO using a different tutorial on RUclips, only to find out it required infrastructure that was recently depricated to continue building it. This was much better. Great work!
Nice! A few notes: * You can actually import { getChainId } from 'hardhat'; and then proposals[(await getChainId()).toString()] * Also you could const root = path.resolve(__dirname, '..'); const json = path.join(root, '/', 'proposals.json'); const proposals = JSON.parse(fs.readFileSync(json, 'utf8')); Just to make it more robust. If TS is complaining that events might be undefined, one could say const proposalId = proposalData.events?.[0].args?.proposalId.toString();
@@PatrickAlphaC I do have one question regarding integrating the ERC20Votes and checkpoint functionality. I have an existing token weight voting system in where the user with more tokens has more vote weight, so i have imported ERC20Votes contract and can`t figure out how to integrate the checkpoint functionality to my system. In my functionalty, when user contrubites to the DAO contract he gets an proportional amount of tokens, so where and how do I integrate the checkpoints functionality ?
thank, but when i deploy the governor contract i get an error telling me the contract is to large to be deployed onto the network. Any ideas how to get around this?
Everyone: This man is a genious, lets build a DAO. Patrick: Wau I completly messed up here because of a spelling error^^ Thanks a lot Patrick, again providing powerfull knowledge!
Awesome content! Thanks PC. Just a note that fs module is apparently native to nodeJS and doesn't need to be installed. Can import with the following syntax: import fs = require('fs')
Thanks Patrick. Excellent tutorial. The GovernorContract available in GitHub uses the ERC20Votes interface rather than iVotes. I had to change to compile the contract.
Im so excited watching this video myself. Really great content Patrick. I just had one question can I use the logics written in typescript in react js so that I can run the scripts with the click of a button ??
You could! But it would probably be better to do some front end stuff so people can connect with their metamasks. I have a video talking about a few different front end strategies called "how to connect to metamask" ruclips.net/video/pdsYCkUWrgQ/видео.html
@@PatrickAlphaC thank you very much patrick! Highly appreciate it. Just a basic frontend boilerplate will do to showcase how it works visually for users. You are the best teacher on RUclips! Keep rocking and thanks again for the high value you give out
Great Vid! btw may I ask why do you still need to override the _afterTokenTransfer? as You don't have any extension other than ERC20Votes? I also tried it and seems works fine, either way I still need to self-delegate?
i'm having issue, with reference to code at 33:13, when im deploying the governanceToken, it's saying the deployer is undefined, when i tried to log await getNamedAccounts() it's giving me {}.
Hi @patrick The governance contract generated from openzeppelin exceeds max size limit of 24576 bytes, is there any work around to solve this issue? I used only the default settings, also tried removing 'updatable Settings' but no luck.
I keep getting this "cannot estimate gas; transaction may fail or may require manual gas limit" after adding the governor contracts deploy script. Even tried copying the code from the git repo but I still get the same thing. "Transaction reverted: trying to deploy a contract whose code is too large"
Hey patrick, i was trying this around with hardhat test and all conditions pass when using your flow. But when i try to vote using account that has no token delegated to him, the voteTx is still passed and not reverted. Is this the intended result or am i missing something? Because i thought the only one that can vote is the one with the erc20Votes delegated to them?
You need to delegate the votes to yourself first! It was a weird implementation detail of this specific code. I think on mint it might make sense to delegate to yourself right away, if you'd like to add that you can.
It's totally up to the user, using Aragon, Colony, DAOHaus, or DAOStack are all great options! I mentioned them in my video prior to this. Creating your own tooling gives you a much deeper understanding of how the DAO actually works, and additionally, gives you much greater flexibility and customization in the future of your organization.
Awesome tutorial! At one point you mentioned upgradeable governance contracts and said you had a video on it. A quick search and scan of the channel didn't reveal a video. Do you know if you have any good references for upgradable governance? Thanks.
Amazing Video! It really made me understand coding of a DAO and the process. Just one question - While making the GovernorToken contract you assigned every token to the Deployer. And in the deploy script you called the delegate function. I don't understand why the 'delegate' function call was needed and how can the whole system be managed if the address of the voter change for each proposal.
The delegate function is needed because we need to create a snapshot of voting power. With the tokens, you can "delegate" them to allow other users to use your tokens to vote (in case you're going to be an inactive voter) > how can the whole system be managed if the address of the voter change for each proposal the system doesn't care, as you transfer tokens around, the owner of the tokens can call "delegate" on whomever they want.
I failed to see anywhere in the code where the governance contract checks to see if the proposal was passed before executing the Box.store() function. Is that right? And if we are just relying on deployer to execute the store() function, wouldn't that make the DAO centralized, relying on deployer to follow through with the results of the vote?
@@PatrickAlphaC oic, it's in the openzeppelin imported contract. I see it now, you check state(proposalID) when you run execute(). Thank you for this pointer Patrick. Your stuff helps me learn, and I'm sure a lot of others as well.
Hey Patrick! Is there any way to get a particular Chainlink oracle heartbeat to trigger an update system state hook in a contract? Or is the only way to get around a blockchain's passive nature in a decentralized way to use Chainlink Keepers? Thanks in advance!
Thanks for the awesome content PC! I got a warning after compiling the GovernorContract that it exceeds 24,576 bytes, and therefore, might not successfully deploy to mainnet. Is this expected or did I potentially make a mistake somewhere? Also, my goal is to build some sort of off-chain voting mechanism. Do you still recommend using chainlink, ipfs, and snapshot as the stack? Thanks again!
@@PatrickAlphaC Open Zeppelin actualy has a ERC721 Votes extension. I think passing the governor that contract as arg instead of the erc20 one will do it, I’ll look more into it today.
@@devopsplaylists you can! You’d have to do something called a wrapper contract - the wrapper contract checks to see they have the NFT you want, and just “adds on” the functionality in the wrapper contract
Hi Patrick, I have seen multiple examples of people using keepers to execute functions with one one uint256token ID as a parameter. But how would you or what is the best way in your opinion to execute contract wide governance functions in keepers. Would you pass through an array ad the parameter?
I'm getting an error trying to deploy the contracts with hardhat with the 03-deploy..., "Error: cannot estimate gas; transaction may fail or may require manual gas limit". Anyone with the same issue that had solved it?
Thanks for the content Patrick. Can u tell me what will the structure of this task DAO on a polygon which can do the following things 1. People can apply for joining the DAO 2. Admin can approve membership 3. Anyone can create a proposal 4. People can vote on proposal 5. Admin can close the voting process and declare the result As if how it will be implemented
Hmm… you could adapt this code to do that. Would be a lot for me to code it though. Instead of having a set supply of an ERC20 you could have the down be the owner of a “mint” function to mint membership
And “-network rinkeby” to your “yarn hardhat deploy” command, and have the rinkeby network in your hardhat config. You can see more examples at tutorials at the hardhat starter kit: github.com/smartcontractkit/hardhat-starter-kit
@@PatrickAlphaC Thanks !, and the last question, i did test all, but i found the "proposes" could create their with any account address, how could restrinct this ? so that only account who have ERC20 token could do it.
@@user-yy5gq5by1h yep, we setup everyone to be able to propose. You’d just add a proposer role to the governance contract and only allow an array of addresses to propose then
I've developed a DApp using truffle suite and now I want to deploy this dapp online so that everyone will be able to access it over the internet. I've used Rinkeby-Testnet for smart contract deployment. Whenever I use npm run dev command, it deploy the frontend of dapp on locally using lite-server but, now I want to publish it globally and have no idea about it. Please help me !!!
Every time I try to run the command ''yarn hardhat run scripts/vote.ts --network localhost'' I get the following error reason: 'invalid BigNumber value', code: 'INVALID_ARGUMENT', argument: 'value', value: undefined What am I doing wrong? import * as fs from "fs"; import { proposalsFile, developmentChains, VOTING_PERIOD } from "../helper-hardhat-config"; import { moveBlocks } from "../utils/move-blocks"; //ts-ignore import { network, ethers } from "hardhat"; const index = 0; async function main(proposalIndex: number) { const proposals = JSON.parse(fs.readFileSync(proposalsFile, "utf8")); const proposalId = proposals[network.config.chainId!][proposalIndex]; // 0 = Against, 1 = For, 2 = Abstain for this example const voteWay = 1 const governor = await ethers.getContract("GovernorContract"); const reason = "I like a do da cha cha"; const voteTxResponse = await governor.castVoteWithReason( proposalId, voteWay, reason ); await voteTxResponse.wait(1); if (developmentChains.includes(network.name)) { await moveBlocks(VOTING_PERIOD + 1) } console.log("Voted") } main(index) .then(() => process.exit(0)) .catch((error) => { console.error(error) process.exit(1) })
I am getting this error when run yarn hardhat node can anyone help? TSError: ⨯ Unable to compile TypeScript: deploy/04-setup-governance-contract.ts:15:33 - error TS2551: Property 'getContract' does not exist on type 'typeof import("dao-governance/node_modules/ethers/lib/ethers") & HardhatEthersHelpers'. Did you mean 'getContractAt'?
I was getting a hardhat error stating: Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. --> contracts/governance_standard/GovernorContract.sol:11:1: Any tips on how to squash this?
Yes , you can cheese these errors by modifying your "hardhat.config.js" module.exports = { solidity: "0.8.4", settings: { optimizer: { enabled: true, runs: 1, }, }, defaultNetwork:"hardhat", networks: { hardhat:{ allowUnlimitedContractSize:true, chainId: 31337 }, localhost:{ allowUnlimitedContractSize:true, chainId: 31337 } You need to modify "runs" under optimizer and add "allowUnlimitedContractSize:true" under networks Hope i helped !!
@@kamenoscsdas right on thanks, I was able to silence the error locally w allowUnlimitedContractSize. I am curious how to optimize for production though. Seems like once several Openzeppelin scripts are imported the contract balloons and this error throws. I’ll have to learn more about optimizing for production when it comes to deploying these on main net.
Great tutorial as usual, but when i run vote.ts, comes with "reverted with reason string 'Governor: vote not currently active'". then i check the state , it's
When I compile the contracts, I get the following warning: Note; I am using Truffle. Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. --> project:/contracts/governance_standard/GovernorContract.sol:11:1: | 11 | contract GovernorContract is | ^ (Relevant source part starts here and spans across multiple lines). Anyone knows WHY? Thanks.
Problem solved! Made changes to Solidity in the hardhat-config-js file by enabling Optimizer setting to a lower value, 100, as show follow module.exports = { solidity: { version: "0.8.9", settings: { optimizer: { enabled: true, runs: 100, }, }, }, };ruclips.net/user/sgaming/emoji/7ff574f2/emoji_u1f642.png
for anyone getting the error "Governor: vote not currently active": Make sure that you didnt mess up the deploy inside your 03-deploy-governor-contract. "args:[ governanceToken.address, timeLock.address, helpers.VOTING_DELAY, helpers.VOTING_PERIOD, helpers.QUORUM_PERCENTAGE ]," Also, has anyone encountered 'Governor: unknown proposal id' when trying to Queue and execute?
@@PatrickAlphaC hmmm..i can't seem to find the problem.. propose and vote work fine. Using the same arguments for Queue/execute , doesn't seem to work tho. (I'm using JS instead of TS)
@@PatrickAlphaC i found the problem. i removed the keccak256, and modified encodeFunctionData as follows: const encodedFunctionCall = box.interface.encodeFunctionData( functionToCall, args, helpers.PROPOSAL_DESCRIPTION ); const descriptionHash = ethers.utils.id(helpers.PROPOSAL_DESCRIPTION) You were absolutely correct, it was a hashing issue ! You are great ! Thanks !!
Great tutorial!! I was wondering if you could help me encode the proposal to send native tokens (eg. ETH) to some grant receiver account address. I tried using account address as target and also used web3.eth.sendTransaction, but they seem not to be working.
so for some reason I cant get the state of the proposal to update to active. The proposal deploys fine and i can even log the proposalid from the voting script but it never runs correctly and as it breaks it tells me the proposal isnt active github.com/MontyWilliams/dao_typescript.git
Hey Patrick, like to say watching your videos make me uplifted, you're a really gifted teacher. Thanks for all that you do, your constant hard work is inspiring.
You are so underrated. Great content as always patrick!
Thanks fren :)
Trying my best to give y’all the best :)
My God!!!, extraordinary content, immensely useful.
Without a doubt, your channel is a wonder to the world.
The greatest of successes.
Amazing! Things can become very confusing as a beginner dev taking a stab at web3 projects. A big source of ambiguity comes from a lack of knowledge in how things work on ethereum itself, as well as common practices, but videos like this that thoroughly go through a lot of the process are a huge help. Thank you Patrick!!
Glad it’s helpful!!
Secureum Bootcamp vids on youtube are a great fast-track (although you will need to do your own research/reading supplemental to the vids.. but the vids will show you the initial nodes on the tree of blockchain knowledge from where to dig deeper)
@@crucru4000 Thank you for the recommendation.. I will check them out!
Thank you for this content Patrick. I spent 3 hours yesterday making a DAO using a different tutorial on RUclips, only to find out it required infrastructure that was recently depricated to continue building it. This was much better. Great work!
8:20 you can also used the constructor as like this:-
"contract GovernToken is ERC20("Govern", "GT") {
}
"
Nice! A few notes:
* You can actually import { getChainId } from 'hardhat'; and then proposals[(await getChainId()).toString()]
* Also you could
const root = path.resolve(__dirname, '..');
const json = path.join(root, '/', 'proposals.json');
const proposals = JSON.parse(fs.readFileSync(json, 'utf8'));
Just to make it more robust.
If TS is complaining that events might be undefined, one could say
const proposalId = proposalData.events?.[0].args?.proposalId.toString();
Also, one could use ethers.constants.AddressZero constant which returns zero address
@@IlyaBodrovKrukowski thanks for this!!
I didn't realize you had a RUclips channel! I have subscribed! You are so knowledgeable! Thank you for the awesome content! :)
Boom! Welcome to the crew! And thank you!
Great tutorial as usual my guy. Gonna spin up a test version of the Street Credit DAO today
Have fun!
The only Dao tutorial on youtube. Thank you Patrick
I got you dog
Excellent work as always, waiting for the front end.
Great tutorial! Thanks a lot, Patrick Collins!
I have been developing a DAO for a few months now, but will have to update my project with some of this features 👌This is awesome !
Yes!!
@@PatrickAlphaC I do have one question regarding integrating the ERC20Votes and checkpoint functionality. I have an existing token weight voting system in where the user with more tokens has more vote weight, so i have imported ERC20Votes contract and can`t figure out how to integrate the checkpoint functionality to my system. In my functionalty, when user contrubites to the DAO contract he gets an proportional amount of tokens, so where and how do I integrate the checkpoints functionality ?
@@apex12122 just mint and delegate them tokens. You only get a token checkpoint after you delegate
thank, but when i deploy the governor contract i get an error telling me the contract is to large to be deployed onto the network.
Any ideas how to get around this?
Everyone: This man is a genious, lets build a DAO.
Patrick: Wau I completly messed up here because of a spelling error^^
Thanks a lot Patrick, again providing powerfull knowledge!
Bahahahha
Like 99% of my shit is me being dumb at some point and I edit it out
@@PatrickAlphaC well sounds like my phase of cleaning code and overthinking some decisions and why I took that path once lol
Patric, great job! You're amazing! Big thanks to you!
Great content as always patrick!
Update your browser. And thank you! This is really amazing :)
What are your "babel/plugin-proposal-private-methods --dev
Awesome content! Thanks PC.
Just a note that fs module is apparently native to nodeJS and doesn't need to be installed. Can import with the following syntax:
import fs = require('fs')
Thanks for this!!! Learning everyday :D
😂😂 NPC here, Liked, commented and subscribed cause I liked the content 😂😂. Amazing stuff tho.
Thank you Patrick. Keep it up!
Good job Patrick!!! Life changer!
Glad it’s helpful!
This tutorial is awesome, thanks!
This is going to get me a new job!
weekend project ty for this
Thanks Patrick. Excellent tutorial.
The GovernorContract available in GitHub uses the ERC20Votes interface rather than iVotes.
I had to change to compile the contract.
Thanks for the note!
Thx for the video. Is amazing!!!
Thank you for this. You the man!
Woot woot
Im so excited watching this video myself. Really great content Patrick. I just had one question can I use the logics written in typescript in react js so that I can run the scripts with the click of a button ??
You could! But it would probably be better to do some front end stuff so people can connect with their metamasks. I have a video talking about a few different front end strategies called "how to connect to metamask" ruclips.net/video/pdsYCkUWrgQ/видео.html
@@PatrickAlphaC sure will check it out cheers 😀
Thank you. But where is the frontend version to see how it looks like and to make functional to actually allow users to vote?
Damn, I almost made this, but then decided to focus on the backend.
I’ll make a front end in a future vid
@@PatrickAlphaC thank you very much patrick! Highly appreciate it. Just a basic frontend boilerplate will do to showcase how it works visually for users. You are the best teacher on RUclips! Keep rocking and thanks again for the high value you give out
Great content! Learned a lot, thanks :D
Great work aman
This guy is so cool :D
Thanks fren
Great Vid! btw may I ask why do you still need to override the _afterTokenTransfer? as You don't have any extension other than ERC20Votes? I also tried it and seems works fine, either way I still need to self-delegate?
This is great, thank you!
i'm having issue, with reference to code at 33:13, when im deploying the governanceToken, it's saying the deployer is undefined, when i tried to log await getNamedAccounts() it's giving me {}.
Hi @patrick
The governance contract generated from openzeppelin exceeds max size limit of 24576 bytes, is there any work around to solve this issue? I used only the default settings, also tried removing 'updatable Settings' but no luck.
Hmm... you might have to try their newer contracts
Great content 🖤
I keep getting this "cannot estimate gas; transaction may fail or may require manual gas limit" after adding the governor contracts deploy script. Even tried copying the code from the git repo but I still get the same thing. "Transaction reverted: trying to deploy a contract whose code is too large"
I'm getting the same thing too. Would appreciate some help as well.
Hey patrick, i was trying this around with hardhat test and all conditions pass when using your flow. But when i try to vote using account that has no token delegated to him, the voteTx is still passed and not reverted. Is this the intended result or am i missing something? Because i thought the only one that can vote is the one with the erc20Votes delegated to them?
You need to delegate the votes to yourself first! It was a weird implementation detail of this specific code. I think on mint it might make sense to delegate to yourself right away, if you'd like to add that you can.
I don't get the purpose of the Box contract. What does it map to in a real world use case?
Is there a real compelling reason the code your DAO and not use Aragorn or something similar ?
It's totally up to the user, using Aragon, Colony, DAOHaus, or DAOStack are all great options! I mentioned them in my video prior to this.
Creating your own tooling gives you a much deeper understanding of how the DAO actually works, and additionally, gives you much greater flexibility and customization in the future of your organization.
The Compiler tells governor.propose(....) is not a function but it works when used like governor[propose()](...)
Why?!
Legend, as always!
Awesome tutorial! At one point you mentioned upgradeable governance contracts and said you had a video on it. A quick search and scan of the channel didn't reveal a video. Do you know if you have any good references for upgradable governance? Thanks.
What is the = hre, in the Deployment Scripts:Governor Token section?
Amazing Video! It really made me understand coding of a DAO and the process. Just one question - While making the GovernorToken contract you assigned every token to the Deployer. And in the deploy script you called the delegate function. I don't understand why the 'delegate' function call was needed and how can the whole system be managed if the address of the voter change for each proposal.
The delegate function is needed because we need to create a snapshot of voting power. With the tokens, you can "delegate" them to allow other users to use your tokens to vote (in case you're going to be an inactive voter)
> how can the whole system be managed if the address of the voter change for each proposal
the system doesn't care, as you transfer tokens around, the owner of the tokens can call "delegate" on whomever they want.
I failed to see anywhere in the code where the governance contract checks to see if the proposal was passed before executing the Box.store() function. Is that right? And if we are just relying on deployer to execute the store() function, wouldn't that make the DAO centralized, relying on deployer to follow through with the results of the vote?
Its deeeeeeeeeep in the openzeppelin imported contracts, but it 100% does check.
We don't rely on the deployer at all.
@@PatrickAlphaC oic, it's in the openzeppelin imported contract. I see it now, you check state(proposalID) when you run execute(). Thank you for this pointer Patrick. Your stuff helps me learn, and I'm sure a lot of others as well.
Hey Patrick! Is there any way to get a particular Chainlink oracle heartbeat to trigger an update system state hook in a contract? Or is the only way to get around a blockchain's passive nature in a decentralized way to use Chainlink Keepers? Thanks in advance!
Thanks for the awesome content PC! I got a warning after compiling the GovernorContract that it exceeds 24,576 bytes, and therefore, might not successfully deploy to mainnet. Is this expected or did I potentially make a mistake somewhere?
Also, my goal is to build some sort of off-chain voting mechanism. Do you still recommend using chainlink, ipfs, and snapshot as the stack? Thanks again!
Thanks for this awesome video. Do you have any pointers on how I can incorporate Hector-DAO/hector-contracts into this setup?
similar question to yours dude! eagerly waiting for a response
I'm not familiar with Hector - sorry!
When coding in VS how do you fix," Linter: Code contains empty blocks [no-empty-blocks]", Thx
Could you as on stack exchange ETH? Thanks
Awesome tutorial as always! Will you make aNFT governance DAO tutorial as well?
I think the contract wizard can do that form you too! Then all the same concepts from this apply
@@PatrickAlphaC Open Zeppelin actualy has a ERC721 Votes extension. I think passing the governor that contract as arg instead of the erc20 one will do it, I’ll look more into it today.
@@tomandreii awesome! If you want to make a PR to the repo adding NFT voting, I’d love to add it
@@devopsplaylists you can!
You’d have to do something called a wrapper contract - the wrapper contract checks to see they have the NFT you want, and just “adds on” the functionality in the wrapper contract
can we code a DAO using ECR721 or ERC115 Tokens?
You sure can
Hi Patrick, I have seen multiple examples of people using keepers to execute functions with one one uint256token ID as a parameter. But how would you or what is the best way in your opinion to execute contract wide governance functions in keepers. Would you pass through an array ad the parameter?
really broad question... not sure what you're asking?
Almost there
I got this error when writing the deploy script for the Governor: Error: expected 0 constructor arguments, got 5. Anyone having the same error ?
Could you make an issue on the repo?
Which tool did you use to setup auto formatting for solidity in vscode? Thanks!
Their is a solidity extension! Just look up solidity in the extensions
How complex would be the Chainlink-IPFS-Snapshot integration?
Hard to say
@Patrick Collins is there any ways to make dao with 1155 token? havent found anytihnk to make it possible?
Yes. But this code doesn't do that type
@@PatrickAlphaC is there any ways you can possible make governance for 1155 and show us?)
how do you do the governance token with a erc-721 (NFT)?
That might have to be a different video
I'm getting an error trying to deploy the contracts with hardhat with the 03-deploy..., "Error: cannot estimate gas; transaction may fail or may require manual gas limit". Anyone with the same issue that had solved it?
Please make an issue on the repo with the exact steps you took
@@PatrickAlphaC sure thing, I’ll do it, thanks for replying!
@@PatrickAlphaC I created the issue already, thanks!
Thanks for the content Patrick. Can u tell me what will the structure of this task DAO on a polygon which can do the following things
1. People can apply for joining the DAO
2. Admin can approve membership
3. Anyone can create a proposal
4. People can vote on proposal
5. Admin can close the voting process and declare the result
As if how it will be implemented
Hmm… you could adapt this code to do that. Would be a lot for me to code it though. Instead of having a set supply of an ERC20 you could have the down be the owner of a “mint” function to mint membership
@@PatrickAlphaC Thanks for the suggestion
Although u can just tell me about different contracts name that I have to develop for this dao and their functionalities just an overview not the code
@@user-dn2cq5ex6e I'm not following, what are you looking for?
Anyone having this error when trying to run first vote.ts "Governor: vote not currently active" ?
Please make an issue on the repo with exact steps
Could you do a frontend as well please in order to get a better understanding about Governance.
Yes…. At some point 😅
Be sure to watch my high level DAO video too, it’ll give you a better understanding as to what’s going on
Great video , do u have any resources for off chain voting and then sending it in in single transaction to the chain
Not yet. I want someone to build that with chainlink sooooon
@@PatrickAlphaC any chain link docs or resources , I would love to try build it with chainlink
@@hitenjain4688 you’d start with the any api docs at docs.chain.link
🥰
great video but now how would you deploy this to a live tesnet like rinkeby so you can track the contract deployments on etherscan?
And “-network rinkeby” to your “yarn hardhat deploy” command, and have the rinkeby network in your hardhat config.
You can see more examples at tutorials at the hardhat starter kit: github.com/smartcontractkit/hardhat-starter-kit
I propose, you should be the king of England after Queen Elizabeth 😍
LOL
I love you 😘❣️❣️❣️❣️
Back at ya
Sorry I'm a newbie, I always run into problems when using hardhat compile, even though I've followed the video.
hmm... the codebase is a bit outdated, perhaps you can leave an issue on the repo?
Thanks for video, one questions, is possible use truffle instead hardhat?
Yes! All the contracts are going to be exactly the same, but you can just use truffle.
@@PatrickAlphaC Thanks !, and the last question, i did test all, but i found the "proposes" could create their with any account address, how could restrinct this ? so that only account who have ERC20 token could do it.
@@user-yy5gq5by1h yep, we setup everyone to be able to propose.
You’d just add a proposer role to the governance contract and only allow an array of addresses to propose then
@@PatrickAlphaC Yep, Thanks !
I've developed a DApp using truffle suite and now I want to deploy this dapp online so that everyone will be able to access it over the internet.
I've used Rinkeby-Testnet for smart contract deployment. Whenever I use npm run dev command, it deploy the frontend of dapp on locally using lite-server but, now I want to publish it globally and have no idea about it.
Please help me !!!
You’d need to look up a typical hosting setup like docs.netlify.com/ or moralis
can't use the links
Which ones
er... where's the Brownie link?
It’s the PY code and python video in the description
Bruce Almighty
Can you Audit our smart contract please ?
Yes! Can you make a request at cyfrin.io?
Mehnn... I thought we'd be working with Brownie😔
Check description, we did a brownie one too ;)
@@PatrickAlphaC Nice!!!!. Thanks so much mahn. This channel is really underrated. Content that you release is gold.
Every time I try to run the command ''yarn hardhat run scripts/vote.ts --network localhost'' I get the following error
reason: 'invalid BigNumber value',
code: 'INVALID_ARGUMENT',
argument: 'value',
value: undefined
What am I doing wrong?
import * as fs from "fs";
import { proposalsFile, developmentChains, VOTING_PERIOD } from "../helper-hardhat-config";
import { moveBlocks } from "../utils/move-blocks";
//ts-ignore
import { network, ethers } from "hardhat";
const index = 0;
async function main(proposalIndex: number) {
const proposals = JSON.parse(fs.readFileSync(proposalsFile, "utf8"));
const proposalId = proposals[network.config.chainId!][proposalIndex];
// 0 = Against, 1 = For, 2 = Abstain for this example
const voteWay = 1
const governor = await ethers.getContract("GovernorContract");
const reason = "I like a do da cha cha";
const voteTxResponse = await governor.castVoteWithReason(
proposalId,
voteWay,
reason
);
await voteTxResponse.wait(1);
if (developmentChains.includes(network.name)) {
await moveBlocks(VOTING_PERIOD + 1)
}
console.log("Voted")
}
main(index)
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
I am getting this error when run yarn hardhat node
can anyone help?
TSError: ⨯ Unable to compile TypeScript:
deploy/04-setup-governance-contract.ts:15:33 - error TS2551: Property 'getContract' does not exist on type 'typeof import("dao-governance/node_modules/ethers/lib/ethers") & HardhatEthersHelpers'. Did you mean 'getContractAt'?
Could you ask this on stack exchange ETH or make an issue on the repo? Thank you!
@@PatrickAlphaC solved Thanks for reply...
I was getting a hardhat error stating: Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. --> contracts/governance_standard/GovernorContract.sol:11:1:
Any tips on how to squash this?
Yes , you can cheese these errors by modifying your "hardhat.config.js"
module.exports = {
solidity: "0.8.4",
settings: {
optimizer: {
enabled: true,
runs: 1,
},
},
defaultNetwork:"hardhat",
networks: {
hardhat:{
allowUnlimitedContractSize:true,
chainId: 31337
},
localhost:{
allowUnlimitedContractSize:true,
chainId: 31337
}
You need to modify "runs" under optimizer and add "allowUnlimitedContractSize:true" under networks
Hope i helped !!
@@kamenoscsdas he’s right!
@@kamenoscsdas right on thanks, I was able to silence the error locally w allowUnlimitedContractSize. I am curious how to optimize for production though. Seems like once several Openzeppelin scripts are imported the contract balloons and this error throws. I’ll have to learn more about optimizing for production when it comes to deploying these on main net.
Great tutorial as usual, but when i run vote.ts, comes with "reverted with reason string 'Governor: vote not currently active'". then i check the state , it's
Hmm… could you make an issue on the repo with the exact steps you took?
@@PatrickAlphaC ok, i found that when deploying my GovernorContract, the parameters is in the wrong order
When I compile the contracts, I get the following warning: Note; I am using Truffle.
Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.
--> project:/contracts/governance_standard/GovernorContract.sol:11:1:
|
11 | contract GovernorContract is
| ^ (Relevant source part starts here and spans across multiple lines).
Anyone knows WHY? Thanks.
Problem solved! Made changes to Solidity in the hardhat-config-js file by enabling Optimizer setting to a lower value, 100, as show follow
module.exports = {
solidity: {
version: "0.8.9",
settings: {
optimizer: {
enabled: true,
runs: 100,
},
},
},
};ruclips.net/user/sgaming/emoji/7ff574f2/emoji_u1f642.png
for anyone getting the error "Governor: vote not currently active": Make sure that you didnt mess up the deploy inside your 03-deploy-governor-contract.
"args:[
governanceToken.address,
timeLock.address,
helpers.VOTING_DELAY,
helpers.VOTING_PERIOD,
helpers.QUORUM_PERCENTAGE
],"
Also, has anyone encountered 'Governor: unknown proposal id' when trying to Queue and execute?
Great comment! And yes, that’s usually when you forget to hash the proposal Id…. Hopefully your code looks the same as mine?
@@PatrickAlphaC hmmm..i can't seem to find the problem.. propose and vote work fine. Using the same arguments for Queue/execute , doesn't seem to work tho. (I'm using JS instead of TS)
@@kamenoscsdas what happens when you clone my repo and try to run it from there? If that doesn't work, can you please make an issue on the repo?
@@PatrickAlphaC i found the problem. i removed the keccak256, and modified encodeFunctionData as follows:
const encodedFunctionCall = box.interface.encodeFunctionData(
functionToCall,
args,
helpers.PROPOSAL_DESCRIPTION
);
const descriptionHash = ethers.utils.id(helpers.PROPOSAL_DESCRIPTION)
You were absolutely correct, it was a hashing issue !
You are great ! Thanks !!
@@kamenoscsdas nice work!!
Great tutorial!!
I was wondering if you could help me encode the proposal to send native tokens (eg. ETH) to some grant receiver account address.
I tried using account address as target and also used web3.eth.sendTransaction, but they seem not to be working.
I probably won't be able to help you specifically... but you could ask on forums!
so for some reason I cant get the state of the proposal to update to active. The proposal deploys fine and i can even log the proposalid from the voting script but it never runs correctly and as it breaks it tells me the proposal isnt active github.com/MontyWilliams/dao_typescript.git
Could you watch this for debugging help?
ruclips.net/video/XT8STflvwNo/видео.html
@@PatrickAlphaC will do!