netparams

package
v0.73.4-preview.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: AGPL-3.0 Imports: 23 Imported by: 6

Documentation

Index

Constants

View Source
const (
	SpotMarketTradingEnabled  = "limits.markets.proposeSpotEnabled"
	PerpsMarketTradingEnabled = "limits.markets.proposePerpetualEnabled"
	EthereumOraclesEnabled    = "ethereum.oracles.enabled"

	MarketMarginScalingFactors        = "market.margin.scalingFactors"
	MarketFeeFactorsMakerFee          = "market.fee.factors.makerFee"
	MarketFeeFactorsInfrastructureFee = "market.fee.factors.infrastructureFee"
	MarketAuctionMinimumDuration      = "market.auction.minimumDuration"
	MarketAuctionMaximumDuration      = "market.auction.maximumDuration"

	MarketTargetStakeTimeWindow               = "market.stake.target.timeWindow"
	MarketTargetStakeScalingFactor            = "market.stake.target.scalingFactor"
	MarketLiquidityTargetStakeTriggeringRatio = "market.liquidity.targetstake.triggering.ratio"
	MarketValueWindowLength                   = "market.value.windowLength"
	MarketPriceMonitoringDefaultParameters    = "market.monitor.price.defaultParameters"

	MarketMinLpStakeQuantumMultiple          = "market.liquidityProvision.minLpStakeQuantumMultiple"
	MarketProbabilityOfTradingTauScaling     = "market.liquidity.probabilityOfTrading.tau.scaling"
	MarketMinProbabilityOfTradingForLPOrders = "market.liquidity.minimum.probabilityOfTrading.lpOrders"
	MarketSuccessorLaunchWindow              = "market.liquidity.successorLaunchWindowLength"

	MarketLiquidityProvisionShapesMaxSize            = "market.liquidityProvision.shapes.maxSize"
	MarketLiquidityTargetStakeTriggeringRatioXXX     = "market.liquidity.targetstake.triggering.ratio"
	MarketLiquidityBondPenaltyParameter              = "market.liquidity.bondPenaltyParameter"
	MarketLiquidityEarlyExitPenalty                  = "market.liquidity.earlyExitPenalty"
	MarketLiquidityMaximumLiquidityFeeFactorLevel    = "market.liquidity.maximumLiquidityFeeFactorLevel"
	MarketLiquiditySLANonPerformanceBondPenaltyMax   = "market.liquidity.sla.nonPerformanceBondPenaltyMax"
	MarketLiquiditySLANonPerformanceBondPenaltySlope = "market.liquidity.sla.nonPerformanceBondPenaltySlope"
	MarketLiquidityStakeToCCYVolume                  = "market.liquidity.stakeToCcyVolume"
	MarketLiquidityProvidersFeeCalculationTimeStep   = "market.liquidity.providersFeeCalculationTimeStep"

	RewardAsset = "reward.asset"

	// market proposal parameters.
	GovernanceProposalMarketMinClose              = "governance.proposal.market.minClose"
	GovernanceProposalMarketMaxClose              = "governance.proposal.market.maxClose"
	GovernanceProposalMarketMinEnact              = "governance.proposal.market.minEnact"
	GovernanceProposalMarketMaxEnact              = "governance.proposal.market.maxEnact"
	GovernanceProposalMarketRequiredParticipation = "governance.proposal.market.requiredParticipation"
	GovernanceProposalMarketRequiredMajority      = "governance.proposal.market.requiredMajority"
	GovernanceProposalMarketMinProposerBalance    = "governance.proposal.market.minProposerBalance"
	GovernanceProposalMarketMinVoterBalance       = "governance.proposal.market.minVoterBalance"

	// asset proposal parameters.
	GovernanceProposalAssetMinClose              = "governance.proposal.asset.minClose"
	GovernanceProposalAssetMaxClose              = "governance.proposal.asset.maxClose"
	GovernanceProposalAssetMinEnact              = "governance.proposal.asset.minEnact"
	GovernanceProposalAssetMaxEnact              = "governance.proposal.asset.maxEnact"
	GovernanceProposalAssetRequiredParticipation = "governance.proposal.asset.requiredParticipation"
	GovernanceProposalAssetRequiredMajority      = "governance.proposal.asset.requiredMajority"
	GovernanceProposalAssetMinProposerBalance    = "governance.proposal.asset.minProposerBalance"
	GovernanceProposalAssetMinVoterBalance       = "governance.proposal.asset.minVoterBalance"

	// update asset proposal parameters.
	GovernanceProposalUpdateAssetMinClose              = "governance.proposal.updateAsset.minClose"
	GovernanceProposalUpdateAssetMaxClose              = "governance.proposal.updateAsset.maxClose"
	GovernanceProposalUpdateAssetMinEnact              = "governance.proposal.updateAsset.minEnact"
	GovernanceProposalUpdateAssetMaxEnact              = "governance.proposal.updateAsset.maxEnact"
	GovernanceProposalUpdateAssetRequiredParticipation = "governance.proposal.updateAsset.requiredParticipation"
	GovernanceProposalUpdateAssetRequiredMajority      = "governance.proposal.updateAsset.requiredMajority"
	GovernanceProposalUpdateAssetMinProposerBalance    = "governance.proposal.updateAsset.minProposerBalance"
	GovernanceProposalUpdateAssetMinVoterBalance       = "governance.proposal.updateAsset.minVoterBalance"

	// updateMarket proposal parameters.
	GovernanceProposalUpdateMarketMinClose                   = "governance.proposal.updateMarket.minClose"
	GovernanceProposalUpdateMarketMaxClose                   = "governance.proposal.updateMarket.maxClose"
	GovernanceProposalUpdateMarketMinEnact                   = "governance.proposal.updateMarket.minEnact"
	GovernanceProposalUpdateMarketMaxEnact                   = "governance.proposal.updateMarket.maxEnact"
	GovernanceProposalUpdateMarketRequiredParticipation      = "governance.proposal.updateMarket.requiredParticipation"
	GovernanceProposalUpdateMarketRequiredMajority           = "governance.proposal.updateMarket.requiredMajority"
	GovernanceProposalUpdateMarketMinProposerBalance         = "governance.proposal.updateMarket.minProposerBalance"
	GovernanceProposalUpdateMarketMinVoterBalance            = "governance.proposal.updateMarket.minVoterBalance"
	GovernanceProposalUpdateMarketMinProposerEquityLikeShare = "governance.proposal.updateMarket.minProposerEquityLikeShare"
	GovernanceProposalUpdateMarketRequiredParticipationLP    = "governance.proposal.updateMarket.requiredParticipationLP"
	GovernanceProposalUpdateMarketRequiredMajorityLP         = "governance.proposal.updateMarket.requiredMajorityLP"

	// updateNetParam proposal parameters.
	GovernanceProposalUpdateNetParamMinClose              = "governance.proposal.updateNetParam.minClose"
	GovernanceProposalUpdateNetParamMaxClose              = "governance.proposal.updateNetParam.maxClose"
	GovernanceProposalUpdateNetParamMinEnact              = "governance.proposal.updateNetParam.minEnact"
	GovernanceProposalUpdateNetParamMaxEnact              = "governance.proposal.updateNetParam.maxEnact"
	GovernanceProposalUpdateNetParamRequiredParticipation = "governance.proposal.updateNetParam.requiredParticipation"
	GovernanceProposalUpdateNetParamRequiredMajority      = "governance.proposal.updateNetParam.requiredMajority"
	GovernanceProposalUpdateNetParamMinProposerBalance    = "governance.proposal.updateNetParam.minProposerBalance"
	GovernanceProposalUpdateNetParamMinVoterBalance       = "governance.proposal.updateNetParam.minVoterBalance"

	// freeform proposal parameters.
	GovernanceProposalFreeformMinClose              = "governance.proposal.freeform.minClose"
	GovernanceProposalFreeformMaxClose              = "governance.proposal.freeform.maxClose"
	GovernanceProposalFreeformRequiredParticipation = "governance.proposal.freeform.requiredParticipation"
	GovernanceProposalFreeformRequiredMajority      = "governance.proposal.freeform.requiredMajority"
	GovernanceProposalFreeformMinProposerBalance    = "governance.proposal.freeform.minProposerBalance"
	GovernanceProposalFreeformMinVoterBalance       = "governance.proposal.freeform.minVoterBalance"

	// governance transfer proposal parameters.
	GovernanceProposalTransferMinClose              = "governance.proposal.transfer.minClose"
	GovernanceProposalTransferMaxClose              = "governance.proposal.transfer.maxClose"
	GovernanceProposalTransferMinEnact              = "governance.proposal.transfer.minEnact"
	GovernanceProposalTransferMaxEnact              = "governance.proposal.transfer.maxEnact"
	GovernanceProposalTransferRequiredParticipation = "governance.proposal.transfer.requiredParticipation"
	GovernanceProposalTransferRequiredMajority      = "governance.proposal.transfer.requiredMajority"
	GovernanceProposalTransferMinProposerBalance    = "governance.proposal.transfer.minProposerBalance"
	GovernanceProposalTransferMinVoterBalance       = "governance.proposal.transfer.minVoterBalance"
	GovernanceTransferMaxAmount                     = "governance.proposal.transfer.maxAmount"
	GovernanceTransferMaxFraction                   = "governance.proposal.transfer.maxFraction"

	// Network parameters for referral program update.
	GovernanceProposalReferralProgramMinClose              = "governance.proposal.referralProgram.minClose"
	GovernanceProposalReferralProgramMaxClose              = "governance.proposal.referralProgram.maxClose"
	GovernanceProposalReferralProgramMinEnact              = "governance.proposal.referralProgram.minEnact"
	GovernanceProposalReferralProgramMaxEnact              = "governance.proposal.referralProgram.maxEnact"
	GovernanceProposalReferralProgramRequiredParticipation = "governance.proposal.referralProgram.requiredParticipation"
	GovernanceProposalReferralProgramRequiredMajority      = "governance.proposal.referralProgram.requiredMajority"
	GovernanceProposalReferralProgramMinProposerBalance    = "governance.proposal.referralProgram.minProposerBalance"
	GovernanceProposalReferralProgramMinVoterBalance       = "governance.proposal.referralProgram.minVoterBalance"

	// Network parameters for referral program update.
	GovernanceProposalVolumeDiscountProgramMinClose              = "governance.proposal.VolumeDiscountProgram.minClose"
	GovernanceProposalVolumeDiscountProgramMaxClose              = "governance.proposal.VolumeDiscountProgram.maxClose"
	GovernanceProposalVolumeDiscountProgramMinEnact              = "governance.proposal.VolumeDiscountProgram.minEnact"
	GovernanceProposalVolumeDiscountProgramMaxEnact              = "governance.proposal.VolumeDiscountProgram.maxEnact"
	GovernanceProposalVolumeDiscountProgramRequiredParticipation = "governance.proposal.VolumeDiscountProgram.requiredParticipation"
	GovernanceProposalVolumeDiscountProgramRequiredMajority      = "governance.proposal.VolumeDiscountProgram.requiredMajority"
	GovernanceProposalVolumeDiscountProgramMinProposerBalance    = "governance.proposal.VolumeDiscountProgram.minProposerBalance"
	GovernanceProposalVolumeDiscountProgramMinVoterBalance       = "governance.proposal.VolumeDiscountProgram.minVoterBalance"

	// staking and delegation reward network params.
	StakingAndDelegationRewardPayoutFraction          = "reward.staking.delegation.payoutFraction"
	StakingAndDelegationRewardMaxPayoutPerParticipant = "reward.staking.delegation.maxPayoutPerParticipant"
	StakingAndDelegationRewardPayoutDelay             = "reward.staking.delegation.payoutDelay"
	StakingAndDelegationRewardDelegatorShare          = "reward.staking.delegation.delegatorShare"
	StakingAndDelegationRewardMinimumValidatorStake   = "reward.staking.delegation.minimumValidatorStake"
	StakingAndDelegationRewardCompetitionLevel        = "reward.staking.delegation.competitionLevel"
	StakingAndDelegationRewardMaxPayoutPerEpoch       = "reward.staking.delegation.maxPayoutPerEpoch"
	StakingAndDelegationRewardsMinValidators          = "reward.staking.delegation.minValidators"
	StakingAndDelegationRewardOptimalStakeMultiplier  = "reward.staking.delegation.optimalStakeMultiplier"

	RewardMarketCreationQuantumMultiple       = "rewards.marketCreationQuantumMultiple"
	MinEpochsInTeamForMetricRewardEligibility = "rewards.team.minEpochsInTeam"

	// spam policies params.
	SpamProtectionMaxVotes                         = "spam.protection.max.votes"
	SpamProtectionMinTokensForVoting               = "spam.protection.voting.min.tokens"
	SpamProtectionMaxProposals                     = "spam.protection.max.proposals"
	SpamProtectionMinTokensForProposal             = "spam.protection.proposal.min.tokens"
	SpamProtectionMaxDelegations                   = "spam.protection.max.delegations"
	SpamProtectionMinTokensForDelegation           = "spam.protection.delegation.min.tokens"
	SpamProtectionMaxBatchSize                     = "spam.protection.max.batchSize"
	SpamProtectionMinimumWithdrawalQuantumMultiple = "spam.protection.minimumWithdrawalQuantumMultiple"
	SpamProtectionMinMultisigUpdates               = "spam.protection.minMultisigUpdates"
	SpamProtectionMaxStopOrdersPerMarket           = "spam.protection.max.stopOrdersPerMarket"

	SpamProtectionMaxCreateReferralSet     = "spam.protection.max.createReferralSet"
	SpamProtectionMaxUpdateReferralSet     = "spam.protection.max.updateReferralSet"
	SpamProtectionMaxApplyReferralCode     = "spam.protection.max.applyReferralCode"
	SpamProtectionBalanceSnapshotFrequency = "spam.protection.balanceSnapshotFrequency"
	SpamProtectionApplyReferralMinFunds    = "spam.protection.applyReferral.min.funds"

	// blockchain specifics?
	BlockchainsEthereumConfig = "blockchains.ethereumConfig"

	// length of epoch in seconds.
	ValidatorsEpochLength = "validators.epoch.length"
	// delegation params.
	DelegationMinAmount = "validators.delegation.minAmount"

	ValidatorsVoteRequired = "validators.vote.required"

	// network related parameters.
	NetworkCheckpointTimeElapsedBetweenCheckpoints = "network.checkpoint.timeElapsedBetweenCheckpoints"

	// snapshot parameters.
	SnapshotIntervalLength = "snapshot.interval.length"

	FloatingPointUpdatesDuration = "network.floatingPointUpdates.delay"

	// validators by stake.
	NumberOfTendermintValidators               = "network.validators.tendermint.number"
	ValidatorIncumbentBonus                    = "network.validators.incumbentBonus"
	NumberEthMultisigSigners                   = "network.validators.multisig.numberOfSigners"
	ErsatzvalidatorsRewardFactor               = "network.validators.ersatz.rewardFactor"
	MultipleOfTendermintValidatorsForEtsatzSet = "network.validators.ersatz.multipleOfTendermintValidators"
	MinimumEthereumEventsForNewValidator       = "network.validators.minimumEthereumEventsForNewValidator"

	TransferFeeFactor                  = "transfer.fee.factor"
	TransferMinTransferQuantumMultiple = "transfer.minTransferQuantumMultiple"
	TransferMaxCommandsPerEpoch        = "spam.protection.maxUserTransfersPerEpoch"

	// proof of work.
	SpamPoWNumberOfPastBlocks   = "spam.pow.numberOfPastBlocks"
	SpamPoWDifficulty           = "spam.pow.difficulty"
	SpamPoWHashFunction         = "spam.pow.hashFunction"
	SpamPoWNumberOfTxPerBlock   = "spam.pow.numberOfTxPerBlock"
	SpamPoWIncreasingDifficulty = "spam.pow.increaseDifficulty"

	// limits.
	LimitsProposeMarketEnabledFrom = "limits.markets.proposeEnabledFrom"
	LimitsProposeAssetEnabledFrom  = "limits.assets.proposeEnabledFrom"

	MaxGasPerBlock   = "network.transactions.maxgasperblock"
	DefaultGas       = "network.transaction.defaultgas"
	MinBlockCapacity = "network.transactions.minBlockCapacity"

	// network wide limits.
	MaxPeggedOrders = "limits.markets.maxPeggedOrders"
	// MTM interval.
	MarkPriceUpdateMaximumFrequency = "network.markPriceUpdateMaximumFrequency"

	// how much to scale the number of proposed blocks used for performance calculation.
	ValidatorPerformanceScalingFactor = "validator.performance.scaling.factor"

	RewardsVestingBaseRate        = "rewards.vesting.baseRate"
	RewardsVestingMinimumTransfer = "rewards.vesting.minimumTransfer"
	RewardsVestingBenefitTiers    = "rewards.vesting.benefitTiers"

	// Referral program.
	ReferralProgramMaxReferralTiers                        = "referralProgram.maxReferralTiers"
	ReferralProgramMaxReferralRewardFactor                 = "referralProgram.maxReferralRewardFactor"
	ReferralProgramMaxReferralDiscountFactor               = "referralProgram.maxReferralDiscountFactor"
	ReferralProgramMaxPartyNotionalVolumeByQuantumPerEpoch = "referralProgram.maxPartyNotionalVolumeByQuantumPerEpoch"
	ReferralProgramMinStakedVegaTokens                     = "referralProgram.minStakedVegaTokens"
	ReferralProgramMaxReferralRewardProportion             = "referralProgram.maxReferralRewardProportion"

	// volume discount program.
	VolumeDiscountProgramMaxBenefitTiers         = "volumeDiscountProgram.maxBenefitTiers"
	VolumeDiscountProgramMaxVolumeDiscountFactor = "volumeDiscountProgram.maxVolumeDiscountFactor"

	RewardsActivityStreakBenefitTiers          = "rewards.activityStreak.benefitTiers"
	RewardsActivityStreakInactivityLimit       = "rewards.activityStreak.inactivityLimit"
	RewardsActivityStreakMinQuantumOpenVolume  = "rewards.activityStreak.minQuantumOpenVolume"
	RewardsActivityStreakMinQuantumTradeVolume = "rewards.activityStreak.minQuantumTradeVolume"
)

