Skip to content

MinVotingPowerCondition ​

Contract · src/conditions/MinVotingPowerCondition.sol

Explained in: Lock to Vote Plugin

Author: Aragon X - 2024

Inherits: PermissionCondition

Checks if an account's voting power or token balance meets the threshold defined on the given plugin.

security-contact: sirt@aragon.org

Constructor ​

constructor ​

solidity
constructor(ILockToGovernBase _plugin)

Initializes the contract with the ILockToGovernBase plugin address and caches the associated token.

ParameterTypeDescription
_pluginILockToGovernBaseThe address of the ILockToGovernBase plugin.

Functions ​

getRequiredLockAmount ​

solidity
function getRequiredLockAmount(address _who) external view returns (uint256)

Selector: 0x0e14d0d6

isGranted ​

solidity
function isGranted(
    address _where,
    address _who,
    bytes32 _permissionId,
    bytes _data
) external view returns (bool)

Selector: 0x2675fdd0

Checks if a call is permitted.

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.

ParameterTypeDescription
_whereaddressThe address of the target contract.
_whoaddressThe address (EOA or contract) for which the permissions are checked.
_permissionIdbytes32The permission identifier.
_databytesOptional data passed to the PermissionCondition implementation.
ReturnsTypeDescription
[0]boolReturns true if the call is permitted.

protocolVersion ​

solidity
function protocolVersion() external pure returns (uint8[3])

Selector: 0x2ae9c600

Returns the semantic Aragon OSx protocol version number that the implementing contract is associated with.

Dev: This version number is not to be confused with the release and build numbers found in the Version.Tag struct inside the PluginRepo contract being used to version plugin setup and associated plugin implementation contracts.

ReturnsTypeDescription
[0]uint8[3]Returns the semantic Aragon OSx protocol version number.

supportsInterface ​

solidity
function supportsInterface(bytes4 _interfaceId) external view returns (bool)

Selector: 0x01ffc9a7

Checks if an interface is supported by this or its parent contract.

ParameterTypeDescription
_interfaceIdbytes4The ID of the interface.

Constants ​

Public, so each is also readable through a generated getter.

lockManager ​

solidity
ILockManager public immutable lockManager;

The address of the LockManager used by the plugin.

plugin ​

solidity
ILockToGovernBase public immutable plugin;

The address of the ILockToGovernBase plugin used to fetch the settings from.

token ​

solidity
IERC20 public immutable token;

The IERC20 token interface used to check token balance.