Matching Round
The MatchingRound contract contains the logic of a Kickflow match-funding round. It collects sponsorship funds, accepts project entries, allows contributions and finally withdrawal of match amount by the projects.
The Matching Round is governed by Flow DAO, and there are certain protected entrypoints that can only be called by a proposal that has passed the vote in the DAO.

Design

Initiation

For every new match-funding round, a fresh MatchingRound contract is deployed. The currently active round contract's address is stored in the DonationHandler contract's storage.
The round contract to which the DonationHandler points too, can be changed by submitting a proposal in the DAO. This essentially means that every new match-funding round must be approved by the DAO.
Fresh Matching Round being approved by the DAO
Sponsorships for a match-funding round are collected preferably in a stablecoin, the address of which is mentioned in the storage. A stablecoin is chosen due to its relatively low price volatility, which assists in match amount calculation.

Lifecycle & Timeline

Right after a round is approved by the DAO, it is opened up to sponsorship collection and project entries. Sponsoring and entries continue for a pre-decided period of time (specified in the proposal).
Post this, the community can make their contributions that would be counted in the CLR match calculation of the project entries. Once the contribution period is over, there is a brief cooldown period, followed by which the DAO sets the CLR matches of the entries. The projects can then retrieve their match amount after a brief challenge period when the CLR matches set by the DAO can be disputed and reset through another proposal.
Lifecycle of a Match-Funding Round
A description of the storage, entrypoints and timeline could be found here.

Entering a Round

Projects can enter a round by supplying their Tezos address to the enter_round entrypoint. Every entry must deposit a returnable stake in tez. The value of the deposit could vary across rounds.
The security deposit is a part of one of the multiple collusion prevention aspects. It would keep spam entries at bay.
Entries are stored in a dedicated entries big_map indexed by an incrementing id. Each entry has the fields mentioned in this types file.
Any project that is disqualified by the DAO for resorting to collusion and/or not following the rules of the system, would have its security deposit seized and transferred to the community fund.

Contributions

Contributions are handled in a two-step process-
  • Calling of the donate entrypoint in the DonationHandler contract, to relay the contribution amount to the project's wallet address.
  • The donate entrypoint subsequently making an inter-contract call to the contribute entrypoint of MatchingRound contract and record the amount, contributor address and token of contribution.
Contributions must be made in a token that is present in the token_set of the round. The set of tokens that would be accepted during a round are predefined during contract deployment. Contributions are accepted only from a limited number of tokens based on their present market liquidity and ease of fetching the price during CLR match calculation.

Disqualification

Disqualification is done by means of submitting a proposal in the DAO. The disqualify entrypoint is called by a proposal that has passed the vote.
Once the community contributions stop, a cooldown period starts in the round, which gives extra time to the community to identify and remove potential violaters from the round.
Disqualifications are not limited to the cooldown period, and entries can be disqualified even during the contribution phase.
As mentioned above, the disqualified project loses its security stake.

Setting CLR Matches

The CLR matches that the entries would be retrieving from the sponsor pool is also set by means of submitting a proposal in the DAO. The CLR matches are calculated off-chain for precision and to overcome the limitations of gas on the blockchain.
The matches can be set only after the cooldown period is over. Once the DAO sets the match, a brief challenge period begins, during which the currently set matches can be disputed and set again by means of a fresh proposal.