Variables

View Source
var (
	ErrUnknownKey                        = errors.New("unknown key")
	ErrNetworkParameterUpdateDisabledFor = func(key string) error {
		return fmt.Errorf("network parameter update disabled for %v", key)
	}
	ErrNetworkParameterDeprecated = func(key string) error {
		return fmt.Errorf("network parameter has been deprecated: %v", key)
	}
)
View Source
var AllKeys = map[string]struct{}{}/* 171 elements not displayed */
View Source
var ErrNoNetParamsGenesisState = errors.New("no network parameters genesis state")

Functions

func DecimalDependentLT added in v0.61.0

func DecimalDependentLT(otherName string, other *Decimal) func(num.Decimal) error

func DecimalDependentLTE added in v0.61.0

func DecimalDependentLTE(otherName string, other *Decimal) func(num.Decimal) error

func DecimalGT

func DecimalGT(f num.Decimal) func(num.Decimal) error

func DecimalGTE

func DecimalGTE(f num.Decimal) func(num.Decimal) error

func DecimalLT

func DecimalLT(f num.Decimal) func(num.Decimal) error

func DecimalLTE

func DecimalLTE(f num.Decimal) func(num.Decimal) error

func DurationGT

func DurationGT(i time.Duration) func(time.Duration) error

func DurationGTE

