Clarity-Innovation-Lab / ecosystem-dao

An instance of Executor DAO - a community DAO project
MIT License
2 stars 1 forks source link

Off-chain voting and SIP-018 #3

Open radicleart opened 2 years ago

radicleart commented 2 years ago

Prop for Implementing Off Chain Voting

This is a suggestion for implementing off-chain or batch voting alongside the model for delegate voting see -PR 2.

The solution is based on / mirrors the reference implementation of SIP-018 - see money-order example.

The solution only impacts the EDE001 Proposal Voting extension introducing a new function batch-vote which overrides vote for off-chain voting.

The vote data contains the voter principal and the signature is created by voter - note this is compatible with delegate voting since it makes no difference whether the voter is a delegate (proxy) voter or direct voter.

(batch-vote (signed-votes (list 100 { signature: (buff 65), 
               vote: {
                    amount: uint, 
                    for: bool, 
                    proposal: principal, 
                    governance-token: <governance-token-trait>, 
                    voter: principal}})))
      ...
      (fold batch-vote-iter signed-votes (ok true))

The votes are unfolded and the signatures checked before counting the vote on the proposal.

E.g.

(batch-vote-iter (signed-vote { signature: (buff 65), vote: {
                amount: uint, for: bool, proposal: principal, 
                governance-token: <governance-token-trait>, voter: principal}}))

(verify-signed-structured-data ...