forked from ethereum-optimism/op-geth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deposit_tx.go
96 lines (85 loc) · 3.44 KB
/
deposit_tx.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright 2021 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 types
import (
"math/big"
"github.com/shoyo10/op-geth/common"
)
const DepositTxType = 0x7E
type DepositTx struct {
// SourceHash uniquely identifies the source of the deposit
SourceHash common.Hash
// From is exposed through the types.Signer, not through TxData
From common.Address
// nil means contract creation
To *common.Address `rlp:"nil"`
// Mint is minted on L2, locked on L1, nil if no minting.
Mint *big.Int `rlp:"nil"`
// Value is transferred from L2 balance, executed after Mint (if any)
Value *big.Int
// gas limit
Gas uint64
// Field indicating if this transaction is exempt from the L2 gas limit.
IsSystemTransaction bool
// Normal Tx data
Data []byte
}
// copy creates a deep copy of the transaction data and initializes all fields.
func (tx *DepositTx) copy() TxData {
cpy := &DepositTx{
SourceHash: tx.SourceHash,
From: tx.From,
To: copyAddressPtr(tx.To),
Mint: nil,
Value: new(big.Int),
Gas: tx.Gas,
IsSystemTransaction: tx.IsSystemTransaction,
Data: common.CopyBytes(tx.Data),
}
if tx.Mint != nil {
cpy.Mint = new(big.Int).Set(tx.Mint)
}
if tx.Value != nil {
cpy.Value.Set(tx.Value)
}
return cpy
}
// accessors for innerTx.
func (tx *DepositTx) txType() byte { return DepositTxType }
func (tx *DepositTx) chainID() *big.Int { return common.Big0 }
func (tx *DepositTx) accessList() AccessList { return nil }
func (tx *DepositTx) data() []byte { return tx.Data }
func (tx *DepositTx) gas() uint64 { return tx.Gas }
func (tx *DepositTx) gasFeeCap() *big.Int { return new(big.Int) }
func (tx *DepositTx) gasTipCap() *big.Int { return new(big.Int) }
func (tx *DepositTx) gasPrice() *big.Int { return new(big.Int) }
func (tx *DepositTx) value() *big.Int { return tx.Value }
func (tx *DepositTx) nonce() uint64 { return 0 }
func (tx *DepositTx) to() *common.Address { return tx.To }
func (tx *DepositTx) blobGas() uint64 { return 0 }
func (tx *DepositTx) blobGasFeeCap() *big.Int { return nil }
func (tx *DepositTx) blobHashes() []common.Hash { return nil }
func (tx *DepositTx) isSystemTx() bool { return tx.IsSystemTransaction }
func (tx *DepositTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
return dst.Set(new(big.Int))
}
func (tx *DepositTx) effectiveNonce() *uint64 { return nil }
func (tx *DepositTx) rawSignatureValues() (v, r, s *big.Int) {
return common.Big0, common.Big0, common.Big0
}
func (tx *DepositTx) setSignatureValues(chainID, v, r, s *big.Int) {
// this is a noop for deposit transactions
}