Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add governance docs #9

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Add governance docs #9

wants to merge 7 commits into from

Conversation

prxgr4mm3r
Copy link

No description provided.

@vercel
Copy link

vercel bot commented Aug 17, 2023

@prxgr4mm3r is attempting to deploy a commit to the Brushfam Team on Vercel.

To accomplish this, @prxgr4mm3r needs to request access to the Team.

Afterwards, an owner of the Team is required to accept their membership request.

If you're already a member of the respective Vercel Team, make sure that your Personal Vercel Account is connected to your GitHub account.

you need to enable `PSP22Votes` feature, embed modules data structures and implement them via `#[openbrush::implementation]` macro
as described in [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush).

you need to enable `governance` feature. Also, you need to use implementation macro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs governance and psp22

@@ -4,14 +4,25 @@ title: GovernorVotes
---
This extension gives Governor contract the ability to communicate with [PSP22Votes](../../PSP22/Extensions/votes.md) token.
The main purpose of this extension is to provide a way to check how much voting power a voter has.
Also, it provides the ability to delegate tokens from one account to another for voting.
You can check the [documentation](https://docs.openzeppelin.com/contracts/4.x/api/governance#GovernorVotes) in OpenZeppelin Contracts for more information about the voting mechanism.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure that it's the best idea to point directly to OpenZeppelin, maybe there is some other link?

Copy link

@coreggon11 coreggon11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments

}
```

You can check [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush) to understand how it works.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can check [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush) to understand how it works.
You can check [this section](../../overview.md/#reuse-implementation-of-traits-from-openbrush) to understand how it works.

First, you should implement basic version of [PSP22](../psp22.md).

With [default `Cargo.toml`](../../overview.md/#the-default-toml-of-your-project-with-openbrush),
you need to enable `governance` feature. Also, you need to use implementation macro

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
you need to enable `governance` feature. Also, you need to use implementation macro
you need to enable `governance` feature. Also, you need to use the implementation macro

Comment on lines 32 to 35
It should add a `votes` field in your Storage. It should be named `votes` and have the type `votes::Data`.
It stores information about delegations, [checkpoints]() for each account, which stores the number of votes at a certain time, and the total number of votes, also at a certain time.
Also, Storage should have a `nonces` field. It should be named `nonces` and have the type `nonces::Data`.
It stores the number of nonces for each account. Nonce is a number that is incremented each time a user delegates tokens to another account by signature.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It should add a `votes` field in your Storage. It should be named `votes` and have the type `votes::Data`.
It stores information about delegations, [checkpoints]() for each account, which stores the number of votes at a certain time, and the total number of votes, also at a certain time.
Also, Storage should have a `nonces` field. It should be named `nonces` and have the type `nonces::Data`.
It stores the number of nonces for each account. Nonce is a number that is incremented each time a user delegates tokens to another account by signature.
You need to add a storage field of type `votes::Data`, which will store the information about delegations, the number of votes at a certain time, and the total number of votes, at a certain time.
Also, you will need a storage field of type `nonces::Data`, which stores the number of nonces for each account. Nonce is a number that is incremented each time a user delegates tokens to another account.

...
}
```
That's it! Now we have a [PSP22Votes](/) contract. You can use it in your [Governor](../../governance/governor.md) contract, as a voting power.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it is used to count votes, or something like that 😄 Rephrase pls

title: Governance
---
This feature provides a governance mechanism. It allows token holders to vote on proposals and change the token's parameters.
Everybody who has enough votes can create a proposal to call a method of some contract with some arguments. Then token holders can vote for, against the proposal, or abstain.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they abstain, they basically do not vote so we don't need to mention it here)

Suggested change
Everybody who has enough votes can create a proposal to call a method of some contract with some arguments. Then token holders can vote for, against the proposal, or abstain.
Everybody who has enough votes can create a proposal to call a method of some contract with some arguments. Then token holders can vote for or against the proposal.

}
```

You can check [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush) to understand how it works.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can check [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush) to understand how it works.
You can check [this section](../../overview.md/#reuse-implementation-of-traits-from-openbrush) to understand how it works.

}
```
## Step 3: Add GovernorVotes field in your Storage
GovernorVotes field in your Storage should be named `governor_votes` and have type `governor_votes::Data`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing with naming


## Step 2: Add field in your Storage, that uses Checkpoints
For example, you want to save how total supply of your token changes over time.
Then you need to add a field in your Storage, that uses Checkpoints.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they also need to update the logic in transfer functions otherwise it will not be updated just like that)


With [default `Cargo.toml`](../../overview.md/#the-default-toml-of-your-project-with-openbrush),
you need to enable `Nonces` feature, embed modules data structures and implement them via `#[openbrush::implementation]` macro
as described in [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
as described in [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush).
as described in [this section](../../overview.md/#reuse-implementation-of-traits-from-openbrush).

as described in [that section](../../overview.md/#reuse-implementation-of-traits-from-openbrush).

## Step 2: Add Nonces field in your Storage
Nonces field in your Storage should be named `nonces` and have type `nonces::Data`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing with naming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants