Documentation ¶
Index ¶
- Constants
- type Bch2SbchRecord
- func (record *Bch2SbchRecord) UpdateStatusToBchUnlocked(bchUnlockTxHash string) *Bch2SbchRecord
- func (record *Bch2SbchRecord) UpdateStatusToSbchLocked(sbchLockTxHash string, sbchLockTxTime uint64) *Bch2SbchRecord
- func (record *Bch2SbchRecord) UpdateStatusToSbchRefunded(sbchRefundTxHash string) *Bch2SbchRecord
- func (record *Bch2SbchRecord) UpdateStatusToSecretRevealed(secret, sbchUnlockTxHash string) *Bch2SbchRecord
- type Bch2SbchStatus
- type BchClient
- type DB
- type IBchClient
- type ISbchClient
- type LastHeights
- type MarketMakerBot
- type MockBchClient
- type MockSbchClient
- type Sbch2BchRecord
- func (record *Sbch2BchRecord) UpdateStatusToBchLocked(bchLockTxHash string) *Sbch2BchRecord
- func (record *Sbch2BchRecord) UpdateStatusToBchRefunded(bchRefundTxHash string) *Sbch2BchRecord
- func (record *Sbch2BchRecord) UpdateStatusToSbchUnlocked(sbchUnlockTxHash string) *Sbch2BchRecord
- func (record *Sbch2BchRecord) UpdateStatusToSecretRevealed(secret, bchUnlockTxHash string) *Sbch2BchRecord
- type Sbch2BchStatus
- type SbchClient
Constants ¶
View Source
const ( SwapInvalid = iota SwapLocked SwapUnlocked SwapRefunded )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bch2SbchRecord ¶
type Bch2SbchRecord struct { gorm.Model BchLockHeight uint64 `gorm:"not null"` // got from tx BchLockTxHash string `gorm:"unique"` // got from tx Value uint64 `gorm:"not null"` // got from tx, in Sats RecipientPkh string `gorm:"not null"` // got from retData SenderPkh string `gorm:"not null"` // got from retData HashLock string `gorm:"unique"` // got from retData, in Blocks TimeLock uint32 `gorm:"not null"` // got from retData PenaltyBPS uint16 `gorm:"not null"` // got from retData SenderEvmAddr string `gorm:"not null"` // got from retData HtlcScriptHash string `gorm:"not null"` // calculated SbchLockTxTime uint64 `` // set when status changed to Bch2SbchStatusSbchLocked SbchLockTxHash string `` // set when status changed to Bch2SbchStatusSbchLocked SbchUnlockTxHash string `` // set when status changed to Bch2SbchStatusSecretRevealed Secret string `` // set when status changed to Bch2SbchStatusSecretRevealed BchUnlockTxHash string `` // set when status changed to Bch2SbchStatusBchUnlocked SbchRefundTxHash string `` // set when status changed to Bch2SbchStatusSbchRefunded Status Bch2SbchStatus `gorm:"not null"` // }
func (*Bch2SbchRecord) UpdateStatusToBchUnlocked ¶ added in v0.1.0
func (record *Bch2SbchRecord) UpdateStatusToBchUnlocked(bchUnlockTxHash string) *Bch2SbchRecord
func (*Bch2SbchRecord) UpdateStatusToSbchLocked ¶ added in v0.1.0
func (record *Bch2SbchRecord) UpdateStatusToSbchLocked(sbchLockTxHash string, sbchLockTxTime uint64) *Bch2SbchRecord
func (*Bch2SbchRecord) UpdateStatusToSbchRefunded ¶ added in v0.1.0
func (record *Bch2SbchRecord) UpdateStatusToSbchRefunded(sbchRefundTxHash string) *Bch2SbchRecord
func (*Bch2SbchRecord) UpdateStatusToSecretRevealed ¶ added in v0.1.0
func (record *Bch2SbchRecord) UpdateStatusToSecretRevealed(secret, sbchUnlockTxHash string) *Bch2SbchRecord
type Bch2SbchStatus ¶
type Bch2SbchStatus int
const ( Bch2SbchStatusNew Bch2SbchStatus = iota Bch2SbchStatusSbchLocked Bch2SbchStatusSecretRevealed Bch2SbchStatusBchUnlocked Bch2SbchStatusSbchRefunded Bch2SbchStatusTooLateToLockSbch )
type BchClient ¶
type BchClient struct {
// contains filtered or unexported fields
}
func NewBchClient ¶ added in v0.1.0
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (DB) GetAllBch2SbchRecords ¶
func (db DB) GetAllBch2SbchRecords() (records []*Bch2SbchRecord, err error)
func (DB) GetAllSbch2BchRecords ¶
func (db DB) GetAllSbch2BchRecords() (records []*Sbch2BchRecord, err error)
type IBchClient ¶
type ISbchClient ¶
type ISbchClient interface {
// contains filtered or unexported methods
}
type LastHeights ¶
type MarketMakerBot ¶
type MarketMakerBot struct {
// contains filtered or unexported fields
}
func NewBot ¶
func NewBot( dbFile string, bchPrivKeyWIF, sbchPrivKeyHex string, bchMasterAddr, sbchMasterAddr string, bchRpcUrl, sbchRpcUrl string, sbchHtlcAddr gethcmn.Address, sbchGasPrice *big.Int, bchConfirmations uint8, bchSendMinerFeeRate, bchReceiveMinerFeeRate, bchRefundMinerFeeRate uint64, sbchLockGasLimit, sbchUnlockGasLimit, sbchRefundGasLimit uint64, dbQueryLimit int, debugMode bool, slaveMode bool, lazyMaster bool, ) (*MarketMakerBot, error)
func (*MarketMakerBot) GetUTXOs ¶
func (bot *MarketMakerBot) GetUTXOs() ([]btcjson.ListUnspentResult, error)
func (*MarketMakerBot) Loop ¶
func (bot *MarketMakerBot) Loop()
func (*MarketMakerBot) PrepareDB ¶
func (bot *MarketMakerBot) PrepareDB()
type MockBchClient ¶
type MockBchClient struct {
// contains filtered or unexported fields
}
type MockSbchClient ¶
type MockSbchClient struct {
// contains filtered or unexported fields
}
type Sbch2BchRecord ¶
type Sbch2BchRecord struct { gorm.Model SbchLockTime uint64 `gorm:"not null"` // got from event SbchLockTxHash string `gorm:"unique"` // got from event Value uint64 `gorm:"not null"` // got from txValue, in Sats SbchSenderAddr string `gorm:"not null"` // got from event BchRecipientPkh string `gorm:"not null"` // got from event HashLock string `gorm:"unique"` // got from event TimeLock uint32 `gorm:"not null"` // got from event, in Seconds PenaltyBPS uint16 `gorm:"not null"` // got from event HtlcScriptHash string `gorm:"not null"` // calculated by bot BchLockTxHash string `` // set when status changed to Sbch2BchStatusBchLocked BchUnlockTxHash string `` // set when status changed to Sbch2BchStatusSecretRevealed Secret string `` // set when status changed to Sbch2BchStatusSecretRevealed SbchUnlockTxHash string `` // set when status changed to Sbch2BchStatusSbchUnlocked BchRefundTxHash string `` // set when status changed to Sbch2BchStatusBchRefunded Status Sbch2BchStatus `gorm:"not null"` // }
func (*Sbch2BchRecord) UpdateStatusToBchLocked ¶ added in v0.1.0
func (record *Sbch2BchRecord) UpdateStatusToBchLocked(bchLockTxHash string) *Sbch2BchRecord
func (*Sbch2BchRecord) UpdateStatusToBchRefunded ¶ added in v0.1.0
func (record *Sbch2BchRecord) UpdateStatusToBchRefunded(bchRefundTxHash string) *Sbch2BchRecord
func (*Sbch2BchRecord) UpdateStatusToSbchUnlocked ¶ added in v0.1.0
func (record *Sbch2BchRecord) UpdateStatusToSbchUnlocked(sbchUnlockTxHash string) *Sbch2BchRecord
func (*Sbch2BchRecord) UpdateStatusToSecretRevealed ¶ added in v0.1.0
func (record *Sbch2BchRecord) UpdateStatusToSecretRevealed(secret, bchUnlockTxHash string) *Sbch2BchRecord
type Sbch2BchStatus ¶
type Sbch2BchStatus int
const ( Sbch2BchStatusNew Sbch2BchStatus = iota Sbch2BchStatusBchLocked Sbch2BchStatusSecretRevealed Sbch2BchStatusSbchUnlocked Sbch2BchStatusBchRefunded Sbch2BchStatusTooLateToLockBch )
type SbchClient ¶
type SbchClient struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.