Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename CheckActions #591

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/api/event_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ func (h *Handler) toEvent(ctx context.Context, trace *core.Trace, result *bath.A
}
event.Actions[i] = convertedAction
}
event.IsScam = h.spamFilter.CheckActions(event.Actions, nil, trace.Account)
event.IsScam = h.spamFilter.IsScamEvent(event.EventID, event.Actions, nil, trace.Account)
previews := make(map[tongo.AccountID]oas.JettonPreview)
for _, flow := range result.ValueFlow.Accounts {
for jettonMaster := range flow.Jettons {
Expand Down Expand Up @@ -886,7 +886,7 @@ func (h *Handler) toAccountEvent(ctx context.Context, account tongo.AccountID, t
e.Actions = append(e.Actions, convertedAction)
}
if h.spamFilter != nil {
e.IsScam = h.spamFilter.CheckActions(e.Actions, &account, trace.Account)
e.IsScam = h.spamFilter.IsScamEvent(e.EventID, e.Actions, &account, trace.Account)
}
if len(e.Actions) == 0 {
e.Actions = []oas.Action{
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ type scoreSource interface {
}

type SpamFilter interface {
CheckActions(actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool
IsScamEvent(eventId string, actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool
JettonTrust(address tongo.AccountID, symbol, name, image string) core.TrustType
AccountTrust(address tongo.AccountID) core.TrustType
NftTrust(ctx context.Context, address tongo.AccountID, collection *ton.AccountID, description, image string) core.TrustType
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/jetton_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (h *Handler) convertJettonHistory(ctx context.Context, account ton.AccountI
}
event.Actions = append(event.Actions, convertedAction)
}
event.IsScam = h.spamFilter.CheckActions(event.Actions, &account, trace.Account)
event.IsScam = h.spamFilter.IsScamEvent(event.EventID, event.Actions, &account, trace.Account)
if len(event.Actions) == 0 {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/nft_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (h *Handler) convertNftHistory(ctx context.Context, account tongo.AccountID
}
event.Actions = append(event.Actions, convertedAction)
}
event.IsScam = h.spamFilter.CheckActions(event.Actions, &account, trace.Account)
event.IsScam = h.spamFilter.IsScamEvent(event.EventID, event.Actions, &account, trace.Account)
if len(event.Actions) > 0 {
events = append(events, event)
lastLT = trace.Lt
Expand Down
2 changes: 1 addition & 1 deletion pkg/spam/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewSpamFilter() *Filter {
}
}

func (f Filter) CheckActions(actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool {
func (f Filter) IsScamEvent(eventId string, actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool {
var comment string
for _, action := range actions {
switch {
Expand Down
Loading