constants

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package constants contains all the constants used by thorchain by default all the settings in this is for mainnet

Index

Constants

View Source
const (
	CtxMetricLabels  contextKey = "metricLabels"
	CtxLoanTxID      contextKey = "loan-txid"
	CtxLoanToAddress contextKey = "loan-toaddress"
)
View Source
const (
	// Memo prefixes
	MemoPrefixRefund  = "REFUND"
	MemoPrefixMigrate = "MIGRATE"
)
View Source
const (
	MimirKeySecuredAssetHaltGlobal = "HaltSecuredGlobal"

	MimirTemplateConfMultiplierBasisPoints = "ConfMultiplierBasisPoints-%s" // Use with Chain
	MimirTemplateMaxConfirmations          = "MaxConfirmations-%s"          // Use with Chain
	MimirTemplateSwapSlipBasisPointsMin    = "SwapSlipBasisPointsMin-%s"    // Use with MimirRef
	MimirTemplateSecuredAssetHaltDeposit   = "HaltSecuredDeposit-%s"        // Use with Chain
	MimirTemplateSecuredAssetHaltWithdraw  = "HaltSecuredWithdraw-%s"       // Use with Chain

	MimirRefL1           = "L1"           // Use with SwapSlipBasisPoints
	MimirRefSynth        = "Synth"        // Use with SwapSlipBasisPoints
	MimirRefTradeAccount = "TradeAccount" // Use with SwapSlipBasisPoints
)

All strings used in Mimir keys should be recorded here and referred to from elsewhere, except for strings referring to arbitrary Assets/Chains. Each string should clearly indicate its usage for the final Mimir key (key, template, reference) and no Mimir key should require the combination of more than two strings.

View Source
const DollarMulti = 1e9

used to preserve precision when determining the dollar price of rune.

View Source
const MaxBasisPts = uint64(10_000)

max basis points

View Source
const MaxETHGas = 50000000

MaxETHGas define the maximum gas for a single transaction on ETH

View Source
const MaxMemoSize = 250

MaxMemoSize Maximum Memo Size

View Source
const MimirKeyRegex = `^[a-zA-Z0-9-]+$`
View Source
const StreamingSwapMinBPFeeMulti = int64(100)

TODO: remove on hard fork. StreamingSwapMinBPFee multiplier. This is used to allow decimal points for streaming swap math

Variables

View Source
var (
	GitCommit = "null"  // sha1 revision used to build the program
	BuildTime = "null"  // when the executable was built
	Version   = "0.1.0" // software version

)
View Source
var SWVersion, _ = semver.Make(Version)
View Source
var ThorchainBlockTime = 5 * time.Second

ThorchainBlockTime Block time of THORChain

Functions

This section is empty.

Types

type ConstantName

type ConstantName int

ConstantName the name we used to get constant values.

const (
	EmissionCurve ConstantName = iota
	MaxRuneSupply
	BlocksPerYear
	OutboundTransactionFee
	NativeTransactionFee
	PoolCycle
	MinRunePoolDepth
	MaxAvailablePools
	StagedPoolCost
	PendingLiquidityAgeLimit
	MinimumNodesForBFT
	DesiredValidatorSet
	AsgardSize
	DerivedDepthBasisPts
	DerivedMinDepth
	MaxAnchorSlip
	MaxAnchorBlocks
	DynamicMaxAnchorSlipBlocks
	DynamicMaxAnchorTarget
	DynamicMaxAnchorCalcInterval
	ChurnInterval
	ChurnRetryInterval
	BadValidatorRedline
	LackOfObservationPenalty
	SigningTransactionPeriod
	DoubleSignMaxAge
	PauseBond
	PauseUnbond
	MinimumBondInRune
	FundMigrationInterval
	MaxOutboundAttempts
	SlashPenalty
	PauseOnSlashThreshold
	FailKeygenSlashPoints
	FailKeysignSlashPoints
	LiquidityLockUpBlocks
	ObserveSlashPoints
	DoubleBlockSignSlashPoints
	MissBlockSignSlashPoints
	ObservationDelayFlexibility
	JailTimeKeygen
	JailTimeKeysign
	NodePauseChainBlocks
	EnableDerivedAssets
	MinSwapsPerBlock
	MaxSwapsPerBlock
	EnableOrderBooks
	MaxSynthPerPoolDepth
	MaxSynthsForSaversYield
	VirtualMultSynths
	VirtualMultSynthsBasisPoints
	MinSlashPointsForBadValidator
	MaxBondProviders
	MinTxOutVolumeThreshold
	TxOutDelayRate
	TxOutDelayMax
	MaxTxOutOffset
	TNSRegisterFee
	TNSFeeOnSale
	TNSFeePerBlock
	StreamingSwapPause
	StreamingSwapMinBPFee // TODO: remove on hard fork
	StreamingSwapMaxLength
	StreamingSwapMaxLengthNative
	MinCR
	MaxCR
	LoanStreamingSwapsInterval
	PauseLoans
	LoanRepaymentMaturity
	LendingLever
	PermittedSolvencyGap
	NodeOperatorFee
	ValidatorMaxRewardRatio
	MaxNodeToChurnOutForLowVersion
	ChurnOutForLowVersionBlocks
	POLMaxNetworkDeposit
	POLMaxPoolMovement
	POLTargetSynthPerPoolDepth
	POLBuffer
	RagnarokProcessNumOfLPPerIteration
	SynthYieldBasisPoints
	SynthYieldCycle
	MinimumL1OutboundFeeUSD
	MinimumPoolLiquidityFee
	ChurnMigrateRounds
	AllowWideBlame
	MaxAffiliateFeeBasisPoints
	TargetOutboundFeeSurplusRune
	MaxOutboundFeeMultiplierBasisPoints
	MinOutboundFeeMultiplierBasisPoints
	NativeOutboundFeeUSD
	NativeTransactionFeeUSD
	TNSRegisterFeeUSD
	TNSFeePerBlockUSD
	EnableUSDFees
	PreferredAssetOutboundFeeMultiplier
	FeeUSDRoundSignificantDigits
	MigrationVaultSecurityBps
	CloutReset
	CloutLimit
	KeygenRetryInterval
	SaversStreamingSwapsInterval
	RescheduleCoalesceBlocks
	L1SlipMinBps
	SynthSlipMinBps
	TradeAccountsSlipMinBps
	DerivedSlipMinBps
	TradeAccountsEnabled
	TradeAccountsDepositEnabled
	SecuredAssetSlipMinBps
	EVMDisableContractWhitelist
	OperationalVotesMin
	RUNEPoolEnabled
	RUNEPoolDepositMaturityBlocks
	RUNEPoolMaxReserveBackstop
	SaversEjectInterval
	SystemIncomeBurnRateBps
	DevFundSystemIncomeBps
	DevFundAddress
	PendulumAssetsBasisPoints
	PendulumUseEffectiveSecurity
	PendulumUseVaultAssets
	MultipleAffiliatesMaxCount
	BondSlashBan
	BankSendEnabled

	// These are the implicitly-0 Constants undisplayed in the API endpoint (no explicit value set).
	ArtificialRagnarokBlockHeight
	BondLockupPeriod
	BurnSynths
	DefaultPoolStatus
	ManualSwapsToSynthDisabled
	MaximumLiquidityRune
	MintSynths
	NumberOfNewNodesPerChurn
	SignerConcurrency
	StrictBondLiquidityRatio
	SwapOutDexAggregationDisabled
)

