-
Notifications
You must be signed in to change notification settings - Fork 4
/
message.go
38 lines (33 loc) · 1.1 KB
/
message.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
package vminterface
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
)
type Message struct {
to *common.Address
from common.Address
nonce uint64
amount, price, gasLimit *big.Int
data []byte
checkNonce bool
}
func NewMessage(from common.Address, to *common.Address, nonce uint64, amount, gasLimit, price *big.Int, data []byte, checkNonce bool) Message {
return Message{
from: from,
to: to,
nonce: nonce,
amount: amount,
price: price,
gasLimit: gasLimit,
data: data,
checkNonce: checkNonce,
}
}
func (m Message) From() common.Address { return m.from }
func (m Message) To() *common.Address { return m.to }
func (m Message) GasPrice() *big.Int { return m.price }
func (m Message) Value() *big.Int { return m.amount }
func (m Message) Gas() *big.Int { return m.gasLimit }
func (m Message) Nonce() uint64 { return m.nonce }
func (m Message) Data() []byte { return m.data }
func (m Message) CheckNonce() bool { return m.checkNonce }