genesis

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

README

To generate the *_parameters_json files:

go generate mycelo/genesis/config.go

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

This section is empty.

Functions

func FundAccounts added in v1.4.0

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

func GenerateGenesis

func GenerateGenesis(accounts *env.AccountsConfig, cfg *Config, contractsBuildPath string) (*core.Genesis, error)

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

Types

type AssetAllocation

type AssetAllocation struct {
	Symbol string       `json:"symbol"`
	Weight *fixed.Fixed `json:"weight"`
}

AssetAllocation config for Reserve

type AssetAllocationList

type AssetAllocationList []AssetAllocation

AssetAllocationList list of AssetAllocation

func (AssetAllocationList) SymbolsABI

func (aa AssetAllocationList) SymbolsABI() []common.Hash

SymbolsABI returns symbols in ABI format for assets in list

func (AssetAllocationList) Weights

func (aa AssetAllocationList) Weights() []*big.Int

Weights returns weights for assets in list

type AttestationsParameters

type AttestationsParameters struct {
	AttestationExpiryBlocks        uint64          `json:"attestationExpiryBlocks"`
	SelectIssuersWaitBlocks        uint64          `json:"selectIssuersWaitBlocks"`
	MaxAttestations                uint64          `json:"maxAttestations"`
	AttestationRequestFeeInDollars decimal.Decimal `json:"AttestationRequestFeeInDollars"`
}

AttestationsParameters are the initial configuration parameters for Attestations

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 {
	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"`

	SortedOracles              SortedOraclesParameters
	GasPriceMinimum            GasPriceMinimumParameters
	Reserve                    ReserveParameters
	StableToken                StableTokenParameters
	StableTokenEUR             StableTokenParameters
	StableTokenBRL             StableTokenParameters
	Exchange                   ExchangeParameters
	ExchangeEUR                ExchangeParameters
	ExchangeBRL                ExchangeParameters
	LockedGold                 LockedGoldParameters
	GoldToken                  GoldTokenParameters
	Validators                 ValidatorsParameters
	Election                   ElectionParameters
	EpochRewards               EpochRewardsParameters
	Blockchain                 BlockchainParameters
	Random                     RandomParameters
	Attestations               AttestationsParameters
	ReserveSpenderMultiSig     MultiSigParameters
	GovernanceApproverMultiSig MultiSigParameters
	DoubleSigningSlasher       DoubleSigningSlasherParameters
	DowntimeSlasher            DowntimeSlasherParameters
	Governance                 GovernanceParameters
	GrandaMento                GrandaMentoParameters
	FeeHandler                 FeeHandlerParameters
}

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

func BaseConfig

func BaseConfig(gingerbreadBlock *big.Int) *Config

BaseConfig creates base parameters for celo Callers must complete missing pieces

func CreateCommonGenesisConfig added in v1.4.0

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

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"`
	CarbonOffsettingPartner                      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 ExchangeParameters

type ExchangeParameters struct {
	Frozen          bool         `json:"frozen"`
	Spread          *fixed.Fixed `json:"spread"`
	ReserveFraction *fixed.Fixed `json:"reserveFraction"`
	UpdateFrequency uint64       `json:"updateFrequency"`
	MinimumReports  uint64       `json:"minimumReports"`
}

ExchangeParameters are the initial configuration parameters for Exchange

type FeeHandlerParameters added in v1.8.0

type FeeHandlerParameters struct {
	NewFeeBeneficiary common.Address   `json:"newFeeBeneficiary"`
	NewBurnFraction   *fixed.Fixed     `json:"newBurnFraction"`
	Tokens            []common.Address `json:"tokens"`
	Handlers          []common.Address `json:"handlers"`
	NewLimits         []*big.Int       `json:"newLimits"`
	NewMaxSlippages   []*big.Int       `json:"newMaxSlippages"`
}

FeeHandlerParameters are the initial configuration parameters for FeeHandler

type GasPriceMinimumParameters

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

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"`
	BaseFeeOpCodeActivationBlock *bigintstr.BigIntStr `json:"baseFeeOpCodeActivationBlock"`
}

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"`
	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 GrandaMentoParameters added in v1.7.3

type GrandaMentoParameters struct {
	Approver                      common.Address                `json:"approver"`
	MaxApprovalExchangeRateChange *fixed.Fixed                  `json:"maxApprovalExchangeRateChange"`
	Spread                        *fixed.Fixed                  `json:"spread"`
	VetoPeriodSeconds             uint64                        `json:"vetoPeriodSeconds"`
	StableTokenExchangeLimits     StableTokenExchangeLimitsList `json:"stableTokenExchangeLimits"`
}

