genesis

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Second = 1
	Minute = 60 * Second
	Hour   = 60 * Minute
	Day    = 24 * Hour
	Week   = 7 * Day
	Year   = 365 * Day
)

durations in seconds

Variables

View Source
var AdminAT env.Account
View Source
var ValidatorsAT []env.Account

Functions

func FundAccounts

func FundAccounts(genesisConfig *Config, accounts []env.Account)

func GenerateGenesis

func GenerateGenesis(ctx *cli.Context, accounts *env.AccountsConfig, cfg *Config, contractsBuildPath string) (*chain.Genesis, error)

GenerateGenesis will create a new genesis block with full atlas blockchain already configured

func UnmarshalMarkerConfig

func UnmarshalMarkerConfig()

Types

type AccoutInfo

type AccoutInfo struct {
	Account  string
	Password string
}

type Balance

type Balance struct {
	Account common.Address `json:"account"`
	Amount  *big.Int       `json:"amount"`
}

Balance represents an account and it's initial balance in wei

func (Balance) MarshalJSON

func (b Balance) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*Balance) UnmarshalJSON

func (b *Balance) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type BalanceList

type BalanceList []Balance

BalanceList list of balances

func (BalanceList) Accounts

func (bl BalanceList) Accounts() []common.Address

Accounts returns all the addresses

func (BalanceList) Amounts

func (bl BalanceList) Amounts() []*big.Int

Amounts returns all the amounts

type BalanceMarshaling

type BalanceMarshaling struct {
	Amount *bigintstr.BigIntStr `json:"amount"`
}

type BlockchainParameters

type BlockchainParameters struct {
	Version                 Version `json:"version"`
	GasForNonGoldCurrencies uint64  `json:"gasForNonGoldCurrencies"`
	BlockGasLimit           uint64  `json:"blockGasLimit"`
}

BlockchainParameters are the initial configuration parameters for Blockchain

type Config

type Config struct {
	ChainID          *big.Int              `json:"chainId"` // chainId identifies the current chain and is used for replay protection
	Istanbul         params.IstanbulConfig `json:"istanbul"`
	Hardforks        HardforkConfig        `json:"hardforks"`
	GenesisTimestamp uint64                `json:"genesisTimestamp"`

	GasPriceMinimum            GasPriceMinimumParameters
	LockedGold                 LockedGoldParameters
	GoldToken                  GoldTokenParameters
	Validators                 ValidatorsParameters
	Election                   ElectionParameters
	EpochRewards               EpochRewardsParameters
	Blockchain                 BlockchainParameters
	Random                     RandomParameters
	TransferWhitelist          TransferWhitelistParameters
	ReserveSpenderMultiSig     MultiSigParameters
	GovernanceApproverMultiSig MultiSigParameters
	DoubleSigningSlasher       DoubleSigningSlasherParameters
	DowntimeSlasher            DowntimeSlasherParameters
	Governance                 GovernanceParameters
}

Config represent all atlas-blockchain configuration options for the genesis block

func BaseConfig

func BaseConfig() *Config

BaseConfig creates base parameters for atlas Callers must complete missing pieces

func CreateCommonGenesisConfig

func CreateCommonGenesisConfig(chainID *big.Int, adminAccountAddress common.Address, istanbulConfig params.IstanbulConfig) *Config

CreateCommonGenesisConfig generates a config starting point which templates can then customize further

func LoadConfig

func LoadConfig(filepath string) (*Config, error)

LoadConfig will read config from a json file

func (*Config) ChainConfig

func (cfg *Config) ChainConfig() *params.ChainConfig

ChainConfig returns the chain config objt for the blockchain

func (*Config) Save

func (cfg *Config) Save(filepath string) error

Save will write config into a json file

type DoubleSigningSlasherParameters

type DoubleSigningSlasherParameters struct {
	Penalty *big.Int `json:"penalty"`
	Reward  *big.Int `json:"reward"`
}

DoubleSigningSlasherParameters are the initial configuration parameters for DoubleSigningSlasher

func (DoubleSigningSlasherParameters) MarshalJSON

func (d DoubleSigningSlasherParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*DoubleSigningSlasherParameters) UnmarshalJSON

