models

package
v0.0.0-...-9f791b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BucketMeta        = "meta"
	BucketAck         = "ack"
	BucketBlockNumber = "bucketBlockNumber"
	BucketChainID     = "bucketChainID"
	/*
		保存channel完整信息
	*/
	BucketChannelSerialization = "bucketChannelSerialization"
	/*
		保存所有通道的ChannelParticipantMap
	*/
	BucketChannel = "bucketChannel"
	/*
	   保留 settle 的通道信息,供查询需要
	*/
	BucketSettledChannel = "settled_channel"

	BucketToken      = "bucketToken"
	BucketTokenNodes = "bucketTokenNodes"
	BucketXMPP       = "bucketxmpp"

	/*
		保存已经解锁的锁
	*/
	BucketWithDraw = "bucketWithdraw"
	/*
		保存已经过期的锁
	*/
	BucketExpiredHashlock          = "expiredHashlock"
	BucketEnvelopMessager          = "EnvelopMessager"
	BucketFeeChargeRecord          = "FeeChargeRecord"
	BucketFeePolicy                = "FeePolicy"
	BucketSentAnnounceDisposed     = "SentAnnounceDisposed"
	BucketReceivedAnnounceDisposed = "ReceivedAnnounceDisposed"
	BucketSentTransfer             = "SentTransfer"
	BucketReceivedTransfer         = "ReceivedTransfer"
	BucketTransferStatus           = "TransferStatus"
	BucketTXInfo                   = "TXInfo"
	BucketSentTransferDetail       = "SentTransferDetail"
	BucketChainEventRecord         = "ChainEventRecord"
)

#no-golint

View Source
const (
	// keys of BucketMeta
	KeyVersion        = "version"
	KeyCloseFlag      = "close"
	KeyRegistry       = "registry"
	KeySecretRegistry = "secretregistry"

	// keys of BucketBlockNumber
	KeyBlockNumber     = "blocknumber"
	KeyBlockNumberTime = "blockTime"

	// keys of BucketChainID
	KeyChainID = "chainID"

	// keys of BucketFeePolicy
	KeyFeePolicy string = "feePolicy"
	// keys of BucketToken
	KeyToken = "tokens"
)

#no-golint

View Source
const (

	// TransferStatusInit init
	TransferStatusInit = iota

	// TransferStatusCanCancel transfer can cancel right now
	TransferStatusCanCancel

	// TransferStatusCanNotCancel transfer can not cancel
	TransferStatusCanNotCancel

	// TransferStatusSuccess transfer already success
	TransferStatusSuccess

	// TransferStatusCanceled transfer cancel by user request
	TransferStatusCanceled

	// TransferStatusFailed transfer already failed
	TransferStatusFailed
)
View Source
const (
	TXInfoStatusPending = "pending"
	TXInfoStatusSuccess = "success"
	TXInfoStatusFailed  = "failed"
)

#nosec

View Source
const (
	TXInfoTypeDeposit            = "ChannelDeposit"
	TXInfoTypeClose              = "ChannelClose"
	TXInfoTypeSettle             = "ChannelSettle"
	TXInfoTypeCooperateSettle    = "CooperateSettle"
	TXInfoTypeUpdateBalanceProof = "UpdateBalanceProof"
	TXInfoTypeUnlock             = "Unlock"
	TXInfoTypePunish             = "Punish"
	TXInfoTypeWithdraw           = "Withdraw"
	TXInfoTypeApproveDeposit     = "ApproveDeposit"
	TXInfoTypeRegisterSecret     = "RegisterSecret"
)

#nosec

View Source
const (
	ChainEventStatusDelivered = "delivered" // 该状态标志事件已经投递到service层处理过
)

#nosec

View Source
const DbVersion = 1

DbVersion :

Variables

This section is empty.

Functions

func GeneratDBError

func GeneratDBError(err error) error

GeneratDBError helper function

func SortEnvelopMessager

func SortEnvelopMessager(msgs []*SentEnvelopMessager)

