-
Notifications
You must be signed in to change notification settings - Fork 0
/
dctStorageHandlerStub.go
81 lines (70 loc) · 3.98 KB
/
dctStorageHandlerStub.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
package mock
import (
"math/big"
"github.com/bhagyaraj1208117/andes-core-go/data"
"github.com/bhagyaraj1208117/andes-core-go/data/dct"
vmcommon "github.com/bhagyaraj1208117/andes-vm-common-go"
)
// DCTNFTStorageHandlerStub -
type DCTNFTStorageHandlerStub struct {
SaveDCTNFTTokenCalled func(senderAddress []byte, acnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64, dctData *dct.DCToken, mustUpdateAllFields bool, isReturnWithError bool) ([]byte, error)
GetDCTNFTTokenOnSenderCalled func(acnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64) (*dct.DCToken, error)
GetDCTNFTTokenOnDestinationCalled func(acnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64) (*dct.DCToken, bool, error)
GetDCTNFTTokenOnDestinationWithCustomSystemAccountCalled func(accnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64, systemAccount vmcommon.UserAccountHandler) (*dct.DCToken, bool, error)
WasAlreadySentToDestinationShardAndUpdateStateCalled func(tickerID []byte, nonce uint64, dstAddress []byte) (bool, error)
SaveNFTMetaDataToSystemAccountCalled func(tx data.TransactionHandler) error
AddToLiquiditySystemAccCalled func(dctTokenKey []byte, nonce uint64, transferValue *big.Int) error
}
// SaveDCTNFTToken -
func (stub *DCTNFTStorageHandlerStub) SaveDCTNFTToken(senderAddress []byte, acnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64, dctData *dct.DCToken, mustUpdateAllFields bool, isReturnWithError bool) ([]byte, error) {
if stub.SaveDCTNFTTokenCalled != nil {
return stub.SaveDCTNFTTokenCalled(senderAddress, acnt, dctTokenKey, nonce, dctData, mustUpdateAllFields, isReturnWithError)
}
return nil, nil
}
// GetDCTNFTTokenOnSender -
func (stub *DCTNFTStorageHandlerStub) GetDCTNFTTokenOnSender(acnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64) (*dct.DCToken, error) {
if stub.GetDCTNFTTokenOnSenderCalled != nil {
return stub.GetDCTNFTTokenOnSenderCalled(acnt, dctTokenKey, nonce)
}
return nil, nil
}
// GetDCTNFTTokenOnDestination -
func (stub *DCTNFTStorageHandlerStub) GetDCTNFTTokenOnDestination(acnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64) (*dct.DCToken, bool, error) {
if stub.GetDCTNFTTokenOnDestinationCalled != nil {
return stub.GetDCTNFTTokenOnDestinationCalled(acnt, dctTokenKey, nonce)
}
return nil, false, nil
}
// GetDCTNFTTokenOnDestinationWithCustomSystemAccount -
func (stub *DCTNFTStorageHandlerStub) GetDCTNFTTokenOnDestinationWithCustomSystemAccount(accnt vmcommon.UserAccountHandler, dctTokenKey []byte, nonce uint64, systemAccount vmcommon.UserAccountHandler) (*dct.DCToken, bool, error) {
if stub.GetDCTNFTTokenOnDestinationWithCustomSystemAccountCalled != nil {
return stub.GetDCTNFTTokenOnDestinationWithCustomSystemAccountCalled(accnt, dctTokenKey, nonce, systemAccount)
}
return nil, false, nil
}
// WasAlreadySentToDestinationShardAndUpdateState -
func (stub *DCTNFTStorageHandlerStub) WasAlreadySentToDestinationShardAndUpdateState(tickerID []byte, nonce uint64, dstAddress []byte) (bool, error) {
if stub.WasAlreadySentToDestinationShardAndUpdateStateCalled != nil {
return stub.WasAlreadySentToDestinationShardAndUpdateStateCalled(tickerID, nonce, dstAddress)
}
return false, nil
}
// SaveNFTMetaDataToSystemAccount -
func (stub *DCTNFTStorageHandlerStub) SaveNFTMetaDataToSystemAccount(tx data.TransactionHandler) error {
if stub.SaveNFTMetaDataToSystemAccountCalled != nil {
return stub.SaveNFTMetaDataToSystemAccountCalled(tx)
}
return nil
}
// AddToLiquiditySystemAcc -
func (stub *DCTNFTStorageHandlerStub) AddToLiquiditySystemAcc(dctTokenKey []byte, nonce uint64, transferValue *big.Int) error {
if stub.AddToLiquiditySystemAccCalled != nil {
return stub.AddToLiquiditySystemAccCalled(dctTokenKey, nonce, transferValue)
}
return nil
}
// IsInterfaceNil -
func (stub *DCTNFTStorageHandlerStub) IsInterfaceNil() bool {
return stub == nil
}