From 596660c1106a5d991784a1372ba69a9f1e9b1f7e Mon Sep 17 00:00:00 2001 From: Pascal Precht <445106+0x-r4bbit@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:27:48 +0100 Subject: [PATCH] feat: add CommunityTokenPermission to community description This adds token permission capabilities to CommunityDescription such that token permissions can be created, updated and deleted. --- protocol/communities/community.go | 171 +++++-- protocol/communities/errors.go | 2 + protocol/communities/manager.go | 77 +++ protocol/messenger_communities.go | 50 ++ protocol/protobuf/communities.pb.go | 461 +++++++++++++----- protocol/protobuf/communities.proto | 26 + ...eate_community_token_permission_request.go | 58 +++ .../delete_community_token_permission.go | 26 + ...edit_community_token_permission_request.go | 32 ++ services/ext/api.go | 12 + 10 files changed, 750 insertions(+), 165 deletions(-) create mode 100644 protocol/requests/create_community_token_permission_request.go create mode 100644 protocol/requests/delete_community_token_permission.go create mode 100644 protocol/requests/edit_community_token_permission_request.go diff --git a/protocol/communities/community.go b/protocol/communities/community.go index 9e6d32d48..3bc70a315 100644 --- a/protocol/communities/community.go +++ b/protocol/communities/community.go @@ -95,23 +95,24 @@ func (o *Community) MarshalPublicAPIJSON() ([]byte, error) { return nil, errors.New("member identity not set") } communityItem := struct { - ID types.HexBytes `json:"id"` - Verified bool `json:"verified"` - Chats map[string]CommunityChat `json:"chats"` - Categories map[string]CommunityCategory `json:"categories"` - Name string `json:"name"` - Description string `json:"description"` - IntroMessage string `json:"introMessage"` - OutroMessage string `json:"outroMessage"` - Tags []CommunityTag `json:"tags"` - Images map[string]images.IdentityImage `json:"images"` - Color string `json:"color"` - MembersCount int `json:"membersCount"` - EnsName string `json:"ensName"` - Link string `json:"link"` - CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"` - Encrypted bool `json:"encrypted"` - BanList []string `json:"banList"` + ID types.HexBytes `json:"id"` + Verified bool `json:"verified"` + Chats map[string]CommunityChat `json:"chats"` + Categories map[string]CommunityCategory `json:"categories"` + Name string `json:"name"` + Description string `json:"description"` + IntroMessage string `json:"introMessage"` + OutroMessage string `json:"outroMessage"` + Tags []CommunityTag `json:"tags"` + Images map[string]images.IdentityImage `json:"images"` + Color string `json:"color"` + MembersCount int `json:"membersCount"` + EnsName string `json:"ensName"` + Link string `json:"link"` + CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"` + Encrypted bool `json:"encrypted"` + BanList []string `json:"banList"` + TokenPermissions map[string]*protobuf.CommunityTokenPermission `json:"tokenPermissions"` }{ ID: o.ID(), Verified: o.config.Verified, @@ -148,6 +149,8 @@ func (o *Community) MarshalPublicAPIJSON() ([]byte, error) { } communityItem.Chats[id] = chat } + + communityItem.TokenPermissions = o.config.CommunityDescription.TokenPermissions communityItem.MembersCount = len(o.config.CommunityDescription.Members) communityItem.Link = fmt.Sprintf("https://join.status.im/c/0x%x", o.ID()) communityItem.IntroMessage = o.config.CommunityDescription.IntroMessage @@ -183,33 +186,34 @@ func (o *Community) MarshalJSON() ([]byte, error) { return nil, errors.New("member identity not set") } communityItem := struct { - ID types.HexBytes `json:"id"` - Admin bool `json:"admin"` - Verified bool `json:"verified"` - Joined bool `json:"joined"` - Spectated bool `json:"spectated"` - RequestedAccessAt int `json:"requestedAccessAt"` - Name string `json:"name"` - Description string `json:"description"` - IntroMessage string `json:"introMessage"` - OutroMessage string `json:"outroMessage"` - Tags []CommunityTag `json:"tags"` - Chats map[string]CommunityChat `json:"chats"` - Categories map[string]CommunityCategory `json:"categories"` - Images map[string]images.IdentityImage `json:"images"` - Permissions *protobuf.CommunityPermissions `json:"permissions"` - Members map[string]*protobuf.CommunityMember `json:"members"` - CanRequestAccess bool `json:"canRequestAccess"` - CanManageUsers bool `json:"canManageUsers"` - CanDeleteMessageForEveryone bool `json:"canDeleteMessageForEveryone"` - CanJoin bool `json:"canJoin"` - Color string `json:"color"` - RequestedToJoinAt uint64 `json:"requestedToJoinAt,omitempty"` - IsMember bool `json:"isMember"` - Muted bool `json:"muted"` - CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"` - Encrypted bool `json:"encrypted"` - BanList []string `json:"banList"` + ID types.HexBytes `json:"id"` + Admin bool `json:"admin"` + Verified bool `json:"verified"` + Joined bool `json:"joined"` + Spectated bool `json:"spectated"` + RequestedAccessAt int `json:"requestedAccessAt"` + Name string `json:"name"` + Description string `json:"description"` + IntroMessage string `json:"introMessage"` + OutroMessage string `json:"outroMessage"` + Tags []CommunityTag `json:"tags"` + Chats map[string]CommunityChat `json:"chats"` + Categories map[string]CommunityCategory `json:"categories"` + Images map[string]images.IdentityImage `json:"images"` + Permissions *protobuf.CommunityPermissions `json:"permissions"` + Members map[string]*protobuf.CommunityMember `json:"members"` + CanRequestAccess bool `json:"canRequestAccess"` + CanManageUsers bool `json:"canManageUsers"` + CanDeleteMessageForEveryone bool `json:"canDeleteMessageForEveryone"` + CanJoin bool `json:"canJoin"` + Color string `json:"color"` + RequestedToJoinAt uint64 `json:"requestedToJoinAt,omitempty"` + IsMember bool `json:"isMember"` + Muted bool `json:"muted"` + CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"` + Encrypted bool `json:"encrypted"` + BanList []string `json:"banList"` + TokenPermissions map[string]*protobuf.CommunityTokenPermission `json:"tokenPermissions"` }{ ID: o.ID(), Admin: o.IsAdmin(), @@ -257,6 +261,7 @@ func (o *Community) MarshalJSON() ([]byte, error) { } communityItem.Chats[id] = chat } + communityItem.TokenPermissions = o.config.CommunityDescription.TokenPermissions communityItem.Members = o.config.CommunityDescription.Members communityItem.Permissions = o.config.CommunityDescription.Permissions communityItem.IntroMessage = o.config.CommunityDescription.IntroMessage @@ -432,6 +437,10 @@ type CommunityChanges struct { MembersAdded map[string]*protobuf.CommunityMember `json:"membersAdded"` MembersRemoved map[string]*protobuf.CommunityMember `json:"membersRemoved"` + TokenPermissionsAdded map[string]*protobuf.CommunityTokenPermission `json:"tokenPermissionsAdded"` + TokenPermissionsModified map[string]*protobuf.CommunityTokenPermission `json:"tokenPermissionsModified"` + TokenPermissionsRemoved []string `json:"tokenPermissionsRemoved"` + ChatsRemoved map[string]*protobuf.CommunityChat `json:"chatsRemoved"` ChatsAdded map[string]*protobuf.CommunityChat `json:"chatsAdded"` ChatsModified map[string]*CommunityChatChanges `json:"chatsModified"` @@ -1390,6 +1399,80 @@ func (o *Community) Categories() map[string]*protobuf.CommunityCategory { return response } +func (o *Community) AddTokenPermission(permission *protobuf.CommunityTokenPermission) (*CommunityChanges, error) { + o.mutex.Lock() + defer o.mutex.Unlock() + + if o.config.PrivateKey == nil { + return nil, ErrNotAdmin + } + + if o.config.CommunityDescription.TokenPermissions == nil { + o.config.CommunityDescription.TokenPermissions = make(map[string]*protobuf.CommunityTokenPermission) + } + + if _, exists := o.config.CommunityDescription.TokenPermissions[permission.Id]; exists { + return nil, ErrTokenPermissionAlreadyExists + } + + o.config.CommunityDescription.TokenPermissions[permission.Id] = permission + o.increaseClock() + changes := o.emptyCommunityChanges() + + if changes.TokenPermissionsAdded == nil { + changes.TokenPermissionsAdded = make(map[string]*protobuf.CommunityTokenPermission) + } + changes.TokenPermissionsAdded[permission.Id] = permission + + return changes, nil +} + +func (o *Community) UpdateTokenPermission(permissionID string, tokenPermission *protobuf.CommunityTokenPermission) (*CommunityChanges, error) { + o.mutex.Lock() + defer o.mutex.Unlock() + + if o.config.PrivateKey == nil { + return nil, ErrNotAdmin + } + + if o.config.CommunityDescription.TokenPermissions == nil { + o.config.CommunityDescription.TokenPermissions = make(map[string]*protobuf.CommunityTokenPermission) + } + if _, ok := o.config.CommunityDescription.TokenPermissions[permissionID]; !ok { + return nil, ErrTokenPermissionNotFound + } + + changes := o.emptyCommunityChanges() + o.config.CommunityDescription.TokenPermissions[permissionID] = tokenPermission + o.increaseClock() + + if changes.TokenPermissionsModified == nil { + changes.TokenPermissionsModified = make(map[string]*protobuf.CommunityTokenPermission) + } + changes.TokenPermissionsModified[permissionID] = o.config.CommunityDescription.TokenPermissions[tokenPermission.Id] + + return changes, nil +} + +func (o *Community) DeleteTokenPermission(permissionID string) (*CommunityChanges, error) { + o.mutex.Lock() + defer o.mutex.Unlock() + + if o.config.PrivateKey == nil { + return nil, ErrNotAdmin + } + + if _, exists := o.config.CommunityDescription.TokenPermissions[permissionID]; !exists { + return nil, ErrTokenPermissionNotFound + } + + delete(o.config.CommunityDescription.TokenPermissions, permissionID) + changes := o.emptyCommunityChanges() + changes.TokenPermissionsRemoved = append(changes.TokenPermissionsRemoved, permissionID) + o.increaseClock() + return changes, nil +} + func (o *Community) VerifyGrantSignature(data []byte) (*protobuf.Grant, error) { if len(data) <= signatureLength { return nil, ErrInvalidGrant diff --git a/protocol/communities/errors.go b/protocol/communities/errors.go index cd89fc95b..3c94f09a2 100644 --- a/protocol/communities/errors.go +++ b/protocol/communities/errors.go @@ -29,3 +29,5 @@ var ErrAlreadyMember = errors.New("already a member") var ErrAlreadyJoined = errors.New("already joined") var ErrInvalidMessage = errors.New("invalid community description message") var ErrMemberNotFound = errors.New("member not found") +var ErrTokenPermissionAlreadyExists = errors.New("token permission already exists") +var ErrTokenPermissionNotFound = errors.New("token permission not found") diff --git a/protocol/communities/manager.go b/protocol/communities/manager.go index d547e69f3..9957dd5ef 100644 --- a/protocol/communities/manager.go +++ b/protocol/communities/manager.go @@ -439,6 +439,83 @@ func (m *Manager) CreateCommunity(request *requests.CreateCommunity, publish boo return community, nil } +func (m *Manager) CreateCommunityTokenPermission(request *requests.CreateCommunityTokenPermission) (*Community, *CommunityChanges, error) { + community, err := m.GetByID(request.CommunityID) + if err != nil { + return nil, nil, err + } + if community == nil { + return nil, nil, ErrOrgNotFound + } + + tokenPermission := request.ToCommunityTokenPermission() + tokenPermission.Id = uuid.New().String() + + changes, err := community.AddTokenPermission(&tokenPermission) + if err != nil { + return nil, nil, err + } + + err = m.persistence.SaveCommunity(community) + if err != nil { + return nil, nil, err + } + + m.publish(&Subscription{Community: community}) + + return community, changes, nil +} + +func (m *Manager) EditCommunityTokenPermission(request *requests.EditCommunityTokenPermission) (*Community, *CommunityChanges, error) { + community, err := m.GetByID(request.CommunityID) + if err != nil { + return nil, nil, err + } + if community == nil { + return nil, nil, ErrOrgNotFound + } + + tokenPermission := request.ToCommunityTokenPermission() + + changes, err := community.UpdateTokenPermission(tokenPermission.Id, &tokenPermission) + if err != nil { + return nil, nil, err + } + + err = m.persistence.SaveCommunity(community) + if err != nil { + return nil, nil, err + } + + m.publish(&Subscription{Community: community}) + + return community, changes, nil +} + +func (m *Manager) DeleteCommunityTokenPermission(request *requests.DeleteCommunityTokenPermission) (*Community, *CommunityChanges, error) { + community, err := m.GetByID(request.CommunityID) + if err != nil { + return nil, nil, err + } + if community == nil { + return nil, nil, ErrOrgNotFound + } + + changes, err := community.DeleteTokenPermission(request.PermissionID) + if err != nil { + return nil, nil, err + } + + err = m.persistence.SaveCommunity(community) + if err != nil { + return nil, nil, err + } + + m.publish(&Subscription{Community: community}) + + return community, changes, nil +} + func (m *Manager) DeleteCommunity(id types.HexBytes) error { err := m.persistence.DeleteCommunity(id) if err != nil { diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go index d2d1a0105..a068a9d46 100644 --- a/protocol/messenger_communities.go +++ b/protocol/messenger_communities.go @@ -1070,6 +1070,56 @@ func (m *Messenger) CreateCommunity(request *requests.CreateCommunity, createDef return response, nil } +func (m *Messenger) CreateCommunityTokenPermission(request *requests.CreateCommunityTokenPermission) (*MessengerResponse, error) { + if err := request.Validate(); err != nil { + return nil, err + } + + community, changes, err := m.communitiesManager.CreateCommunityTokenPermission(request) + if err != nil { + return nil, err + } + + response := &MessengerResponse{} + response.AddCommunity(community) + response.CommunityChanges = []*communities.CommunityChanges{changes} + + return response, nil +} + +func (m *Messenger) EditCommunityTokenPermission(request *requests.EditCommunityTokenPermission) (*MessengerResponse, error) { + if err := request.Validate(); err != nil { + return nil, err + } + + community, changes, err := m.communitiesManager.EditCommunityTokenPermission(request) + if err != nil { + return nil, err + } + + response := &MessengerResponse{} + response.AddCommunity(community) + response.CommunityChanges = []*communities.CommunityChanges{changes} + + return response, nil +} + +func (m *Messenger) DeleteCommunityTokenPermission(request *requests.DeleteCommunityTokenPermission) (*MessengerResponse, error) { + if err := request.Validate(); err != nil { + return nil, err + } + + community, changes, err := m.communitiesManager.DeleteCommunityTokenPermission(request) + if err != nil { + return nil, err + } + + response := &MessengerResponse{} + response.AddCommunity(community) + response.CommunityChanges = []*communities.CommunityChanges{changes} + return response, nil +} + func (m *Messenger) EditCommunity(request *requests.EditCommunity) (*MessengerResponse, error) { if err := request.Validate(); err != nil { return nil, err diff --git a/protocol/protobuf/communities.pb.go b/protocol/protobuf/communities.pb.go index c71401841..4c3fb1f64 100644 --- a/protocol/protobuf/communities.pb.go +++ b/protocol/protobuf/communities.pb.go @@ -82,6 +82,34 @@ func (CommunityPermissions_Access) EnumDescriptor() ([]byte, []int) { return fileDescriptor_f937943d74c1cd8b, []int{2, 0} } +type CommunityTokenPermission_Type int32 + +const ( + CommunityTokenPermission_UNKNOWN_TOKEN_PERMISSION CommunityTokenPermission_Type = 0 + CommunityTokenPermission_BECOME_ADMIN CommunityTokenPermission_Type = 1 + CommunityTokenPermission_BECOME_MEMBER CommunityTokenPermission_Type = 2 +) + +var CommunityTokenPermission_Type_name = map[int32]string{ + 0: "UNKNOWN_TOKEN_PERMISSION", + 1: "BECOME_ADMIN", + 2: "BECOME_MEMBER", +} + +var CommunityTokenPermission_Type_value = map[string]int32{ + "UNKNOWN_TOKEN_PERMISSION": 0, + "BECOME_ADMIN": 1, + "BECOME_MEMBER": 2, +} + +func (x CommunityTokenPermission_Type) String() string { + return proto.EnumName(CommunityTokenPermission_Type_name, int32(x)) +} + +func (CommunityTokenPermission_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_f937943d74c1cd8b, []int{4, 0} +} + type Grant struct { CommunityId []byte `protobuf:"bytes,1,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"` MemberId []byte `protobuf:"bytes,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"` @@ -240,30 +268,189 @@ func (m *CommunityPermissions) GetAccess() CommunityPermissions_Access { return CommunityPermissions_UNKNOWN_ACCESS } +type TokenCriteria struct { + ContractAddresses map[uint64]string `protobuf:"bytes,1,rep,name=contract_addresses,json=contractAddresses,proto3" json:"contract_addresses,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Type CommunityTokenType `protobuf:"varint,2,opt,name=type,proto3,enum=protobuf.CommunityTokenType" json:"type,omitempty"` + Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Amount string `protobuf:"bytes,5,opt,name=amount,proto3" json:"amount,omitempty"` + TokenIds []uint64 `protobuf:"varint,6,rep,packed,name=token_ids,json=tokenIds,proto3" json:"token_ids,omitempty"` + EnsPattern string `protobuf:"bytes,7,opt,name=ens_pattern,json=ensPattern,proto3" json:"ens_pattern,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TokenCriteria) Reset() { *m = TokenCriteria{} } +func (m *TokenCriteria) String() string { return proto.CompactTextString(m) } +func (*TokenCriteria) ProtoMessage() {} +func (*TokenCriteria) Descriptor() ([]byte, []int) { + return fileDescriptor_f937943d74c1cd8b, []int{3} +} + +func (m *TokenCriteria) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TokenCriteria.Unmarshal(m, b) +} +func (m *TokenCriteria) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TokenCriteria.Marshal(b, m, deterministic) +} +func (m *TokenCriteria) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenCriteria.Merge(m, src) +} +func (m *TokenCriteria) XXX_Size() int { + return xxx_messageInfo_TokenCriteria.Size(m) +} +func (m *TokenCriteria) XXX_DiscardUnknown() { + xxx_messageInfo_TokenCriteria.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenCriteria proto.InternalMessageInfo + +func (m *TokenCriteria) GetContractAddresses() map[uint64]string { + if m != nil { + return m.ContractAddresses + } + return nil +} + +func (m *TokenCriteria) GetType() CommunityTokenType { + if m != nil { + return m.Type + } + return CommunityTokenType_UNKNOWN_TOKEN_TYPE +} + +func (m *TokenCriteria) GetSymbol() string { + if m != nil { + return m.Symbol + } + return "" +} + +func (m *TokenCriteria) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TokenCriteria) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func (m *TokenCriteria) GetTokenIds() []uint64 { + if m != nil { + return m.TokenIds + } + return nil +} + +func (m *TokenCriteria) GetEnsPattern() string { + if m != nil { + return m.EnsPattern + } + return "" +} + +type CommunityTokenPermission struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type CommunityTokenPermission_Type `protobuf:"varint,2,opt,name=type,proto3,enum=protobuf.CommunityTokenPermission_Type" json:"type,omitempty"` + TokenCriteria []*TokenCriteria `protobuf:"bytes,3,rep,name=token_criteria,json=tokenCriteria,proto3" json:"token_criteria,omitempty"` + ChatIds []string `protobuf:"bytes,4,rep,name=chat_ids,json=chatIds,proto3" json:"chat_ids,omitempty"` + IsPrivate bool `protobuf:"varint,5,opt,name=is_private,json=isPrivate,proto3" json:"is_private,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommunityTokenPermission) Reset() { *m = CommunityTokenPermission{} } +func (m *CommunityTokenPermission) String() string { return proto.CompactTextString(m) } +func (*CommunityTokenPermission) ProtoMessage() {} +func (*CommunityTokenPermission) Descriptor() ([]byte, []int) { + return fileDescriptor_f937943d74c1cd8b, []int{4} +} + +func (m *CommunityTokenPermission) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommunityTokenPermission.Unmarshal(m, b) +} +func (m *CommunityTokenPermission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommunityTokenPermission.Marshal(b, m, deterministic) +} +func (m *CommunityTokenPermission) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommunityTokenPermission.Merge(m, src) +} +func (m *CommunityTokenPermission) XXX_Size() int { + return xxx_messageInfo_CommunityTokenPermission.Size(m) +} +func (m *CommunityTokenPermission) XXX_DiscardUnknown() { + xxx_messageInfo_CommunityTokenPermission.DiscardUnknown(m) +} + +var xxx_messageInfo_CommunityTokenPermission proto.InternalMessageInfo + +func (m *CommunityTokenPermission) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *CommunityTokenPermission) GetType() CommunityTokenPermission_Type { + if m != nil { + return m.Type + } + return CommunityTokenPermission_UNKNOWN_TOKEN_PERMISSION +} + +func (m *CommunityTokenPermission) GetTokenCriteria() []*TokenCriteria { + if m != nil { + return m.TokenCriteria + } + return nil +} + +func (m *CommunityTokenPermission) GetChatIds() []string { + if m != nil { + return m.ChatIds + } + return nil +} + +func (m *CommunityTokenPermission) GetIsPrivate() bool { + if m != nil { + return m.IsPrivate + } + return false +} + type CommunityDescription struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Members map[string]*CommunityMember `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Permissions *CommunityPermissions `protobuf:"bytes,3,opt,name=permissions,proto3" json:"permissions,omitempty"` - Identity *ChatIdentity `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"` - Chats map[string]*CommunityChat `protobuf:"bytes,6,rep,name=chats,proto3" json:"chats,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - BanList []string `protobuf:"bytes,7,rep,name=ban_list,json=banList,proto3" json:"ban_list,omitempty"` - Categories map[string]*CommunityCategory `protobuf:"bytes,8,rep,name=categories,proto3" json:"categories,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - ArchiveMagnetlinkClock uint64 `protobuf:"varint,9,opt,name=archive_magnetlink_clock,json=archiveMagnetlinkClock,proto3" json:"archive_magnetlink_clock,omitempty"` - AdminSettings *CommunityAdminSettings `protobuf:"bytes,10,opt,name=admin_settings,json=adminSettings,proto3" json:"admin_settings,omitempty"` - IntroMessage string `protobuf:"bytes,11,opt,name=intro_message,json=introMessage,proto3" json:"intro_message,omitempty"` - OutroMessage string `protobuf:"bytes,12,opt,name=outro_message,json=outroMessage,proto3" json:"outro_message,omitempty"` - Encrypted bool `protobuf:"varint,13,opt,name=encrypted,proto3" json:"encrypted,omitempty"` - Tags []string `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` + Members map[string]*CommunityMember `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Permissions *CommunityPermissions `protobuf:"bytes,3,opt,name=permissions,proto3" json:"permissions,omitempty"` + Identity *ChatIdentity `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"` + Chats map[string]*CommunityChat `protobuf:"bytes,6,rep,name=chats,proto3" json:"chats,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + BanList []string `protobuf:"bytes,7,rep,name=ban_list,json=banList,proto3" json:"ban_list,omitempty"` + Categories map[string]*CommunityCategory `protobuf:"bytes,8,rep,name=categories,proto3" json:"categories,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + ArchiveMagnetlinkClock uint64 `protobuf:"varint,9,opt,name=archive_magnetlink_clock,json=archiveMagnetlinkClock,proto3" json:"archive_magnetlink_clock,omitempty"` + AdminSettings *CommunityAdminSettings `protobuf:"bytes,10,opt,name=admin_settings,json=adminSettings,proto3" json:"admin_settings,omitempty"` + IntroMessage string `protobuf:"bytes,11,opt,name=intro_message,json=introMessage,proto3" json:"intro_message,omitempty"` + OutroMessage string `protobuf:"bytes,12,opt,name=outro_message,json=outroMessage,proto3" json:"outro_message,omitempty"` + Encrypted bool `protobuf:"varint,13,opt,name=encrypted,proto3" json:"encrypted,omitempty"` + Tags []string `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` + TokenPermissions map[string]*CommunityTokenPermission `protobuf:"bytes,15,rep,name=token_permissions,json=tokenPermissions,proto3" json:"token_permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CommunityDescription) Reset() { *m = CommunityDescription{} } func (m *CommunityDescription) String() string { return proto.CompactTextString(m) } func (*CommunityDescription) ProtoMessage() {} func (*CommunityDescription) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{3} + return fileDescriptor_f937943d74c1cd8b, []int{5} } func (m *CommunityDescription) XXX_Unmarshal(b []byte) error { @@ -375,6 +562,13 @@ func (m *CommunityDescription) GetTags() []string { return nil } +func (m *CommunityDescription) GetTokenPermissions() map[string]*CommunityTokenPermission { + if m != nil { + return m.TokenPermissions + } + return nil +} + type CommunityAdminSettings struct { PinMessageAllMembersEnabled bool `protobuf:"varint,1,opt,name=pin_message_all_members_enabled,json=pinMessageAllMembersEnabled,proto3" json:"pin_message_all_members_enabled,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -386,7 +580,7 @@ func (m *CommunityAdminSettings) Reset() { *m = CommunityAdminSettings{} func (m *CommunityAdminSettings) String() string { return proto.CompactTextString(m) } func (*CommunityAdminSettings) ProtoMessage() {} func (*CommunityAdminSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{4} + return fileDescriptor_f937943d74c1cd8b, []int{6} } func (m *CommunityAdminSettings) XXX_Unmarshal(b []byte) error { @@ -429,7 +623,7 @@ func (m *CommunityChat) Reset() { *m = CommunityChat{} } func (m *CommunityChat) String() string { return proto.CompactTextString(m) } func (*CommunityChat) ProtoMessage() {} func (*CommunityChat) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{5} + return fileDescriptor_f937943d74c1cd8b, []int{7} } func (m *CommunityChat) XXX_Unmarshal(b []byte) error { @@ -498,7 +692,7 @@ func (m *CommunityCategory) Reset() { *m = CommunityCategory{} } func (m *CommunityCategory) String() string { return proto.CompactTextString(m) } func (*CommunityCategory) ProtoMessage() {} func (*CommunityCategory) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{6} + return fileDescriptor_f937943d74c1cd8b, []int{8} } func (m *CommunityCategory) XXX_Unmarshal(b []byte) error { @@ -554,7 +748,7 @@ func (m *CommunityInvitation) Reset() { *m = CommunityInvitation{} } func (m *CommunityInvitation) String() string { return proto.CompactTextString(m) } func (*CommunityInvitation) ProtoMessage() {} func (*CommunityInvitation) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{7} + return fileDescriptor_f937943d74c1cd8b, []int{9} } func (m *CommunityInvitation) XXX_Unmarshal(b []byte) error { @@ -618,7 +812,7 @@ func (m *CommunityRequestToJoin) Reset() { *m = CommunityRequestToJoin{} func (m *CommunityRequestToJoin) String() string { return proto.CompactTextString(m) } func (*CommunityRequestToJoin) ProtoMessage() {} func (*CommunityRequestToJoin) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{8} + return fileDescriptor_f937943d74c1cd8b, []int{10} } func (m *CommunityRequestToJoin) XXX_Unmarshal(b []byte) error { @@ -689,7 +883,7 @@ func (m *CommunityCancelRequestToJoin) Reset() { *m = CommunityCancelReq func (m *CommunityCancelRequestToJoin) String() string { return proto.CompactTextString(m) } func (*CommunityCancelRequestToJoin) ProtoMessage() {} func (*CommunityCancelRequestToJoin) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{9} + return fileDescriptor_f937943d74c1cd8b, []int{11} } func (m *CommunityCancelRequestToJoin) XXX_Unmarshal(b []byte) error { @@ -761,7 +955,7 @@ func (m *CommunityRequestToJoinResponse) Reset() { *m = CommunityRequest func (m *CommunityRequestToJoinResponse) String() string { return proto.CompactTextString(m) } func (*CommunityRequestToJoinResponse) ProtoMessage() {} func (*CommunityRequestToJoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{10} + return fileDescriptor_f937943d74c1cd8b, []int{12} } func (m *CommunityRequestToJoinResponse) XXX_Unmarshal(b []byte) error { @@ -836,7 +1030,7 @@ func (m *CommunityRequestToLeave) Reset() { *m = CommunityRequestToLeave func (m *CommunityRequestToLeave) String() string { return proto.CompactTextString(m) } func (*CommunityRequestToLeave) ProtoMessage() {} func (*CommunityRequestToLeave) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{11} + return fileDescriptor_f937943d74c1cd8b, []int{13} } func (m *CommunityRequestToLeave) XXX_Unmarshal(b []byte) error { @@ -883,7 +1077,7 @@ func (m *CommunityMessageArchiveMagnetlink) Reset() { *m = CommunityMess func (m *CommunityMessageArchiveMagnetlink) String() string { return proto.CompactTextString(m) } func (*CommunityMessageArchiveMagnetlink) ProtoMessage() {} func (*CommunityMessageArchiveMagnetlink) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{12} + return fileDescriptor_f937943d74c1cd8b, []int{14} } func (m *CommunityMessageArchiveMagnetlink) XXX_Unmarshal(b []byte) error { @@ -935,7 +1129,7 @@ func (m *WakuMessage) Reset() { *m = WakuMessage{} } func (m *WakuMessage) String() string { return proto.CompactTextString(m) } func (*WakuMessage) ProtoMessage() {} func (*WakuMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{13} + return fileDescriptor_f937943d74c1cd8b, []int{15} } func (m *WakuMessage) XXX_Unmarshal(b []byte) error { @@ -1019,7 +1213,7 @@ func (m *WakuMessageArchiveMetadata) Reset() { *m = WakuMessageArchiveMe func (m *WakuMessageArchiveMetadata) String() string { return proto.CompactTextString(m) } func (*WakuMessageArchiveMetadata) ProtoMessage() {} func (*WakuMessageArchiveMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{14} + return fileDescriptor_f937943d74c1cd8b, []int{16} } func (m *WakuMessageArchiveMetadata) XXX_Unmarshal(b []byte) error { @@ -1081,7 +1275,7 @@ func (m *WakuMessageArchive) Reset() { *m = WakuMessageArchive{} } func (m *WakuMessageArchive) String() string { return proto.CompactTextString(m) } func (*WakuMessageArchive) ProtoMessage() {} func (*WakuMessageArchive) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{15} + return fileDescriptor_f937943d74c1cd8b, []int{17} } func (m *WakuMessageArchive) XXX_Unmarshal(b []byte) error { @@ -1138,7 +1332,7 @@ func (m *WakuMessageArchiveIndexMetadata) Reset() { *m = WakuMessageArch func (m *WakuMessageArchiveIndexMetadata) String() string { return proto.CompactTextString(m) } func (*WakuMessageArchiveIndexMetadata) ProtoMessage() {} func (*WakuMessageArchiveIndexMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{16} + return fileDescriptor_f937943d74c1cd8b, []int{18} } func (m *WakuMessageArchiveIndexMetadata) XXX_Unmarshal(b []byte) error { @@ -1205,7 +1399,7 @@ func (m *WakuMessageArchiveIndex) Reset() { *m = WakuMessageArchiveIndex func (m *WakuMessageArchiveIndex) String() string { return proto.CompactTextString(m) } func (*WakuMessageArchiveIndex) ProtoMessage() {} func (*WakuMessageArchiveIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_f937943d74c1cd8b, []int{17} + return fileDescriptor_f937943d74c1cd8b, []int{19} } func (m *WakuMessageArchiveIndex) XXX_Unmarshal(b []byte) error { @@ -1236,13 +1430,18 @@ func (m *WakuMessageArchiveIndex) GetArchives() map[string]*WakuMessageArchiveIn func init() { proto.RegisterEnum("protobuf.CommunityMember_Roles", CommunityMember_Roles_name, CommunityMember_Roles_value) proto.RegisterEnum("protobuf.CommunityPermissions_Access", CommunityPermissions_Access_name, CommunityPermissions_Access_value) + proto.RegisterEnum("protobuf.CommunityTokenPermission_Type", CommunityTokenPermission_Type_name, CommunityTokenPermission_Type_value) proto.RegisterType((*Grant)(nil), "protobuf.Grant") proto.RegisterType((*CommunityMember)(nil), "protobuf.CommunityMember") proto.RegisterType((*CommunityPermissions)(nil), "protobuf.CommunityPermissions") + proto.RegisterType((*TokenCriteria)(nil), "protobuf.TokenCriteria") + proto.RegisterMapType((map[uint64]string)(nil), "protobuf.TokenCriteria.ContractAddressesEntry") + proto.RegisterType((*CommunityTokenPermission)(nil), "protobuf.CommunityTokenPermission") proto.RegisterType((*CommunityDescription)(nil), "protobuf.CommunityDescription") proto.RegisterMapType((map[string]*CommunityCategory)(nil), "protobuf.CommunityDescription.CategoriesEntry") proto.RegisterMapType((map[string]*CommunityChat)(nil), "protobuf.CommunityDescription.ChatsEntry") proto.RegisterMapType((map[string]*CommunityMember)(nil), "protobuf.CommunityDescription.MembersEntry") + proto.RegisterMapType((map[string]*CommunityTokenPermission)(nil), "protobuf.CommunityDescription.TokenPermissionsEntry") proto.RegisterType((*CommunityAdminSettings)(nil), "protobuf.CommunityAdminSettings") proto.RegisterType((*CommunityChat)(nil), "protobuf.CommunityChat") proto.RegisterMapType((map[string]*CommunityMember)(nil), "protobuf.CommunityChat.MembersEntry") @@ -1266,94 +1465,114 @@ func init() { } var fileDescriptor_f937943d74c1cd8b = []byte{ - // 1411 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcd,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 0x13, 0x12, - 0x75, 0x00, 0x1c, 0x22, 0x69, 0xdf, 0x0f, 0x18, 0x15, 0x66, 0x51, 0x1b, 0x68, 0xbc, 0xc9, 0x40, - 0xa2, 0x10, 0x5a, 0x49, 0x21, 0xa0, 0x07, 0x60, 0x92, 0xc0, 0x39, 0x65, 0xe7, 0xd4, 0x1e, 0x90, - 0x3e, 0xa7, 0xd2, 0x63, 0xfc, 0xcc, 0x0e, 0x2b, 0x52, 0xd2, 0x15, 0xd9, 0x88, 0xbe, 0x1f, 0x24, - 0x9f, 0xf7, 0x74, 0x89, 0x9e, 0xc2, 0x2a, 0x71, 0x07, 0x8c, 0xdb, 0x82, 0x4a, 0xc9, 0x78, 0x5f, - 0x98, 0xa0, 0xf3, 0x53, 0x5f, 0xe0, 0x4d, 0x53, 0x09, 0x1e, 0x46, 0x72, 0xb8, 0x4a, 0xd2, 0x24, - 0x7a, 0x0f, 0xaa, 0x8c, 0xcb, 0xc0, 0xb7, 0x07, 0x54, 0x08, 0xd2, 0xa7, 0x66, 0x59, 0x0f, 0x76, - 0x45, 0x33, 0x0f, 0x42, 0x9e, 0x12, 0xf2, 0x47, 0x69, 0xa1, 0x4a, 0x28, 0xa4, 0x99, 0xb1, 0xd0, - 0x0d, 0x28, 0x51, 0xee, 0x04, 0xe3, 0xa1, 0xa4, 0xae, 0x59, 0xd5, 0x53, 0x31, 0x61, 0x20, 0x04, - 0x39, 0x49, 0xfa, 0xc2, 0x5c, 0xd5, 0x19, 0xd5, 0xe7, 0xad, 0x23, 0xa8, 0xa4, 0x3b, 0x07, 0xd5, - 0x20, 0x7b, 0x46, 0xc3, 0x59, 0x2b, 0x61, 0x75, 0x44, 0x77, 0x21, 0x7f, 0x4e, 0xbc, 0x51, 0x38, - 0x65, 0xe5, 0xdd, 0x6b, 0x4b, 0x6f, 0x0b, 0x1c, 0xca, 0x7d, 0x92, 0x79, 0x60, 0x6c, 0xbd, 0x00, - 0x98, 0x54, 0x75, 0x01, 0xe8, 0x47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x65, 0xba, - 0x04, 0x7d, 0xda, 0xdb, 0xcc, 0xac, 0xb7, 0xbf, 0x1b, 0x50, 0x7e, 0x49, 0xce, 0x46, 0xf1, 0xe6, - 0xab, 0x41, 0x56, 0xb0, 0x7e, 0x34, 0x75, 0xea, 0xa8, 0x76, 0xa1, 0x64, 0x03, 0x2a, 0x24, 0x19, - 0x0c, 0xb5, 0x7e, 0x0e, 0x4f, 0x18, 0xca, 0xa8, 0xf4, 0x87, 0xcc, 0xd1, 0xe9, 0xad, 0xe0, 0x90, - 0xd0, 0x6f, 0x4a, 0x32, 0xf6, 0x7c, 0x12, 0xf7, 0x4b, 0x4c, 0x86, 0x5f, 0x5c, 0x97, 0xf1, 0x7e, - 0x94, 0xda, 0x98, 0x54, 0x37, 0xc9, 0x29, 0x11, 0xa7, 0x3a, 0xa1, 0x15, 0xac, 0xcf, 0xc8, 0x82, - 0x8a, 0x3c, 0x65, 0x81, 0xfb, 0x9c, 0x04, 0x2a, 0x0f, 0x66, 0x21, 0xdc, 0xd5, 0x69, 0x9e, 0xf5, - 0x23, 0x6c, 0xa5, 0x02, 0x88, 0xd3, 0x42, 0x25, 0x71, 0x89, 0x24, 0xca, 0xde, 0x39, 0x0d, 0x44, - 0x7c, 0x93, 0x54, 0x71, 0x4c, 0x2a, 0x7b, 0x27, 0x81, 0x3f, 0x88, 0x42, 0xd2, 0x67, 0xb4, 0x0a, - 0x19, 0xe9, 0xeb, 0x50, 0x72, 0x38, 0x23, 0x7d, 0x65, 0xdf, 0xf1, 0xb9, 0xa4, 0x5c, 0xf6, 0x74, - 0x90, 0xb9, 0x7a, 0x76, 0xa7, 0x82, 0xa7, 0x78, 0xea, 0x9f, 0x01, 0x9a, 0x77, 0xe0, 0x02, 0xc3, - 0x8f, 0xa0, 0x38, 0x88, 0xdc, 0x8b, 0x3a, 0x3a, 0xb5, 0xb3, 0x96, 0x87, 0x82, 0x13, 0x2d, 0x74, - 0x4f, 0x21, 0x68, 0x19, 0xf5, 0x14, 0x55, 0x5b, 0x6f, 0x7d, 0x21, 0x02, 0x4e, 0xc4, 0xac, 0x3f, - 0x0c, 0xd8, 0x9e, 0xc7, 0x6e, 0x73, 0x97, 0x7e, 0xff, 0x16, 0xb9, 0x7a, 0x77, 0x97, 0x37, 0x60, - 0xc5, 0x3f, 0x39, 0x11, 0x54, 0x46, 0xd9, 0x8d, 0x28, 0x55, 0x05, 0xc1, 0x7e, 0xa0, 0xd1, 0x9f, - 0x2d, 0x7d, 0x9e, 0xed, 0x91, 0x5c, 0xd2, 0x23, 0xd6, 0x9f, 0x06, 0x6c, 0x2e, 0x89, 0x02, 0x3d, - 0x83, 0x62, 0xf4, 0xc0, 0x8c, 0x9f, 0x02, 0x77, 0x2f, 0xf2, 0x51, 0x2b, 0x35, 0x22, 0x22, 0x7a, - 0x15, 0x24, 0x00, 0x5b, 0x27, 0x50, 0x9d, 0xfa, 0xb4, 0x60, 0xc9, 0x3e, 0x9c, 0x5e, 0xb2, 0x77, - 0xde, 0x68, 0x2c, 0xc9, 0xca, 0x64, 0xe9, 0x3e, 0xae, 0xbe, 0x2e, 0x37, 0xee, 0x7e, 0x1a, 0x6b, - 0x1e, 0xaf, 0xe8, 0xd3, 0xfd, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x07, 0x30, 0x39, 0xf5, 0x25, - 0x0f, 0x00, 0x00, + // 1730 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6f, 0x23, 0x49, + 0x15, 0x9f, 0xf6, 0x47, 0x62, 0x3f, 0x7f, 0x8c, 0x53, 0x33, 0x49, 0x7a, 0x32, 0x33, 0x9b, 0x4c, + 0x03, 0x22, 0x2b, 0x84, 0x87, 0xf5, 0x82, 0x34, 0x62, 0x61, 0x77, 0x3d, 0x89, 0x35, 0x98, 0x89, + 0xed, 0x6c, 0xd9, 0x61, 0xd9, 0x95, 0xa0, 0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xfb, 0xe1, 0xbd, + 0xce, 0xd2, 0xaa, 0x2c, 0x2e, 0xdd, 0xd7, 0xb5, 0xaf, 0x2b, 0xcd, 0x97, 0x9f, 0x24, 0x9a, 0x97, + 0x5b, 0x6a, 0xf5, 0xf1, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x59, 0xa3, 0xa0, 0xfc, 0x8b, 0x12, + 0x00, 0x00, } diff --git a/protocol/protobuf/communities.proto b/protocol/protobuf/communities.proto index 5095a37ce..66d47946b 100644 --- a/protocol/protobuf/communities.proto +++ b/protocol/protobuf/communities.proto @@ -37,6 +37,31 @@ message CommunityPermissions { Access access = 3; } +message TokenCriteria { + map contract_addresses = 1; + CommunityTokenType type = 2; + string symbol = 3; + string name = 4; + string amount = 5; + repeated uint64 token_ids = 6; + string ens_pattern = 7; +} + +message CommunityTokenPermission { + + enum Type { + UNKNOWN_TOKEN_PERMISSION = 0; + BECOME_ADMIN = 1; + BECOME_MEMBER = 2; + } + + string id = 1; + Type type = 2; + repeated TokenCriteria token_criteria = 3; + repeated string chat_ids = 4; + bool is_private = 5; +} + message CommunityDescription { uint64 clock = 1; map members = 2; @@ -51,6 +76,7 @@ message CommunityDescription { string outro_message = 12; bool encrypted = 13; repeated string tags = 14; + map token_permissions = 15; } message CommunityAdminSettings { diff --git a/protocol/requests/create_community_token_permission_request.go b/protocol/requests/create_community_token_permission_request.go new file mode 100644 index 000000000..1c1068f88 --- /dev/null +++ b/protocol/requests/create_community_token_permission_request.go @@ -0,0 +1,58 @@ +package requests + +import ( + "errors" + "strconv" + + "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/protocol/protobuf" +) + +const maxTokenCriteriaPerPermission = 5 + +var ( + ErrCreateCommunityTokenPermissionInvalidCommunityID = errors.New("create community token permission needs a valid community id") + ErrCreateCommunityTokenPermissionTooManyTokenCriteria = errors.New("too many token criteria") + ErrCreateCommunityTokenPermissionInvalidPermissionType = errors.New("invalid community token permission type") + ErrCreateCommunityTokenPermissionInvalidTokenCriteria = errors.New("invalid community permission token criteria data") +) + +type CreateCommunityTokenPermission struct { + CommunityID types.HexBytes `json:"communityId"` + Type protobuf.CommunityTokenPermission_Type `json:"type"` + TokenCriteria []*protobuf.TokenCriteria `json:"tokenCriteria"` +} + +func (p *CreateCommunityTokenPermission) Validate() error { + if len(p.CommunityID) == 0 { + return ErrCreateCommunityTokenPermissionInvalidCommunityID + } + + if len(p.TokenCriteria) > maxTokenCriteriaPerPermission { + return ErrCreateCommunityTokenPermissionTooManyTokenCriteria + } + + if p.Type == protobuf.CommunityTokenPermission_UNKNOWN_TOKEN_PERMISSION { + return ErrCreateCommunityTokenPermissionInvalidPermissionType + } + + for _, c := range p.TokenCriteria { + if c.EnsPattern == "" && len(c.ContractAddresses) == 0 { + return ErrCreateCommunityTokenPermissionInvalidTokenCriteria + } + + floatAmount, _ := strconv.ParseFloat(c.Amount, 32) + if len(c.ContractAddresses) > 0 && floatAmount == 0 { + return ErrCreateCommunityTokenPermissionInvalidTokenCriteria + } + } + + return nil +} + +func (p *CreateCommunityTokenPermission) ToCommunityTokenPermission() protobuf.CommunityTokenPermission { + return protobuf.CommunityTokenPermission{ + Type: p.Type, + TokenCriteria: p.TokenCriteria, + } +} diff --git a/protocol/requests/delete_community_token_permission.go b/protocol/requests/delete_community_token_permission.go new file mode 100644 index 000000000..8acbb7aa2 --- /dev/null +++ b/protocol/requests/delete_community_token_permission.go @@ -0,0 +1,26 @@ +package requests + +import ( + "errors" + + "github.com/status-im/status-go/eth-node/types" +) + +var ErrDeleteCommunityTokenPermissionInvalidCommunityID = errors.New("delete community token permission needs a valid community id ") +var ErrDeleteCommunityTokenPermissionInvalidPermissionID = errors.New("invalid token permission id") + +type DeleteCommunityTokenPermission struct { + CommunityID types.HexBytes `json:"communityId"` + PermissionID string `json:"permissionId"` +} + +func (r *DeleteCommunityTokenPermission) Validate() error { + if len(r.CommunityID) == 0 { + return ErrDeleteCommunityCategoryInvalidCommunityID + } + + if len(r.PermissionID) == 0 { + return ErrDeleteCommunityTokenPermissionInvalidPermissionID + } + return nil +} diff --git a/protocol/requests/edit_community_token_permission_request.go b/protocol/requests/edit_community_token_permission_request.go new file mode 100644 index 000000000..932e339d3 --- /dev/null +++ b/protocol/requests/edit_community_token_permission_request.go @@ -0,0 +1,32 @@ +package requests + +import ( + "errors" + + "github.com/status-im/status-go/protocol/protobuf" +) + +var ( + ErrEditCommunityTokenPermissionInvalidID = errors.New("invalid community token permission id") +) + +type EditCommunityTokenPermission struct { + PermissionID string `json:"permissionId"` + CreateCommunityTokenPermission +} + +func (u *EditCommunityTokenPermission) Validate() error { + if len(u.PermissionID) == 0 { + return ErrEditCommunityTokenPermissionInvalidID + } + + return u.CreateCommunityTokenPermission.Validate() +} + +func (u *EditCommunityTokenPermission) ToCommunityTokenPermission() protobuf.CommunityTokenPermission { + return protobuf.CommunityTokenPermission{ + Id: u.PermissionID, + Type: u.Type, + TokenCriteria: u.TokenCriteria, + } +} diff --git a/services/ext/api.go b/services/ext/api.go index 23d3b08f2..03fababe4 100644 --- a/services/ext/api.go +++ b/services/ext/api.go @@ -484,6 +484,18 @@ func (api *PublicAPI) RemoveRoleFromMember(request *requests.RemoveRoleFromMembe return api.service.messenger.RemoveRoleFromMember(request) } +func (api *PublicAPI) CreateCommunityTokenPermission(request *requests.CreateCommunityTokenPermission) (*protocol.MessengerResponse, error) { + return api.service.messenger.CreateCommunityTokenPermission(request) +} + +func (api *PublicAPI) DeleteCommunityTokenPermission(request *requests.DeleteCommunityTokenPermission) (*protocol.MessengerResponse, error) { + return api.service.messenger.DeleteCommunityTokenPermission(request) +} + +func (api *PublicAPI) EditCommunityTokenPermission(request *requests.EditCommunityTokenPermission) (*protocol.MessengerResponse, error) { + return api.service.messenger.EditCommunityTokenPermission(request) +} + // MyPendingRequestsToJoin returns the pending requests for the logged in user func (api *PublicAPI) MyPendingRequestsToJoin() ([]*communities.RequestToJoin, error) { return api.service.messenger.MyPendingRequestsToJoin()