types

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccountTypeEOA defines the type for externally owned accounts (EOAs)
	AccountTypeEOA = int8(iota + 1)
	// AccountTypeContract defines the type for contract accounts
	AccountTypeContract
)
View Source
const (
	// AttoDenom defines the default coin denomination used in Haqq Network 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 Haqq Network.
	AttoDenom string = "aISLM"

	// BaseDenomUnit defines the base denomination unit for Haqq Network.
	// 1 ISLM = 1x10^{BaseDenomUnit} aISLM
	BaseDenomUnit = 18

	// DefaultGasPrice is default gas price for evm transactions
	DefaultGasPrice = 20
)
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 = "haqq"

RootCodespace is the codespace for all errors defined in this package

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 (
	ErrInvalidLengthDynamicFee        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDynamicFee          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDynamicFee = fmt.Errorf("proto: unexpected end of group")
)
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 (
	ErrInvalidLengthIndexer        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowIndexer          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupIndexer = fmt.Errorf("proto: unexpected end of group")
)
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 ErrInvalidChainID = errorsmod.Register(RootCodespace, 3, "invalid chain ID")

ErrInvalidChainID returns an error resulting from an invalid chain ID.

PowerReduction defines the default power reduction value for staking

Functions

func BlockGasLimit added in v1.6.0

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 HasDynamicFeeExtensionOption added in v1.6.0

func HasDynamicFeeExtensionOption(any *codectypes.Any) bool

HasDynamicFeeExtensionOption returns true if the tx implements the `ExtensionOptionDynamicFeeTx` extension option.

func IsEmptyHash added in v1.6.0

func IsEmptyHash(hash string) bool

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

func IsValidChainID added in v1.6.0

func IsValidChainID(chainID string) bool

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

func IsValidInt256 added in v1.6.0

func IsValidInt256(i *big.Int) bool

IsValidInt256 check the bound of 256 bit number

func IsZeroAddress added in v1.6.0

func IsZeroAddress(address string) bool

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

func NewInfiniteGasMeterWithLimit added in v1.6.0

func NewInfiniteGasMeterWithLimit(limit sdk.Gas) sdk.GasMeter

NewInfiniteGasMeterWithLimit returns a reference to a new infiniteGasMeter.

func NewIslmCoin added in v1.6.0

func NewIslmCoin(amount sdkmath.Int) sdk.Coin

NewIslmCoin is a utility function that returns an "aISLM" coin with the given sdkmath.Int amount. The function will panic if the provided amount is negative.

func NewIslmCoinInt64 added in v1.6.0

func NewIslmCoinInt64(amount int64) sdk.Coin

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

func NewIslmDecCoin added in v1.6.0

func NewIslmDecCoin(amount sdkmath.Int) sdk.DecCoin

NewIslmDecCoin is a utility function that returns an "aISLM" decimal coin with the given sdkmath.Int amount. The function will panic if the provided amount is negative.

func ParseChainID added in v1.6.0

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 added in v1.6.0

func ProtoAccount() authtypes.AccountI

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

func RegisterInterfaces added in v1.6.0

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

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

func SafeInt64 added in v1.6.0

func SafeInt64(value uint64) (int64, error)

SafeInt64 checks for overflows while casting a uint64 to int64 value.

func SafeNewIntFromBigInt added in v1.6.0

func SafeNewIntFromBigInt(i *big.Int) (sdkmath.Int, error)

SafeNewIntFromBigInt constructs Int from big.Int, return error if more than 256bits

func ValidateAddress added in v1.6.0

func ValidateAddress(address string) error

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

func ValidateNonZeroAddress added in v1.6.0

func ValidateNonZeroAddress(address string) error

ValidateNonZeroAddress returns an error if the provided string is not a hex formatted string address or is equal to zero

Types

type EVMTxIndexer added in v1.6.0

type EVMTxIndexer interface {
	// LastIndexedBlock returns -1 if indexer db is empty
	LastIndexedBlock() (int64, error)
	IndexBlock(*tmtypes.Block, []*abci.ResponseDeliverTx) error

	// GetByTxHash returns nil if tx not found.
	GetByTxHash(common.Hash) (*TxResult, error)
	// GetByBlockAndIndex returns nil if tx not found.
	GetByBlockAndIndex(int64, int32) (*TxResult, error)
}

EVMTxIndexer defines the interface of custom eth tx indexer.

type ErrorGasOverflow added in v1.6.0

type ErrorGasOverflow struct {
	Descriptor string
}

