Skip to content

Commit

Permalink
Merge pull request #504 from tonkeeper/risk_orders
Browse files Browse the repository at this point in the history
replace to MessageRelaxed in risks extraction
  • Loading branch information
erokhinav authored Oct 3, 2024
2 parents 39c73cc + 281cbe3 commit 5fe6016
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/sourcegraph/conc v0.3.0
github.com/stretchr/testify v1.9.0
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20240812140315-a2b21a866ae6
github.com/tonkeeper/tongo v1.10.0
github.com/tonkeeper/tongo v1.10.2
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/metric v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20240812140315-a2b21a866ae6 h1:2/A4HLpyu4qFmjtHfAU3Iu9kFrdM9lQJtkyWR2BRlX8=
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20240812140315-a2b21a866ae6/go.mod h1:SqZXYO9vbID8ku+xnnaKXeNGmehxigODGrk5V1KqbRA=
github.com/tonkeeper/tongo v1.10.0 h1:EsuZSw+ZBxCfB/lTZaUPp0/Mr5zPQCvA8T48QKwMgeI=
github.com/tonkeeper/tongo v1.10.0/go.mod h1:MjgIgAytFarjCoVjMLjYEtpZNN1f2G/pnZhKjr28cWs=
github.com/tonkeeper/tongo v1.10.2 h1:vlEne15Kl+bmY2i40Us28uDjIRbgfpk1P+tp8jNWu4s=
github.com/tonkeeper/tongo v1.10.2/go.mod h1:MjgIgAytFarjCoVjMLjYEtpZNN1f2G/pnZhKjr28cWs=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
Expand Down
18 changes: 6 additions & 12 deletions pkg/wallet/risk.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,17 @@ func ExtractRiskFromRawMessages(rawMessages []tongoWallet.RawMessage) (*Risk, er
if tongoWallet.IsMessageModeSet(int(rawMsg.Mode), tongoWallet.AttachAllRemainingBalance) {
risk.TransferAllRemainingBalance = true
}
var m tlb.Message
var m abi.MessageRelaxed
if err := tlb.Unmarshal(rawMsg.Message, &m); err != nil {
return nil, err
}
var err error
var tonValue uint64
var destination *tongo.AccountID
if m.Info.IntMsgInfo != nil {
tonValue = uint64(m.Info.IntMsgInfo.Value.Grams)
destination, err = ton.AccountIDFromTlb(m.Info.IntMsgInfo.Dest)
if err != nil {
return nil, err
}
tonValue := uint64(m.MessageInternal.Value.Grams)
destination, err := ton.AccountIDFromTlb(m.MessageInternal.Dest)
if err != nil {
return nil, err
}
risk.Ton += tonValue
body := boc.Cell(m.Body.Value)
_, _, msgBody, err := abi.InternalMessageDecoder(&body, nil)
msgBody := m.MessageInternal.Body.Value.Value
if err != nil {
continue
}
Expand Down

0 comments on commit 5fe6016

Please sign in to comment.