2023-02-15 08:05:43 +01:00
|
|
|
package store
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-02-21 18:34:22 +01:00
|
|
|
"github.com/grassrootseconomics/cic-custodial/pkg/enum"
|
2023-02-15 08:05:43 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
2023-03-02 10:12:39 +01:00
|
|
|
MinimalTxInfo struct {
|
|
|
|
Block uint64 `json:"block"`
|
|
|
|
From string `json:"from"`
|
|
|
|
To string `json:"to"`
|
|
|
|
ContractAddress string `json:"contractAddress"`
|
|
|
|
Success bool `json:"success"`
|
|
|
|
TxHash string `json:"transactionHash"`
|
|
|
|
TxIndex uint `json:"transactionIndex"`
|
|
|
|
Value uint64 `json:"value"`
|
|
|
|
}
|
2023-02-15 08:05:43 +01:00
|
|
|
OTX struct {
|
2023-02-21 18:34:22 +01:00
|
|
|
TrackingId string
|
|
|
|
Type enum.OtxType
|
|
|
|
RawTx string
|
|
|
|
TxHash string
|
|
|
|
From string
|
|
|
|
Data string
|
|
|
|
GasLimit uint64
|
|
|
|
TransferValue uint64
|
|
|
|
GasPrice uint64
|
|
|
|
Nonce uint64
|
2023-02-15 08:05:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DispatchStatus struct {
|
|
|
|
OtxId uint
|
2023-02-21 18:34:22 +01:00
|
|
|
Status enum.OtxStatus
|
2023-02-15 08:05:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Store interface {
|
2023-02-21 18:34:22 +01:00
|
|
|
CreateOtx(ctx context.Context, otx OTX) (id uint, err error)
|
2023-02-20 10:56:30 +01:00
|
|
|
CreateDispatchStatus(ctx context.Context, dispatch DispatchStatus) error
|
2023-02-21 18:34:22 +01:00
|
|
|
GetTxStatusByTrackingId(ctx context.Context, trackingId string) ([]*TxStatus, error)
|
2023-03-02 10:12:39 +01:00
|
|
|
UpdateOtxStatusFromChainEvent(ctx context.Context, chainEvent MinimalTxInfo) error
|
2023-02-15 08:05:43 +01:00
|
|
|
}
|
|
|
|
)
|