chains

package
v0.0.0-...-e53369f Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader

type BlockHeader struct {
	gorm.Model
	Chain       string `gorm:"type:varchar(64);index:idx_chain_blocknumber,unique"`
	BlockNumber uint64 `gorm:"type:bigint;index:idx_chain_blocknumber,unique"`
	ParentHash  string `gorm:"type:varchar(64)"`
	BlockHash   string `gorm:"type:varchar(64)"`
	BlockTime   uint64 `gorm:"type:bigint"`
	TxHash      string `gorm:"type:varchar(64)"`
	Root        string `gorm:"type:varchar(64)"`
	BeaconRoot  string `gorm:"type:varchar(64)"`
}

type BtcBlockHeader

type BtcBlockHeader struct {
	Version       int32  `json:"version"` //TODO: remove this field
	PrevBlockHash string `json:"prev_block_hash"`
	MerkleRoot    []byte `json:"merkle_root"`
	Time          uint32 `json:"time"`
	CompactTarget uint32 `json:"compact_target"`
	Nonce         uint32 `json:"nonce"`
	Hash          string `json:"hash"`
	Height        int    `json:"height" gorm:"type:bigint;index:idx_btc_block_header_height,unique"` //Height of the block
}

func (*BtcBlockHeader) ParseHeaderEntry

func (b *BtcBlockHeader) ParseHeaderEntry(headerEntry *HeaderEntry) error

type BtcRedeemTx

type BtcRedeemTx struct {
	gorm.Model
	Chain             string `gorm:"type:varchar(64);index:idx_btc_redeem_tx_chain_tx_hash,unique"`
	BlockNumber       uint64 `gorm:"type:bigint;index:idx_btc_redeem_tx_block_number"`
	BlockHash         string `gorm:"type:varchar(255)"`
	TxHash            string `gorm:"type:varchar(255);index:idx_btc_redeem_tx_tx_hash;index:idx_btc_redeem_tx_chain_tx_hash,unique"`
	TxPosition        uint   `gorm:"type:int"`
	Amount            uint64 `gorm:"type:bigint"`
	Timestamp         uint64 `gorm:"type:bigint"`
	ServiceTag        string `gorm:"type:varchar(32)"`
	CovenantQuorum    uint8  `gorm:"type:int"`
	SessionSequence   uint64 `gorm:"type:bigint"`
	CustodianGroupUid string `gorm:"type:varchar(255)"`
	MerkleProof       []byte `gorm:"type:bytea"`
	RawTx             []byte `gorm:"type:bytea"`
}

type BtcRedeemTxOutput

type BtcRedeemTxOutput struct {
	gorm.Model
	Chain       string `gorm:"type:varchar(64);index:idx_btc_redeem_tx_output_chain_tx_hash,unique"`
	BlockNumber uint64 `gorm:"type:bigint;index:idx_btc_redeem_tx_output_block_number"`
	BlockHash   string `gorm:"type:varchar(255)"`
	TxHash      string `gorm:"type:varchar(255);index:idx_btc_redeem_tx_output_tx_hash;index:idx_btc_redeem_tx_output_chain_tx_hash,unique"`
	TxPosition  uint   `gorm:"type:int"`
	Amount      uint64 `gorm:"type:bigint"`
}

type CommandExecuted

type CommandExecuted struct {
	gorm.Model
	SourceChain string `gorm:"type:varchar(255)"`
	Address     string `gorm:"type:varchar(255)"`
	TxHash      string `gorm:"type:varchar(255);index:idx_command_executed_tx_hash"`
	BlockNumber uint64
	BlockTime   uint64
	LogIndex    uint
	CommandID   string `gorm:"uniqueIndex; type:varchar(255)"`
}

type ContractCall

type ContractCall struct {
	EventID            string `gorm:"primaryKey"`
	TxHash             string `gorm:"type:varchar(255)"`
	BlockNumber        uint64 `gorm:"default:0"`
	BlockTime          uint64 `gorm:"default:0"`
	LogIndex           uint
	SourceChain        string             `gorm:"type:varchar(64)"`
	SourceAddress      string             `gorm:"type:varchar(255)"`
	DestinationChain   string             `gorm:"type:varchar(64)"`
	DestinationAddress string             `gorm:"type:varchar(255)"`
	Status             ContractCallStatus `gorm:"default:pending"`
	Payload            []byte
	PayloadHash        string    `gorm:"type:varchar(255)"`
	ExecuteHash        string    `gorm:"type:varchar(255)"`
	CreatedAt          time.Time `gorm:"type:timestamp(6);default:current_timestamp(6)"`
	UpdatedAt          time.Time `gorm:"type:timestamp(6);default:current_timestamp(6)"`
	DeletedAt          gorm.DeletedAt
}

type ContractCallApproved