SortEnvelopMessager : must be stable 对于 ChannelOpenedAndDeposit 事件,会产生两个 stateChange, 严格要求有先后顺序

  • sortEnvelopMessager : function to sort arrays of sent messenger. *
  • Note that for event of ChannelOpenedAndDeposit, two stateChange will be generated.
  • And they must be in order.

Types

type AckDao

type AckDao interface {
	GetAck(echoHash common.Hash) []byte
	SaveAck(echoHash common.Hash, ack []byte, tx TX)
	SaveAckNoTx(echoHash common.Hash, ack []byte)
}

AckDao :

type AddressMap

type AddressMap map[common.Address]common.Address

AddressMap is token address to mananger address

type BlockNumberDao

type BlockNumberDao interface {
	GetLatestBlockNumber() int64
	SaveLatestBlockNumber(blockNumber int64)
	GetLastBlockNumberTime() time.Time
}

BlockNumberDao :

type ChainEventID

type ChainEventID string

ChainEventID 一个链上事件的唯一ID, txHash+logIndex

type ChainEventRecord

type ChainEventRecord struct {
	ID          ChainEventID     `json:"id" storm:"id"`
	BlockNumber uint64           `json:"block_number" storm:"index"`
	Status      ChainEventStatus `json:"status"`
}

ChainEventRecord 保存收到的链上事件

type ChainEventRecordDao

type ChainEventRecordDao interface {
	NewDeliveredChainEvent(id ChainEventID, blockNumber uint64)
	CheckChainEventDelivered(id ChainEventID) (blockNumber uint64, delivered bool)
	ClearOldChainEventRecord(blockNumber uint64)
	MakeChainEventID(l *types.Log) ChainEventID
}

ChainEventRecordDao :

type ChainEventStatus

type ChainEventStatus string

ChainEventStatus :

type ChainIDDao

type ChainIDDao interface {
	GetChainID() int64
	SaveChainID(chainID int64)
}

ChainIDDao :

type ChannelCloseOrChannelUpdateBalanceProofTXParams

type ChannelCloseOrChannelUpdateBalanceProofTXParams struct {
	TokenAddress       common.Address `json:"token_address"`
	ParticipantAddress common.Address `json:"participant_address"`
	PartnerAddress     common.Address `json:"partner_address"`
	TransferAmount     *big.Int       `json:"transfer_amount"`
	LocksRoot          common.Hash    `json:"locks_root"`
	Nonce              uint64         `json:"nonce"`
	ExtraHash          common.Hash    `json:"extra_hash"`
	Signature          []byte         `json:"signature"`
}

ChannelCloseOrChannelUpdateBalanceProofTXParams 关闭通道或者UpdateBalanceProof的参数,两种操作复用,根据上层TXInfo中的Type区分

type ChannelCooperativeSettleTXParams

type ChannelCooperativeSettleTXParams struct {
	TokenAddress common.Address `json:"token_address"`
	P1Address    common.Address `json:"p1_address"`
	P1Balance    *big.Int       `json:"p1_balance"`
	P2Address    common.Address `json:"p2_address"`
	P2Balance    *big.Int       `json:"p2_balance"`
	P1Signature  []byte         `json:"p1_signature"`
	P2Signature  []byte         `json:"p2_signature"`
}

ChannelCooperativeSettleTXParams 通道合作关闭的参数

type ChannelDao

type ChannelDao interface {
	ChannelUpdateDao
	// add
	NewChannel(c *channeltype.Serialization) error
	// remove
	RemoveChannel(c *channeltype.Serialization) error
	//query
	GetChannel(token, partner common.Address) (c *channeltype.Serialization, err error)
	GetChannelByAddress(channelIdentifier common.Hash) (c *channeltype.Serialization, err error)
	GetChannelList(token, partner common.Address) (cs []*channeltype.Serialization, err error)
}

ChannelDao :

type ChannelParticipantMap

type ChannelParticipantMap map[common.Hash][]byte

ChannelParticipantMap : used by BucketChannel

type ChannelSettleTXParams

