-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gov powers; prevent full slashing
- Loading branch information
Showing
18 changed files
with
1,040 additions
and
264 deletions.
There are no files selected for viewing
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,89 @@ | ||
// SPDX-License-Identifier: agpl-3.0 | ||
pragma solidity 0.7.5; | ||
|
||
interface IGovernancePowerDelegationERC20 { | ||
|
||
enum DelegationType { | ||
VOTING_POWER, | ||
PROPOSITION_POWER | ||
} | ||
|
||
/** | ||
* @dev Emitted when a user delegates governance power to another user. | ||
* | ||
* @param delegator The delegator. | ||
* @param delegatee The delegatee. | ||
* @param delegationType The type of delegation (VOTING_POWER, PROPOSITION_POWER). | ||
*/ | ||
event DelegateChanged( | ||
address indexed delegator, | ||
address indexed delegatee, | ||
DelegationType delegationType | ||
); | ||
|
||
/** | ||
* @dev Emitted when an action changes the delegated power of a user. | ||
* | ||
* @param user The user whose delegated power has changed. | ||
* @param amount The new amount of delegated power for the user. | ||
* @param delegationType The type of delegation (VOTING_POWER, PROPOSITION_POWER). | ||
*/ | ||
event DelegatedPowerChanged(address indexed user, uint256 amount, DelegationType delegationType); | ||
|
||
/** | ||
* @dev Delegates a specific governance power to a delegatee. | ||
* | ||
* @param delegatee The address to delegate power to. | ||
* @param delegationType The type of delegation (VOTING_POWER, PROPOSITION_POWER). | ||
*/ | ||
function delegateByType(address delegatee, DelegationType delegationType) external virtual; | ||
|
||
/** | ||
* @dev Delegates all governance powers to a delegatee. | ||
* | ||
* @param delegatee The user to which the power will be delegated. | ||
*/ | ||
function delegate(address delegatee) external virtual; | ||
|
||
/** | ||
* @dev Returns the delegatee of an user. | ||
* | ||
* @param delegator The address of the delegator. | ||
* @param delegationType The type of delegation (VOTING_POWER, PROPOSITION_POWER). | ||
*/ | ||
function getDelegateeByType(address delegator, DelegationType delegationType) | ||
external | ||
view | ||
virtual | ||
returns (address); | ||
|
||
/** | ||
* @dev Returns the current delegated power of a user. The current power is the power delegated | ||
* at the time of the last snapshot. | ||
* | ||
* @param user The user whose power to query. | ||
* @param delegationType The type of power (VOTING_POWER, PROPOSITION_POWER). | ||
*/ | ||
function getPowerCurrent(address user, DelegationType delegationType) | ||
external | ||
view | ||
virtual | ||
returns (uint256); | ||
|
||
/** | ||
* @dev Returns the delegated power of a user at a certain block. | ||
* | ||
* @param user The user whose power to query. | ||
* @param blockNumber The block number at which to get the user's power. | ||
* @param delegationType The type of power (VOTING_POWER, PROPOSITION_POWER). | ||
*/ | ||
function getPowerAtBlock( | ||
address user, | ||
uint256 blockNumber, | ||
DelegationType delegationType | ||
) | ||
external | ||
view | ||
virtual | ||
returns (uint256); | ||
} |
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
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
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.