models

package
v0.0.0-...-2b2340b Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	ID      uint
	Address string `gorm:"uniqueIndex"`
}

type Block

type Block struct {
	ID                    uint
	TimeStamp             time.Time
	Height                int64 `gorm:"uniqueIndex:chainheight"`
	ChainID               uint  `gorm:"uniqueIndex:chainheight"`
	Chain                 Chain
	ProposerConsAddress   Address
	ProposerConsAddressID uint
	TxIndexed             bool
	// TODO: Should block event indexing be split out or rolled up?
	BlockEventsIndexed bool
}

type BlockEvent

type BlockEvent struct {
	ID uint
	// These fields uniquely identify every block event
	// Index refers to the position of the event in the block event lifecycle array
	// LifecyclePosition refers to whether the event is a BeginBlock or EndBlock event
	Index             uint64                 `gorm:"uniqueIndex:eventBlockPositionIndex,priority:3"`
	LifecyclePosition BlockLifecyclePosition `gorm:"uniqueIndex:eventBlockPositionIndex,priority:2"`
	BlockID           uint                   `gorm:"uniqueIndex:eventBlockPositionIndex,priority:1"`
	Block             Block
	BlockEventTypeID  uint
	BlockEventType    BlockEventType
}

type BlockEventAttribute

type BlockEventAttribute struct {
	ID           uint
	BlockEvent   BlockEvent
	BlockEventID uint `gorm:"uniqueIndex:eventAttributeIndex,priority:1"`
	Value        string
	Index        uint64 `gorm:"uniqueIndex:eventAttributeIndex,priority:2"`
	// Keys are limited to a smallish subset of string values set by the Cosmos SDK and external modules
	// Save DB space by storing the key as a foreign key
	BlockEventAttributeKeyID uint
	BlockEventAttributeKey   BlockEventAttributeKey
}

type BlockEventAttributeKey

type BlockEventAttributeKey struct {
	ID  uint
	Key string `gorm:"uniqueIndex"`
}

type BlockEventParser

type BlockEventParser struct {
	ID                     uint
	BlockLifecyclePosition BlockLifecyclePosition `gorm:"uniqueIndex:idx_block_event_parser_identifier_lifecycle_position"`
	Identifier             string                 `gorm:"uniqueIndex:idx_block_event_parser_identifier_lifecycle_position"`
}

type BlockEventParserError

type BlockEventParserError struct {
	ID                 uint
	BlockEventParserID uint
	BlockEventParser   BlockEventParser
	BlockEventID       uint
	BlockEvent         BlockEvent
	Error              string
}

type BlockEventType

type BlockEventType struct {
	ID   uint
	Type string `gorm:"uniqueIndex"`
}

type BlockLifecyclePosition

type BlockLifecyclePosition int

Used to keep track of BeginBlock and EndBlock events

const (
	BeginBlockEvent BlockLifecyclePosition = iota
	EndBlockEvent
)

type Chain

type Chain struct {
	ID      uint   `gorm:"primaryKey"`
	ChainID string `gorm:"uniqueIndex"` // e.g. osmosis-1
	Name    string // e.g. Osmosis
}

type Custodial

type Custodial struct {
	ID              uint   `gorm:"primaryKey;column:id"`
	Name            string `gorm:"column:name"`
	BtcPublicKeyHex string `gorm:"uniqueIndex; not null;column:btc_public_key_hex"`
}

type CustodialGroup

type CustodialGroup struct {
	ID             uint        `gorm:"primaryKey;column:id"`
	Name           string      `gorm:"column:name"`
	TaprootAddress string      `gorm:"uniqueIndex; not null;column:taproot_address"` // Calculate from BtcPublicKeyHex of each Custodials
	Quorum         uint        `gorm:"not null;column:quorum"`
	Custodials     []Custodial `gorm:"many2many:custodial_group_members;"`
}

type DApp

