mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
c293883ec0
after removal of tevm experiment - we left interfaces everywhere removing it for performance and for geth compatibility
60 lines
1.3 KiB
Go
60 lines
1.3 KiB
Go
package jsonrpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/holiman/uint256"
|
|
"github.com/ledgerwatch/erigon-lib/common"
|
|
|
|
"github.com/ledgerwatch/erigon/core/types"
|
|
"github.com/ledgerwatch/erigon/core/vm"
|
|
)
|
|
|
|
type CreateTracer struct {
|
|
DefaultTracer
|
|
ctx context.Context
|
|
target common.Address
|
|
found bool
|
|
Creator common.Address
|
|
Tx types.Transaction
|
|
}
|
|
|
|
func NewCreateTracer(ctx context.Context, target common.Address) *CreateTracer {
|
|
return &CreateTracer{
|
|
ctx: ctx,
|
|
target: target,
|
|
found: false,
|
|
}
|
|
}
|
|
|
|
func (t *CreateTracer) SetTransaction(tx types.Transaction) {
|
|
t.Tx = tx
|
|
}
|
|
|
|
func (t *CreateTracer) Found() bool {
|
|
return t.found
|
|
}
|
|
|
|
func (t *CreateTracer) captureStartOrEnter(from, to common.Address, create bool) {
|
|
if t.found {
|
|
return
|
|
}
|
|
if !create {
|
|
return
|
|
}
|
|
if to != t.target {
|
|
return
|
|
}
|
|
|
|
t.found = true
|
|
t.Creator = from
|
|
}
|
|
|
|
func (t *CreateTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
|
t.captureStartOrEnter(from, to, create)
|
|
}
|
|
|
|
func (t *CreateTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
|
t.captureStartOrEnter(from, to, create)
|
|
}
|