Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Oct 25, 2024
1 parent dfea22a commit 81a7f0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions eth/tracers/native/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewContractTracer(cfg json.RawMessage) (tracers.Tracer, error) {
}
}
t := &contractTracer{
Addrs: make([]string, 1),
Addrs: make([]string, 0),
config: config,
}
// handle invalid opcode case
Expand All @@ -65,7 +65,8 @@ func NewContractTracer(cfg json.RawMessage) (tracers.Tracer, error) {
}

func (t *contractTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
if create {
//When not searching for opcodes, record the contract address.
if create && t.config.OpCode == "" {
t.Addrs = append(t.Addrs, addrToHex(to))
}
}
Expand All @@ -83,9 +84,11 @@ func (t *contractTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas,
if t.config.OpCode == "" {
return
}
if op.String() == t.config.OpCode {
targetOp := vm.StringToOp(t.config.OpCode)
if op == targetOp {
addr := scope.Contract.Address()
t.Addrs = append(t.Addrs, addrToHex(addr))
t.Stop(nil)
}
}

Expand Down

0 comments on commit 81a7f0c

Please sign in to comment.