cointype

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AtomsPerVAR is the number of atoms in one VAR coin.
	// This maintains compatibility with the original DCR atom system.
	AtomsPerVAR = 1e8

	// MaxVARAtoms is the maximum number of VAR atoms that can exist.
	// This follows the original DCR supply model.
	MaxVARAtoms = 21e6 * AtomsPerVAR

	// MaxVARAmount is the maximum VAR amount as an Amount type.
	MaxVARAmount = Amount(MaxVARAtoms)
)

Coin-specific constants for VAR (Varta)

View Source
const (
	// AtomsPerSKA is the number of atoms in one SKA coin.
	// Uses same precision as VAR for consistency.
	AtomsPerSKA = 1e8

	// MaxSKAAtoms is the maximum number of SKA atoms that can exist.
	// Set to 10 million SKA total supply per coin type.
	MaxSKAAtoms = 10e6 * AtomsPerSKA

	// MaxSKAAmount is the maximum SKA amount as an Amount type.
	MaxSKAAmount = Amount(MaxSKAAtoms)
)

Coin-specific constants for SKA (Skarb)

Variables

View Source
var ErrCoinTypeMismatch = errors.New("coin type mismatch")

ErrCoinTypeMismatch is returned when coin types don't match in operations.

View Source
var ErrInactiveCoinType = errors.New("inactive coin type")

ErrInactiveCoinType is returned when attempting to use an inactive coin type.

View Source
var ErrInvalidCoinType = errors.New("invalid coin type")

ErrInvalidCoinType is returned when an invalid coin type is encountered.

Functions

func ValidateCoinType

func ValidateCoinType(ct CoinType) error

ValidateCoinType validates that a coin type value is within valid range.

Types

type Amount

type Amount int64

Amount represents a coin amount in atoms.

type ChainParams

type ChainParams interface {
	GetSKACoinConfig(CoinType) SKACoinConfig
}

ChainParams interface defines the methods needed from chaincfg.Params for coin type activation checking. This avoids import cycles.

type CoinType

type CoinType uint8

CoinType represents the type of native coin in the Monetarium network. The network supports VAR (Varta) and multiple SKA (Skarb) coin types.

const (
	// CoinTypeVAR represents Varta coins - the original mined cryptocurrency
	// that functions as network shares. VAR holders earn transaction fees
	// and can purchase PoS tickets. VAR is always active.
	CoinTypeVAR CoinType = 0

	// CoinTypeMax defines the maximum valid coin type value.
	// SKA coin types range from 1-255 and are activated dynamically.
	CoinTypeMax CoinType = 255
)

func ParseCoinType

func ParseCoinType(s string) (CoinType, error)

ParseCoinType parses a string representation of a coin type. Only supports parsing "VAR" and "SKA" - specific SKA types use numeric parsing.

func (CoinType) AtomsPerCoin

func (ct CoinType) AtomsPerCoin() int64

AtomsPerCoin returns the number of atoms per coin for the given coin type.

func (CoinType) IsActive

func (ct CoinType) IsActive(params ChainParams) bool

IsActive returns true if the coin type is active on the given chain. VAR is always active. SKA coins are active based on chain configuration.

func (CoinType) IsSKA

func (ct CoinType) IsSKA() bool

IsSKA returns true if this is a SKA coin type (1-255). SKA coins are asset-backed tokens that are activated dynamically.

func (CoinType) IsVAR

func (ct CoinType) IsVAR() bool

IsVAR returns true if this is the VAR coin type (0). VAR has special properties: it's mined, used for staking, and always active.

func (CoinType) IsValid

func (ct CoinType) IsValid() bool

IsValid returns whether the coin type is within valid range (0-255).

func (CoinType) MaxAmount

func (ct CoinType) MaxAmount() Amount

MaxAmount returns the maximum amount for the given coin type.

func (CoinType) MaxAtoms

func (ct CoinType) MaxAtoms() int64

MaxAtoms returns the maximum number of atoms for the given coin type.

func (CoinType) String

func (ct CoinType) String() string

String returns the string representation of the coin type.

type SKACoinConfig

type SKACoinConfig interface {
	IsActive() bool
}

SKACoinConfig represents the configuration for a SKA coin type. This mirrors the structure in chaincfg to avoid import cycles.

Jump to

Keyboard shortcuts

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