type ContractCallApproved struct {
	EventID          string    `gorm:"primaryKey"`
	TxHash           string    `gorm:"type:varchar(255)"`
	SourceChain      string    `gorm:"type:varchar(255)"`
	DestinationChain string    `gorm:"type:varchar(255)"`
	CommandID        string    `gorm:"type:varchar(255)"`
	Sender           string    `gorm:"type:varchar(255)"`
	ContractAddress  string    `gorm:"type:varchar(255)"`
	PayloadHash      string    `gorm:"type:varchar(255)"`
	SourceTxHash     string    `gorm:"type:varchar(255)"`
	SourceEventIndex uint64    `gorm:"type:bigint"`
	CreatedAt        time.Time `gorm:"type:timestamp(6);default:current_timestamp(6)"`
	UpdatedAt        time.Time `gorm:"type:timestamp(6);default:current_timestamp(6)"`
	DeletedAt        gorm.DeletedAt
}

type ContractCallStatus

type ContractCallStatus string

TokenSentStatus represents the status of a token transfer

const (
	// TokenSentStatusPending indicates the token is just received from the source chain
	ContractCallStatusPending ContractCallStatus = "pending"
	// TokenSentStatusVerifying indicates the transfer is broadcasting to the scalar for verification
	ContractCallStatusVerifying ContractCallStatus = "verifying"
	// TokenSentStatusApproved indicates the transfer is approved by the scalar network
	ContractCallStatusApproved ContractCallStatus = "approved"
	// TokenSentStatusSigning indicates the transfer is signing in the scalar network
	ContractCallStatusSigning ContractCallStatus = "signing"
	// TokenSentStatusExecuting indicates the transfer is executing on the destination chain
	ContractCallStatusExecuting ContractCallStatus = "executing"
	// TokenSentStatusSuccess indicates the transfer was successful executed on the destination chain
	ContractCallStatusSuccess ContractCallStatus = "success"
	// TokenSentStatusFailed indicates the transfer failed
	ContractCallStatusFailed ContractCallStatus = "failed"
	// TokenSentStatusCancelled indicates the transfer was cancelled
	ContractCallStatusCancelled ContractCallStatus = "cancelled"
)

type ContractCallWithToken

type ContractCallWithToken struct {
	ContractCall
	TokenContractAddress string `gorm:"type:varchar(255)"`
	Symbol               string `gorm:"type:varchar(255)"`
	Amount               uint64 `gorm:"type:bigint"`
	CustodianGroupUid    string `gorm:"type:varchar(255)"` //For redeem evm tx
	SessionSequence      uint64 `gorm:"type:bigint"`       //For redeem evm tx
}

type EvmRedeemTx

type EvmRedeemTx struct {
	EventID              string `gorm:"primaryKey"`
	TxHash               string `gorm:"type:varchar(255)"`
	BlockNumber          uint64 `gorm:"default:0"`
	BlockTime            uint64 `gorm:"default:0"`
	LogIndex             uint
	SourceChain          string       `gorm:"type:varchar(64)"`
	SourceAddress        string       `gorm:"type:varchar(255)"`
	DestinationChain     string       `gorm:"type:varchar(64)"`
	DestinationAddress   string       `gorm:"type:varchar(255)"`
	Status               RedeemStatus `gorm:"default:pending"`
	Payload              []byte
	PayloadHash          string    `gorm:"type:varchar(255)"`
	ExecuteHash          string    `gorm:"type:varchar(255)"`
	TokenContractAddress string    `gorm:"type:varchar(255)"`
	Symbol               string    `gorm:"type:varchar(255)"`
	Amount               uint64    `gorm:"type:bigint"`
	CustodianGroupUid    string    `gorm:"type:varchar(255)"` //For redeem evm tx
	SessionSequence      uint64    `gorm:"type:bigint"`       //For redeem evm tx
	CreatedAt            time.Time `gorm:"type:timestamp(6);default:current_timestamp(6)"`
	UpdatedAt            time.Time `gorm:"type:timestamp(6);default:current_timestamp(6)"`
	DeletedAt            gorm.DeletedAt
}

type HeaderEntry

type HeaderEntry struct {
	Hex    string `json:"hex"` //Header hex
	Hash   string `json:"hash"`
	Height int    `json:"height"` //Height of the block
}

type RedeemStatus

type RedeemStatus string

RedeemStatus represents the status of a token transfer

const (
	// RedeemStatusExecuting indicates the transaction is just broadcast to the network
	RedeemStatusExecuting RedeemStatus = "executing"
	// RedeemStatusVerifying indicates the transfer is broadcasting to the scalar for verification
	RedeemStatusVerifying RedeemStatus = "verifying"
	// RedeemStatusApproved indicates the transfer is approved by the scalar network
	RedeemStatusApproved RedeemStatus = "approved"
	RedeemStatusSuccess  RedeemStatus = "success"
)

type SwitchedPhase

type SwitchedPhase struct {
	gorm.Model
	SourceChain       string `gorm:"type:varchar(32);index:idx_switched_phase,unique"`
	TxHash            string `gorm:"type:varchar(255);index:idx_switched_phase,unique"`
	BlockNumber       uint64 `gorm:"index:idx_block_number;type:bigint"`
	CustodianGroupUid string `gorm:"index:idx_switched_phase,unique;type:varchar(64)"`
	SessionSequence   uint64 `gorm:"index:idx_switched_phase,unique;type:bigint"`
	From              uint8  `gorm:"type:int"`
	To                uint8  `gorm:"type:int"`
}

