forked from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
43 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,31 @@ import {TokenVoting} from "./TokenVoting.sol"; | |
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; | ||
import {IVotesUpgradeable} from "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol"; | ||
|
||
import {IPermissionCondition} from "@aragon/osx-commons-contracts/src/permission/condition/IPermissionCondition.sol"; | ||
import {PermissionCondition} from "@aragon/osx-commons-contracts/src/permission/condition/PermissionCondition.sol"; | ||
|
||
/// @title VotingPowerCondition | ||
/// @notice Checks if an account's voting power or token balance meets the threshold set | ||
/// in an associated TokenVoting plugin. | ||
/// @author Aragon X - 2024 | ||
/// @custom:security-contact [email protected] | ||
contract VotingPowerCondition is PermissionCondition { | ||
/// @notice The address of the `TokenVoting` plugin used to fetch voting power settings. | ||
TokenVoting private immutable TOKEN_VOTING; | ||
|
||
/// @notice The `IVotesUpgradeable` token interface used to check token balance. | ||
IVotesUpgradeable private immutable VOTING_TOKEN; | ||
|
||
/// @notice Initializes the contract with the `TokenVoting` plugin address and fetches the associated token. | ||
/// @param _tokenVoting The address of the `TokenVoting` plugin. | ||
constructor(address _tokenVoting) { | ||
TOKEN_VOTING = TokenVoting(_tokenVoting); | ||
VOTING_TOKEN = TOKEN_VOTING.getVotingToken(); | ||
} | ||
|
||
/// @inheritdoc IPermissionCondition | ||
/// @dev The function checks both the voting power and token balance to ensure `_who` meets the minimum voting | ||
/// threshold defined in the `TokenVoting` plugin. Returns `false` if the minimum requirement is unmet. | ||
function isGranted( | ||
address _where, | ||
address _who, | ||
|
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