MCPcopy Create free account
hub / github.com/CPChain/chain / Call

Function Call

core/vm/runtime/runtime.go:148–164  ·  view source on GitHub ↗

Call executes the code given by the contract's address. It will return the EVM's return value or an error if it failed. Call, unlike Execute, requires a config and also requires the State field to be set.

(address common.Address, input []byte, cfg *Config)

Source from the content-addressed store, hash-verified

146// Call, unlike Execute, requires a config and also requires the State field to
147// be set.
148func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, error) {
149 setDefaults(cfg)
150
151 vmenv := NewEnv(cfg)
152
153 sender := cfg.State.GetOrNewStateObject(cfg.Origin)
154 // Call the code with the given configuration.
155 ret, leftOverGas, err := vmenv.Call(
156 sender,
157 address,
158 input,
159 cfg.GasLimit,
160 cfg.Value,
161 )
162
163 return ret, leftOverGas, err
164}

Callers 1

TestCallFunction · 0.85

Calls 4

setDefaultsFunction · 0.85
NewEnvFunction · 0.85
GetOrNewStateObjectMethod · 0.80
CallMethod · 0.65

Tested by 1

TestCallFunction · 0.68