func (d *DoubleSigningSlasherParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type DoubleSigningSlasherParametersMarshaling

type DoubleSigningSlasherParametersMarshaling struct {
	Penalty *bigintstr.BigIntStr `json:"penalty"`
	Reward  *bigintstr.BigIntStr `json:"reward"`
}

type DowntimeSlasherParameters

type DowntimeSlasherParameters struct {
	Penalty           *big.Int `json:"penalty"`
	Reward            *big.Int `json:"reward"`
	SlashableDowntime uint64   `json:"slashableDowntime"`
}

DowntimeSlasherParameters are the initial configuration parameters for DowntimeSlasher

func (DowntimeSlasherParameters) MarshalJSON

func (d DowntimeSlasherParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*DowntimeSlasherParameters) UnmarshalJSON

func (d *DowntimeSlasherParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type DowntimeSlasherParametersMarshaling

type DowntimeSlasherParametersMarshaling struct {
	Penalty *bigintstr.BigIntStr `json:"penalty"`
	Reward  *bigintstr.BigIntStr `json:"reward"`
}

type ElectionParameters

type ElectionParameters struct {
	MinElectableValidators uint64       `json:"minElectableValidators"`
	MaxElectableValidators uint64       `json:"maxElectableValidators"`
	MaxVotesPerAccount     *big.Int     `json:"maxVotesPerAccount"`
	ElectabilityThreshold  *fixed.Fixed `json:"electabilityThreshold"`
}

ElectionParameters are the initial configuration parameters for Elections

func (ElectionParameters) MarshalJSON

func (e ElectionParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ElectionParameters) UnmarshalJSON

func (e *ElectionParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ElectionParametersMarshaling

type ElectionParametersMarshaling struct {
	MaxVotesPerAccount *bigintstr.BigIntStr `json:"maxVotesPerAccount"`
}

type EpochRewardsParameters

type EpochRewardsParameters struct {
	TargetVotingYieldInitial                     *fixed.Fixed   `json:"targetVotingYieldInitial"`
	TargetVotingYieldMax                         *fixed.Fixed   `json:"targetVotingYieldMax"`
	TargetVotingYieldAdjustmentFactor            *fixed.Fixed   `json:"targetVotingYieldAdjustmentFactor"`
	RewardsMultiplierMax                         *fixed.Fixed   `json:"rewardsMultiplierMax"`
	RewardsMultiplierAdjustmentFactorsUnderspend *fixed.Fixed   `json:"rewardsMultiplierAdjustmentFactorsUnderspend"`
	RewardsMultiplierAdjustmentFactorsOverspend  *fixed.Fixed   `json:"rewardsMultiplierAdjustmentFactorsOverspend"`
	TargetVotingGoldFraction                     *fixed.Fixed   `json:"targetVotingGoldFraction"`
	MaxValidatorEpochPayment                     *big.Int       `json:"maxValidatorEpochPayment"`
	CommunityRewardFraction                      *fixed.Fixed   `json:"communityRewardFraction"`
	CommunityPartnerPartner                      common.Address `json:"carbonOffsettingPartner"`
	//CarbonOffsettingFraction                     *fixed.Fixed   `json:"carbonOffsettingFraction"`
	Frozen bool `json:"frozen"`
}

EpochRewardsParameters are the initial configuration parameters for EpochRewards

func (EpochRewardsParameters) MarshalJSON

func (e EpochRewardsParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*EpochRewardsParameters) UnmarshalJSON

func (e *EpochRewardsParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type EpochRewardsParametersMarshaling

type EpochRewardsParametersMarshaling struct {
	MaxValidatorEpochPayment *bigintstr.BigIntStr `json:"maxValidatorEpochPayment"`
}

type GasPriceMinimumParameters

type GasPriceMinimumParameters struct {
	MinimumFloor    *big.Int     `json:"minimumFloor"`
	TargetDensity   *fixed.Fixed `json:"targetDensity"`
	AdjustmentSpeed *fixed.Fixed `json:"adjustmentSpeed"`
}

GasPriceMinimumParameters are the initial configuration parameters for GasPriceMinimum

func (GasPriceMinimumParameters) MarshalJSON

func (g GasPriceMinimumParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*GasPriceMinimumParameters) UnmarshalJSON

func (g *GasPriceMinimumParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type GasPriceMinimumParametersMarshaling

type GasPriceMinimumParametersMarshaling struct {
	MinimumFloor *bigintstr.BigIntStr `json:"minimumFloor"`
}

type GoldTokenParameters

type GoldTokenParameters struct {
	Frozen          bool        `json:"frozen"`
	InitialBalances BalanceList `json:"initialBalances"`
}

GoldTokenParameters are the initial configuration parameters for GoldToken

type GovernanceParameters

type GovernanceParameters struct {
	UseMultiSig             bool         `json:"useMultiSig"` // whether the approver should be the multisig (otherwise it's the admin)
	ConcurrentProposals     uint64       `json:"concurrentProposals"`
	MinDeposit              *big.Int     `json:"minDeposit"`
	QueueExpiry             uint64       `json:"queueExpiry"`
	DequeueFrequency        uint64       `json:"dequeueFrequency"`
	ApprovalStageDuration   uint64       `json:"approvalStageDuration"`
	ReferendumStageDuration uint64       `json:"referendumStageDuration"`
	ExecutionStageDuration  uint64       `json:"executionStageDuration"`
	ParticipationBaseline   *fixed.Fixed `json:"participationBaseline"`
	ParticipationFloor      *fixed.Fixed `json:"participationFloor"`
	BaselineUpdateFactor    *fixed.Fixed `json:"baselineUpdateFactor"`
	BaselineQuorumFactor    *fixed.Fixed `json:"baselineQuorumFactor"`
}

GovernanceParameters are the initial configuration parameters for Governance

func (GovernanceParameters) MarshalJSON

func (g GovernanceParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*GovernanceParameters) UnmarshalJSON

func (g *GovernanceParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type GovernanceParametersMarshaling

type GovernanceParametersMarshaling struct {
	MinDeposit *bigintstr.BigIntStr `json:"minDeposit"`
}

type HardforkConfig

type HardforkConfig struct {
	ChurritoBlock *big.Int `json:"churritoBlock"`
	DonutBlock    *big.Int `json:"donutBlock"`
}

HardforkConfig contains atlas hardforks activation blocks

type LockedGoldParameters

type LockedGoldParameters struct {
	UnlockingPeriod uint64 `json:"unlockingPeriod"`
}

LockedGoldParameters are the initial configuration parameters for LockedGold

type LockedGoldRequirements

type LockedGoldRequirements struct {
	Value    *big.Int `json:"value"`
	Duration uint64   `json:"duration"`
}

LockedGoldRequirements represents value/duration requirments on locked gold

func (LockedGoldRequirements) MarshalJSON

func (l LockedGoldRequirements) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*LockedGoldRequirements) UnmarshalJSON

func (l *LockedGoldRequirements) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type LockedgoldRequirementsMarshaling

type LockedgoldRequirementsMarshaling struct {
	Value *bigintstr.BigIntStr `json:"value"`
}

type MarkerInfo

type MarkerInfo struct {
	AdminInfo  AccoutInfo
	Validators []AccoutInfo
}

type MultiSigParameters

type MultiSigParameters struct {
	Signatories                      []common.Address `json:"signatories"`
	NumRequiredConfirmations         uint64           `json:"numRequiredConfirmations"`
	NumInternalRequiredConfirmations uint64           `json:"numInternalRequiredConfirmations"`
}

MultiSigParameters are the initial configuration parameters for a MultiSig contract

type RandomParameters

type RandomParameters struct {
	RandomnessBlockRetentionWindow uint64 `json:"randomnessBlockRetentionWindow"`
}

RandomParameters are the initial configuration parameters for Random

type TransferWhitelistParameters

type TransferWhitelistParameters struct {
	Addresses   []common.Address `json:"addresses"`
	RegistryIDs []common.Hash    `json:"registryIds"`
}

TransferWhitelistParameters are the initial configuration parameters for TransferWhitelist

type ValidatorsParameters

type ValidatorsParameters struct {
	ValidatorLockedGoldRequirements LockedGoldRequirements `json:"validatorLockedGoldRequirements"`
	ValidatorScoreExponent          uint64                 `json:"validatorScoreExponent"`
	ValidatorScoreAdjustmentSpeed   *fixed.Fixed           `json:"validatorScoreAdjustmentSpeed"`
	MembershipHistoryLength         uint64                 `json:"membershipHistoryLength"`
	SlashingPenaltyResetPeriod      uint64                 `json:"slashingPenaltyResetPeriod"`
	CommissionUpdateDelay           uint64                 `json:"commissionUpdateDelay"`
	DowntimeGracePeriod             uint64                 `json:"downtimeGracePeriod"`

	Commission *fixed.Fixed `json:"commission"` // commission for genesis registered validator
}

ValidatorsParameters are the initial configuration parameters for Validators

type Version

type Version struct {
	Major int64 `json:"major"`
	Minor int64 `json:"minor"`
	Patch int64 `json:"patch"`
}

Version represents an artifact version number

Jump to

Keyboard shortcuts

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