ErrorGasOverflow defines an error thrown when an action results gas consumption unsigned integer overflow.

type ErrorNegativeGasConsumed added in v1.6.0

type ErrorNegativeGasConsumed struct {
	Descriptor string
}

ErrorNegativeGasConsumed defines an error thrown when the amount of gas refunded results in a negative gas consumed amount. Copied from cosmos-sdk

type EthAccount added in v1.6.0

type EthAccount struct {
	// base_account is an authtypes.BaseAccount
	*types.BaseAccount `` /* 136-byte string literal not displayed */
	// code_hash is the hash calculated from the code contents
	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 added in v1.6.0

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

func (EthAccount) EthAddress added in v1.6.0

func (acc EthAccount) EthAddress() common.Address

EthAddress returns the account address ethereum format.

func (EthAccount) GetBaseAccount added in v1.6.0

func (acc EthAccount) GetBaseAccount() *authtypes.BaseAccount

GetBaseAccount returns base account.

func (EthAccount) GetCodeHash added in v1.6.0

func (acc EthAccount) GetCodeHash() common.Hash

GetCodeHash returns the account code hash in byte format

func (*EthAccount) Marshal added in v1.6.0

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

func (*EthAccount) MarshalTo added in v1.6.0

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

func (*EthAccount) MarshalToSizedBuffer added in v1.6.0

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

func (*EthAccount) ProtoMessage added in v1.6.0

func (*EthAccount) ProtoMessage()

func (*EthAccount) Reset added in v1.6.0

func (m *EthAccount) Reset()

func (*EthAccount) SetCodeHash added in v1.6.0

func (acc *EthAccount) SetCodeHash(codeHash common.Hash) error

SetCodeHash sets the account code hash to the EthAccount fields

func (*EthAccount) Size added in v1.6.0

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

func (EthAccount) Type added in v1.6.0

func (acc EthAccount) Type() int8

Type returns the type of Ethereum Account (EOA or Contract)

func (*EthAccount) Unmarshal added in v1.6.0

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

func (*EthAccount) XXX_DiscardUnknown added in v1.6.0

func (m *EthAccount) XXX_DiscardUnknown()

func (*EthAccount) XXX_Marshal added in v1.6.0

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

func (*EthAccount) XXX_Merge added in v1.6.0

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

func (*EthAccount) XXX_Size added in v1.6.0

func (m *EthAccount) XXX_Size() int

func (*EthAccount) XXX_Unmarshal added in v1.6.0

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

type EthAccountI added in v1.6.0

type EthAccountI interface {
	authtypes.AccountI
	// EthAddress returns the ethereum Address representation of the AccAddress
	EthAddress() common.Address
	// CodeHash is the keccak256 hash of the contract code (if any)
	GetCodeHash() common.Hash
	// SetCodeHash sets the code hash to the account fields
	SetCodeHash(code common.Hash) error
	// Type returns the type of Ethereum Account (EOA or Contract)
	Type() int8
}

EthAccountI represents the interface of an EVM compatible account

type ExtensionOptionDynamicFeeTx added in v1.6.0

type ExtensionOptionDynamicFeeTx struct {
	// max_priority_price is the same as `max_priority_fee_per_gas` in eip-1559
	// spec
	MaxPriorityPrice github_com_cosmos_cosmos_sdk_types.Int `` /* 151-byte string literal not displayed */
}

ExtensionOptionDynamicFeeTx is an extension option that specifies the maxPrioPrice for cosmos tx

func (*ExtensionOptionDynamicFeeTx) Descriptor added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) Marshal added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) MarshalTo added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) ProtoMessage added in v1.6.0

func (*ExtensionOptionDynamicFeeTx) ProtoMessage()

func (*ExtensionOptionDynamicFeeTx) Reset added in v1.6.0

func (m *ExtensionOptionDynamicFeeTx) Reset()

func (*ExtensionOptionDynamicFeeTx) Size added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) String added in v1.6.0

func (m *ExtensionOptionDynamicFeeTx) String() string

func (*ExtensionOptionDynamicFeeTx) Unmarshal added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown added in v1.6.0

func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown()

func (*ExtensionOptionDynamicFeeTx) XXX_Marshal added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) XXX_Merge added in v1.6.0

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

func (*ExtensionOptionDynamicFeeTx) XXX_Size added in v1.6.0

func (m *ExtensionOptionDynamicFeeTx) XXX_Size() int

func (*ExtensionOptionDynamicFeeTx) XXX_Unmarshal added in v1.6.0

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

