Skip to main content

ICommunityRules

ICommunityRules​

Interface for the CommunityRules contract, which manages the rules for users.

userTypesCount​

function userTypesCount(enum CommunityTypes.UserType userType) external view returns (uint256)

Returns the count of a specific user type.

Getter for the public state variable mapping(UserType => uint256) public userTypesCount.

Parameters​

NameTypeDescription
userTypeenum CommunityTypes.UserTypeThe user type to query.

Return Values​

NameTypeDescription
[0]uint256The count of users for that type.

userTypesTotalCount​

function userTypesTotalCount(enum CommunityTypes.UserType userType) external view returns (uint64)

Returns the total count of a user type (used for generating IDs).

Getter for the public state variable mapping(UserType => uint64) public userTypesTotalCount.

Parameters​

NameTypeDescription
userTypeenum CommunityTypes.UserTypeThe user type to query.

Return Values​

NameTypeDescription
[0]uint64The total count for that type.

addUser​

function addUser(address user, enum CommunityTypes.UserType userType) external

Adds a new user to the system with a specific type.

Parameters​

NameTypeDescription
useraddressThe address of the new user.
userTypeenum CommunityTypes.UserTypeThe type to be assigned to the new user.

userTypeIs​

function userTypeIs(enum CommunityTypes.UserType userType, address user) external view returns (bool)

Checks if a user is of a specific type.

Parameters​

NameTypeDescription
userTypeenum CommunityTypes.UserTypeThe user type to check against.
useraddressThe address of the user to check.

Return Values​

NameTypeDescription
[0]boolbool true if the user is of the specified type, false otherwise.

isDenied​

function isDenied(address user) external view returns (bool)

Checks if a user is denied.

Parameters​

NameTypeDescription
useraddressThe address of the user to check.

Return Values​

NameTypeDescription
[0]boolbool if the user is denied, so true, false otherwise.

getInvitation​

function getInvitation(address userAddress) external view returns (struct CommunityTypes.Invitation)

Gets the invitation data for a specific address.

Parameters​

NameTypeDescription
userAddressaddressThe address of the invited user.

Return Values​

NameTypeDescription
[0]struct CommunityTypes.InvitationThe Invitation struct containing the invitation data.

getUser​

function getUser(address account) external view returns (enum CommunityTypes.UserType)

Retrieves the UserType for a given account.

Parameters​

NameTypeDescription
accountaddressThe address of the user.

Return Values​

NameTypeDescription
[0]enum CommunityTypes.UserTypeThe user's UserType enum.

addInvitation​

function addInvitation(address inviter, address invitee, enum CommunityTypes.UserType userType) external

Adds a new invitation to the system.

Parameters​

NameTypeDescription
inviteraddressThe user who is sending the invitation.
inviteeaddressThe user who is being invited.
userTypeenum CommunityTypes.UserTypeThe UserType being assigned in the invitation.

getUserTypeSettings​

function getUserTypeSettings(enum CommunityTypes.UserType userType) external view returns (struct CommunityTypes.UserTypeSetting)

Retrieves the settings configuration for a specific UserType.

Returns a struct from which specific settings can be accessed.

Parameters​

NameTypeDescription
userTypeenum CommunityTypes.UserTypeThe UserType for which to get the settings.

Return Values​

NameTypeDescription
[0]struct CommunityTypes.UserTypeSettingThe UserTypeSettings struct containing configuration data.

setToDenied​

function setToDenied(address account) external

Sets a user's type to a 'denied' or 'invalid' state.

Parameters​

NameTypeDescription
accountaddressThe address of the user to be denied.

votersCount​

function votersCount() external view returns (uint256)

Returns the total number of users eligible to vote.

This might be a getter for a public state variable.

Return Values​

NameTypeDescription
[0]uint256The total count of voters.

isVoter​

function isVoter(address account) external view returns (bool)

Checks if a given account has voting rights.

Parameters​

NameTypeDescription
accountaddressThe address of the account to check.

Return Values​

NameTypeDescription
[0]booltrue if the account is a voter, false otherwise.

addInviterPenalty​

function addInviterPenalty(address inviter) external

Function to add inviter penalties when invited user is denied.

Parameters​

NameTypeDescription
inviteraddressThe address of the account the inviter to receive penalty.

inviterPenalties​

function inviterPenalties(address addr) external view returns (uint16)

Returns the total count of invitation penalties of a user.

Getter for the public state variable mapping(address => uint16) public inviterPenalties.

Parameters​

NameTypeDescription
addraddressThe user address.

Return Values​

NameTypeDescription
[0]uint16The total count of penlaties for that user.