type ChannelSettleTXParams struct {
	TokenAddress     common.Address `json:"token_address"`
	P1Address        common.Address `json:"p1_address"`
	P1TransferAmount *big.Int       `json:"p1_transfer_amount"`
	P1LocksRoot      common.Hash    `json:"p1_locks_root"`
	P2Address        common.Address `json:"p2_address"`
	P2TransferAmount *big.Int       `json:"p2_transfer_amount"`
	P2LocksRoot      common.Hash    `json:"p2_locks_root"`
}

ChannelSettleTXParams 通道结算的参数

type ChannelUpdateDao

type ChannelUpdateDao interface {
	// update
	UpdateChannel(c *channeltype.Serialization, tx TX) error
	UpdateChannelNoTx(c *channeltype.Serialization) error
	UpdateChannelState(c *channeltype.Serialization) error
	// mix update
	UpdateChannelAndSaveAck(c *channeltype.Serialization, echoHash common.Hash, ack []byte) (err error)
	UpdateChannelContractBalance(c *channeltype.Serialization) error
}

ChannelUpdateDao update channel status in db

type ChannelWithDrawTXParams

type ChannelWithDrawTXParams struct {
	TokenAddress common.Address `json:"token_address"`
	P1Address    common.Address `json:"p1_address"`
	P2Address    common.Address `json:"p2_address"`
	P1Balance    *big.Int       `json:"p1_balance"`
	P1Withdraw   *big.Int       `json:"p1_withdraw"`
	P1Signature  []byte         `json:"p1_signature"`
	P2Signature  []byte         `json:"p2_signature"`
}

ChannelWithDrawTXParams 通道取现的参数

type ContractStatus

type ContractStatus struct {
	RegistryAddress       common.Address
	ContractVersion       string
	SecretRegistryAddress common.Address
	PunishBlockNumber     int64
	ChainID               *big.Int
}

ContractStatus 合约一旦部署就会确定下来的内容,也不会发生改变

type ContractStatusDao

type ContractStatusDao interface {
	SaveContractStatus(contractStatus ContractStatus)
	GetContractStatus() ContractStatus
}

ContractStatusDao :

type DbStatusDao

type DbStatusDao interface {
	MarkDbOpenedStatus()
	IsDbCrashedLastTime() bool
}

DbStatusDao :

type DepositTXParams

type DepositTXParams struct {
	TokenAddress       common.Address `json:"token_address"`
	ParticipantAddress common.Address `json:"participant_address"`
	PartnerAddress     common.Address `json:"partner_address"`
	Amount             *big.Int       `json:"amount"`
	SettleTimeout      uint64         `json:"settle_timeout"`
}

DepositTXParams : 1. 保存在ApproveTX的TXParams中,给崩溃恢复后继续deposit使用 2. 保存在DepositTX的TXParams中

type ExpiredLockDao

type ExpiredLockDao interface {
	IsThisLockRemoved(channelIdentifier common.Hash, sender common.Address, lockHash common.Hash) bool
	RemoveLock(channelIdentifier common.Hash, sender common.Address, lockHash common.Hash)
}

ExpiredLockDao :

type FeeChargeRecord

type FeeChargeRecord struct {
	Key            common.Hash    `json:"key" storm:"id"`
	LockSecretHash common.Hash    `json:"lock_secret_hash"`
	TokenAddress   common.Address `json:"token_address"`
	TransferFrom   common.Address `json:"transfer_from"`
	TransferTo     common.Address `json:"transfer_to"`
	TransferAmount *big.Int       `json:"transfer_amount"`
	InChannel      common.Hash    `json:"in_channel"`  // 我收款的channelID
	OutChannel     common.Hash    `json:"out_channel"` // 我付款的channelID
	Fee            *big.Int       `json:"fee"`
	Timestamp      int64          `json:"timestamp"` // 时间戳,time.Unix()
	Data           string         `json:"data"`
	BlockNumber    int64          `json:"block_number"`
}

FeeChargeRecord : 记录中间节点收取手续费的流水

func (*FeeChargeRecord) ToSerialized

ToSerialized :

func (*FeeChargeRecord) ToString

func (r *FeeChargeRecord) ToString() string

ToString :

type FeeChargeRecordDao