func DurationGTE(i time.Duration) func(time.Duration) error

func DurationLT

func DurationLT(i time.Duration) func(time.Duration) error

func DurationLTE

func DurationLTE(i time.Duration) func(time.Duration) error

func IntGT

func IntGT(i int64) func(int64) error

func IntGTE

func IntGTE(i int64) func(int64) error

func IntLT

func IntLT(i int64) func(int64) error

func IntLTE

func IntLTE(i int64) func(int64) error

func PriceMonitoringParametersValidation added in v0.55.0

func PriceMonitoringParametersValidation(i interface{}) error

func TimeNonZero

func TimeNonZero() func(time.Time) error

func UintGT

func UintGT(i *num.Uint) func(*num.Uint) error

func UintGTE

func UintGTE(i *num.Uint) func(*num.Uint) error

func UintLT

func UintLT(i *num.Uint) func(*num.Uint) error

func UintLTE

func UintLTE(i *num.Uint) func(*num.Uint) error

Types

type AddParamRules

type AddParamRules struct {
	Param string
	Rules []interface{}
}

func ParamDurationRules

func ParamDurationRules(key string, rules ...DurationRule) AddParamRules

func ParamIntRules

func ParamIntRules(key string, rules ...IntRule) AddParamRules

func ParamJSONRules

