db

package
v0.0.0-...-fdc2919 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Pending is the initial state of a mint
	// when we are waiting for the monero deposit to confirm
	Pending = MintState("PENDING")
	// Processing is the secondary state of a mint
	// when the monero deposit has confirmed, and when
	// we've broadcasted the wXMR mint transaction
	Processing = MintState("PROCESSING")
	// Confirmed is the third and last state of a mint
	// when the monero deposit has confirmed, and
	// the wXMR mint transaction has confirmed
	Confirmed = MintState("CONFIRMED")
)

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database wraps a backend db

func New

func New(dbPath string) (*Database, error)

New returns a new sqlite3 database wrapper

func (*Database) Close

func (d *Database) Close() error

func (*Database) ConfirmDeposit

func (d *Database) ConfirmDeposit(address string) error

func (*Database) GetDeposit

func (d *Database) GetDeposit(address string) (*Deposit, error)

func (*Database) GetMint

func (d *Database) GetMint(paymentID string) (*Mint, error)

func (*Database) GetProof

func (d *Database) GetProof(hash string) (*Proof, error)

GetProof searches for a proof by its hash

func (*Database) GetProofs

func (d *Database) GetProofs() ([]Proof, error)

GetProofs returns all known proofs

func (*Database) NewMint

func (d *Database) NewMint(paymentID, ethAddress string) error

NewMint creates a new mint event

func (*Database) NewProof

func (d *Database) NewProof(
	moneroHeight uint64,
	ethereumHeight int64,
	proofHash, proofSignature string,
) error

NewProof stores a new proof in the database

func (*Database) RegisterDeposit

func (d *Database) RegisterDeposit(address, paymentID string) error

RegisterDeposit is used to register a new deposit address

func (*Database) SetMintState

func (d *Database) SetMintState(paymentID string, state MintState) error

func (*Database) SetMintTx

func (d *Database) SetMintTx(paymentID string, txHash string) error

type Deposit

type Deposit struct {
	gorm.Model
	Address   string `gorm:"unique"`
	PaymentID string `gorm:"unique"`
	Confirmed bool
}

Deposit represents an integrated address that can be used to deposit XMR into the reserve minting wXMR

type Mint

type Mint struct {
	gorm.Model
	PaymentID       string `gorm:"unique"`
	EthAddress      string
	MintTransaction string
	State           MintState
}

Mint represents a given minting event

type MintState

type MintState string

MintState represents a state about a given mint

func (MintState) String

func (m MintState) String() string

type Proof

type Proof struct {
	gorm.Model
	MoneroHeight   uint64
	EthereumHeight int64
	ProofHash      string `gorm:"unique"` // the hash of the proof signature
	ProofSignature string
}

Proof are the official proofs submitted to the reserve contract

Jump to

Keyboard shortcuts

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