type FeeChargeRecordDao interface {
	SaveFeeChargeRecord(r *FeeChargeRecord) (err error)
	GetAllFeeChargeRecord(tokenAddress common.Address, fromTime, toTime int64) (records []*FeeChargeRecord, err error)
	GetFeeChargeRecordByLockSecretHash(lockSecretHash common.Hash) (records []*FeeChargeRecord, err error)
}

FeeChargeRecordDao :

type FeeChargerRecordSerialization

type FeeChargerRecordSerialization struct {
	Key            []byte `storm:"id"`
	LockSecretHash []byte `storm:"index"`
	TokenAddress   []byte `storm:"index"`
	TransferFrom   []byte
	TransferTo     []byte
	TransferAmount *big.Int
	InChannel      []byte
	OutChannel     []byte
	Fee            *big.Int
	Timestamp      int64 `storm:"index"`
	Data           string
	BlockNumber    int64 `storm:"index"`
}

FeeChargerRecordSerialization : 记录中间节点收取手续费的流水

func (*FeeChargerRecordSerialization) ToFeeChargeRecord

func (rs *FeeChargerRecordSerialization) ToFeeChargeRecord() *FeeChargeRecord

ToFeeChargeRecord :

type FeePolicy

type FeePolicy struct {
	Key           string                         `storm:"id"`
	AccountFee    *FeeSetting                    `json:"account_fee"`
	TokenFeeMap   map[common.Address]*FeeSetting `json:"token_fee_map"`
	ChannelFeeMap map[common.Hash]*FeeSetting    `json:"channel_fee_map"`
}

FeePolicy :

func NewDefaultFeePolicy

func NewDefaultFeePolicy() *FeePolicy

NewDefaultFeePolicy : 默认手续费万分之一

func (*FeePolicy) Sign

func (fp *FeePolicy) Sign(key *ecdsa.PrivateKey)

Sign for pfs

type FeePolicyDao

type FeePolicyDao interface {
	SaveFeePolicy(fp *FeePolicy) (err error)
	GetFeePolicy() (fp *FeePolicy)
}

FeePolicyDao :

type FeeSetting

type FeeSetting struct {
	FeeConstant *big.Int `json:"fee_constant"`
	FeePercent  int64    `json:"fee_percent"`
	Signature   []byte   `json:"signature"` // used when set fee policy to pfs
}

FeeSetting : 其中FeeConstant为固定费率,比如5代表手续费固定部分为5个token,设置为0即不收费 FeePercent为比例费率,计算方式为 交易金额/FeePercent,比如交易金额50000,FeePercent=10000,那么手续费比例部分=50000/10000=5,设置为0即不收费 最终为手续费为固定收费+比例收费

type KeyGetter

type KeyGetter interface {
	GetKey() []byte
}

KeyGetter :

type NonParticipantChannelDao

type NonParticipantChannelDao interface {
	NewNonParticipantChannel(token common.Address, channelIdentifier common.Hash, participant1, participant2 common.Address) error
	RemoveNonParticipantChannel(channel common.Hash) error
	GetAllNonParticipantChannelByToken(token common.Address) (edges []common.Address, err error)
	GetNonParticipantChannelByID(channelIdentifierForQuery common.Hash) (
		tokenAddress common.Address, participant1, participant2 common.Address, err error)
}

NonParticipantChannelDao :

type PunishObsoleteUnlockTXParams

type PunishObsoleteUnlockTXParams struct {
	TokenAddress     common.Address `json:"token_address"`
	Beneficiary      common.Address `json:"beneficiary"`
	Cheater          common.Address `json:"cheater"`
	LockHash         common.Hash    `json:"lock_hash"`
	ExtraHash        common.Hash    `json:"extra_hash"`
	CheaterSignature []byte         `json:"cheater_signature"`
}

PunishObsoleteUnlockTXParams 通道惩罚的参数

type ReceivedAnnounceDisposed

type ReceivedAnnounceDisposed struct {
	Key               []byte `storm:"id"`
	LockHash          []byte `storm:"index"` //hash(expiration,locksecrethash,amount)
	ChannelIdentifier []byte `storm:"index"`
	OpenBlockNumber   int64
	AdditionalHash    common.Hash
	Signature         []byte
}

