keeper

package
v0.0.0-...-1f47db2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryCurrentEpoch = "currentEpoch"
	QueryPrices       = "prices"
	QueryEthFee       = "eth_fee"
	QueryCoins        = "coins"
	QueryTxStatus     = "tx_status"
)

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

	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.BinaryMarshaler, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, stakingKeeper types.StakingKeeper, bankKeeper types.BankKeeper) 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) Coins

func (k Keeper) Coins(context context.Context, request *types.QueryCoinsRequest) (*types.QueryCoinsResponse, error)

func (Keeper) ConvertFromEthValue

func (k Keeper) ConvertFromEthValue(ctx sdk.Context, tokenContract string, amount sdk.Int) sdk.Int

func (Keeper) ConvertToEthValue

func (k Keeper) ConvertToEthValue(ctx sdk.Context, tokenContract string, amount sdk.Int) sdk.Int

func (Keeper) CurrentEpoch

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 (k Keeper) EthFee(context context.Context, request *types.QueryEthFeeRequest) (*types.QueryEthFeeResponse, error)

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) GetClaim

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

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) GetCoins

func (k Keeper) GetCoins(ctx sdk.Context) types.Coins

func (Keeper) GetCommissionForDemon

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

func (Keeper) GetCurrentEpoch

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

func (Keeper) GetEthGasPrice

func (k Keeper) GetEthGasPrice(ctx sdk.Context) (sdk.Int, error)

func (Keeper) GetEthPrice

func (k Keeper) GetEthPrice(ctx sdk.Context) (sdk.Int, error)

func (Keeper) GetGasUnits

func (k Keeper) GetGasUnits() int64

func (Keeper) GetMinBatchGas

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

func (Keeper) GetMinSingleWithdrawGas

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

func (Keeper) GetMinterPrice

func (k Keeper) GetMinterPrice(ctx sdk.Context, id uint64) (sdk.Int, error)

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) GetPipInBip

func (k Keeper) GetPipInBip() sdk.Int

func (Keeper) GetPrices

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

func (Keeper) GetTxStatus

func (k Keeper) GetTxStatus(ctx sdk.Context, inTxHash string) *types.TxStatus

func (Keeper) HasClaim

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

HasClaim returns true if a claim exists

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) 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) SetParams

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

SetParams sets the parameters in the store

func (Keeper) SetTxStatus

func (k Keeper) SetTxStatus(ctx sdk.Context, inTxHash string, status types.TxStatusType, outTxHash string)

Jump to

Keyboard shortcuts

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