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

Function Create

core/vm/runtime/runtime.go:119–141  ·  view source on GitHub ↗

Create executes the code using the EVM create method

(input []byte, cfg *Config)

Source from the content-addressed store, hash-verified

117
118// Create executes the code using the EVM create method
119func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) {
120 if cfg == nil {
121 cfg = new(Config)
122 }
123 setDefaults(cfg)
124
125 if cfg.State == nil {
126 cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(database.NewMemDatabase()))
127 }
128 var (
129 vmenv = NewEnv(cfg)
130 sender = vm.AccountRef(cfg.Origin)
131 )
132
133 // Call the code with the given configuration.
134 code, address, leftOverGas, err := vmenv.Create(
135 sender,
136 input,
137 cfg.GasLimit,
138 cfg.Value,
139 )
140 return code, address, leftOverGas, err
141}
142
143// Call executes the code given by the contract's address. It will return the
144// EVM's return value or an error if it failed.

Callers

nothing calls this directly

Calls 3

setDefaultsFunction · 0.85
NewEnvFunction · 0.85
CreateMethod · 0.65

Tested by

no test coverage detected