config

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "k2"

Variables

View Source
var (
	LoggerLevelFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "logger-level",
		Usage:    "The log level for the application",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
		Value:    "info",
	}
	WalletPrivateKeyFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "eth1-private-key",
		Usage:    "The private key of the validator wallet. You can load multiple keys by separating them with a comma in order of priority",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
		EnvVars:  []string{"ETH1_PRIVATE_KEY"},
	}
	Web3SignerUrlFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "web3-signer-url",
		Usage:    "The url of the web3 signer",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	PayoutRecipientFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "payout-recipient",
		Usage:    "The address of the payout recipient, optional would then default to the registration fee recepient address",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	BeaconNodeUrlFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "beacon-node-url",
		Usage:    "The url of the beacon node",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	ExecutionNodeUrlFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "execution-node-url",
		Usage:    "The url of the execution node",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	ExclusionListFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "exclusion-list",
		Usage:    "The list of addresses to exclude from either the Proposer Registration or Native Delegation",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	StrictInclusionListFileFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "strict-inclusion-list",
		Usage:    "The list of addresses to include in either the Proposer Registration or Native Delegation",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	RepresentativeMappingFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "representative-mapping",
		Usage:    "The mapping of representative addresses designated to handle validators that pay to different fee recipients",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	MaxGasPriceFlag = &cli.Uint64Flag{
		Name:     ModuleName + "." + "max-gas-price",
		Usage:    "The maximum gas price to use for transactions, in Wei",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	RegistrationOnlyFlag = &cli.BoolFlag{
		Name:     ModuleName + "." + "registration-only",
		Usage:    "Only register the validators in the proposer registry, do not natively delegate",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	ListenAddressFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "listen-address",
		Usage:    "The address to listen on for incoming requests",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	ClaimThresholdFlag = &cli.Float64Flag{
		Name:     ModuleName + "." + "claim-threshold",
		Usage:    "The threshold for claiming rewards, in KETH",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	K2LendingContractAddressFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "k2-lending-contract-address",
		Usage:    "The address of the K2 lending contract to override the internal configuration",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	K2NodeOperatorContractAddressFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "k2-node-operator-contract-address",
		Usage:    "The address of the K2 node operator contract to override the internal configuration",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	ProposerRegistryContractAddressFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "proposer-registry-contract-address",
		Usage:    "The address of the proposer registry contract to override the internal configuration",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	SignatureSwapperUrlFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "signature-swapper-url",
		Usage:    "The url of the signature swapper to override the internal configuration",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	BalanceVerificationUrlFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "balance-verification-url",
		Usage:    "The url of the balance verification service to override the internal configuration",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
	SubgraphUrlFlag = &cli.StringFlag{
		Name:     ModuleName + "." + "subgraph-url",
		Usage:    "The url of the subgraph to override the internal configuration",
		Category: strings.ReplaceAll(strings.ToUpper(ModuleName), "_", " "),
	}
)
View Source
var K2ConfigConstants = map[uint64]K2Config{
	1: {
		K2LendingContractAddress:        common.HexToAddress("0x7D1e9f343a57bD58436b50Ad9935c128a6cF97DB"),
		K2NodeOperatorContractAddress:   common.HexToAddress("0x8eeC404Ef2d4756C972658629400a39359099EF6"),
		ProposerRegistryContractAddress: common.HexToAddress("0xF7F6D8F8b76E94379034d333f4B5FE1694A32D87"),
		SignatureSwapperUrl: &url.URL{
			Scheme: "https",
			Host:   "signature-swapper.ponrelay.com",
		},
		BalanceVerificationUrl: &url.URL{
			Scheme: "https",
			Host:   "verify-effective-balance.restaking.cloud",
		},
		SubgraphUrl: &url.URL{
			Scheme: "https",
			Host:   "api.thegraph.com",
			Path:   "/subgraphs/name/restaking-cloud/k2-protocol",
		},
	},
	5: {
		K2LendingContractAddress:        common.HexToAddress("0xEEc98aBa34AB03EC1533D37F5256651b43E32d05"),
		K2NodeOperatorContractAddress:   common.HexToAddress("0x10b37A1A3e3114fe479B2cf962dB8806c941d2Dc"),
		ProposerRegistryContractAddress: common.HexToAddress("0x1643ec804d944Da97d90c013cBaCD1358Cce1bAF"),
		SignatureSwapperUrl: &url.URL{
			Scheme: "https",
			Host:   "goerli-signature-swapper.ponrelay.com",
		},
		BalanceVerificationUrl: &url.URL{
			Scheme: "https",
			Host:   "verify-effective-balance-goerli.restaking.cloud",
		},
		SubgraphUrl: &url.URL{
			Scheme: "https",
			Host:   "api.thegraph.com",
			Path:   "/subgraphs/name/restaking-cloud/k2",
		},
	},
	17000: {
		K2LendingContractAddress:        common.HexToAddress("0x4655512B176243Dd161e61a818899324AE4E9323"),
		K2NodeOperatorContractAddress:   common.HexToAddress("0xe7C28eb37802c4015e65a8c55e182A9d5421Cac3"),
		ProposerRegistryContractAddress: common.HexToAddress("0x33a12a1cdc00EE02976fE41509A4A053b9DC5555"),
		SignatureSwapperUrl: &url.URL{
			Scheme: "https",
			Host:   "holesky-signature-swapper.ponrelay.com",
		},
		BalanceVerificationUrl: &url.URL{
			Scheme: "https",
			Host:   "verify-effective-balance-holesky.restaking.cloud",
		},
		SubgraphUrl: &url.URL{
			Scheme: "https",
			Host:   "api.studio.thegraph.com",
			Path:   "/query/45760/k2-holesky/version/latest",
		},
	},
}

A mapping of chain IDs to their respective K2 known configurations

View Source
var K2ConfigDefaults = K2Config{
	LoggerLevel:                     "info",
	ValidatorWallets:                nil,
	Web3SignerUrl:                   nil,
	SignatureSwapperUrl:             nil,
	BeaconNodeUrl:                   nil,
	ExecutionNodeUrl:                nil,
	K2LendingContractAddress:        common.Address{},
	K2NodeOperatorContractAddress:   common.Address{},
	ProposerRegistryContractAddress: common.Address{},
	BalanceVerificationUrl:          nil,
	SubgraphUrl:                     nil,
	PayoutRecipient:                 common.Address{},
	ExclusionListFile:               "",
	StrictInclusionListFile:         "",
	RepresentativeMappingFile:       "",
	MaxGasPrice:                     0,
	RegistrationOnly:                false,
	ListenAddress:                   &url.URL{Scheme: "http", Host: "localhost:10000"},
	ClaimThreshold:                  0.0,
}

Functions

func NewCommand

func NewCommand() *cli.Command

Types

type K2Config

type K2Config struct {
	LoggerLevel                     string
	ValidatorWallets                []k2common.ValidatorWallet
	Web3SignerUrl                   *url.URL
	SignatureSwapperUrl             *url.URL
	BeaconNodeUrl                   *url.URL
	ExecutionNodeUrl                *url.URL
	K2LendingContractAddress        common.Address
	K2NodeOperatorContractAddress   common.Address
	ProposerRegistryContractAddress common.Address
	BalanceVerificationUrl          *url.URL       // for effective balance reporting for verifiable signatures to claim rewards
	SubgraphUrl                     *url.URL       // for querying the subgraph for validator registration status
	PayoutRecipient                 common.Address // to override the payout recipient for all validators
	ExclusionListFile               string         // to exclude validators from registration or native delegation
	StrictInclusionListFile         string         // to include only specified validators in registration or native delegation
	RepresentativeMappingFile       string         // to map fee recipients / specific validators to representatives
	MaxGasPrice                     uint64
	RegistrationOnly                bool
	ListenAddress                   *url.URL
	ClaimThreshold                  float64 // To only claim rewards if the validator has earned more than this threshold (in KETH)
}

Jump to

Keyboard shortcuts

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