treasury

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTreasuryPoolNotFound          = errors.New("no records could be found")
	ErrTreasuryPoolBlockhashNotFound = errors.New("treasury pool blockhash not found")
	ErrStaleTreasuryPoolState        = errors.New("treasury pool state is stale")
	ErrNegativeFunding               = errors.New("treasury pool has negative funding")
)

Functions

This section is empty.

Types

type FundingHistoryRecord

type FundingHistoryRecord struct {
	Id            uint64
	Vault         string
	DeltaQuarks   int64
	TransactionId string
	State         FundingState
	CreatedAt     time.Time
}

func (*FundingHistoryRecord) Clone

func (*FundingHistoryRecord) CopyTo

func (*FundingHistoryRecord) Validate

func (r *FundingHistoryRecord) Validate() error

type FundingState

type FundingState uint8
const (
	FundingStateUnknown FundingState = iota
	FundingStatePending
	FundingStateConfirmed
	FundingStateFailed
)

type Record

type Record struct {
	Id uint64

	DataVersion splitter_token.DataVersion

	Name string

	Address string
	Bump    uint8

	Vault     string
	VaultBump uint8

	Authority string

	MerkleTreeLevels uint8

	CurrentIndex    uint8
	HistoryListSize uint8
	HistoryList     []string // order maintained with on-chain state

	SolanaBlock uint64

	State TreasuryPoolState // currently managed manually

	LastUpdatedAt time.Time
}

func (*Record) Clone

func (r *Record) Clone() *Record

func (*Record) ContainsRecentRoot

func (r *Record) ContainsRecentRoot(recentRoot string) (bool, int)

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) GetMostRecentRoot

func (r *Record) GetMostRecentRoot() string

func (*Record) GetPreviousMostRecentRoot

func (r *Record) GetPreviousMostRecentRoot() string

func (*Record) Update

func (r *Record) Update(data *splitter_token.PoolAccount, solanaBlock uint64) error

func (*Record) Validate

func (r *Record) Validate() error

type Store

type Store interface {
	// Save saves a treasury pool account's state
	Save(ctx context.Context, record *Record) error

	// GetByName gets a treasury pool account by its name
	GetByName(ctx context.Context, name string) (*Record, error)

	// GetByAddress gets a treasury pool account by its address
	GetByAddress(ctx context.Context, address string) (*Record, error)

	// GetByVault gets a treasury pool account by its vault address
	GetByVault(ctx context.Context, vault string) (*Record, error)

	// GetAllByState gets all treasury pool accounts in the provided state
	GetAllByState(ctx context.Context, state TreasuryPoolState, cursor query.Cursor, limit uint64, direction query.Ordering) ([]*Record, error)

	// SaveFunding saves a funding history record for a treasury pool vault
	SaveFunding(ctx context.Context, record *FundingHistoryRecord) error

	// GetTotalAvailableFunds gets the total available funds for a treasury pool's vault
	GetTotalAvailableFunds(ctx context.Context, vault string) (uint64, error)
}

type TreasuryPoolState

type TreasuryPoolState uint8
const (
	TreasuryPoolStateUnknown TreasuryPoolState = iota
	TreasuryPoolStateAvailable
	TreasuryPoolStateDeprecated
)

func (TreasuryPoolState) String

func (s TreasuryPoolState) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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