一、整体结构
文档参考: Move版 Snapshot 1.0需求列表
space:空间,一个空间可以理解为一个运营方,负责跟踪提案、投票的全局设置,其包含多个提案,空间中有一些Meta data(头像,描述,主站信息等),DaoSpace用以负责描述空间信息,每个项目方均可通过调用DaoSpace::add来对其进行注册空间
// DaoSpace.move module DaoSpace { struct Space { voting_delay: u128, // The delay between when a proposal is created, and when the voting starts. A voting_delay of 0 means that as soon as the proposal is created, anyone can vote. A voting_delay of 3600 means that voting will start 3600 seconds after the proposal is created. voting_duration: u128, // The duration of the voting period, i.e. how long people will be able to vote for a proposal. proposal_threshold: u128, // The minimum amount of voting power needed to be able to create a new proposal in the space. Used to avoid having anyone be able to create a proposal. voting_strategies: vector<u8>, //A list of voting strategy contracts addresses that define the voting strategies used by the space. The voting power of each user will be calculated as the sum of voting powers returned for each strategy in the list for that user. More information in the Voting Strategy section. authenticators: vector<address>// A list of accepted authenticators. These are the ways in which a user can authenticate themselves in order to vote or propose. For more information, refer to the Authenticators section. executor: Option::Option<Executor> // The execution strategy contract that will handle the execution of transactions inside proposals once voting is complete. More information about execution in the Execution Contract section } public fun add(signer: &signer, voting_delay: u128, voting_duration: u128, ); public fun query(broker: address) : (u128, u128, u128); }
(这里的Executor需要讨论一下Move设计方式)
proposal:提案,即一个提案代表一次投票过程,投票类型有单选投票、二次投票、排名投票、加权投票。
// DaoProposal.move module DaoProposal { struct Proposal<TokenT> };
二、流程
参考:
https://github.com/snapshot-labs/sx-core/blob/develop/docs/milestones/1.md snapshot x 合约架构图