financials

package
v0.2.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FundSourceContract identifies a contract as the source of funds
	FundSourceContract = "contract"
	// FundSourceAccount identifies an account as the source of funds
	FundSourceAccount = "account"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FundSource

type FundSource struct {
	ID   types.Hash256
	Type string
}

A FundSource identifies the source of a financial record

func (FundSource) MarshalText

func (fs FundSource) MarshalText() ([]byte, error)

MarshalText marshals a fund source to a string

func (FundSource) String

func (fs FundSource) String() string

String returns a string representation of the fund source

func (FundSource) UnmarshalText

func (fs FundSource) UnmarshalText(text []byte) error

UnmarshalText unmarshals a fund source from a string

type FundingRecord

type FundingRecord struct {
	// Source is the source of the funds. It must be a contract.
	Source FundSource `json:"source"`
	// Destination is the destination of the funds. It must be an account.
	Destination FundSource     `json:"destination"`
	Amount      types.Currency `json:"amount"`
	// Reverted indicates whether the funding source was reverted due to a
	// block reorg or other consensus issue.
	Reverted  bool      `json:"reverted"`
	Timestamp time.Time `json:"timestamp"`
}

A FundingRecord records a transfer of funds between a source contract and a destination account.

type Record

type Record struct {
	Source        FundSource     `json:"source"`
	Egress        types.Currency `json:"egress"`
	Ingress       types.Currency `json:"ingress"`
	Fees          types.Currency `json:"fees"`
	Storage       types.Currency `json:"storage"`
	RegistryRead  types.Currency `json:"registryRead"`
	RegistryWrite types.Currency `json:"registryWrite"`

	Timestamp time.Time `json:"timestamp"`
}

A Record records spending from a funding source

type Revenue

type Revenue struct {
	Storage       types.Currency `json:"storage"`
	Ingress       types.Currency `json:"ingress"`
	Egress        types.Currency `json:"egress"`
	RegistryRead  types.Currency `json:"registryRead"`
	RegistryWrite types.Currency `json:"registryWrite"`
	Fees          types.Currency `json:"fees"`

	// AccountDrift tracks funds that were transferred to an account but are
	// no longer backed by a contract due to a reorg or other consensus
	// event. Once funds are transferred to an ephemeral account, the
	// financial records cannot be cleanly reverted. The revenue is,
	// basically, lost.
	AccountDrift types.Currency `json:"accountDrift"`

	Timestamp time.Time `json:"timestamp"`
}

Revenue tracks the host's earnings from all possible sources for a given period

Jump to

Keyboard shortcuts

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