types

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AttoPhoton defines the default coin denomination used in Treasurenet in:
	//
	// - Staking parameters: denomination used as stake in the dPoS chain
	// - Mint parameters: denomination minted due to fee distribution rewards
	// - Governance parameters: denomination used for spam prevention in proposal deposits
	// - Crisis parameters: constant fee denomination used for spam prevention to check broken invariant
	// - EVM parameters: denomination used for running EVM state transitions in Treasurenet.
	//AttoPhoton string = "aphoton"
	AttoPhoton string = "aunit"

	// BaseDenomUnit defines the base denomination unit for Photons.
	// 1 photon = 1x10^{BaseDenomUnit} aphoton
	// 1 unit = 1x10^{BaseDenomUnit} aunit
	BaseDenomUnit = 18
)
View Source
const (

	// ProtocolVersion is the latest supported version of the eth protocol.
	ProtocolVersion = eth65
)

Constants to match up protocol versions and messages

View Source
const (
	// RootCodespace is the codespace for all errors defined in this package
	RootCodespace = "treasurenet"
)

Variables

View Source
var (
	ErrInvalidLengthAccount        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAccount          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAccount = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// ErrInvalidValue returns an error resulting from an invalid value.
	ErrInvalidValue = sdkerrors.Register(RootCodespace, 2, "invalid value")

	// ErrInvalidChainID returns an error resulting from an invalid chain ID.
	ErrInvalidChainID = sdkerrors.Register(RootCodespace, 3, "invalid chain ID")

	// ErrMarshalBigInt returns an error resulting from marshaling a big.Int to a string.
	ErrMarshalBigInt = sdkerrors.Register(RootCodespace, 5, "cannot marshal big.Int to string")

	// ErrUnmarshalBigInt returns an error resulting from unmarshaling a big.Int from a string.
	ErrUnmarshalBigInt = sdkerrors.Register(RootCodespace, 6, "cannot unmarshal big.Int from string")
)
View Source
var (
	// Bip44CoinType satisfies EIP84. See https://github.com/ethereum/EIPs/issues/84 for more info.
	Bip44CoinType uint32 = 60

	// BIP44HDPath is the default BIP44 HD path used on Ethereum.
	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)
View Source
var (
	ErrInvalidLengthWeb3        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWeb3          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWeb3 = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// PowerReduction defines the default power reduction value for staking
	PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(BaseDenomUnit), nil))
)

Functions

func BlockGasLimit

func BlockGasLimit(ctx sdk.Context) uint64

BlockGasLimit returns the max gas (limit) defined in the block gas meter. If the meter is not set, it returns the max gas from the application consensus params. NOTE: see https://github.com/cosmos/cosmos-sdk/issues/9514 for full reference

func IsEmptyHash

func IsEmptyHash(hash string) bool

IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash.

func IsValidChainID

func IsValidChainID(chainID string) bool

IsValidChainID returns false if the given chain identifier is incorrectly formatted.

func IsZeroAddress

func IsZeroAddress(address string) bool

IsZeroAddress returns true if the address corresponds to an empty ethereum hex address.

func NewPhotonCoin

func NewPhotonCoin(amount sdk.Int) sdk.Coin

NewPhotonCoin is a utility function that returns an "aunit" coin with the given sdk.Int amount. The function will panic if the provided amount is negative.

func NewPhotonCoinInt64

func NewPhotonCoinInt64(amount int64) sdk.Coin

NewPhotonCoinInt64 is a utility function that returns an "aunit" coin with the given int64 amount. The function will panic if the provided amount is negative.

func NewPhotonDecCoin

func NewPhotonDecCoin(amount sdk.Int) sdk.DecCoin

NewPhotonDecCoin is a utility function that returns an "aunit" decimal coin with the given sdk.Int amount. The function will panic if the provided amount is negative.

func ParseChainID

func ParseChainID(chainID string) (*big.Int, error)

ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format

func ProtoAccount

func ProtoAccount() authtypes.AccountI

ProtoAccount defines the prototype function for BaseAccount used for an AccountKeeper.

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the tendermint concrete client-related implementations and interfaces.

func ValidateAddress

func ValidateAddress(address string) error

ValidateAddress returns an error if the provided string is either not a hex formatted string address

Types

type Code

type Code []byte

Code is account Code type alias

func (Code) String

