/
transaction.go
65 lines (52 loc) · 1.52 KB
/
transaction.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
package stub
import (
"math/big"
"go.uber.org/zap"
"github.com/ariden83/blockchain/internal/blockchain"
"github.com/ariden83/blockchain/internal/event"
"github.com/ariden83/blockchain/internal/persistence"
transactionadapter "github.com/ariden83/blockchain/internal/transaction"
)
// Transactions represent a transactions adapter.
type Transactions struct {
Reward *big.Int
serverPublicKey string
persistence persistenceadapter.Adapter
event *event.Event
log *zap.Logger
}
func New() *Transactions {
return &Transactions{}
}
func (p *Transactions) New([]byte, []byte, *big.Int) (*blockchain.Transaction, error) {
return &blockchain.Transaction{}, nil
}
func (p *Transactions) CoinBaseTx([]byte) *blockchain.Transaction {
return &blockchain.Transaction{}
}
func (p *Transactions) FindUserBalance([]byte) *big.Int {
balance := new(big.Int)
balance.SetInt64(1)
return balance
}
func (p *Transactions) FindUserTokensSend([]byte) *big.Int {
balance := new(big.Int)
balance.SetInt64(1)
return balance
}
func (p *Transactions) FindUserTokensReceived([]byte) *big.Int {
balance := new(big.Int)
balance.SetInt64(1)
return balance
}
func (p *Transactions) WriteBlock([]byte) (*blockchain.Block, error) {
return &blockchain.Block{}, nil
}
func (p *Transactions) GetLastBlock() ([]byte, *big.Int, error) {
balance := new(big.Int)
balance.SetInt64(1)
return []byte("last block"), balance, nil
}
func (p *Transactions) SendBlock(input transactionadapter.SendBlockInput) error {
return nil
}