db

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package db provides the database interfaces and types for the STIP Relayer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type STIPDB

type STIPDB interface {
	STIPDBReader
	STIPDBWriter
	// SubmitterDB returns the submitter database service.
	SubmitterDB() submitterDB.Service
}

STIPDB is the interface for the database service.

type STIPDBReader

type STIPDBReader interface {
	GetSTIPTransactionsNotRebated(ctx context.Context) ([]*STIPTransactions, error)
	GetTotalArbRebated(ctx context.Context, address string) (*big.Int, error)
}

STIPDBReader is the interface for reading from the database.

type STIPDBWriter

type STIPDBWriter interface {
	UpdateSTIPTransactionRebated(ctx context.Context, hash string, nonce uint64, arbAmountRebated string) error
	InsertNewStipTransactions(ctx context.Context, stipTransactions []STIPTransactions) error
	UpdateSTIPTransactionDoNotProcess(ctx context.Context, hash string) error
}

STIPDBWriter is the interface for writing to the database.

type STIPTransactions

type STIPTransactions struct {
	ExecutionID      string    `gorm:"column:execution_id;index"`
	Address          string    `gorm:"column:address"`
	Amount           float64   `gorm:"column:amount"`
	AmountUSD        float64   `gorm:"column:amount_usd"`
	ArbPrice         float64   `gorm:"column:arb_price"`
	BlockTime        time.Time `gorm:"column:block_time"`
	Direction        string    `gorm:"column:direction"`
	Hash             string    `gorm:"column:hash;index;primaryKey"`
	Module           string    `gorm:"column:module"`
	Token            string    `gorm:"column:token"`
	TokenPrice       float64   `gorm:"column:token_price"`
	Rebated          bool      `gorm:"column:rebated"`
	Nonce            uint64    `gorm:"column:nonce"`
	DoNotProcess     bool      `gorm:"column:do_not_process"`
	ArbAmountRebated string    `gorm:"column:arb_amount_rebated"`
}

STIPTransactions is the model that saves raw Dune response data.

Directories

Path Synopsis
sql
Package sql provides a common interface for starting sql-lite databases
Package sql provides a common interface for starting sql-lite databases
base
Package base contains the base sql implementation
Package base contains the base sql implementation
mysql
Package mysql contains a mysql db
Package mysql contains a mysql db
sqlite
Package sqlite implements the sqlite package
Package sqlite implements the sqlite package

Jump to

Keyboard shortcuts

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