func (ConstantName) String

func (i ConstantName) String() string

type ConstantVals

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

ConstantVals implement ConstantValues interface

func NewConstantValue

func NewConstantValue() *ConstantVals

NewConstantValue get new instance of ConstantValue

func (*ConstantVals) GetBoolValue

func (cv *ConstantVals) GetBoolValue(name ConstantName) bool

GetBoolValue retrieve a bool constant value from the map

func (ConstantVals) GetConstantValsByKeyname

func (cv ConstantVals) GetConstantValsByKeyname() ConstantValsByKeyname

func (*ConstantVals) GetInt64Value

func (cv *ConstantVals) GetInt64Value(name ConstantName) int64

GetInt64Value get value in int64 type, if it doesn't exist then it will return the default value of int64, which is 0

func (*ConstantVals) GetStringValue

func (cv *ConstantVals) GetStringValue(name ConstantName) string

GetStringValue retrieve a string const value from the map

func (ConstantVals) MarshalJSON

func (cv ConstantVals) MarshalJSON() ([]byte, error)

MarshalJSON marshal result to json format

func (*ConstantVals) String

func (cv *ConstantVals) String() string

type ConstantValsByKeyname

type ConstantValsByKeyname struct {
	Int64Values  map[string]int64  `json:"int_64_values"`
	BoolValues   map[string]bool   `json:"bool_values"`
	StringValues map[string]string `json:"string_values"`
}

type ConstantValues

type ConstantValues interface {
	fmt.Stringer
	GetInt64Value(name ConstantName) int64
	GetBoolValue(name ConstantName) bool
	GetStringValue(name ConstantName) string
	GetConstantValsByKeyname() ConstantValsByKeyname
}

ConstantValues define methods used to get constant values

func GetConstantValues

func GetConstantValues(_ semver.Version) ConstantValues

GetConstantValues will return an implementation of ConstantValues which provide ways to get constant values TODO hard fork remove unused version parameter

type DummyConstants

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

func NewDummyConstants

func NewDummyConstants(int64Values map[ConstantName]int64, boolValues map[ConstantName]bool, stringValues map[ConstantName]string) *DummyConstants

NewDummyConstants create a new instance of DummyConstants for test purpose

func (*DummyConstants) GetBoolValue

func (dc *DummyConstants) GetBoolValue(name ConstantName) bool

func (*DummyConstants) GetConstantValsByKeyname

func (dc *DummyConstants) GetConstantValsByKeyname() ConstantValsByKeyname

func (*DummyConstants) GetInt64Value

func (dc *DummyConstants) GetInt64Value(name ConstantName) int64

func (*DummyConstants) GetStringValue

func (dc *DummyConstants) GetStringValue(name ConstantName) string

func (*DummyConstants) String

func (dc *DummyConstants) String() string

Jump to

Keyboard shortcuts

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