Documentation ¶
Index ¶
- Constants
- func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState
- func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) sdk.Querier
- type AttestationHandler
- type Keeper
- func (k Keeper) AddClaim(ctx sdk.Context, details types.Claim) (*types.Attestation, error)
- func (k Keeper) Coins(context context.Context, request *types.QueryCoinsRequest) (*types.QueryCoinsResponse, error)
- func (k Keeper) ConvertFromEthValue(ctx sdk.Context, tokenContract string, amount sdk.Int) sdk.Int
- func (k Keeper) ConvertToEthValue(ctx sdk.Context, tokenContract string, amount sdk.Int) sdk.Int
- func (k Keeper) CurrentEpoch(context context.Context, request *types.QueryCurrentEpochRequest) (*types.QueryCurrentEpochResponse, error)
- func (k Keeper) DeleteAttestation(ctx sdk.Context, att types.Attestation)
- func (k Keeper) EthFee(context context.Context, request *types.QueryEthFeeRequest) (*types.QueryEthFeeResponse, error)
- func (k Keeper) GetAttestation(ctx sdk.Context, epoch uint64, details types.Claim) *types.Attestation
- func (k Keeper) GetAttestationMapping(ctx sdk.Context) (out map[uint64][]types.Attestation)
- func (k Keeper) GetClaim(ctx sdk.Context, valaddr string, epoch uint64) types.Claim
- func (k Keeper) GetClaimsByValidatorAndType(ctx sdk.Context, claimType types.ClaimType, val sdk.ValAddress) (out []types.Claim)
- func (k Keeper) GetCoins(ctx sdk.Context) types.Coins
- func (k Keeper) GetCommissionForDemon(ctx sdk.Context, denom string) sdk.Dec
- func (k Keeper) GetCurrentEpoch(ctx sdk.Context) uint64
- func (k Keeper) GetEthGasPrice(ctx sdk.Context) (sdk.Int, error)
- func (k Keeper) GetEthPrice(ctx sdk.Context) (sdk.Int, error)
- func (k Keeper) GetGasUnits() int64
- func (k Keeper) GetMinBatchGas(ctx sdk.Context) uint64
- func (k Keeper) GetMinSingleWithdrawGas(ctx sdk.Context) uint64
- func (k Keeper) GetMinterPrice(ctx sdk.Context, id uint64) (sdk.Int, error)
- func (k Keeper) GetNormalizedValPowers(ctx sdk.Context) map[string]uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPipInBip() sdk.Int
- func (k Keeper) GetPrices(ctx sdk.Context) *types.Prices
- func (k Keeper) GetTxStatus(ctx sdk.Context, inTxHash string) *types.TxStatus
- func (k Keeper) HasClaim(ctx sdk.Context, details types.Claim) bool
- func (k Keeper) IterateAttestaions(ctx sdk.Context, cb func([]byte, types.Attestation) bool)
- func (k Keeper) IterateClaimsByValidatorAndType(ctx sdk.Context, claimType types.ClaimType, validatorKey sdk.ValAddress, ...)
- func (k Keeper) ProcessCurrentEpoch(ctx sdk.Context)
- func (k Keeper) SetAttestation(ctx sdk.Context, att *types.Attestation, claim types.Claim)
- func (k Keeper) SetAttestationUnsafe(ctx sdk.Context, att *types.Attestation)
- func (k Keeper) SetParams(ctx sdk.Context, ps types.Params)
- func (k Keeper) SetTxStatus(ctx sdk.Context, inTxHash string, status types.TxStatusType, outTxHash string)
Constants ¶
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 ¶
NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.
func NewQuerier ¶
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 ¶
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 (Keeper) ConvertToEthValue ¶
func (Keeper) CurrentEpoch ¶
func (k Keeper) CurrentEpoch(context context.Context, request *types.QueryCurrentEpochRequest) (*types.QueryCurrentEpochResponse, error)
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 ¶
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) GetCommissionForDemon ¶
func (Keeper) GetGasUnits ¶
func (Keeper) GetMinSingleWithdrawGas ¶
func (Keeper) GetMinterPrice ¶
func (Keeper) GetNormalizedValPowers ¶
func (Keeper) GetPipInBip ¶
func (Keeper) GetTxStatus ¶
func (Keeper) IterateAttestaions ¶
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 (Keeper) SetAttestation ¶
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