The RFPCommitteeStrategy
contract extends the functionality of the RFPSimpleStrategy
contract to implement a strategy where a committee of members vote to select a recipient for RFP allocation. This contract enhances the base strategy by introducing a voting mechanism and threshold to determine the accepted recipient.
sequenceDiagram
participant Alice
participant PoolManager
participant Allo
participant RFPCommitteeStrategy
PoolManager->>Allo: createPool() with RFPCommittee
Allo-->>PoolManager: poolId
Alice->>+Allo: registerRecipient()
Allo->>RFPCommitteeStrategy: registerRecipient()
RFPCommitteeStrategy-->>Allo: recipient1
Allo-->>-Alice: recipientId1
PoolManager->>+Allo: allocate() (if threshold: accepts a recipient and allocate proposal bid, else: store vote)
Allo-->>-RFPCommitteeStrategy: allocate() (if threshold: accepts a recipient and allocate proposal bid, else: store vote)
PoolManager->> RFPCommitteeStrategy: setMilestones()
Alice->> RFPCommitteeStrategy: submitUpcomingMilestone()
PoolManager->> RFPCommitteeStrategy: rejectMilestone()
Alice->> RFPCommitteeStrategy: submitUpcomingMilestone()
PoolManager->>+Allo: distribute() ( mnextilestone for recipient)
Allo-->>-RFPCommitteeStrategy: distribute() (next milestone for recipient)
PoolManager->>RFPCommitteeStrategy: setPoolActive() to close pool
- License: The
RFPCommitteeStrategy
contract operates under the AGPL-3.0-only License. - Solidity Version: Developed using Solidity version 0.8.19.
- Inheritance: Inherits functionality from the
RFPSimpleStrategy
contract. - Events: Introduces an additional event
Voted
to signal committee member votes. - Storage Variables: Adds new storage variables for voting and threshold management.
Voted
: Emitted when a committee member casts a vote for a recipient.
voteThreshold
: The minimum number of votes required for a recipient to be accepted.votedFor
: Maps committee member addresses to the recipient they voted for.votes
: Maps recipient addresses to the number of votes received.
The constructor initializes the strategy by accepting the address of the IAllo
contract and a name. It then invokes the constructor of the RFPCommitteeStrategy
contract.
The initialize
function decodes and initializes parameters passed during strategy creation. It sets specific strategy variables and initializes the vote threshold.
The _allocate
function is overridden to incorporate the committee voting mechanism. It verifies whether the sender has already voted, registers the vote, and if the vote threshold is reached, accepts the recipient. The function then updates the recipient's status, deactivates the pool, and emits relevant events.
- Committee member initiates an allocation.
- Verifies if sender is authorized to allocate.
- Checks if an accepted recipient is already selected.
- Retrieves the recipient ID to allocate for.
- Removes the old vote if applicable.
- Casts a vote for the recipient and updates the votes mapping.
- If the vote threshold is reached:
- Marks the recipient as accepted.
- Deactivates the pool.
- Emits
Allocated
event.
Overrides the _allocate
function from the parent contract to incorporate the committee voting mechanism.