type DApp struct {
	ID                   string         `gorm:"primaryKey;type:uuid;default:gen_random_uuid()"`
	ChainName            string         `gorm:"column:chain_name;not null"`
	BTCAddressHex        string         `gorm:"column:btc_address_hex"`
	PublicKeyHex         string         `gorm:"column:public_key_hex"`
	SmartContractAddress string         `gorm:"column:smart_contract_address"`
	State                bool           `gorm:"column:state"`
	ChainID              string         `gorm:"column:chain_id"`
	ChainEndpoint        string         `gorm:"column:chain_endpoint"`
	RPCUrl               string         `gorm:"column:rpc_url"`
	AccessToken          string         `gorm:"column:access_token"`
	TokenContractAddress string         `gorm:"column:token_contract_address"`
	CustodialGroupID     uint           `gorm:"not null" json:"-"`
	CustodialGroup       CustodialGroup `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
}

type Denom

type Denom struct {
	ID   uint
	Base string `gorm:"uniqueIndex"`
}

type FailedBlock

type FailedBlock struct {
	ID           uint
	Height       int64 `gorm:"uniqueIndex:failedchainheight"`
	BlockchainID uint  `gorm:"uniqueIndex:failedchainheight"`
	Chain        Chain `gorm:"foreignKey:BlockchainID"`
}

type FailedEventBlock

type FailedEventBlock struct {
	ID           uint
	Height       int64 `gorm:"uniqueIndex:failedchaineventheight"`
	BlockchainID uint  `gorm:"uniqueIndex:failedchaineventheight"`
	Chain        Chain `gorm:"foreignKey:BlockchainID"`
}

type FailedMessage

type FailedMessage struct {
	ID           uint
	MessageIndex int
	TxID         uint
	Tx           Tx
}

type FailedTx

type FailedTx struct {
	ID      uint
	Hash    string `gorm:"uniqueIndex"`
	BlockID uint
	Block   Block
}

type Fee

type Fee struct {
	ID             uint            `gorm:"primaryKey"`
	TxID           uint            `gorm:"uniqueIndex:txDenomFee"`
	Amount         decimal.Decimal `gorm:"type:decimal(78,0);"`
	DenominationID uint            `gorm:"uniqueIndex:txDenomFee"`
	Denomination   Denom           `gorm:"foreignKey:DenominationID"`
	PayerAddressID uint            `gorm:"index:idx_payer_addr"`
	PayerAddress   Address         `gorm:"foreignKey:PayerAddressID"`
}

func (*Fee) BeforeCreate

func (b *Fee) BeforeCreate(tx *gorm.DB) (err error)

This lifecycle function ensures the on conflict statement is added for Fees which are associated to Txes by the Gorm slice association method for has_many

type Message

type Message struct {
	ID            uint
	TxID          uint `gorm:"uniqueIndex:messageIndex,priority:1"`
	Tx            Tx
	MessageTypeID uint `gorm:"foreignKey:MessageTypeID,index:idx_txid_typeid"`
	MessageType   MessageType
	MessageIndex  int `gorm:"uniqueIndex:messageIndex,priority:2"`
	MessageBytes  []byte
}

type MessageEvent

type MessageEvent struct {
	ID uint
	// These fields uniquely identify every message event
	// Index refers to the position of the event in the message event array
	Index              uint64 `gorm:"uniqueIndex:messageEventIndex,priority:2"`
	MessageID          uint   `gorm:"uniqueIndex:messageEventIndex,priority:1"`
	Message            Message
	MessageEventTypeID uint
	MessageEventType   MessageEventType
}

type MessageEventAttribute

type MessageEventAttribute struct {
	ID             uint
	MessageEvent   MessageEvent
	MessageEventID uint `gorm:"uniqueIndex:messageAttributeIndex,priority:1"`
	Value          string
	Index          uint64 `gorm:"uniqueIndex:messageAttributeIndex,priority:2"`
	// Keys are limited to a smallish subset of string values set by the Cosmos SDK and external modules
	// Save DB space by storing the key as a foreign key
	MessageEventAttributeKeyID uint
	MessageEventAttributeKey   MessageEventAttributeKey
}

type MessageEventAttributeKey

type MessageEventAttributeKey struct {
	ID  uint
	Key string `gorm:"uniqueIndex"`
}

type MessageEventType

type MessageEventType struct {
	ID   uint
	Type string `gorm:"uniqueIndex"`
}

type MessageParser

type MessageParser struct {
	ID uint
	// Should the message type be added here for clarity purposes?
	Identifier string `gorm:"uniqueIndex:idx_message_parser_identifier"`
}

type MessageParserError

type MessageParserError struct {
	ID              uint
	MessageParserID uint
	MessageParser   MessageParser
	MessageID       uint
	Message         Message
	Error           string
}

type MessageType

type MessageType struct {
	ID          uint   `gorm:"primaryKey"`
	MessageType string `gorm:"uniqueIndex;not null"`
}

type ShortenCustodialGroup

type ShortenCustodialGroup struct {
	ID             uint
	Name           string
	TaprootAddress string
}

type Tx

type Tx struct {
	ID              uint
	Hash            string `gorm:"uniqueIndex"`
	Code            uint32
	BlockID         uint
	Block           Block
	Memo            string
	SignerAddresses []Address `gorm:"many2many:tx_signer_addresses;"`
	Fees            []Fee
}

Jump to

Keyboard shortcuts

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