github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/environment/script_info.go (about) 1 package environment 2 3 import ( 4 "github.com/onflow/flow-go/model/fingerprint" 5 "github.com/onflow/flow-go/model/flow" 6 "github.com/onflow/flow-go/model/hash" 7 ) 8 9 type ScriptInfoParams struct { 10 ID flow.Identifier 11 Script []byte 12 Arguments [][]byte 13 } 14 15 func (info ScriptInfoParams) Fingerprint() []byte { 16 return fingerprint.Fingerprint(struct { 17 Script []byte 18 Arguments [][]byte 19 }{ 20 Script: info.Script, 21 Arguments: info.Arguments, 22 }) 23 } 24 25 func NewScriptInfoParams(code []byte, arguments [][]byte) *ScriptInfoParams { 26 info := &ScriptInfoParams{ 27 Script: code, 28 Arguments: arguments, 29 } 30 info.ID = flow.HashToID(hash.DefaultComputeHash(info.Fingerprint())) 31 return info 32 }