GrandaMentoParameters are the initial configuration parameters for GrandaMento

type HardforkConfig

type HardforkConfig struct {
	ChurritoBlock      *big.Int `json:"churritoBlock"`
	DonutBlock         *big.Int `json:"donutBlock"`
	EspressoBlock      *big.Int `json:"espressoBlock"`
	GingerbreadBlock   *big.Int `json:"gingerbreadBlock"`
	GingerbreadP2Block *big.Int `json:"gingerbreadP2Block"`
}

HardforkConfig contains celo 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 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 ReserveParameters

type ReserveParameters struct {
	TobinTaxStalenessThreshold uint64              `json:"tobinTaxStalenessThreshold"`
	DailySpendingRatio         *fixed.Fixed        `json:"dailySpendingRatio"`
	AssetAllocations           AssetAllocationList `json:"assetAllocations"`
	TobinTax                   *fixed.Fixed        `json:"tobinTax"`
	TobinTaxReserveRatio       *fixed.Fixed        `json:"tobinTaxReserveRatio"`

	// Other parameters
	Spenders                 []common.Address `json:"spenders"`
	OtherAddresses           []common.Address `json:"otherAddresses"`
	InitialBalance           *big.Int         `json:"initialBalance"`
	FrozenAssetsStartBalance *big.Int         `json:"frozenAssetsStartBalance"`
	FrozenAssetsDays         uint64           `json:"frozenAssetsDays"`
}

ReserveParameters are the initial configuration parameters for Reserve

func (ReserveParameters) MarshalJSON

func (r ReserveParameters) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ReserveParameters) UnmarshalJSON

func (r *ReserveParameters) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ReserveParametersMarshaling

type ReserveParametersMarshaling struct {
	InitialBalance           *bigintstr.BigIntStr `json:"initialBalance"`
	FrozenAssetsStartBalance *bigintstr.BigIntStr `json:"frozenAssetsStartBalance"`
}

type SortedOraclesParameters

type SortedOraclesParameters struct {
	ReportExpirySeconds uint64 `json:"reportExpirySeconds"`
}

SortedOraclesParameters are the initial configuration parameters for SortedOracles

type StableTokenExchangeLimit added in v1.7.3

type StableTokenExchangeLimit struct {
	StableToken       string   `json:"stableToken"`
	MinExchangeAmount *big.Int `json:"minExchangeAmount"`
	MaxExchangeAmount *big.Int `json:"maxExchangeAmount"`
}

StableTokenExchangeLimit represents the granda mento's exchange limit for a specific stable

func (StableTokenExchangeLimit) MarshalJSON added in v1.7.3

func (s StableTokenExchangeLimit) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*StableTokenExchangeLimit) UnmarshalJSON added in v1.7.3

func (s *StableTokenExchangeLimit) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type StableTokenExchangeLimitsList added in v1.7.3

type StableTokenExchangeLimitsList []StableTokenExchangeLimit

BalanceList list of balances

type StableTokenExchangeLimitsMarshaling added in v1.7.3

type StableTokenExchangeLimitsMarshaling struct {
	MinExchangeAmount *bigintstr.BigIntStr `json:"minExchangeAmount"`
	MaxExchangeAmount *bigintstr.BigIntStr `json:"maxExchangeAmount"`
}

type StableTokenParameters

type StableTokenParameters struct {
	Name                        string           `json:"name"`
	Symbol                      string           `json:"symbol"`
	Decimals                    uint8            `json:"decimals"`
	Rate                        *fixed.Fixed     `json:"rate"`
	InflationFactorUpdatePeriod uint64           `json:"inflationFactorUpdatePeriod"` // How often the inflation factor is updated.
	InitialBalances             BalanceList      `json:"initialBalances"`
	Frozen                      bool             `json:"frozen"`
	Oracles                     []common.Address `json:"oracles"`
	GoldPrice                   *fixed.Fixed     `json:"goldPrice"`
	ExchangeIdentifier          string           `json:"exchangeIdentifier"`
}

StableTokenParameters are the initial configuration parameters for StableToken

type ValidatorsParameters

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

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

ValidatorsParameters are the initial configuration parameters for Validators

Jump to

Keyboard shortcuts

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