state

package
v0.2403.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImmutableState

type ImmutableState struct {
	// contains filtered or unexported fields
}

ImmutableState is the immutable consensus state wrapper.

func NewImmutableState

func NewImmutableState(ctx context.Context, state api.ApplicationQueryState, version int64) (*ImmutableState, error)

NewImmutableState returns immutable vault state.

func (*ImmutableState) AddressState

func (s *ImmutableState) AddressState(ctx context.Context, vaultAddr staking.Address, address staking.Address) (*vault.AddressState, error)

func (*ImmutableState) AddressStates

func (s *ImmutableState) AddressStates(ctx context.Context, vaultAddr staking.Address) (map[staking.Address]*vault.AddressState, error)

func (*ImmutableState) ConsensusParameters

func (s *ImmutableState) ConsensusParameters(ctx context.Context) (*vault.ConsensusParameters, error)

ConsensusParameters returns the vault consensus parameters.

func (*ImmutableState) PendingAction

func (s *ImmutableState) PendingAction(ctx context.Context, vaultAddr staking.Address, nonce uint64) (*vault.PendingAction, error)

func (*ImmutableState) PendingActions

func (s *ImmutableState) PendingActions(ctx context.Context, vaultAddr staking.Address) ([]*vault.PendingAction, error)

func (*ImmutableState) Vault

func (s *ImmutableState) Vault(ctx context.Context, address staking.Address) (*vault.Vault, error)

func (*ImmutableState) Vaults

func (s *ImmutableState) Vaults(ctx context.Context) ([]*vault.Vault, error)

Vaults looks up all vaults.

type MutableState

type MutableState struct {
	*ImmutableState
	// contains filtered or unexported fields
}

MutableState is a mutable consensus state wrapper.

func NewMutableState

func NewMutableState(tree mkvs.KeyValueTree) *MutableState

NewMutableState creates a new mutable vault state.

func (*MutableState) CreateVault

func (s *MutableState) CreateVault(ctx context.Context, vlt *vault.Vault) error

CreateVault creates a new vault.

NOTE: This operation performs multiple actions so it should be wrapped in a transaction.

func (*MutableState) RemovePendingAction

func (s *MutableState) RemovePendingAction(ctx context.Context, vaultAddr staking.Address, nonce uint64) error

RemovePendingAction removes the pending action with the given nonce.

func (*MutableState) SetAddressState

func (s *MutableState) SetAddressState(ctx context.Context, vaultAddr staking.Address, addr staking.Address, state *vault.AddressState) error

SetAddressState sets the address state.

func (*MutableState) SetConsensusParameters

func (s *MutableState) SetConsensusParameters(ctx context.Context, params *vault.ConsensusParameters) error

SetConsensusParameters sets vault consensus parameters.

NOTE: This method must only be called from InitChain/EndBlock contexts.

func (*MutableState) SetPendingAction

func (s *MutableState) SetPendingAction(ctx context.Context, vaultAddr staking.Address, action *vault.PendingAction) error

SetPendingAction updates the pending action.

func (*MutableState) SetVault

func (s *MutableState) SetVault(ctx context.Context, vault *vault.Vault) error

SetVault updates a vault descriptor.

Jump to

Keyboard shortcuts

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