OpenZeppelin / openzeppelin-contracts

OpenZeppelin Contracts is a library for secure smart contract development.
https://openzeppelin.com/contracts
MIT License
24.92k stars 11.79k forks source link

Improve Governor Guide #4619

Open Heph789 opened 1 year ago

Heph789 commented 1 year ago

🧐 Motivation

As someone learning how to implement on-chain governance through OZ's Governor contract, I found the Governance in the guide to be missing important information and in some cases, outdated. I'd like to make it better!

📝 Details

Here are a few of the key missing areas I've found:

Overall, I think it would be better if this guide were actually a walkthrough. "Deploy on-chain governance locally on hardhat!" That way there is an actual example that people can interact with locally. I'd love to hear yall's thoughts on this!

frangio commented 1 year ago

I agree with the bullet points. I think I agree that a walkthrough would be nice, but the current guide is also a bit of a conceptual introduction and overview so that doesn't exactly fit in a walkthrough.

Feel free to submit a PR for the bullet points.

Heph789 commented 1 year ago

A couple of questions and comments: Addressing the first two bullet points would require changing the sample code provided in the guide, but that code is behind an api somewhere (referenced like this: link:api:example$governance/MyToken.sol[]) and I'm not sure how/if I can access that.

For the last third bullet point, should I just include the fact that hardhat is being used, and add a note about which version is being used, and which function is a hardhat injection? Or should I try to change it so it works solely with ethers.js? Solely using ethers.js might increase the complexity of the code a fair amount.

ernestognw commented 1 year ago

but that code is behind an api somewhere (referenced like this: link:api:example$governance/MyToken.sol[])

You can find them under the mocks/docs/** folder. The API reference is the route after this folder.

Regarding ethersjs, I think mentioning briefly at the beginning as a prerequisite will be fine. Additionally, feel free to add comments to the code snippets if you think they're useful.