-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [x] Allow to add tally results and keep them onchain - [x] Update cli commands
- Loading branch information
Showing
15 changed files
with
1,292 additions
and
117 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
packages/contracts/contracts/interfaces/IPayoutStrategy.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import { IPoll } from "./IPoll.sol"; | ||
|
||
/// @title IPayoutStrategy | ||
/// @notice Interface responsible for payout strategy | ||
interface IPayoutStrategy { | ||
/// @notice Strategy initialization params | ||
struct StrategyInit { | ||
/// @notice The cooldown duration for withdrawal extra funds | ||
uint256 cooldownTime; | ||
/// @notice The max contribution amount | ||
uint256 maxContribution; | ||
/// @notice The payout token | ||
address payoutToken; | ||
/// @notice The poll address | ||
address poll; | ||
} | ||
|
||
/// @notice Claim params | ||
struct Claim { | ||
/// @notice The index of the vote option to verify the correctness of the tally | ||
uint256 index; | ||
/// @notice The voice credit options received for recipient | ||
uint256 voiceCreditsPerOption; | ||
/// @notice Flattened array of the tally | ||
uint256 tallyResult; | ||
/// @notice The total amount of voice credits spent | ||
uint256 totalSpent; | ||
/// @notice Corresponding proof of the tally result | ||
uint256[][] tallyResultProof; | ||
/// @notice The respective salt in the results object in the tally.json | ||
uint256 tallyResultSalt; | ||
/// @notice Depth of the vote option tree | ||
uint8 voteOptionTreeDepth; | ||
/// @notice hashLeftRight(number of spent voice credits, spent salt) | ||
uint256 spentVoiceCreditsHash; | ||
/// @notice hashLeftRight(merkle root of the no spent voice | ||
uint256 perVOSpentVoiceCreditsHash; | ||
} | ||
|
||
/// @notice Total deposited amount | ||
function totalAmount() external view returns (uint256); | ||
|
||
/// @notice The cooldown timeout | ||
function cooldown() external view returns (uint256); | ||
|
||
/// @notice Deposit amount | ||
/// @param amount The amount | ||
function deposit(uint256 amount) external; | ||
|
||
/// @notice Withdraw extra amount | ||
/// @param receivers The receivers addresses | ||
/// @param amounts The amounts | ||
function withdrawExtra(address[] calldata receivers, uint256[] calldata amounts) external; | ||
|
||
/// @notice Claim funds for recipient | ||
/// @param params The claim params | ||
function claim(Claim calldata params) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.