func (c Code) String() string

type EthAccount

type EthAccount struct {
	*types.BaseAccount ``     /* 136-byte string literal not displayed */
	CodeHash           string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"`
}

EthAccount implements the authtypes.AccountI interface and embeds an authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.

func (*EthAccount) Descriptor

func (*EthAccount) Descriptor() ([]byte, []int)

func (EthAccount) EthAddress

func (acc EthAccount) EthAddress() common.Address

EthAddress returns the account address ethereum format.

func (EthAccount) GetCodeHash

func (acc EthAccount) GetCodeHash() common.Hash

GetCodeHash returns the account code hash in byte format

func (*EthAccount) Marshal

func (m *EthAccount) Marshal() (dAtA []byte, err error)

func (*EthAccount) MarshalTo

func (m *EthAccount) MarshalTo(dAtA []byte) (int, error)

func (*EthAccount) MarshalToSizedBuffer

func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EthAccount) ProtoMessage

func (*EthAccount) ProtoMessage()

func (*EthAccount) Reset

func (m *EthAccount) Reset()

func (*EthAccount) Size

func (m *EthAccount) Size() (n int)

func (*EthAccount) Unmarshal

func (m *EthAccount) Unmarshal(dAtA []byte) error

func (*EthAccount) XXX_DiscardUnknown

func (m *EthAccount) XXX_DiscardUnknown()

func (*EthAccount) XXX_Marshal

func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EthAccount) XXX_Merge

func (m *EthAccount) XXX_Merge(src proto.Message)

func (*EthAccount) XXX_Size

func (m *EthAccount) XXX_Size() int

func (*EthAccount) XXX_Unmarshal

func (m *EthAccount) XXX_Unmarshal(b []byte) error

type ExtensionOptionsWeb3Tx

type ExtensionOptionsWeb3Tx struct {
	// typedDataChainID used only in EIP712 Domain and should match
	// Ethereum network ID in a Web3 provider (e.g. Metamask).
	TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typedDataChainID,proto3" json:"typedDataChainID,omitempty"`
	// feePayer is an account address for the fee payer. It will be validated
	// during EIP712 signature checking.
	FeePayer string `protobuf:"bytes,2,opt,name=feePayer,proto3" json:"feePayer,omitempty"`
	// feePayerSig is a signature data from the fee paying account,
	// allows to perform fee delegation when using EIP712 Domain.
	FeePayerSig []byte `protobuf:"bytes,3,opt,name=feePayerSig,proto3" json:"feePayerSig,omitempty"`
}

func (*ExtensionOptionsWeb3Tx) Descriptor

func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int)

func (*ExtensionOptionsWeb3Tx) Marshal

func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error)

func (*ExtensionOptionsWeb3Tx) MarshalTo

func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) MarshalToSizedBuffer

func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) ProtoMessage

func (*ExtensionOptionsWeb3Tx) ProtoMessage()

func (*ExtensionOptionsWeb3Tx) Reset

func (m *ExtensionOptionsWeb3Tx) Reset()

func (*ExtensionOptionsWeb3Tx) Size

func (m *ExtensionOptionsWeb3Tx) Size() (n int)

func (*ExtensionOptionsWeb3Tx) String

func (m *ExtensionOptionsWeb3Tx) String() string

func (*ExtensionOptionsWeb3Tx) Unmarshal

func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error

func (*ExtensionOptionsWeb3Tx) XXX_DiscardUnknown

func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()

func (*ExtensionOptionsWeb3Tx) XXX_Marshal

func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExtensionOptionsWeb3Tx) XXX_Merge

func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message)

func (*ExtensionOptionsWeb3Tx) XXX_Size

func (m *ExtensionOptionsWeb3Tx) XXX_Size() int

func (*ExtensionOptionsWeb3Tx) XXX_Unmarshal

func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error

type ExtensionOptionsWeb3TxI

type ExtensionOptionsWeb3TxI interface{}

type HDPathIterator

type HDPathIterator func() ethaccounts.DerivationPath

func NewHDPathIterator

func NewHDPathIterator(basePath string, ledgerIter bool) (HDPathIterator, error)

HDPathIterator receives a base path as a string and a boolean for the desired iterator type and returns a function that iterates over the base HD path, returning the string.

Jump to

Keyboard shortcuts

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