2020-11-18 09:16:51 +00:00
|
|
|
package communities
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
|
|
var ErrChatNotFound = errors.New("chat not found")
|
2021-05-23 13:34:17 +00:00
|
|
|
var ErrCategoryNotFound = errors.New("category not found")
|
2021-08-25 16:52:28 +00:00
|
|
|
var ErrNoChangeInPosition = errors.New("no change in category position")
|
2021-05-23 13:34:17 +00:00
|
|
|
var ErrChatAlreadyAssigned = errors.New("chat already assigned to a category")
|
2020-11-18 09:16:51 +00:00
|
|
|
var ErrOrgNotFound = errors.New("community not found")
|
2023-05-29 17:57:05 +00:00
|
|
|
var ErrOrgAlreadyJoined = errors.New("community already joined")
|
2020-11-18 09:16:51 +00:00
|
|
|
var ErrChatAlreadyExists = errors.New("chat already exists")
|
2021-05-23 13:34:17 +00:00
|
|
|
var ErrCategoryAlreadyExists = errors.New("category already exists")
|
2020-11-18 09:16:51 +00:00
|
|
|
var ErrCantRequestAccess = errors.New("can't request access")
|
|
|
|
var ErrInvalidCommunityDescription = errors.New("invalid community description")
|
|
|
|
var ErrInvalidCommunityDescriptionNoOrgPermissions = errors.New("invalid community description no org permissions")
|
|
|
|
var ErrInvalidCommunityDescriptionNoChatPermissions = errors.New("invalid community description no chat permissions")
|
|
|
|
var ErrInvalidCommunityDescriptionUnknownChatAccess = errors.New("invalid community description unknown chat access")
|
|
|
|
var ErrInvalidCommunityDescriptionUnknownOrgAccess = errors.New("invalid community description unknown org access")
|
|
|
|
var ErrInvalidCommunityDescriptionMemberInChatButNotInOrg = errors.New("invalid community description member in chat but not in org")
|
2021-05-23 13:34:17 +00:00
|
|
|
var ErrInvalidCommunityDescriptionCategoryNoID = errors.New("invalid community category id")
|
|
|
|
var ErrInvalidCommunityDescriptionCategoryNoName = errors.New("invalid community category name")
|
2021-06-02 08:54:53 +00:00
|
|
|
var ErrInvalidCommunityDescriptionChatIdentity = errors.New("invalid community chat name, missing")
|
|
|
|
var ErrInvalidCommunityDescriptionDuplicatedName = errors.New("invalid community chat name, duplicated")
|
2021-05-23 13:34:17 +00:00
|
|
|
var ErrInvalidCommunityDescriptionUnknownChatCategory = errors.New("invalid community category in chat")
|
2022-06-24 13:40:12 +00:00
|
|
|
var ErrInvalidCommunityTags = errors.New("invalid community tags")
|
2020-11-18 09:16:51 +00:00
|
|
|
var ErrNotAdmin = errors.New("no admin privileges for this community")
|
2023-06-14 14:15:46 +00:00
|
|
|
var ErrNotOwner = errors.New("no owner privileges for this community")
|
2023-10-18 15:04:02 +00:00
|
|
|
var ErrNotControlNode = errors.New("not a control node")
|
2020-11-18 09:16:51 +00:00
|
|
|
var ErrInvalidGrant = errors.New("invalid grant")
|
|
|
|
var ErrNotAuthorized = errors.New("not authorized")
|
2021-01-11 10:32:51 +00:00
|
|
|
var ErrAlreadyMember = errors.New("already a member")
|
2022-08-22 10:10:31 +00:00
|
|
|
var ErrAlreadyJoined = errors.New("already joined")
|
2020-11-18 09:16:51 +00:00
|
|
|
var ErrInvalidMessage = errors.New("invalid community description message")
|
2022-12-02 11:34:02 +00:00
|
|
|
var ErrMemberNotFound = errors.New("member not found")
|
2023-03-02 16:27:48 +00:00
|
|
|
var ErrTokenPermissionAlreadyExists = errors.New("token permission already exists")
|
|
|
|
var ErrTokenPermissionNotFound = errors.New("token permission not found")
|
Check token funds when handling community requests to join
This adds checks to `HandleCommunityRequestToJoin` and
`AcceptRequestToJoinCommunity` that ensure a given user's revealed
wallet addresses own the token funds required by a community.
When community has token permissions of type `BECOME_MEMBER`, the
following happens when the owner receives a request:
1. Upon verifying provided wallet addresses by the requester, the owner
node accumulates all token funds related to the given wallets that
match the token criteria in the configured permissions
2. If the requester does not meet the necessary requirements, the
request to join will be declined. If the requester does have the
funds, he'll either be automatically accepted to the community, or
enters the next stage where an owner needs to manually accept the
request.
3. The the community does not automatically accept users, then the funds
check will happen again, when the owner tries to manually accept the
request. If the necessary funds do not exist at this stage, the
request will be declined
4. Upon accepting, whether automatically or manually, the owner adds the
requester's wallet addresses to the `CommunityDescription`, such that
they can be retrieved later when doing periodic checks or when
permissions have changed.
2023-03-16 14:35:33 +00:00
|
|
|
var ErrNoPermissionToJoin = errors.New("member has no permission to join")
|
|
|
|
var ErrMemberWalletAlreadyExists = errors.New("member wallet already exists")
|
|
|
|
var ErrMemberWalletNotFound = errors.New("member wallet not found")
|
2023-06-14 14:15:46 +00:00
|
|
|
var ErrNotEnoughPermissions = errors.New("not enough permissions for this community")
|
2023-06-23 07:02:12 +00:00
|
|
|
var ErrCannotRemoveOwnerOrAdmin = errors.New("not allowed to remove admin or owner")
|
|
|
|
var ErrCannotBanOwnerOrAdmin = errors.New("not allowed to ban admin or owner")
|
2023-08-04 10:28:46 +00:00
|
|
|
var ErrInvalidManageTokensPermission = errors.New("no privileges to manage tokens")
|
2023-11-27 09:54:46 +00:00
|
|
|
var ErrRevealedAccountsAbsent = errors.New("revealed accounts is absent")
|
|
|
|
var ErrNoRevealedAccountsSignature = errors.New("revealed accounts without the signature")
|
2023-12-14 09:52:10 +00:00
|
|
|
var ErrNoFreeSpaceForHistoryArchives = errors.New("history archive: No free space for downloading history archives")
|