ReceivedAnnounceDisposed 收到对方的 disposed, 主要是用来对方unlock 的时候,提交证据,惩罚对方

  • ReceiveAnnounceDisposed : to receive AnnounceDisposed message from channel partner,
  • mainly to submit proofs and punish fraudulent behaviors while partner submits unlock.

func NewReceivedAnnounceDisposed

func NewReceivedAnnounceDisposed(LockHash, ChannelIdentifier, additionalHash common.Hash, openBlockNumber int64, signature []byte) *ReceivedAnnounceDisposed

NewReceivedAnnounceDisposed create ReceivedAnnounceDisposed

type ReceivedAnnounceDisposedDao

type ReceivedAnnounceDisposedDao interface {
	MarkLockHashCanPunish(r *ReceivedAnnounceDisposed) error
	IsLockHashCanPunish(lockHash, channelIdentifier common.Hash) bool
	GetReceivedAnnounceDisposed(lockHash, channelIdentifier common.Hash) *ReceivedAnnounceDisposed
	GetChannelAnnounceDisposed(channelIdentifier common.Hash) []*ReceivedAnnounceDisposed
}

ReceivedAnnounceDisposedDao :

type ReceivedTransfer

type ReceivedTransfer struct {
	Key               string `storm:"id"`
	BlockNumber       int64  `json:"block_number" storm:"index"`
	OpenBlockNumber   int64
	ChannelIdentifier common.Hash    `json:"channel_identifier"`
	TokenAddress      common.Address `json:"token_address"`
	TokenAddressBytes []byte         `json:"-"`
	FromAddress       common.Address `json:"initiator_address"`
	Nonce             uint64         `json:"nonce"`
	Amount            *big.Int       `json:"amount"`
	Data              string         `json:"data"`
	TimeStamp         int64          `json:"time_stamp" storm:"index"`
}

ReceivedTransfer tokens I have received and where it comes from

type ReceivedTransferDao

type ReceivedTransferDao interface {
	NewReceivedTransfer(blockNumber int64, channelIdentifier common.Hash, openBlockNumber int64, tokenAddr, fromAddr common.Address, nonce uint64, amount *big.Int, lockSecretHash common.Hash, data string) *ReceivedTransfer
	GetReceivedTransfer(key string) (*ReceivedTransfer, error)
	GetReceivedTransferList(tokenAddress common.Address, fromBlock, toBlock, fromTime, toTime int64) (transfers []*ReceivedTransfer, err error)
}

ReceivedTransferDao :

type SecretRegisterTxParams

type SecretRegisterTxParams struct {
	Secret common.Hash `json:"secret"`
}

SecretRegisterTxParams 注册密码的参数

type SentAnnounceDisposed

type SentAnnounceDisposed struct {
	Key               []byte `storm:"id"`
	LockSecretHash    []byte `storm:"index"` //假设非恶意的情况下,锁肯定是不会重复的.但是我有可能在多个通道上发送 AnnounceDisposed,但是肯定不会在同一个通道上发送多次 announce disposed // Assume in honest case, locks are not repeated, but maybe I send AnnounceDisposed in multiple channels.
	ChannelIdentifier common.Hash
}

SentAnnounceDisposed 我发出了 AnnonuceDisposed, 那么就要标记这个 channel 上的这个锁我不要去链上兑现了, 如果对方发送过来 AnnounceDisposedResponse, 我要移除这个锁.

  • SendAnnounceDisposed : a channel participant sends out an AnnounceDisposed message, then that lock in this channel should be tagged
  • to inform that this participant should not register it on chain.
  • If his partner sends AnnounceDisposedResponse, that lock has to be removed.

type SentAnnounceDisposedDao

type SentAnnounceDisposedDao interface {
	MarkLockSecretHashDisposed(lockSecretHash common.Hash, channelIdentifier common.Hash) error
	IsLockSecretHashDisposed(lockSecretHash common.Hash) bool
	IsLockSecretHashChannelIdentifierDisposed(lockSecretHash common.Hash, ChannelIdentifier common.Hash) bool
}

