How to build an on-chain DAO | Typescript & Solidity (Python version in description)

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 175

  • @YeahYofurtYeah
    @YeahYofurtYeah День назад +1

    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.

  • @Justobolsa
    @Justobolsa 2 года назад +17

    You are so underrated. Great content as always patrick!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +3

      Thanks fren :)
      Trying my best to give y’all the best :)

  • @jonathanbriceno3865
    @jonathanbriceno3865 2 года назад +3

    My God!!!, extraordinary content, immensely useful.
    Without a doubt, your channel is a wonder to the world.
    The greatest of successes.

  • @GhostkillerPlaysMC
    @GhostkillerPlaysMC 2 года назад +4

    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!!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      Glad it’s helpful!!

    • @crucru4000
      @crucru4000 2 года назад

      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)

    • @GhostkillerPlaysMC
      @GhostkillerPlaysMC 2 года назад

      @@crucru4000 Thank you for the recommendation.. I will check them out!

  • @josephdelgiorgio3997
    @josephdelgiorgio3997 2 года назад +1

    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!

  • @wantedai6689
    @wantedai6689 2 года назад +4

    8:20 you can also used the constructor as like this:-
    "contract GovernToken is ERC20("Govern", "GT") {
    }
    "

  • @IlyaBodrovKrukowski
    @IlyaBodrovKrukowski 2 года назад +1

    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();

    • @IlyaBodrovKrukowski
      @IlyaBodrovKrukowski 2 года назад

      Also, one could use ethers.constants.AddressZero constant which returns zero address

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      @@IlyaBodrovKrukowski thanks for this!!

  • @yoshikagarner6655
    @yoshikagarner6655 2 года назад +2

    I didn't realize you had a RUclips channel! I have subscribed! You are so knowledgeable! Thank you for the awesome content! :)

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      Boom! Welcome to the crew! And thank you!

  • @Street.Credit
    @Street.Credit 2 года назад +2

    Great tutorial as usual my guy. Gonna spin up a test version of the Street Credit DAO today

  • @elad3958
    @elad3958 2 года назад +1

    The only Dao tutorial on youtube. Thank you Patrick

  • @neighbourhoodcoder5988
    @neighbourhoodcoder5988 2 года назад +2

    Excellent work as always, waiting for the front end.

  • @user-ex5dk6oj6w
    @user-ex5dk6oj6w 2 года назад +2

    Great tutorial! Thanks a lot, Patrick Collins!

  • @apex12122
    @apex12122 2 года назад +2

    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 !

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Yes!!

    • @apex12122
      @apex12122 2 года назад

      @@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 ?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      @@apex12122 just mint and delegate them tokens. You only get a token checkpoint after you delegate

  • @philknirck7347
    @philknirck7347 Год назад

    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?

  • @michimich8808
    @michimich8808 2 года назад +1

    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!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      Bahahahha
      Like 99% of my shit is me being dumb at some point and I edit it out

    • @michimich8808
      @michimich8808 2 года назад +1

      @@PatrickAlphaC well sounds like my phase of cleaning code and overthinking some decisions and why I took that path once lol

  • @yourchance2852
    @yourchance2852 2 года назад +1

    Patric, great job! You're amazing! Big thanks to you!

  • @asthamishra5191
    @asthamishra5191 8 месяцев назад

    Great content as always patrick!

  • @JasonGarcia24
    @JasonGarcia24 Год назад +1

    Update your browser. And thank you! This is really amazing :)

    • @Volhybo1t
      @Volhybo1t Год назад

      What are your "babel/plugin-proposal-private-methods --dev

  • @whosteen7743
    @whosteen7743 2 года назад +1

    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')

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Thanks for this!!! Learning everyday :D

  • @isaacnjeru1694
    @isaacnjeru1694 10 месяцев назад +1

    😂😂 NPC here, Liked, commented and subscribed cause I liked the content 😂😂. Amazing stuff tho.

  • @codesoupio
    @codesoupio 2 года назад +1

    Thank you Patrick. Keep it up!

  • @rafaelramos3260
    @rafaelramos3260 2 года назад +1

    Good job Patrick!!! Life changer!

  • @willurban837
    @willurban837 2 года назад +1

    This tutorial is awesome, thanks!

  • @magnetto90
    @magnetto90 2 года назад

    This is going to get me a new job!

  • @carlooo00s
    @carlooo00s Год назад

    weekend project ty for this

  • @fernandomaximoferreira1067
    @fernandomaximoferreira1067 2 года назад +1

    Thanks Patrick. Excellent tutorial.
    The GovernorContract available in GitHub uses the ERC20Votes interface rather than iVotes.
    I had to change to compile the contract.

  • @michelezaniolocrypto1115
    @michelezaniolocrypto1115 2 года назад +1

    Thx for the video. Is amazing!!!

  • @user-iw1dv3rw4t
    @user-iw1dv3rw4t 2 года назад

    Thank you for this. You the man!

  • @Diamond_Hanz
    @Diamond_Hanz 2 года назад +2

    Woot woot

  • @sachinaugustine9023
    @sachinaugustine9023 2 года назад +3

    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 ??

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      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

    • @sachinaugustine9023
      @sachinaugustine9023 2 года назад

      @@PatrickAlphaC sure will check it out cheers 😀

  • @holo406
    @holo406 2 года назад +2

    Thank you. But where is the frontend version to see how it looks like and to make functional to actually allow users to vote?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +2

      Damn, I almost made this, but then decided to focus on the backend.
      I’ll make a front end in a future vid

    • @holo406
      @holo406 2 года назад +2

      @@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

  • @santiagoivan7384
    @santiagoivan7384 2 года назад

    Great content! Learned a lot, thanks :D

  • @lakeman4101
    @lakeman4101 2 года назад +1

    Great work aman

  • @kusakibachizumi1339
    @kusakibachizumi1339 2 года назад +1

    This guy is so cool :D

  • @johnpaulcas1771
    @johnpaulcas1771 2 года назад +1

    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?

  • @OldTimeHoneyOfficial
    @OldTimeHoneyOfficial 2 года назад

    This is great, thank you!

  • @pratyushbhatnagar5465
    @pratyushbhatnagar5465 2 года назад

    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 {}.

  • @theultimatenoteofthehour5538
    @theultimatenoteofthehour5538 Год назад

    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.

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      Hmm... you might have to try their newer contracts

  • @Dreams_and_nightmares
    @Dreams_and_nightmares 2 года назад +1

    Great content 🖤

  • @officialhush
    @officialhush 2 года назад +1

    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"

    • @homelessdeveloper6420
      @homelessdeveloper6420 2 года назад

      I'm getting the same thing too. Would appreciate some help as well.

  • @naufaldbei4234
    @naufaldbei4234 Год назад

    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?

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      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.

  • @patrick-base-eth
    @patrick-base-eth Год назад

    I don't get the purpose of the Box contract. What does it map to in a real world use case?

  • @andreasgrowen5971
    @andreasgrowen5971 2 года назад +1

    Is there a real compelling reason the code your DAO and not use Aragorn or something similar ?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +2

      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.

  • @blackcandy9187
    @blackcandy9187 2 года назад

    The Compiler tells governor.propose(....) is not a function but it works when used like governor[propose()](...)
    Why?!

  • @jackpaperhands
    @jackpaperhands 2 года назад

    Legend, as always!

  • @codybattery8370
    @codybattery8370 2 года назад +1

    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.

  • @Volhybo1t
    @Volhybo1t Год назад

    What is the = hre, in the Deployment Scripts:Governor Token section?

  • @prakharojha8688
    @prakharojha8688 2 года назад +1

    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.

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +3

      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.

  • @danieljen6465
    @danieljen6465 Год назад

    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
      @PatrickAlphaC  Год назад +1

      Its deeeeeeeeeep in the openzeppelin imported contracts, but it 100% does check.
      We don't rely on the deployer at all.

    • @danieljen6465
      @danieljen6465 Год назад

      @@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.

  • @crucru4000
    @crucru4000 2 года назад

    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!

  • @justinhooker5249
    @justinhooker5249 Год назад

    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!

  • @konqa
    @konqa 2 года назад +1

    Thanks for this awesome video. Do you have any pointers on how I can incorporate Hector-DAO/hector-contracts into this setup?

    • @tonde11
      @tonde11 2 года назад

      similar question to yours dude! eagerly waiting for a response

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      I'm not familiar with Hector - sorry!

  • @fgriffin1017
    @fgriffin1017 2 года назад

    When coding in VS how do you fix," Linter: Code contains empty blocks [no-empty-blocks]", Thx

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Could you as on stack exchange ETH? Thanks

  • @tomandreii
    @tomandreii 2 года назад +1

    Awesome tutorial as always! Will you make aNFT governance DAO tutorial as well?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      I think the contract wizard can do that form you too! Then all the same concepts from this apply

    • @tomandreii
      @tomandreii 2 года назад +1

      @@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.

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      @@tomandreii awesome! If you want to make a PR to the repo adding NFT voting, I’d love to add it

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      @@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

  • @yashkhanvilkar80
    @yashkhanvilkar80 2 года назад +1

    can we code a DAO using ECR721 or ERC115 Tokens?

  • @jonthenpc2597
    @jonthenpc2597 2 года назад

    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?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      really broad question... not sure what you're asking?

  • @pulsechainalltheway1845
    @pulsechainalltheway1845 4 месяца назад

    Almost there

  • @user-yc9do1qh6f
    @user-yc9do1qh6f 10 месяцев назад

    I got this error when writing the deploy script for the Governor: Error: expected 0 constructor arguments, got 5. Anyone having the same error ?

    • @PatrickAlphaC
      @PatrickAlphaC  10 месяцев назад

      Could you make an issue on the repo?

  • @0426vincent
    @0426vincent 2 года назад

    Which tool did you use to setup auto formatting for solidity in vscode? Thanks!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Their is a solidity extension! Just look up solidity in the extensions

  • @krisograbek
    @krisograbek 2 года назад

    How complex would be the Chainlink-IPFS-Snapshot integration?

  • @lexa1444
    @lexa1444 Год назад

    @Patrick Collins is there any ways to make dao with 1155 token? havent found anytihnk to make it possible?

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      Yes. But this code doesn't do that type

    • @lexa1444
      @lexa1444 Год назад

      @@PatrickAlphaC is there any ways you can possible make governance for 1155 and show us?)

  • @davidalter7057
    @davidalter7057 2 года назад

    how do you do the governance token with a erc-721 (NFT)?

  • @WanerPena
    @WanerPena 2 года назад

    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?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      Please make an issue on the repo with the exact steps you took

    • @WanerPena
      @WanerPena 2 года назад

      @@PatrickAlphaC sure thing, I’ll do it, thanks for replying!

    • @WanerPena
      @WanerPena 2 года назад

      @@PatrickAlphaC I created the issue already, thanks!

  • @user-dn2cq5ex6e
    @user-dn2cq5ex6e Год назад

    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

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      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

    • @user-dn2cq5ex6e
      @user-dn2cq5ex6e Год назад

      @@PatrickAlphaC Thanks for the suggestion

    • @user-dn2cq5ex6e
      @user-dn2cq5ex6e Год назад

      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

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      @@user-dn2cq5ex6e I'm not following, what are you looking for?

  • @scrudlabs
    @scrudlabs 2 года назад

    Anyone having this error when trying to run first vote.ts "Governor: vote not currently active" ?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Please make an issue on the repo with exact steps

  • @Blockchainfirst
    @Blockchainfirst 2 года назад +1

    Could you do a frontend as well please in order to get a better understanding about Governance.

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      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

  • @hitenjain4688
    @hitenjain4688 2 года назад +1

    Great video , do u have any resources for off chain voting and then sending it in in single transaction to the chain

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Not yet. I want someone to build that with chainlink sooooon

    • @hitenjain4688
      @hitenjain4688 2 года назад

      @@PatrickAlphaC any chain link docs or resources , I would love to try build it with chainlink

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      @@hitenjain4688 you’d start with the any api docs at docs.chain.link

  • @kcstorytime4898
    @kcstorytime4898 2 года назад

    🥰

  • @dardangashi3974
    @dardangashi3974 2 года назад

    great video but now how would you deploy this to a live tesnet like rinkeby so you can track the contract deployments on etherscan?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      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

  • @adilnehal9279
    @adilnehal9279 2 года назад +1

    I propose, you should be the king of England after Queen Elizabeth 😍

  • @fromlibyawithlove667
    @fromlibyawithlove667 2 года назад +1

    I love you 😘❣️❣️❣️❣️

  • @_MUS3000
    @_MUS3000 7 месяцев назад

    Sorry I'm a newbie, I always run into problems when using hardhat compile, even though I've followed the video.

    • @PatrickAlphaC
      @PatrickAlphaC  7 месяцев назад

      hmm... the codebase is a bit outdated, perhaps you can leave an issue on the repo?

  • @user-yy5gq5by1h
    @user-yy5gq5by1h 2 года назад

    Thanks for video, one questions, is possible use truffle instead hardhat?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Yes! All the contracts are going to be exactly the same, but you can just use truffle.

    • @user-yy5gq5by1h
      @user-yy5gq5by1h 2 года назад

      ​@@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.

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      @@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

    • @user-yy5gq5by1h
      @user-yy5gq5by1h 2 года назад

      @@PatrickAlphaC Yep, Thanks !

  • @peterkors704
    @peterkors704 2 года назад

    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 !!!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      You’d need to look up a typical hosting setup like docs.netlify.com/ or moralis

  • @isaacgahou8514
    @isaacgahou8514 2 года назад

    can't use the links

  • @oliverli9630
    @oliverli9630 2 года назад

    er... where's the Brownie link?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      It’s the PY code and python video in the description

  • @davinavarro6253
    @davinavarro6253 4 месяца назад

    Bruce Almighty

  • @FabriciodoCarmoCalil
    @FabriciodoCarmoCalil Год назад

    Can you Audit our smart contract please ?

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      Yes! Can you make a request at cyfrin.io?

  • @francise8676
    @francise8676 2 года назад +1

    Mehnn... I thought we'd be working with Brownie😔

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      Check description, we did a brownie one too ;)

    • @francise8676
      @francise8676 2 года назад +1

      @@PatrickAlphaC Nice!!!!. Thanks so much mahn. This channel is really underrated. Content that you release is gold.

  • @vicmsa
    @vicmsa 2 года назад

    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)
    })

  • @abdulmaajid4001
    @abdulmaajid4001 2 года назад

    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'?

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Could you ask this on stack exchange ETH or make an issue on the repo? Thank you!

    • @abdulmaajid4001
      @abdulmaajid4001 2 года назад +1

      @@PatrickAlphaC solved Thanks for reply...

  • @down__lo7359
    @down__lo7359 2 года назад

    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?

    • @kamenoscsdas
      @kamenoscsdas 2 года назад +4

      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 !!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад +1

      @@kamenoscsdas he’s right!

    • @down__lo7359
      @down__lo7359 2 года назад +1

      @@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.

  • @ericliu6314
    @ericliu6314 2 года назад

    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

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Hmm… could you make an issue on the repo with the exact steps you took?

    • @ericliu6314
      @ericliu6314 2 года назад +1

      @@PatrickAlphaC ok, i found that when deploying my GovernorContract, the parameters is in the wrong order

  • @alanhamid5375
    @alanhamid5375 2 года назад

    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.

    • @alanhamid5375
      @alanhamid5375 2 года назад

      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

  • @kamenoscsdas
    @kamenoscsdas 2 года назад +1

    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
      @PatrickAlphaC  2 года назад +1

      Great comment! And yes, that’s usually when you forget to hash the proposal Id…. Hopefully your code looks the same as mine?

    • @kamenoscsdas
      @kamenoscsdas 2 года назад

      @@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
      @PatrickAlphaC  2 года назад

      @@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?

    • @kamenoscsdas
      @kamenoscsdas 2 года назад +1

      @@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 !!

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      @@kamenoscsdas nice work!!

  • @t-phoenix2254
    @t-phoenix2254 Год назад

    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.

    • @PatrickAlphaC
      @PatrickAlphaC  Год назад

      I probably won't be able to help you specifically... but you could ask on forums!

  • @63montywilliams50
    @63montywilliams50 2 года назад

    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

    • @PatrickAlphaC
      @PatrickAlphaC  2 года назад

      Could you watch this for debugging help?
      ruclips.net/video/XT8STflvwNo/видео.html

    • @63montywilliams50
      @63montywilliams50 2 года назад

      @@PatrickAlphaC will do!