func ParamJSONRules(key string, rules ...JSONRule) AddParamRules

func ParamStringRules

func ParamStringRules(key string, rules ...StringRule) AddParamRules

type Broker

type Broker interface {
	Send(e events.Event)
	SendBatch(evts []events.Event)
}

Broker - event bus.

type Config

type Config struct {
	// logging level
	Level encoding.LogLevel
}

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration.

type Decimal

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

func NewDecimal

func NewDecimal(rules ...DecimalRule) *Decimal

func (*Decimal) AddRules

func (f *Decimal) AddRules(fns ...interface{}) error

func (*Decimal) CheckDispatch

func (f *Decimal) CheckDispatch(fn interface{}) error

func (*Decimal) GetDispatch

func (f *Decimal) GetDispatch() func(context.Context, interface{}) error

func (*Decimal) MustUpdate

func (f *Decimal) MustUpdate(value string) *Decimal

func (*Decimal) Mutable

func (f *Decimal) Mutable(b bool) *Decimal

func (*Decimal) String

func (f *Decimal) String() string

func (Decimal) ToBool

func (b Decimal) ToBool() (bool, error)

func (*Decimal) ToDecimal

func (f *Decimal) ToDecimal() (num.Decimal, error)

func (Decimal) ToDuration

func (b Decimal) ToDuration() (time.Duration, error)