SentAnnounceDisposedDao :

type SentEnvelopMessager

type SentEnvelopMessager struct {
	Message  encoding.EnvelopMessager
	Receiver common.Address
	Time     time.Time
	EchoHash []byte `storm:"id"`
}

SentEnvelopMessager is record of envelop message,that don't received a Ack

type SentEnvelopMessagerDao

type SentEnvelopMessagerDao interface {
	NewSentEnvelopMessager(msg encoding.EnvelopMessager, receiver common.Address)
	DeleteEnvelopMessager(echohash common.Hash)
	GetAllOrderedSentEnvelopMessager() []*SentEnvelopMessager
}

SentEnvelopMessagerDao :

type SentTransferDetail

type SentTransferDetail struct {
	Key               string         `storm:"id"`
	BlockNumber       int64          `json:"block_number" storm:"index"`
	TokenAddressBytes []byte         `json:"-"  storm:"index"`
	TokenAddress      common.Address `json:"token_address"`
	LockSecretHash    common.Hash
	TargetAddress     common.Address     `json:"target_address"`
	Amount            *big.Int           `json:"amount"`
	Data              string             `json:"data"`
	IsDirect          bool               `json:"is_direct"`
	SendingTime       int64              `json:"sending_time" storm:"index"`
	FinishTime        int64              `json:"finish_time" storm:"index"`
	Status            TransferStatusCode `json:"status"`
	StatusMessage     string             `json:"status_message"`

	/*
		通道相关信息,如果为MediatorTransfer, 保存的是我与第一个mediator节点的通道上的信息,这部分信息仅交易成功才会有
	*/
	ChannelIdentifier common.Hash `json:"channel_identifier"`
	OpenBlockNumber   int64       `json:"open_block_number"`
}

SentTransferDetail :

type SentTransferDetailDao

type SentTransferDetailDao interface {
	NewSentTransferDetail(tokenAddress, target common.Address, amount *big.Int, data string, isDirect bool, lockSecretHash common.Hash)
	UpdateSentTransferDetailStatus(tokenAddress common.Address, lockSecretHash common.Hash, status TransferStatusCode, statusMessage string, otherParams interface{}) (transfer *SentTransferDetail)
	UpdateSentTransferDetailStatusMessage(tokenAddress common.Address, lockSecretHash common.Hash, statusMessage string) (transfer *SentTransferDetail)
	GetSentTransferDetail(tokenAddress common.Address, lockSecretHash common.Hash) (*SentTransferDetail, error)
	GetSentTransferDetailList(tokenAddress common.Address, fromTime, toTime int64, fromBlock, toBlock int64) (transfers []*SentTransferDetail, err error)
}

SentTransferDetailDao :

type SettledChannelDao

type SettledChannelDao interface {
	NewSettledChannel(c *channeltype.Serialization) error
	GetAllSettledChannel() (chs []*channeltype.Serialization, err error)
	GetSettledChannel(channelIdentifier common.Hash, openBlockNumber int64) (c *channeltype.Serialization, err error)
}

SettledChannelDao :

type TX

type TX interface {
	Set(table string, key interface{}, value interface{}) error
	Save(v KeyGetter) error
	Commit() error
	Rollback() error
}

TX :

type TXInfo

type TXInfo struct {
	TXHash            common.Hash    `json:"tx_hash"`
	ChannelIdentifier common.Hash    `json:"channel_identifier"` // 结合OpenBlockNumber唯一确定一个通道
	OpenBlockNumber   int64          `json:"open_block_number"`
	TokenAddress      common.Address `json:"token_address"`
	Type              TXInfoType     `json:"type"`
	IsSelfCall        bool           `json:"is_self_call"` // 是否自己发起的
	TXParams          string         `json:"tx_params"`    // 保存调用tx的参数信息,json格式,内容根据TXType不同而不同,仅自己发起的部分tx里面会带此参数
	Status            TXInfoStatus   `json:"tx_status"`
	Events            []interface{}  `json:"events"`            // 保存这个tx成功之后对应的所有事件
	PackBlockNumber   int64          `json:"pack_block_number"` // tx最终所在的块号
	CallTime          int64          `json:"call_time"`         // tx发起时间戳
	PackTime          int64          `json:"pack_time"`         // tx打包时间戳
	GasPrice          uint64         `json:"gas_price"`
	GasUsed           uint64         `json:"gas_used"` // 消耗的gas
}

