accounting

package
v0.0.0-...-5ed304f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultInputThresholds = map[string]*big.Int{
		"CFX":  common.MustParseBigInt("2000000000000000000000"),
		"ERG":  new(big.Int).SetUint64(10_000_000_000),
		"ETC":  new(big.Int).SetUint64(3_000_000_000_000_000_000),
		"FIRO": new(big.Int).SetUint64(10_000_000_000),
		"FLUX": new(big.Int).SetUint64(30_000_000_000),
		"RVN":  new(big.Int).SetUint64(20_000_000_000),
	}

	DefaultOutputThresholds = map[string]*big.Int{
		"BTC":  new(big.Int).SetUint64(50_000_000),
		"ETH":  new(big.Int).SetUint64(5_000_000_000_000_000_000),
		"USDC": new(big.Int).SetUint64(20_000_000_000),
	}
)

Functions

func CalculateExchangePaths

func CalculateExchangePaths(
	inputPaths map[string]map[string]*big.Int,
	inputThresholds, outputThresholds map[string]*big.Int,
	prices map[string]map[string]float64,
) (map[string]map[string]*big.Int, error)

func CalculateProportionalValues

func CalculateProportionalValues[K string | uint64](
	value, fee *big.Int,
	proportions map[K]*big.Int,
) (map[K]*big.Int, map[K]*big.Int, error)

func CreditRound

func CreditRound(
	roundValue *big.Int,
	minerIdx, recipientIdx map[uint64]uint64,
) (map[uint64]*big.Int, map[uint64]*big.Int, error)

credits a round based off of the share index and the fee recipient distributions. the output is a merged map of miners and recipients since we can safely assume that miner ids and recipient ids are globally unique.

func ProcessFeeBalance

func ProcessFeeBalance(
	roundChain, minerChain string,
	value, poolFee, feeBalance *big.Int,
	price float64,
) (*big.Int, *big.Int, error)

given a miner's round distributions, check to see if any fee balance is needed and, if so, return the estimated needed fee balance

Types

This section is empty.

Jump to

Keyboard shortcuts

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