func (Decimal) ToInt

func (b Decimal) ToInt() (int64, error)

func (Decimal) ToJSONStruct

func (b Decimal) ToJSONStruct(v Reset) error

func (Decimal) ToString

func (b Decimal) ToString() (string, error)

func (Decimal) ToUint

func (b Decimal) ToUint() (*num.Uint, error)

func (*Decimal) Update

func (f *Decimal) Update(value string) error

func (*Decimal) UpdateOptionalValidation added in v0.67.0

func (f *Decimal) UpdateOptionalValidation(value string, validate bool) error

func (*Decimal) Validate

func (f *Decimal) Validate(value string) error

type DecimalRule

type DecimalRule func(num.Decimal) error

type Duration

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

func NewDuration

func NewDuration(rules ...DurationRule) *Duration

func (*Duration) AddRules

func (d *Duration) AddRules(fns ...interface{}) error

func (*Duration) CheckDispatch

func (d *Duration) CheckDispatch(fn interface{}) error

func (*Duration) GetDispatch

func (d *Duration) GetDispatch() func(context.Context, interface{}) error

func (*Duration) MustUpdate

func (d *Duration) MustUpdate(value string) *Duration

func (*Duration) Mutable

func (d *Duration) Mutable(b bool) *Duration

func (*Duration) String