type ExtensionOptionsWeb3Tx added in v1.6.0

type ExtensionOptionsWeb3Tx struct {
	// typed_data_chain_id is 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=typed_data_chain_id,json=typedDataChainId,proto3" json:"typedDataChainID,omitempty"`
	// fee_payer is an account address for the fee payer. It will be validated
	// during EIP712 signature checking.
	FeePayer string `protobuf:"bytes,2,opt,name=fee_payer,json=feePayer,proto3" json:"feePayer,omitempty"`
	// fee_payer_sig 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=fee_payer_sig,json=feePayerSig,proto3" json:"feePayerSig,omitempty"`
}

ExtensionOptionsWeb3Tx is an extension option that specifies the typed chain id, the fee payer as well as its signature data.

func (*ExtensionOptionsWeb3Tx) Descriptor added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) Marshal added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) MarshalTo added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) MarshalToSizedBuffer added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) ProtoMessage added in v1.6.0

func (*ExtensionOptionsWeb3Tx) ProtoMessage()

func (*ExtensionOptionsWeb3Tx) Reset added in v1.6.0

func (m *ExtensionOptionsWeb3Tx) Reset()

func (*ExtensionOptionsWeb3Tx) Size added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) String added in v1.6.0

func (m *ExtensionOptionsWeb3Tx) String() string

func (*ExtensionOptionsWeb3Tx) Unmarshal added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) XXX_DiscardUnknown added in v1.6.0

func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()

func (*ExtensionOptionsWeb3Tx) XXX_Marshal added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) XXX_Merge added in v1.6.0

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

func (*ExtensionOptionsWeb3Tx) XXX_Size added in v1.6.0

func (m *ExtensionOptionsWeb3Tx) XXX_Size() int

func (*ExtensionOptionsWeb3Tx) XXX_Unmarshal added in v1.6.0

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

type GenesisState added in v1.7.0

type GenesisState map[string]json.RawMessage

GenesisState of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.

type HDPathIterator added in v1.6.0

type HDPathIterator func() ethaccounts.DerivationPath

func NewHDPathIterator added in v1.6.0

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

NewHDPathIterator 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.

type TxResult added in v1.6.0

type TxResult struct {
	// height of the blockchain
	Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// tx_index of the cosmos transaction
	TxIndex uint32 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
	// msg_index in a batch transaction
	MsgIndex uint32 `protobuf:"varint,3,opt,name=msg_index,json=msgIndex,proto3" json:"msg_index,omitempty"`
	// eth_tx_index is the index in the list of valid eth tx in the block,
	// aka. the transaction list returned by eth_getBlock api.
	EthTxIndex int32 `protobuf:"varint,4,opt,name=eth_tx_index,json=ethTxIndex,proto3" json:"eth_tx_index,omitempty"`
	// failed is true if the eth transaction did not go succeed
	Failed bool `protobuf:"varint,5,opt,name=failed,proto3" json:"failed,omitempty"`
	// gas_used by the transaction. If it exceeds the block gas limit,
	// it's set to gas limit, which is what's actually deducted by ante handler.
	GasUsed uint64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
	// cumulative_gas_used specifies the cumulated amount of gas used for all
	// processed messages within the current batch transaction.
	CumulativeGasUsed uint64 `protobuf:"varint,7,opt,name=cumulative_gas_used,json=cumulativeGasUsed,proto3" json:"cumulative_gas_used,omitempty"`
}

TxResult is the value stored in eth tx indexer

func (*TxResult) Descriptor added in v1.6.0

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

func (*TxResult) Marshal added in v1.6.0

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

func (*TxResult) MarshalTo added in v1.6.0

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

func (*TxResult) MarshalToSizedBuffer added in v1.6.0

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

func (*TxResult) ProtoMessage added in v1.6.0

func (*TxResult) ProtoMessage()

func (*TxResult) Reset added in v1.6.0

func (m *TxResult) Reset()

func (*TxResult) Size added in v1.6.0

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

func (*TxResult) String added in v1.6.0

func (m *TxResult) String() string

func (*TxResult) Unmarshal added in v1.6.0

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

func (*TxResult) XXX_DiscardUnknown added in v1.6.0

func (m *TxResult) XXX_DiscardUnknown()

func (*TxResult) XXX_Marshal added in v1.6.0

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

func (*TxResult) XXX_Merge added in v1.6.0

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

func (*TxResult) XXX_Size added in v1.6.0

func (m *TxResult) XXX_Size() int

func (*TxResult) XXX_Unmarshal added in v1.6.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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