-
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] Use tally as payout strategy - [x] Add deposit/claim/withdraw functions - [x] Add tests - [x] Add pause for tally in poll deploy script - [x] Update deploy config - [x] Add tally initialization - [x] Add batch method for rewards calculation
- Loading branch information
Showing
18 changed files
with
1,687 additions
and
274 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
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,53 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
/// @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 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 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.