func (d *Duration) String() string

func (Duration) ToBool

func (b Duration) ToBool() (bool, error)

func (Duration) ToDecimal

func (b Duration) ToDecimal() (num.Decimal, error)

func (*Duration) ToDuration

func (d *Duration) ToDuration() (time.Duration, error)

func (Duration) ToInt

func (b Duration) ToInt() (int64, error)

func (Duration) ToJSONStruct

func (b Duration) ToJSONStruct(v Reset) error

func (Duration) ToString

func (b Duration) ToString() (string, error)

func (Duration) ToUint

func (b Duration) ToUint() (*num.Uint, error)

func (*Duration) Update

func (d *Duration) Update(value string) error

func (*Duration) UpdateOptionalValidation added in v0.67.0

func (d *Duration) UpdateOptionalValidation(value string, validate bool) error

func (*Duration) Validate

func (d *Duration) Validate(value string) error

type DurationRule

type DurationRule func(time.Duration) error

func DurationDependentGT added in v0.61.0

func DurationDependentGT(otherName string, other *Duration) DurationRule

func DurationDependentGTE added in v0.61.0

func DurationDependentGTE(otherName string, other *Duration) DurationRule

func DurationDependentLT added in v0.61.0

func DurationDependentLT(otherName string, other *Duration) DurationRule

func DurationDependentLTE added in v0.61.0

func DurationDependentLTE(otherName string, other *Duration) DurationRule

type GenesisState

type GenesisState map[string]string

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func LoadGenesisState

func LoadGenesisState(bytes []byte) (GenesisState, error)

type GenesisStateOverwrite

type GenesisStateOverwrite []string

func LoadGenesisStateOverwrite

func LoadGenesisStateOverwrite(bytes []byte) (GenesisStateOverwrite, error)

type Int

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

func NewInt

func NewInt(rules ...IntRule) *Int

func (*Int) AddRules

func (i *Int) AddRules(fns ...interface{}) error

func (*Int) CheckDispatch

func (i *Int) CheckDispatch(fn interface{}) error

func (*Int) GetDispatch

func (i *Int) GetDispatch() func(context.Context, interface{}) error

func (*Int) MustUpdate

func (i *Int) MustUpdate(value string) *Int

func (*Int) Mutable

func (i *Int) Mutable(b bool) *Int

func (*Int) String

func (i *Int) String() string

func (Int) ToBool

func (b Int) ToBool() (bool, error)

func (Int) ToDecimal

func (b Int) ToDecimal() (num.Decimal, error)

func (Int) ToDuration

func (b Int) ToDuration() (time.Duration, error)

func (*Int) ToInt

func (i *Int) ToInt() (int64, error)

func (Int) ToJSONStruct

func (b Int) ToJSONStruct(v Reset) error

func (Int) ToString

func (b Int) ToString() (string, error)

func (Int) ToUint

func (b Int) ToUint() (*num.Uint, error)

func (*Int) Update

func (i *Int) Update(value string) error

func (*Int) UpdateOptionalValidation added in v0.67.0

func (i *Int) UpdateOptionalValidation(value string, validate bool) error

func (*Int) Validate

func (i *Int) Validate(value string) error

type IntRule

type IntRule func(int64) error

type JSON

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

func NewJSON

func NewJSON(val Reset, rules ...JSONRule) *JSON

func (*JSON) AddRules

func (j *JSON) AddRules(fns ...interface{}) error

func (*JSON) CheckDispatch

func (j *JSON) CheckDispatch(fn interface{}) error

func (*JSON) GetDispatch

func (j *JSON) GetDispatch() func(context.Context, interface{}) error

func (*JSON) MustUpdate

