Playground
gnomod.toml
module = "gno.land/r/g1f4k94fjje9tpeekkrnyv2qc7stwxdqp9vcfjg8/wrapping/v0" gno = "0.9" private = true [addpkg] creator = "g1f4k94fjje9tpeekkrnyv2qc7stwxdqp9vcfjg8" height = 1570407 max_deposit = "5000000ugnot"
wrapping.gno
package wrapping
import (
"crypto/sha256"
"encoding/hex"
"strconv"
"strings"
)
// Dispatch returns the stamp for a numbered parcel.
func Dispatch(parcel int) string {
digest := sha256.Sum256([]byte("gnoel/dispatch/v2/" + strconv.Itoa(parcel)))
return "SNOWBALL-" + strings.ToUpper(hex.EncodeToString(digest[:6]))
}
func Render(_ string) string {
return `# Rudolph's dispatch firmware
Inspect the Gno source, then open [Help and Eval](/r/g1f4k94fjje9tpeekkrnyv2qc7stwxdqp9vcfjg8/wrapping/v0$help#func-Dispatch) to query it.
` + "\n" + "```go\n" + `package wrapping
import (
"crypto/sha256"
"encoding/hex"
"strconv"
"strings"
)
// Dispatch returns the stamp for a numbered parcel.
func Dispatch(parcel int) string {
digest := sha256.Sum256([]byte("gnoel/dispatch/v2/" + strconv.Itoa(parcel)))
return "SNOWBALL-" + strings.ToUpper(hex.EncodeToString(digest[:6]))
}` + "\n```\n"
}