type TokenDeployed

type TokenDeployed struct {
	gorm.Model
	SourceChain  string `gorm:"type:varchar(32);uniqueIndex:idx_token_deployed_source_chain_token_address"`
	TokenAddress string `gorm:"type:varchar(255);uniqueIndex:idx_token_deployed_source_chain_token_address"`
	BlockNumber  uint64 `gorm:"type:bigint"`
	TxHash       string `gorm:"type:varchar(255)"`
	Symbol       string `gorm:"type:varchar(32)"`
}

type TokenSent

type TokenSent struct {
	EventID              string            `gorm:"primaryKey;type:varchar(255)"`
	TxHash               string            `gorm:"type:varchar(255)"`
	RawTx                []byte            `gorm:"type:bytea"`
	BlockNumber          uint64            `gorm:"default:0"`
	BlockTime            uint64            `gorm:"default:0"`
	LogIndex             uint              `gorm:"default:0"`
	MerkleProof          types.StringArray `gorm:"type:text[]"`
	SourceChain          string            `gorm:"type:varchar(64)"`
	SourceAddress        string            `gorm:"type:varchar(255)"`
	StakerPubkey         []byte            `gorm:"type:bytea"`
	DestinationChain     string            `gorm:"type:varchar(64)"`
	DestinationAddress   string            `gorm:"type:varchar(255)"`
	TokenContractAddress string            `gorm:"type:varchar(255)"`
	Amount               uint64            `gorm:"type:bigint"`
	Symbol               string            `gorm:"type:varchar(255)"`
	Status               TokenSentStatus   `gorm:"default:pending"`
	CreatedAt            time.Time         `gorm:"default:current_timestamp(6)"`
	UpdatedAt            time.Time         `gorm:"type:timestamp(6);default:current_timestamp(6)"`
}

type TokenSentStatus

type TokenSentStatus string

TokenSentStatus represents the status of a token transfer

const (
	// TokenSentStatusPending indicates the token is just received from the source chain
	TokenSentStatusPending TokenSentStatus = "pending"
	// TokenSentStatusVerifying indicates the transfer is broadcasting to the scalar for verification
	TokenSentStatusVerifying TokenSentStatus = "verifying"
	// TokenSentStatusApproved indicates the transfer is approved by the scalar network
	TokenSentStatusApproved TokenSentStatus = "approved"
	// TokenSentStatusSigning indicates the transfer is signing in the scalar network
	TokenSentStatusSigning TokenSentStatus = "signing"
	// TokenSentStatusExecuting indicates the transfer is executing on the destination chain
	TokenSentStatusExecuting TokenSentStatus = "executing"
	// TokenSentStatusSuccess indicates the transfer was successful executed on the destination chain
	TokenSentStatusSuccess TokenSentStatus = "success"
	// TokenSentStatusFailed indicates the transfer failed
	TokenSentStatusFailed TokenSentStatus = "failed"
	// TokenSentStatusCancelled indicates the transfer was cancelled
	TokenSentStatusCancelled TokenSentStatus = "cancelled"

	TokenSentStatusDeleted TokenSentStatus = "deleted"
)

type VaultTransaction

type VaultTransaction struct {
	gorm.Model
	Chain                       string `gorm:"type:varchar(64);index:idx_vault_tx_chain_tx_hash,unique"`
	BlockNumber                 uint64 `gorm:"type:bigint;index:idx_vault_tx_block_number"`
	BlockHash                   string `gorm:"type:varchar(255)"`
	TxHash                      string `gorm:"type:varchar(255);index:idx_vault_tx_tx_hash;index:idx_vault_tx_chain_tx_hash,unique"`
	TxPosition                  uint   `gorm:"type:int"`
	Amount                      uint64 `gorm:"type:bigint"`
	StakerScriptPubkey          string `gorm:"type:varchar(255)"`
	Timestamp                   uint64 `gorm:"type:bigint"`
	ChangeAmount                uint64 `gorm:"type:bigint"`
	ChangeAddress               string `gorm:"type:varchar(255)"`
	ServiceTag                  string `gorm:"type:varchar(32)"`
	CovenantQuorum              uint8  `gorm:"type:int"`
	VaultTxType                 uint8  `gorm:"type:int"` // 1=Staking, 2=Unstaking
	DestinationChain            uint64 `gorm:"type:bigint"`
	DestinationTokenAddress     string `gorm:"type:varchar(255)"`
	DestinationRecipientAddress string `gorm:"type:varchar(255)"`
	SessionSequence             uint64 `gorm:"type:bigint"`
	CustodianGroupUID           string `gorm:"type:varchar(255)"`
	ScriptPubkey                []byte `gorm:"type:bytea"`
	MerkleProof                 []byte `gorm:"type:bytea"`
	RawTx                       []byte `gorm:"type:bytea"`
}

Jump to

Keyboard shortcuts

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