Skip to content
Open
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
8 changes: 6 additions & 2 deletions docs/guide/invoke-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ import (
"github.com/google/uuid"
"github.com/pandodao/mtg/mtgpack"
"github.com/pandodao/mtg/protocol"
"github.com/pandodao/mtg/protocol/checksum"
"github.com/shopspring/decimal"
)

func generateSwapMemo() string {
// protocol header
header := protocol.Header{
Version: 1,
Version: 2,
ProtocolID: protocol.ProtocolFswap,
FollowID: uuid.New(),
Action: 3,
Expand Down Expand Up @@ -105,7 +106,10 @@ func generateSwapMemo() string {
if err := enc.EncodeValues(header, receiver, uuid.MustParse(assetID), route, min); err != nil {
panic(err)
}
return base64.StdEncoding.EncodeToString(enc.Bytes())

data := enc.Bytes()
data = append(data, checksum.Sha256(data)...)
return base64.StdEncoding.EncodeToString(data)
}
```

Expand Down