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)
| 146 | // Call, unlike Execute, requires a config and also requires the State field to |
| 147 | // be set. |
| 148 | func 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 | } |