func (j *JSON) MustUpdate(value string) *JSON

func (*JSON) Mutable

func (j *JSON) Mutable(b bool) *JSON

func (*JSON) String

func (j *JSON) String() string

func (JSON) ToBool

func (b JSON) ToBool() (bool, error)

func (JSON) ToDecimal

func (b JSON) ToDecimal() (num.Decimal, error)

func (JSON) ToDuration

func (b JSON) ToDuration() (time.Duration, error)

func (JSON) ToInt

func (b JSON) ToInt() (int64, error)

func (*JSON) ToJSONStruct

func (j *JSON) ToJSONStruct(v Reset) error

func (JSON) ToString

func (b JSON) ToString() (string, error)

func (JSON) ToUint

func (b JSON) ToUint() (*num.Uint, error)

func (*JSON) Update

func (j *JSON) Update(value string) error

func (*JSON) UpdateOptionalValidation added in v0.67.0

func (j *JSON) UpdateOptionalValidation(value string, validate bool) error

func (*JSON) Validate

func (j *JSON) Validate(value string) error

type JSONRule

type JSONRule func(interface{}) error

type Reset

type Reset interface {
	Reset()
}

type Store

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

func New

func New(log *logging.Logger, cfg Config, broker Broker) *Store

func (*Store) AddRules

func (s *Store) AddRules(params ...AddParamRules) error

func (*Store) AnyWatchers added in v0.63.0

func (s *Store) AnyWatchers(p string) bool

func (*Store) Checkpoint

func (s *Store) Checkpoint() ([]byte, error)

func (*Store) DispatchChanges

func (s *Store) DispatchChanges(ctx context.Context)

func (*Store) Exists

func (s *Store) Exists(key string) bool

Exists check if a value exist for the given key.

func (*Store) Get

func (s *Store) Get(key string) (string, error)

Get a value associated to the given key.

func (*Store) GetBool

func (s *Store) GetBool(key string) (bool, error)

GetBool a value associated to the given key.

func (*Store) GetDecimal

func (s *Store) GetDecimal(key string) (num.Decimal, error)

GetDecimal a value associated to the given key.

func (*Store) GetDuration

func (s *Store) GetDuration(key string) (time.Duration, error)

GetDuration a value associated to the given key.

func (*Store) GetInt

func (s *Store) GetInt(key string) (int64, error)

GetInt a value associated to the given key.

func (*Store) GetJSONStruct

func (s *Store) GetJSONStruct(key string, v Reset) error

GetJSONStruct a value associated to the given key.

func (*Store) GetState

func (s *Store) GetState(k string) ([]byte, []types.StateProvider, error)

func (*Store) GetString

func (s *Store) GetString(key string) (string, error)

GetString a value associated to the given key.

func (*Store) GetUint

func (s *Store) GetUint(key string) (*num.Uint, error)

GetUint a value associated to the given key.

func (*Store) IsUpdateAllowed added in v0.56.0

func (s *Store) IsUpdateAllowed(key string) error

func (*Store) Keys

func (s *Store) Keys() []string

func (*Store) Load

func (s *Store) Load(ctx context.Context, data []byte) error

func (*Store) LoadState

func (s *Store) LoadState(ctx context.Context, pl *types.Payload) ([]types.StateProvider, error)

func (*Store) Name

func (s *Store) Name() types.CheckpointName

func (*Store) Namespace

func (s *Store) Namespace() types.SnapshotNamespace

func (*Store) OnTick

func (s *Store) OnTick(ctx context.Context, _ time.Time)

OnTick is trigger once per blocks we will send parameters update to watchers.

func (*Store) Stopped

func (s *Store) Stopped() bool

func (*Store) Update

func (s *Store) Update(ctx context.Context, key, value string) error

Update will update the stored value for a given key will return an error if the value do not pass validation.

func (*Store) UpdateOptionalValidation added in v0.67.0

func (s *Store) UpdateOptionalValidation(ctx context.Context, key, value string, validate, failIfUnknown bool) error

func (*Store) UponGenesis

func (s *Store) UponGenesis(ctx context.Context, rawState []byte) (err error)

UponGenesis load the initial network parameters from the genesis state.

func (*Store) Validate

func (s *Store) Validate(key, value string) error

Validate will call validation on the Value stored for the given key.

func (*Store) Watch

func (s *Store) Watch(wp ...WatchParam) error

Watch a list of parameters updates.

type String

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

func NewString

func NewString(rules ...StringRule) *String

func (*String) AddRules

func (s *String) AddRules(fns ...interface{}) error

func (*String) CheckDispatch

func (s *String) CheckDispatch(fn interface{}) error

