-
Notifications
You must be signed in to change notification settings - Fork 6
/
rewardTx.go
78 lines (62 loc) · 1.86 KB
/
rewardTx.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
//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/multiversx/protobuf/protobuf --gogoslick_out=$GOPATH/src rewardTx.proto
package rewardTx
import (
"math/big"
"github.com/multiversx/mx-chain-core-go/data"
)
var _ = data.TransactionHandler(&RewardTx{})
// IsInterfaceNil verifies if underlying object is nil
func (rtx *RewardTx) IsInterfaceNil() bool {
return rtx == nil
}
// SetValue sets the value of the transaction
func (rtx *RewardTx) SetValue(value *big.Int) {
rtx.Value = value
}
// GetNonce returns 0 as reward transactions do not have a nonce
func (rtx *RewardTx) GetNonce() uint64 {
return 0
}
// GetData returns the data of the reward transaction
func (rtx *RewardTx) GetData() []byte {
return []byte("")
}
// GetSndAddr returns the sender address from the reward transaction
func (rtx *RewardTx) GetSndAddr() []byte {
return nil
}
// GetGasLimit returns the gas limit of the smart reward transaction
func (rtx *RewardTx) GetGasLimit() uint64 {
return 0
}
// GetGasPrice returns the gas price of the smart reward transaction
func (rtx *RewardTx) GetGasPrice() uint64 {
return 0
}
// SetData sets the data of the reward transaction
func (rtx *RewardTx) SetData(_ []byte) {
}
// SetRcvAddr sets the receiver address of the reward transaction
func (rtx *RewardTx) SetRcvAddr(addr []byte) {
rtx.RcvAddr = addr
}
// SetSndAddr sets the sender address of the reward transaction
func (rtx *RewardTx) SetSndAddr(_ []byte) {
}
// GetRcvUserName returns the receiver user name from the reward transaction
func (rtx *RewardTx) GetRcvUserName() []byte {
return nil
}
// CheckIntegrity checks for not nil fields and negative value
func (rtx *RewardTx) CheckIntegrity() error {
if len(rtx.RcvAddr) == 0 {
return data.ErrNilRcvAddr
}
if rtx.Value == nil {
return data.ErrNilValue
}
if rtx.Value.Sign() < 0 {
return data.ErrNegativeValue
}
return nil
}