keeper

package
v0.0.0-...-4334f35 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryCurrentEpoch = "current_epoch"
	QueryPrices       = "prices"
)

Variables

This section is empty.

Functions

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState

ExportGenesis exports all the state needed to restart the chain from the current state of the chain

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)

InitGenesis starts a chain from a genesis state

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

Types

type AttestationHandler

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

AttestationHandler processes `observed` Attestations

func (AttestationHandler) Handle

func (a AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, claim types.Claim) error

Handle is the entry point for Attestation processing.

type Keeper

type Keeper struct {
	StakingKeeper types.StakingKeeper
	Mhub2keeper   types.Mhub2Keeper

	AttestationHandler interface {
		Handle(sdk.Context, types.Attestation, types.Claim) error
	}
	// contains filtered or unexported fields
}

Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, stakingKeeper types.StakingKeeper) Keeper

NewKeeper returns a new instance of the peggy keeper

func (Keeper) AddClaim

func (k Keeper) AddClaim(ctx sdk.Context, details types.Claim) (*types.Attestation, error)

AddClaim starts the following process chain:

  • Records that a given validator has made a claim about a given ethereum event, checking that the event nonce is contiguous (non contiguous eventNonces indicate out of order events which can cause double spends)
  • Either creates a new attestation or adds the validator's vote to the existing attestation for this event
  • Checks if the attestation has enough votes to be considered "Observed", then attempts to apply it to the consensus state (e.g. minting tokens for a deposit event)
  • If so, marks it "Observed" and emits an event

func (Keeper) BscFee

func (Keeper) DeleteAttestation

func (k Keeper) DeleteAttestation(ctx sdk.Context, att types.Attestation)

DeleteAttestation deletes an attestation given an event nonce and claim

func (Keeper) EthFee

func (Keeper) GetAttestation

func (k Keeper) GetAttestation(ctx sdk.Context, epoch uint64, details types.Claim) *types.Attestation

GetAttestation return an attestation given a nonce

func (Keeper) GetAttestationMapping

func (k Keeper) GetAttestationMapping(ctx sdk.Context) (out map[uint64][]types.Attestation)

GetAttestationMapping returns a mapping of eventnonce -> attestations at that nonce

func (Keeper) GetClaimsByValidatorAndType

func (k Keeper) GetClaimsByValidatorAndType(ctx sdk.Context, claimType types.ClaimType, val sdk.ValAddress) (out []types.Claim)

GetClaimsByValidatorAndType returns the list of claims a validator has signed for

func (Keeper) GetCurrentEpoch

func (k Keeper) GetCurrentEpoch(ctx sdk.Context) uint64

func (Keeper) GetHolderValue

func (k Keeper) GetHolderValue(ctx sdk.Context, address string) sdk.Int

func (Keeper) GetHolders

func (k Keeper) GetHolders(ctx sdk.Context) *types.Holders

func (Keeper) GetHoldersClaim

func (k Keeper) GetHoldersClaim(ctx sdk.Context, valaddr string, epoch uint64) types.Claim

func (Keeper) GetNormalizedValPowers

func (k Keeper) GetNormalizedValPowers(ctx sdk.Context) map[string]uint64

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the parameters from the store

func (Keeper) GetPriceClaim

func (k Keeper) GetPriceClaim(ctx sdk.Context, valaddr string, epoch uint64) types.Claim

func (Keeper) GetPrices

func (k Keeper) GetPrices(ctx sdk.Context) *types.Prices

func (Keeper) GetTokenPrice

func (k Keeper) GetTokenPrice(ctx sdk.Context, denom string) (sdk.Dec, error)

func (Keeper) HasClaim

func (k Keeper) HasClaim(ctx sdk.Context, details types.Claim) bool

HasClaim returns true if a claim exists

func (Keeper) Holders

func (Keeper) IterateAttestaions

func (k Keeper) IterateAttestaions(ctx sdk.Context, cb func([]byte, types.Attestation) bool)

IterateAttestaions iterates through all attestations

func (Keeper) IterateClaimsByValidatorAndType

func (k Keeper) IterateClaimsByValidatorAndType(ctx sdk.Context, claimType types.ClaimType, validatorKey sdk.ValAddress, cb func([]byte, types.Claim) bool)

IterateClaimsByValidatorAndType takes a validator key and a claim type and then iterates over these claims

func (Keeper) MustGetTokenPrice

func (k Keeper) MustGetTokenPrice(ctx sdk.Context, denom string) sdk.Dec

func (Keeper) Prices

func (Keeper) ProcessCurrentEpoch

func (k Keeper) ProcessCurrentEpoch(ctx sdk.Context)

func (Keeper) SetAttestation

func (k Keeper) SetAttestation(ctx sdk.Context, att *types.Attestation, claim types.Claim)

SetAttestation sets the attestation in the store

func (Keeper) SetAttestationUnsafe

func (k Keeper) SetAttestationUnsafe(ctx sdk.Context, att *types.Attestation)

SetAttestationUnsafe sets the attestation w/o setting height and claim hash

func (Keeper) SetMhub2Keeper

func (k Keeper) SetMhub2Keeper(keeper types.Mhub2Keeper) Keeper

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, ps types.Params)

SetParams sets the parameters in the store

Jump to

Keyboard shortcuts

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