func (*String) GetDispatch

func (s *String) GetDispatch() func(context.Context, interface{}) error

func (*String) MustUpdate

func (s *String) MustUpdate(value string) *String

func (*String) Mutable

func (s *String) Mutable(b bool) *String

func (*String) String

func (s *String) String() string

func (String) ToBool

func (b String) ToBool() (bool, error)

func (String) ToDecimal

func (b String) ToDecimal() (num.Decimal, error)

func (String) ToDuration

func (b String) ToDuration() (time.Duration, error)

func (String) ToInt

func (b String) ToInt() (int64, error)

func (String) ToJSONStruct

func (b String) ToJSONStruct(v Reset) error

func (*String) ToString

func (s *String) ToString() (string, error)

func (String) ToUint

func (b String) ToUint() (*num.Uint, error)

func (*String) Update

func (s *String) Update(value string) error

func (*String) UpdateOptionalValidation added in v0.67.0

func (s *String) UpdateOptionalValidation(value string, validate bool) error

func (*String) Validate

func (s *String) Validate(value string) error

type StringRule

type StringRule func(string) error

type Time

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

func NewTime

func NewTime(rules ...TimeRule) *Time

func (*Time) AddRules

func (t *Time) AddRules(fns ...interface{}) error

func (*Time) CheckDispatch

func (t *Time) CheckDispatch(fn interface{}) error

func (*Time) GetDispatch

func (t *Time) GetDispatch() func(context.Context, interface{}) error

func (*Time) MustUpdate

func (t *Time) MustUpdate(value string) *Time

func (*Time) Mutable

func (t *Time) Mutable(b bool) *Time

func (*Time) String

func (t *Time) String() string

func (Time) ToBool

func (b Time) ToBool() (bool, error)

func (Time) ToDecimal

func (b Time) ToDecimal() (num.Decimal, error)

func (Time) ToDuration

func (b Time) ToDuration() (time.Duration, error)

func (Time) ToInt

func (b Time) ToInt() (int64, error)

func (Time) ToJSONStruct

func (b Time) ToJSONStruct(v Reset) error

func (Time) ToString

func (b Time) ToString() (string, error)

func (*Time) ToTime

func (t *Time) ToTime() (time.Time, error)

func (Time) ToUint

func (b Time) ToUint() (*num.Uint, error)

func (*Time) Update

func (t *Time) Update(value string) error

func (*Time) Validate

func (t *Time) Validate(value string) error

type TimeRule

type TimeRule func(time.Time) error

type Uint

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

func NewUint

func NewUint(rules ...UintRule) *Uint

func (*Uint) AddRules

func (i *Uint) AddRules(fns ...interface{}) error

func (*Uint) CheckDispatch

func (i *Uint) CheckDispatch(fn interface{}) error

func (*Uint) GetDispatch

func (i *Uint) GetDispatch() func(context.Context, interface{}) error

func (*Uint) MustUpdate

func (i *Uint) MustUpdate(value string) *Uint

func (*Uint) Mutable

func (i *Uint) Mutable(b bool) *Uint

func (*Uint) String

func (i *Uint) String() string

func (Uint) ToBool

func (b Uint) ToBool() (bool, error)

func (Uint) ToDecimal

func (b Uint) ToDecimal() (num.Decimal, error)

func (Uint) ToDuration

func (b Uint) ToDuration() (time.Duration, error)

func (Uint) ToInt

func (b Uint) ToInt() (int64, error)

func (Uint) ToJSONStruct

func (b Uint) ToJSONStruct(v Reset) error

func (Uint) ToString

func (b Uint) ToString() (string, error)

func (*Uint) ToUint

func (i *Uint) ToUint() (*num.Uint, error)

func (*Uint) Update

func (i *Uint) Update(value string) error

func (*Uint) UpdateOptionalValidation added in v0.67.0

func (i *Uint) UpdateOptionalValidation(value string, validate bool) error

func (*Uint) Validate

func (i *Uint) Validate(value string) error

type UintRule

type UintRule func(*num.Uint) error

func UintDependentGTE added in v0.63.0

func UintDependentGTE(otherName string, other *Uint, factor num.Decimal) UintRule

ensure that the value is >= the other value x factor.

func UintDependentLTE added in v0.63.0

func UintDependentLTE(otherName string, other *Uint, factor num.Decimal) UintRule

ensure that the value is <= the other value x factor.

type WatchParam

type WatchParam struct {
	Param string
	// this is to be cast to a function accepting the
	// inner type of the parameters
	// e.g: for a String value, the expected function
	// is to be of the type: func(string) error
	Watcher interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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