Skip to content

Instantly share code, notes, and snippets.

@JAicewizard
Created July 16, 2019 10:54
Show Gist options
  • Save JAicewizard/0b7e3819490784eb11595c5870793e57 to your computer and use it in GitHub Desktop.
Save JAicewizard/0b7e3819490784eb11595c5870793e57 to your computer and use it in GitHub Desktop.
type (
ModuleFunctionID struct {
isContracted bool
moduleName string
functionName string
}
)
func (mf *ModuleFunctionID) FromBytes(data []byte) {
fmt.Println(string(data))
if data == nil {
return
}
split := bytes.SplitN(data, []byte("_"), 2)
if len(split) == 1 {
mf.isContracted = true
mf.moduleName = string(split[0])
mf.functionName = string(split[0])
} else if len(split) == 2 {
mf.moduleName = string(split[0])
mf.functionName = string(split[1])
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment