@1hive/apps-dandelion-voting 中文文档教程
Dandelion voting
蒲公英投票应用程序是原始 Aragon 投票应用程序 的一个分支。 它的用途与最初的投票应用程序相同,但也使组织能够将行动限制在最近投票中表示赞同的成员。 这基本上意味着通过对提案投赞成票,您将在组织中做出决定。
已实现的与原始投票应用程序不同的主要更改是:
- Removed the ability for a user to change their vote.
- Added a buffer period which determines how much time in blocks must pass between the start of each vote.
- Added an execution delay period in blocks (this means that the
full vote duration
+full execution delay period
must pass before being able to execute a vote in case it passes). - Removed the early execution functionality.
- Changed the vote duration to blocks. The main reason for this is that since proposals are queued we do not necessarily know which block number to use for the vote snapshot (since we are not necessarily processing the transaction right when the vote starts).
- Keep track of the latest vote ids users have voted yes on.
- Make the app an ACL Oracle.
Security Review Status: Contracts frozen for audit as of commit e5b06df5c6bf3c289ce1abc02b7faa1efb0b65f4
此回购协议中的代码未经审计。
How does it work?
它具有与常规投票应用程序相同的功能,但有一些例外:
- Proposals are now queued with a minimum number of blocks between the start of each one.
- Users cannot change their decision after they have already voted.
- Votes are delayed a configurable period of time since when they are closed till when they can be executed (in the case they pass).
- Votes cannot be early executed. This means that the
full vote duration
+ thefull delay period
has to pass in order to be able to execute a vote (in case it passes).
它还充当 ACL Oracle。 ACL Oracle 是插入 Aragon 的访问控制列表 (ACL) 以执行更复杂的权限评估的小型辅助函数。 该 Oracle 旨在将行动限制在最近投票中表示赞同的成员。
该应用程序会跟踪用户投赞成票的最新投票 ID。 这样,当查询 Oracle 函数时,它可以正确评估成员是否可以在组织内执行特定操作。
在 Dandelion Orgs 的上下文中,兑换功能将由此 ACL Oracle 背后设置的角色保护。 这意味着每当用户想要兑换一些代币时,它会首先调用 ACL Oracle 函数来检查他/她是否可以执行该操作。
如果满足以下条件之一,用户将能够赎回代币:
- The latest vote in which the user voted yea failed (did not passed) and the execution delay for this vote has already passed.
- The latest vote in which the user voted yea passed and has been executed.
- The latest vote in which the user voted yea passed and the fallback period has passed.
What's the fallback period ?
回退期旨在确保用户都锁定他们投赞成票的票,但仍有机会在下一次他们没有投赞成票的投票将被执行。 这里的想法是,它让其他成员有机会在对提案投赞成票的任何人有机会退出之前执行投票。 它还考虑了由于组织无法控制的原因导致投票失败的可能性。
Initialization
蒲公英投票应用使用 MiniMeToken _token
、uint64 _supportRequiredPct
、uint64 _minAcceptQuorumPct
、uint64 _durationBlocks
、进行初始化>uint64 _bufferBlocks
和 uint64 _executionDelayBlocks
。
MiniMeToken _token
refers to the token that will be used to voteuint64 _supportRequiredPct
refers to the support required to pass a voteuint64 _minAcceptQuorumPct
refers to the quorum required to pass a voteuint64 _durationBlocks
refers to the number of blocks that a vote stays openuint64 _bufferBlocks
refers to the minimum number of blocks between the start block of each voteuint64 _executionDelayBlocks
refers to the number of blocks that a vote will be delayed from when is closed to when it actually can be executed (in case it passes).
Roles
蒲公英投票应用程序应实现以下角色:
- CREATEVOTESROLE: This allows for changing the Aragon app that can create votes
- MODIFYSUPPORTROLE: This allows for changing the amount of support required to pass a vote
- MODIFYQUORUMROLE: This allows for changing the quorum required to pass votes
- MODIFYBUFFERBLOCKS_ROLE: This allows for changing the minimum number of blocks between the start block of each vote
- MODIFYEXECUTIONDELAY_ROLE; This allows for changing the number of blocks that votes are delayed from when they are closed till when they can be executed (in case they pass).
Interface
界面与原始投票应用程序几乎相同,但现在您可以看到未来投票何时开始(即将投票)。
How to try Dandelion Voting app immediately
Template
如果您想实际查看蒲公英投票应用程序,我们推荐 Aragon 模板目录中提供的蒲公英组织模板。 只需转到 https://preview.1hive.org/,然后创建一个新组织,然后从模板选项中选择 Dandelion。
How to run the Dandelion Voting app locally
Git 克隆这个仓库。
git clone https://github.com/1Hive/dandelion-voting-app.git
导航到 dandelion-voting-app
目录。
cd dandelion-voting-app
安装 npm 依赖项。
npm i
在您的本地环境中部署一个带有蒲公英投票应用程序的 dao。
npm run start:template
Aragon DAO Installation
如需详细的分步指南,您可以查看我们的安装指南
要部署到组织,您可以使用 aragonCLI。
aragon dao install <dao-address> dandelion-voting.open.aragonpm.eth --app-init-args <token-address> <supportRequiredPct> <minAcceptQuorumPct> <durationBlocks> <bufferBlocks> <executionDelayBlocks>
Contributing
我们欢迎社区贡献!
请查看我们的未决问题以开始使用。
如果您发现可能影响安全的事情,请立即通知我们。 联系我们的最快方式是通过我们的team Keybase chat 中的#dev 频道。 只要打个招呼,你发现了一个潜在的安全漏洞,我们就会私信给你讨论细节。
Dandelion voting
The Dandelion Voting app is a fork of the Original Aragon Voting app. It serves the same purpose as the original Voting app but also enables organizations to restrict actions to members who have expressed approval in recent votes. It basically means that by voting yes on a proposal you are committing to a decision in the Org.
The main changes that have been implemented which differ from the original Voting app are:
- Removed the ability for a user to change their vote.
- Added a buffer period which determines how much time in blocks must pass between the start of each vote.
- Added an execution delay period in blocks (this means that the
full vote duration
+full execution delay period
must pass before being able to execute a vote in case it passes). - Removed the early execution functionality.
- Changed the vote duration to blocks. The main reason for this is that since proposals are queued we do not necessarily know which block number to use for the vote snapshot (since we are not necessarily processing the transaction right when the vote starts).
- Keep track of the latest vote ids users have voted yes on.
- Make the app an ACL Oracle.
???? Security Review Status: Contracts frozen for audit as of commit e5b06df5c6bf3c289ce1abc02b7faa1efb0b65f4
The code in this repo has not been audited.
How does it work?
It has the same funcionality as the regular voting app with some exceptions:
- Proposals are now queued with a minimum number of blocks between the start of each one.
- Users cannot change their decision after they have already voted.
- Votes are delayed a configurable period of time since when they are closed till when they can be executed (in the case they pass).
- Votes cannot be early executed. This means that the
full vote duration
+ thefull delay period
has to pass in order to be able to execute a vote (in case it passes).
It also acts as an ACL Oracle. ACL Oracles are small helper functions that plug in to Aragon's access control list (ACL) to do more sophisticated permission evaluation. This Oracle is intended to restrict actions to members who have expressed approval in recent votes.
The app keeps track of the latest vote ids users have voted yes on. This way when the Oracle function is queried, it can properly evaluate whether a member can perform a certain action or not within the Organization.
In the context of Dandelion Orgs, the redeem functionality will be guarded by a role set behind this ACL Oracle. This means that whenever a user wants to redeem some tokens, it will first call the ACL Oracle function to check whether s/he can perform the action or not.
Users will be able to redeem tokens if one of this conditions is met:
- The latest vote in which the user voted yea failed (did not passed) and the execution delay for this vote has already passed.
- The latest vote in which the user voted yea passed and has been executed.
- The latest vote in which the user voted yea passed and the fallback period has passed.
What's the fallback period ?
The fallback period is intended to ensure users are both locked in for votes they voted yes on, but still have an opportunity to exit before the next vote that they didn't vote yes on gets executed. The idea here is that it gives other members an opportunity to execute the vote before anyone who voted yes on the proposal has the opportunity to exit. It also takes into account the possibility of a vote to fail its execution due to reasons that are outside of the Org's control.
Initialization
The Dandelion Voting app is initialized with a MiniMeToken _token
, uint64 _supportRequiredPct
, uint64 _minAcceptQuorumPct
, uint64 _durationBlocks
, uint64 _bufferBlocks
and uint64 _executionDelayBlocks
.
MiniMeToken _token
refers to the token that will be used to voteuint64 _supportRequiredPct
refers to the support required to pass a voteuint64 _minAcceptQuorumPct
refers to the quorum required to pass a voteuint64 _durationBlocks
refers to the number of blocks that a vote stays openuint64 _bufferBlocks
refers to the minimum number of blocks between the start block of each voteuint64 _executionDelayBlocks
refers to the number of blocks that a vote will be delayed from when is closed to when it actually can be executed (in case it passes).
Roles
The Dandelion Voting app should implement the following roles:
- CREATEVOTESROLE: This allows for changing the Aragon app that can create votes
- MODIFYSUPPORTROLE: This allows for changing the amount of support required to pass a vote
- MODIFYQUORUMROLE: This allows for changing the quorum required to pass votes
- MODIFYBUFFERBLOCKS_ROLE: This allows for changing the minimum number of blocks between the start block of each vote
- MODIFYEXECUTIONDELAY_ROLE; This allows for changing the number of blocks that votes are delayed from when they are closed till when they can be executed (in case they pass).
Interface
The interface is pretty much the same as the original Voting app with the exception that now you can see when future votes will start (upcoming votes).
How to try Dandelion Voting app immediately
Template
If you would like to see the Dandelion Voting App in action, we recommend the Dandelion Org template available in the Aragon templates directory. Just go to https://preview.1hive.org/, then create a new organization, and choose Dandelion from the template options.
How to run the Dandelion Voting app locally
Git clone this repo.
git clone https://github.com/1Hive/dandelion-voting-app.git
Navigate into the dandelion-voting-app
directory.
cd dandelion-voting-app
Install npm dependencies.
npm i
Deploy a dao with Dandelion Voting app installed on your local environment.
npm run start:template
Aragon DAO Installation
For a detailed step by step guide you can see our installation guide
To deploy to an organization you can use the aragonCLI.
aragon dao install <dao-address> dandelion-voting.open.aragonpm.eth --app-init-args <token-address> <supportRequiredPct> <minAcceptQuorumPct> <durationBlocks> <bufferBlocks> <executionDelayBlocks>
Contributing
We welcome community contributions!
Please check out our open Issues to get started.
If you discover something that could potentially impact security, please notify us immediately. The quickest way to reach us is via the #dev channel in our team Keybase chat. Just say hi and that you discovered a potential security vulnerability and we'll DM you to discuss details.