MCPcopy Create free account
hub / github.com/DEROFDN/Engram / getContractCode

Function getContractCode

functions.go:2050–2071  ·  view source on GitHub ↗

Get the current code of a smart contract

(scid string)

Source from the content-addressed store, hash-verified

2048
2049// Get the current code of a smart contract
2050func getContractCode(scid string) (code string, err error) {
2051 var params = rpc.GetSC_Params{SCID: scid, Variables: false, Code: true}
2052 var result rpc.GetSC_Result
2053
2054 rpc_client.WS, _, err = websocket.DefaultDialer.Dial("ws://"+session.Daemon+"/ws", nil)
2055 if err != nil {
2056 return
2057 }
2058
2059 input_output := rwc.New(rpc_client.WS)
2060 rpc_client.RPC = jrpc2.NewClient(channel.RawJSON(input_output, input_output), nil)
2061
2062 err = rpc_client.RPC.CallResult(context.Background(), "DERO.GetSC", params, &result)
2063 if err != nil {
2064 logger.Errorf("[Engram] Error getting SC code: %s\n", err)
2065 return
2066 }
2067
2068 code = result.Code
2069
2070 return
2071}
2072
2073// DVM starter InitializePrivate() example for smart contract builder
2074func dvmInitFuncExample() string {

Callers 3

layoutContractBuilderFunction · 0.85
layoutContractEditorFunction · 0.85
layoutTELAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected