keeper

package
v0.0.0-...-ff1fc56 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModuleAccountInvariants

func ModuleAccountInvariants(k Keeper) sdk.Invariant

ModuleAccountInvariants checks that the module account's coins matches those stored in auctions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl creates a new server for handling gRPC queries.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all staking invariants

func ValidAuctionInvariant

func ValidAuctionInvariant(k Keeper) sdk.Invariant

ValidAuctionInvariant verifies that all auctions in the store are independently valid

func ValidIndexInvariant

func ValidIndexInvariant(k Keeper) sdk.Invariant

ValidIndexInvariant checks that all auctions in the store are also in the index and vice versa.

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramstore paramtypes.Subspace,
	bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper,
) Keeper

NewKeeper returns a new auction keeper.

func (Keeper) CloseAuction

func (k Keeper) CloseAuction(ctx sdk.Context, auctionID uint64) error

CloseAuction closes an auction and distributes funds to the highest bidder.

func (Keeper) CloseExpiredAuctions

func (k Keeper) CloseExpiredAuctions(ctx sdk.Context) error

CloseExpiredAuctions iterates over all the auctions stored by until the current block timestamp and that are past (or at) their ending times and closes them, paying out to the highest bidder.

func (Keeper) DeleteAuction

func (k Keeper) DeleteAuction(ctx sdk.Context, auctionID uint64)

DeleteAuction removes an auction from the store, and any indexes.

func (Keeper) GetAllAuctions

func (k Keeper) GetAllAuctions(ctx sdk.Context) (auctions []types.Auction)

GetAllAuctions returns all auctions from the store

func (Keeper) GetAuction

func (k Keeper) GetAuction(ctx sdk.Context, auctionID uint64) (types.Auction, bool)

GetAuction gets an auction from the store.

func (Keeper) GetNextAuctionID

func (k Keeper) GetNextAuctionID(ctx sdk.Context) (uint64, error)

GetNextAuctionID reads the next available global ID from store

func (Keeper) GetParams

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

func (Keeper) IncrementNextAuctionID

func (k Keeper) IncrementNextAuctionID(ctx sdk.Context) error

IncrementNextAuctionID increments the next auction ID in the store by 1.

func (Keeper) InsertIntoByTimeIndex

func (k Keeper) InsertIntoByTimeIndex(ctx sdk.Context, endTime time.Time, auctionID uint64)

InsertIntoByTimeIndex adds an auction ID and end time into the byTime index.

func (Keeper) IterateAuctions

func (k Keeper) IterateAuctions(ctx sdk.Context, cb func(auction types.Auction) (stop bool))

IterateAuctions provides an iterator over all stored auctions. For each auction, cb will be called. If cb returns true, the iterator will close and stop.

func (Keeper) IterateAuctionsByTime

func (k Keeper) IterateAuctionsByTime(ctx sdk.Context, inclusiveCutoffTime time.Time, cb func(auctionID uint64) (stop bool))

IterateAuctionByTime provides an iterator over auctions ordered by auction.EndTime. For each auction cb will be callled. If cb returns true the iterator will close and stop.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MarshalAuction

func (k Keeper) MarshalAuction(auctionI types.Auction) ([]byte, error)

MarshalAuction protobuf serializes an Auction interface

func (Keeper) MustMarshalAuction

func (k Keeper) MustMarshalAuction(auction types.Auction) []byte

MustMarshalAuction attempts to encode an Auction object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalAuction

func (k Keeper) MustUnmarshalAuction(bz []byte) types.Auction

MustUnmarshalAuction attempts to decode and return an Auction object from raw encoded bytes. It panics on error.

func (Keeper) PayoutCollateralAuction

func (k Keeper) PayoutCollateralAuction(ctx sdk.Context, auction *types.CollateralAuction) error

PayoutCollateralAuction pays out the proceeds for a collateral auction.

func (Keeper) PayoutDebtAuction

func (k Keeper) PayoutDebtAuction(ctx sdk.Context, auction *types.DebtAuction) error

PayoutDebtAuction pays out the proceeds for a debt auction, first minting the coins.

func (Keeper) PayoutSurplusAuction

func (k Keeper) PayoutSurplusAuction(ctx sdk.Context, auction *types.SurplusAuction) error

PayoutSurplusAuction pays out the proceeds for a surplus auction.

func (Keeper) PlaceBid

func (k Keeper) PlaceBid(ctx sdk.Context, auctionID uint64, bidder sdk.AccAddress, newAmount sdk.Coin) error

PlaceBid places a bid on any auction.

func (Keeper) PlaceBidDebt

func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction *types.DebtAuction, bidder sdk.AccAddress, lot sdk.Coin) (*types.DebtAuction, error)

PlaceBidDebt places a reverse bid on a debt auction, moving coins and returning the updated auction.

func (Keeper) PlaceBidSurplus

func (k Keeper) PlaceBidSurplus(ctx sdk.Context, auction *types.SurplusAuction, bidder sdk.AccAddress, bid sdk.Coin) (*types.SurplusAuction, error)

PlaceBidSurplus places a forward bid on a surplus auction, moving coins and returning the updated auction.

func (Keeper) PlaceForwardBidCollateral

func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.CollateralAuction, bidder sdk.AccAddress, bid sdk.Coin) (*types.CollateralAuction, error)

PlaceForwardBidCollateral places a forward bid on a collateral auction, moving coins and returning the updated auction.

func (Keeper) PlaceReverseBidCollateral

func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, auction *types.CollateralAuction, bidder sdk.AccAddress, lot sdk.Coin) (*types.CollateralAuction, error)

PlaceReverseBidCollateral places a reverse bid on a collateral auction, moving coins and returning the updated auction.

func (Keeper) SetAuction

func (k Keeper) SetAuction(ctx sdk.Context, auction types.Auction)

SetAuction puts the auction into the store, and updates any indexes.

func (Keeper) SetNextAuctionID

func (k Keeper) SetNextAuctionID(ctx sdk.Context, id uint64)

SetNextAuctionID stores an ID to be used for the next created auction

func (Keeper) SetParams

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

func (Keeper) StartCollateralAuction

func (k Keeper) StartCollateralAuction(
	ctx sdk.Context, seller string, lot, maxBid sdk.Coin,
	lotReturnAddrs []sdk.AccAddress, lotReturnWeights []sdk.Int, debt sdk.Coin,
) (uint64, error)

StartCollateralAuction starts a new collateral (2-phase) auction.

func (Keeper) StartDebtAuction

func (k Keeper) StartDebtAuction(ctx sdk.Context, buyer string, bid sdk.Coin, initialLot sdk.Coin, debt sdk.Coin) (uint64, error)

StartDebtAuction starts a new debt (reverse) auction.

func (Keeper) StartSurplusAuction

func (k Keeper) StartSurplusAuction(ctx sdk.Context, seller string, lot sdk.Coin, bidDenom string) (uint64, error)

StartSurplusAuction starts a new surplus (forward) auction.

func (Keeper) StoreNewAuction

func (k Keeper) StoreNewAuction(ctx sdk.Context, auction types.Auction) (uint64, error)

StoreNewAuction stores an auction, adding a new ID

func (Keeper) UnmarshalAuction

func (k Keeper) UnmarshalAuction(bz []byte) (types.Auction, error)

UnmarshalAuction returns an Auction interface from raw encoded auction bytes of a Proto-based Auction type

Jump to

Keyboard shortcuts

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