hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
67 stars 44 forks source link

🪣 POC: Onchain Points Calculation #8612

Open zakhap opened 3 months ago

zakhap commented 3 months ago

Description

How Points fit in (Using the language of the WhitePaper)

A Loop requires the ability to reward participants

Community members earn Points as their Reward.

Similar to a VotingStrategy in Snapshot, Points are calculated via a PointStrategy and are a Score.

Because Points can be calculated permissionlessly onchain (via a read function anyone can call), Points can be used by anyone building on or with a community. Some example ways points can be used:

A community can have many PointStrategy contracts that are used toward different ends.

The actions that communities members can take as a part of a Loop are the inputs on the PointStrategy. Examples:

Project Owner

zakhap

PRD (LOCKED DOC for POC)

Including an overview of a potential contract architecture, for consideration: https://www.notion.so/buildcommon/Points-toward-a-Spec-97be198d11b7483f9a97b0529db8f5b5

Tasks

User Story 1: Setting Up a Reward System for a Community

As a community manager, I want to set up a PointsContract that rewards community members for their participation, so that I can incentivize and acknowledge their contributions.

Acceptance Criteria I can deploy a new PointsContract using the PointsFactory with initial point sources. I can add multiple point sources to the PointsContract, specifying the contract address, function selector, and multiplier. Community members can view their current points by calling the calculatePoints function. I can remove point sources from the PointsContract when they are no longer relevant. The PointsContract emits an event when a point source is added or removed.

User Story 2: Securely Managing PointsContract Ownership

As a PointsContract owner, I want to securely manage the addition and removal of point sources, so that the integrity of the reward system is maintained.

Acceptance Criteria Only the owner of the PointsContract can add or remove point sources. The PointsContract emits events when point sources are added or removed. The contract prevents reentrancy attacks when adding or removing point sources. Ownership can be transferred securely to another address if needed.

Additional Context

This is a POC bucket ticket, to dig into implementation issues that arise through iteration and development of this aspect of our Protocol.

How this fits into the UI + interacts with other parts of the system we're building is still TBD, but some potential avenues are discussed in the Doc.

ForestMars commented 3 months ago

Per Refinement, closing out this milestone, as we only have this 1 bucket (and don't need both a bucket and milestone.)