@@ -142,13 +142,16 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
142
142
// set the receiver's (the executing contract) code for execution.
143
143
cfg .State .SetCode (address , code )
144
144
// Call the code with the given configuration.
145
- ret , _ , err := vmenv .Call (
145
+ ret , leftOverGas , err := vmenv .Call (
146
146
sender ,
147
147
common .BytesToAddress ([]byte ("contract" )),
148
148
input ,
149
149
cfg .GasLimit ,
150
150
uint256 .MustFromBig (cfg .Value ),
151
151
)
152
+ if cfg .EVMConfig .Tracer != nil && cfg .EVMConfig .Tracer .OnTxEnd != nil {
153
+ cfg .EVMConfig .Tracer .OnTxEnd (& types.Receipt {GasUsed : cfg .GasLimit - leftOverGas }, err )
154
+ }
152
155
return ret , cfg .State , err
153
156
}
154
157
@@ -181,6 +184,9 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) {
181
184
cfg .GasLimit ,
182
185
uint256 .MustFromBig (cfg .Value ),
183
186
)
187
+ if cfg .EVMConfig .Tracer != nil && cfg .EVMConfig .Tracer .OnTxEnd != nil {
188
+ cfg .EVMConfig .Tracer .OnTxEnd (& types.Receipt {GasUsed : cfg .GasLimit - leftOverGas }, err )
189
+ }
184
190
return code , address , leftOverGas , err
185
191
}
186
192
@@ -214,5 +220,8 @@ func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, er
214
220
cfg .GasLimit ,
215
221
uint256 .MustFromBig (cfg .Value ),
216
222
)
223
+ if cfg .EVMConfig .Tracer != nil && cfg .EVMConfig .Tracer .OnTxEnd != nil {
224
+ cfg .EVMConfig .Tracer .OnTxEnd (& types.Receipt {GasUsed : cfg .GasLimit - leftOverGas }, err )
225
+ }
217
226
return ret , leftOverGas , err
218
227
}
0 commit comments