forked from OffchainLabs/go-ethereum
/
tracer_arbitrum.go
75 lines (67 loc) · 3.04 KB
/
tracer_arbitrum.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2022 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package native
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
)
type arbitrumTransfer struct {
Purpose string `json:"purpose"`
From *string `json:"from"`
To *string `json:"to"`
Value string `json:"value"`
}
func (t *callTracer) CaptureArbitrumTransfer(
env *vm.EVM, from, to *common.Address, value *big.Int, before bool, purpose string,
) {
transfer := arbitrumTransfer{
Purpose: purpose,
Value: bigToHex(value),
}
if from != nil {
from := from.String()
transfer.From = &from
}
if to != nil {
to := to.String()
transfer.To = &to
}
if before {
t.beforeEVMTransfers = append(t.beforeEVMTransfers, transfer)
} else {
t.afterEVMTransfers = append(t.afterEVMTransfers, transfer)
}
}
func (*fourByteTracer) CaptureArbitrumTransfer(env *vm.EVM, from, to *common.Address, value *big.Int, before bool, purpose string) {
}
func (*noopTracer) CaptureArbitrumTransfer(env *vm.EVM, from, to *common.Address, value *big.Int, before bool, purpose string) {
}
func (*prestateTracer) CaptureArbitrumTransfer(env *vm.EVM, from, to *common.Address, value *big.Int, before bool, purpose string) {
}
func (*revertReasonTracer) CaptureArbitrumTransfer(env *vm.EVM, from, to *common.Address, value *big.Int, before bool, purpose string) {
}
func (*callTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {}
func (*fourByteTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {}
func (*noopTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {}
func (*prestateTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {}
func (*revertReasonTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {}
func (*callTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {}
func (*fourByteTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {}
func (*noopTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {}
func (*prestateTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {}
func (*revertReasonTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {
}