keeper

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FrontRunningError

type FrontRunningError struct{}

FrontRunningError defines a custom error type for detecting front-running or sandwich attacks.

func NewFrontRunningError

func NewFrontRunningError() *FrontRunningError

func (FrontRunningError) Error

func (e FrontRunningError) Error() string

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	distrKeeper types.DistributionKeeper,
	stakingKeeper types.StakingKeeper,
	authority string,
) Keeper

NewKeeper is a wrapper around NewKeeperWithRewardsAddressProvider for backwards compatibility.

func NewKeeperWithRewardsAddressProvider

func NewKeeperWithRewardsAddressProvider(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	rewardsAddressProvider types.RewardsAddressProvider,
	authority string,
) Keeper

func (Keeper) ExportGenesis

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

ExportGenesis returns a GenesisState for a given context.

func (Keeper) ExtractBid added in v1.1.0

func (k Keeper) ExtractBid(ctx sdk.Context, bidder sdk.AccAddress, bid sdk.Coin) error

ExtractBid extracts the bid amount from the transaction.

func (Keeper) FrontRunningProtectionEnabled

func (k Keeper) FrontRunningProtectionEnabled(ctx sdk.Context) (bool, error)

FrontRunningProtectionEnabled returns true if front-running protection is enabled.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the address that is capable of executing a MsgUpdateParams message.

func (Keeper) GetEscrowAccount

func (k Keeper) GetEscrowAccount(ctx sdk.Context) (sdk.AccAddress, error)

GetEscrowAccount returns the auction module's escrow account.

func (Keeper) GetMaxBundleSize

func (k Keeper) GetMaxBundleSize(ctx sdk.Context) (uint32, error)

GetMaxBundleSize returns the maximum number of transactions that can be included in a bundle.

func (Keeper) GetMinBidIncrement

func (k Keeper) GetMinBidIncrement(ctx sdk.Context) (sdk.Coin, error)

GetMinBidIncrement returns the minimum bid increment for the auction.

func (Keeper) GetParams

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

GetParams returns the auction module's parameters.

func (Keeper) GetProposerFee

func (k Keeper) GetProposerFee(ctx sdk.Context) (math.LegacyDec, error)

GetProposerFee returns the proposer fee for the auction module.

func (Keeper) GetReserveFee

func (k Keeper) GetReserveFee(ctx sdk.Context) (sdk.Coin, error)

GetReserveFee returns the reserve fee of the auction module.

func (Keeper) InitGenesis

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

InitGenesis initializes the auction module's state from a given genesis state.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a auction module-specific logger.

func (Keeper) SetParams

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

SetParams sets the auction module's parameters.

func (Keeper) ValidateAuctionBid

func (k Keeper) ValidateAuctionBid(ctx sdk.Context, bidder sdk.AccAddress, bid, highestBid sdk.Coin) error

ValidateAuctionBid validates that the bidder has sufficient funds to participate in the auction and that the bid amount is sufficiently high enough.

func (Keeper) ValidateAuctionBundle

func (k Keeper) ValidateAuctionBundle(bidder sdk.AccAddress, bundleSigners []map[string]struct{}) error

ValidateAuctionBundle validates the ordering of the referenced transactions. Bundles are valid if

  1. all of the transactions are signed by the signer.
  2. some subset of contiguous transactions starting from the first tx are signed by the same signer, and all other tranasctions are signed by the bidder.

example:

  1. valid: [tx1, tx2, tx3] where tx1 is signed by the signer 1 and tx2 and tx3 are signed by the bidder.
  2. valid: [tx1, tx2, tx3, tx4] where tx1 - tx4 are signed by the bidder.
  3. invalid: [tx1, tx2, tx3] where tx1 and tx3 are signed by the bidder and tx2 is signed by some other signer. (possible sandwich attack)
  4. invalid: [tx1, tx2, tx3] where tx1 is signed by the bidder, and tx2 - tx3 are signed by some other signer. (possible front-running attack)

func (Keeper) ValidateBidInfo

func (k Keeper) ValidateBidInfo(ctx sdk.Context, highestBid sdk.Coin, bidInfo *types.BidInfo) error

ValidateBidInfo validates that the bid can be included in the auction.

func (Keeper) ValidateBundleTimeouts added in v1.1.0

func (k Keeper) ValidateBundleTimeouts(bidInfo *types.BidInfo) error

ValidateBundleTimeouts validates that the timeouts of the transactions in the bundle are valid. We consider the timeouts valid iff all of the bidders txs in the bundle are equal to the timeout of the bid. This is mandatory as otherwise other searchers can potentially include other searcher's transactions in their bundles.

type MsgServer

type MsgServer struct {
	Keeper
}

MsgServer is the wrapper for the auction module's msg service.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) *MsgServer

NewMsgServerImpl returns an implementation of the auction MsgServer interface.

func (MsgServer) AuctionBid

AuctionBid is a no-op function that emits an event for the auction bid. The bid is extracted in the antehandler.

func (MsgServer) UpdateParams

type QueryServer

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

QueryServer defines the auction module's gRPC querier service.

func NewQueryServer

func NewQueryServer(keeper Keeper) *QueryServer

NewQueryServer creates a new gRPC query server for the auction module.

func (QueryServer) Params

Params queries all parameters of the auction module.

Jump to

Keyboard shortcuts

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