Skip to main content

VoteRules

VoteRules

Defines the rules and logic for determining if a user is eligible to vote for invalidation.

This contract calculates voting eligibility based on a user's levels relative to their user type's average levels.

INITIAL_USER_COUNT_THRESHOLD

uint256 INITIAL_USER_COUNT_THRESHOLD

The threshold of total users below (or equal to) which any user can invite. This allows for easier invitations in the early stages of the system.

communityRules

contract ICommunityRules communityRules

CommunityRules contract interface.

contributorRules

contract IContributorRules contributorRules

ContributorRules contract interface.

developerRules

contract IDeveloperRules developerRules

DeveloperRules contract interface.

researcherRules

contract IResearcherRules researcherRules

ResearcherRules contract interface.

constructor

constructor(address communityRulesAddress, address contributorRulesAddress, address developerRulesAddress, address researcherRulesAddress) public

Initializes the contract with the addresses of the various rule contracts.

Parameters

NameTypeDescription
communityRulesAddressaddressAddress of the CommunityRules contract.
contributorRulesAddressaddressAddress of the ContributorRules contract.
developerRulesAddressaddressAddress of the DeveloperRules contract.
researcherRulesAddressaddressAddress of the ResearcherRules contract.

canVote

function canVote(address addr) public view returns (bool)

Checks if a given address is eligible to send a vote based on predefined rules.

This function calculates a user's eligibility by comparing their levels to the average levels of their user type. It also requires the user to be designated as a 'voter' in CommunityRules.

Parameters

NameTypeDescription
addraddressThe address of the user to check.

Return Values

NameTypeDescription
[0]boolbool True if the user can vote, false otherwise.