TXInfo 记录已经提交到公链节点的tx信息

func (*TXInfo) String

func (ti *TXInfo) String() string

String :

func (*TXInfo) ToTXInfoSerialization

func (ti *TXInfo) ToTXInfoSerialization() *TXInfoSerialization

ToTXInfoSerialization :

type TXInfoDao

type TXInfoDao interface {
	NewPendingTXInfo(tx *types.Transaction, txType TXInfoType, channelIdentifier common.Hash, openBlockNumber int64, txParams TXParams) (txInfo *TXInfo, err error)
	SaveEventToTXInfo(event interface{}) (txInfo *TXInfo, err error)
	UpdateTXInfoStatus(txHash common.Hash, status TXInfoStatus, pendingBlockNumber int64, gasUsed uint64) (txInfo *TXInfo, err error)
	GetTXInfoList(channelIdentifier common.Hash, openBlockNumber int64, tokenAddress common.Address, txType TXInfoType, status TXInfoStatus) (list []*TXInfo, err error)
}

TXInfoDao :

type TXInfoSerialization

type TXInfoSerialization struct {
	TXHash            []byte        `storm:"id"`
	ChannelIdentifier []byte        `storm:"index"` // 结合OpenBlockNumber唯一确定一个通道
	OpenBlockNumber   int64         `storm:"index"`
	TokenAddress      []byte        `storm:"index"`
	Type              string        `storm:"index"`
	IsSelfCall        bool          `storm:"index"` // 是否自己发起的
	TXParams          string        // 保存调用tx的参数信息,json格式,内容根据TXType不同而不同,仅自己发起的部分tx里面会带此参数
	Status            string        `storm:"index"`
	Events            []interface{} // 保存这个tx成功之后对应的所有事件
	PackBlockNumber   int64         `storm:"index"` // tx最终所在的块号
	CallTime          int64         `storm:"index"`
	PackTime          int64         `storm:"index"`
	GasPrice          uint64
	GasUsed           uint64
}

TXInfoSerialization :

func (*TXInfoSerialization) ToTXInfo

func (tis *TXInfoSerialization) ToTXInfo() *TXInfo

ToTXInfo :

type TXInfoStatus

type TXInfoStatus string

TXInfoStatus tx的状态

type TXInfoType

type TXInfoType string

TXInfoType 类型

type TXParams

type TXParams interface{}

TXParams tx的参数,自己发起的tx会带上

type TokenDao

type TokenDao interface {
	GetAllTokens() (tokens AddressMap, err error)
	AddToken(token common.Address, tokenNetworkAddress common.Address) error
}

TokenDao :

type TransferStatusCode

type TransferStatusCode int

TransferStatusCode status of transfer

type UnlockDao

type UnlockDao interface {
	IsThisLockHasUnlocked(channelIdentifier common.Hash, lockHash common.Hash) bool
	UnlockThisLock(channelIdentifier common.Hash, lockHash common.Hash)
}

UnlockDao :

type UnlockTXParams

type UnlockTXParams struct {
	TokenAddress       common.Address `json:"token_address"`
	ParticipantAddress common.Address `json:"participant_address"`
	PartnerAddress     common.Address `json:"partner_address"`
	TransferAmount     *big.Int       `json:"transfer_amount"`
	Expiration         *big.Int       `json:"expiration"`
	Amount             *big.Int       `json:"amount"`
	LockSecretHash     common.Hash    `json:"lock_secret_hash"`
	Proof              []byte         `json:"proof"`
}

UnlockTXParams 链上Unlock的参数

type XMPPSubDao

type XMPPSubDao interface {
	XMPPMarkAddrSubed(addr common.Address)
	XMPPIsAddrSubed(addr common.Address) bool
	XMPPUnMarkAddr(addr common.Address)
}

XMPPSubDao :

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL