Documentation ¶
Index ¶
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServerImpl(k Keeper) types.QueryServer
- func PayingPoolReserveAmountInvariant(k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func SellingPoolReserveAmountInvariant(k Keeper) sdk.Invariant
- func VestingPoolReserveAmountInvariant(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) AddAllowedBidders(ctx context.Context, auctionID uint64, allowedBidders []types.AllowedBidder) error
- func (k Keeper) AddressCodec() address.Codec
- func (k Keeper) AfterBatchAuctionCreated(ctx context.Context, auctionID uint64, auctioneer string, ...) error
- func (k Keeper) AfterFixedPriceAuctionCreated(ctx context.Context, auctionID uint64, auctioneer string, ...) error
- func (k Keeper) AllocateSellingCoin(ctx context.Context, auction types.AuctionI, mInfo MatchingInfo) error
- func (k Keeper) AllowedBidders(ctx context.Context) ([]types.AllowedBidder, error)
- func (k Keeper) ApplyVestingSchedules(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) Auctions(ctx context.Context) ([]types.AuctionI, error)
- func (k Keeper) BeforeAllowedBidderUpdated(ctx context.Context, auctionID uint64, bidder sdk.AccAddress, ...) error
- func (k Keeper) BeforeAllowedBiddersAdded(ctx context.Context, allowedBidders []types.AllowedBidder) error
- func (k Keeper) BeforeAuctionCanceled(ctx context.Context, auctionID uint64, auctioneer string) error
- func (k Keeper) BeforeBatchAuctionCreated(ctx context.Context, auctioneer string, startPrice math.LegacyDec, ...) error
- func (k Keeper) BeforeBidModified(ctx context.Context, auctionID uint64, bidID uint64, bidder string, ...) error
- func (k Keeper) BeforeBidPlaced(ctx context.Context, auctionID uint64, bidID uint64, bidder string, ...) error
- func (k Keeper) BeforeFixedPriceAuctionCreated(ctx context.Context, auctioneer string, startPrice math.LegacyDec, ...) error
- func (k Keeper) BeforeSellingCoinsAllocated(ctx context.Context, auctionID uint64, allocationMap map[string]math.Int, ...) error
- func (k Keeper) BeginBlocker(ctx context.Context) error
- func (k Keeper) Bids(ctx context.Context) ([]types.Bid, error)
- func (k Keeper) CalculateBatchAllocation(ctx context.Context, auction types.AuctionI) (MatchingInfo, error)
- func (k Keeper) CalculateFixedPriceAllocation(ctx context.Context, auction types.AuctionI) (MatchingInfo, error)
- func (k Keeper) CancelAuction(ctx context.Context, msg *types.MsgCancelAuction) error
- func (k Keeper) CloseBatchAuction(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) CloseFixedPriceAuction(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) CreateBatchAuction(ctx context.Context, msg *types.MsgCreateBatchAuction) (types.AuctionI, error)
- func (k Keeper) CreateFixedPriceAuction(ctx context.Context, msg *types.MsgCreateFixedPriceAuction) (types.AuctionI, error)
- func (k Keeper) ExecuteStandByStatus(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) ExecuteStartedStatus(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) ExecuteVestingStatus(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) ExtendRound(ctx context.Context, ba *types.BatchAuction) error
- func (k Keeper) GetAllowedBidder(ctx context.Context, auctionID uint64, bidder sdk.AccAddress) (types.AllowedBidder, error)
- func (k Keeper) GetAllowedBiddersByAuction(ctx context.Context, auctionID uint64) ([]types.AllowedBidder, error)
- func (k Keeper) GetAuction(ctx context.Context, auctionID uint64) (types.AuctionI, error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBid(ctx context.Context, auctionID, bidID uint64) (types.Bid, error)
- func (k Keeper) GetBidsByAuctionID(ctx context.Context, auctionID uint64) ([]types.Bid, error)
- func (k Keeper) GetBidsByBidder(ctx context.Context, bidderAddr sdk.AccAddress) ([]types.Bid, error)
- func (k Keeper) GetLastMatchedBidsLen(ctx context.Context, auctionID uint64) (int64, error)
- func (k Keeper) GetNextBidIDWithUpdate(ctx context.Context, auctionID uint64) (uint64, error)
- func (k Keeper) GetVestingQueue(ctx context.Context, auctionID uint64, releaseTime time.Time) (types.VestingQueue, error)
- func (k Keeper) GetVestingQueuesByAuctionID(ctx context.Context, auctionID uint64) ([]types.VestingQueue, error)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) ModifyBid(ctx context.Context, msg *types.MsgModifyBid) error
- func (k Keeper) PayCreationFee(ctx context.Context, auctioneerAddr sdk.AccAddress) error
- func (k Keeper) PayPlaceBidFee(ctx context.Context, bidderAddr sdk.AccAddress) error
- func (k Keeper) PlaceBid(ctx context.Context, msg *types.MsgPlaceBid) (types.Bid, error)
- func (k Keeper) RefundPayingCoin(ctx context.Context, auction types.AuctionI, mInfo MatchingInfo) error
- func (k Keeper) RefundRemainingSellingCoin(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) ReleaseVestingPayingCoin(ctx context.Context, auction types.AuctionI) error
- func (k Keeper) ReservePayingCoin(ctx context.Context, auctionID uint64, bidderAddr sdk.AccAddress, ...) error
- func (k Keeper) ReserveSellingCoin(ctx context.Context, auctionID uint64, auctioneerAddr sdk.AccAddress, ...) error
- func (k *Keeper) SetHooks(fk types.FundraisingHooks) *Keeper
- func (k Keeper) SetMatchedBidsLen(ctx context.Context, auctionID uint64, matchedLen int64) error
- func (k Keeper) UpdateAllowedBidder(ctx context.Context, auctionID uint64, bidder sdk.AccAddress, ...) error
- func (k Keeper) ValidateBatchManyBid(ctx context.Context, auction types.AuctionI, bid types.Bid) error
- func (k Keeper) ValidateBatchWorthBid(ctx context.Context, auction types.AuctionI, bid types.Bid) error
- func (k Keeper) ValidateFixedPriceBid(ctx context.Context, auction types.AuctionI, bid types.Bid) error
- func (k Keeper) VestingQueues(ctx context.Context) ([]types.VestingQueue, error)
- type MatchingInfo
Constants ¶
This section is empty.
Variables ¶
var ( // EnableAddAllowedBidder indicates whether msgServer accepts MsgAddAllowedBidder or not. // Never set this to true in production environment. Doing that will expose serious attack vector. // Default is false, which means AddAllowedBidder can't be executed through message level. EnableAddAllowedBidder = false )
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the fundraising module.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) types.QueryServer
NewQueryServerImpl returns an implementation of the QueryServer interface for the provided Keeper.
func PayingPoolReserveAmountInvariant ¶
PayingPoolReserveAmountInvariant checks an invariant that the total bid amount must equal or greater than the paying reserve account balance.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all fundraising invariants.
func SellingPoolReserveAmountInvariant ¶
SellingPoolReserveAmountInvariant checks an invariant that the total amount of selling coin for an auction must equal or greater than the selling reserve account balance.
func VestingPoolReserveAmountInvariant ¶
VestingPoolReserveAmountInvariant checks an invariant that the total vesting amount must be equal or greater than the vesting reserve account balance.
Types ¶
type Keeper ¶
type Keeper struct { Schema collections.Schema Params collections.Item[types.Params] MatchedBidsLen collections.Map[uint64, int64] AllowedBidder collections.Map[collections.Pair[uint64, sdk.AccAddress], types.AllowedBidder] VestingQueue collections.Map[collections.Pair[uint64, time.Time], types.VestingQueue] BidSeq collections.Map[uint64, uint64] Bid collections.Map[collections.Pair[uint64, uint64], types.Bid] AuctionSeq collections.Sequence Auction collections.Map[uint64, types.AuctionI] // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, addressCodec address.Codec, storeService store.KVStoreService, logger log.Logger, authority string, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, distrKeeper types.DistrKeeper, ) Keeper
func (Keeper) AddAllowedBidders ¶
func (k Keeper) AddAllowedBidders(ctx context.Context, auctionID uint64, allowedBidders []types.AllowedBidder) error
AddAllowedBidders is a function that is implemented for an external module. An external module uses this function to add allowed bidders in the auction's allowed bidders list. It doesn't look up the bidder's previous maximum bid amount. Instead, it overlaps. It doesn't have any auctioneer's verification logic because the module is fundamentally designed to delegate full authorization to an external module. It is up to an external module to freely add necessary verification and operations depending on their use cases.
func (Keeper) AddressCodec ¶
AddressCodec returns the address codec.
func (Keeper) AfterBatchAuctionCreated ¶
func (k Keeper) AfterBatchAuctionCreated( ctx context.Context, auctionID uint64, auctioneer string, startPrice math.LegacyDec, minBidPrice math.LegacyDec, sellingCoin sdk.Coin, payingCoinDenom string, vestingSchedules []types.VestingSchedule, maxExtendedRound uint32, extendedRoundRate math.LegacyDec, startTime time.Time, endTime time.Time, ) error
AfterBatchAuctionCreated - call hook if registered
func (Keeper) AfterFixedPriceAuctionCreated ¶
func (k Keeper) AfterFixedPriceAuctionCreated( ctx context.Context, auctionID uint64, auctioneer string, startPrice math.LegacyDec, sellingCoin sdk.Coin, payingCoinDenom string, vestingSchedules []types.VestingSchedule, startTime time.Time, endTime time.Time, ) error
AfterFixedPriceAuctionCreated - call hook if registered
func (Keeper) AllocateSellingCoin ¶
func (k Keeper) AllocateSellingCoin(ctx context.Context, auction types.AuctionI, mInfo MatchingInfo) error
AllocateSellingCoin allocates allocated selling coin for all matched bids in MatchingInfo and releases them from the selling reserve account.
func (Keeper) AllowedBidders ¶
AllowedBidders returns all AllowedBidder.
func (Keeper) ApplyVestingSchedules ¶
ApplyVestingSchedules stores vesting queues based on the vesting schedules of the auction and sets status to vesting.
func (Keeper) BeforeAllowedBidderUpdated ¶
func (k Keeper) BeforeAllowedBidderUpdated( ctx context.Context, auctionID uint64, bidder sdk.AccAddress, maxBidAmount math.Int, ) error
BeforeAllowedBidderUpdated - call hook if registered
func (Keeper) BeforeAllowedBiddersAdded ¶
func (k Keeper) BeforeAllowedBiddersAdded( ctx context.Context, allowedBidders []types.AllowedBidder, ) error
BeforeAllowedBiddersAdded - call hook if registered
func (Keeper) BeforeAuctionCanceled ¶
func (k Keeper) BeforeAuctionCanceled( ctx context.Context, auctionID uint64, auctioneer string, ) error
BeforeAuctionCanceled - call hook if registered
func (Keeper) BeforeBatchAuctionCreated ¶
func (k Keeper) BeforeBatchAuctionCreated( ctx context.Context, auctioneer string, startPrice math.LegacyDec, minBidPrice math.LegacyDec, sellingCoin sdk.Coin, payingCoinDenom string, vestingSchedules []types.VestingSchedule, maxExtendedRound uint32, extendedRoundRate math.LegacyDec, startTime time.Time, endTime time.Time, ) error
BeforeBatchAuctionCreated - call hook if registered
func (Keeper) BeforeBidModified ¶
func (k Keeper) BeforeBidModified( ctx context.Context, auctionID uint64, bidID uint64, bidder string, bidType types.BidType, price math.LegacyDec, coin sdk.Coin, ) error
BeforeBidModified - call hook if registered
func (Keeper) BeforeBidPlaced ¶
func (k Keeper) BeforeBidPlaced( ctx context.Context, auctionID uint64, bidID uint64, bidder string, bidType types.BidType, price math.LegacyDec, coin sdk.Coin, ) error
BeforeBidPlaced - call hook if registered
func (Keeper) BeforeFixedPriceAuctionCreated ¶
func (k Keeper) BeforeFixedPriceAuctionCreated( ctx context.Context, auctioneer string, startPrice math.LegacyDec, sellingCoin sdk.Coin, payingCoinDenom string, vestingSchedules []types.VestingSchedule, startTime time.Time, endTime time.Time, ) error
BeforeFixedPriceAuctionCreated - call hook if registered
func (Keeper) BeforeSellingCoinsAllocated ¶
func (k Keeper) BeforeSellingCoinsAllocated( ctx context.Context, auctionID uint64, allocationMap map[string]math.Int, refundMap map[string]math.Int, ) error
BeforeSellingCoinsAllocated - call hook if registered
func (Keeper) CalculateBatchAllocation ¶
func (Keeper) CalculateFixedPriceAllocation ¶
func (k Keeper) CalculateFixedPriceAllocation(ctx context.Context, auction types.AuctionI) (MatchingInfo, error)
CalculateFixedPriceAllocation loops through all bids for the auction and calculate matching information.
func (Keeper) CancelAuction ¶
CancelAuction handles types.MsgCancelAuction and cancels the auction. An auction can only be canceled when it is not started yet.
func (Keeper) CloseBatchAuction ¶
CloseBatchAuction closes a batch auction.
func (Keeper) CloseFixedPriceAuction ¶
CloseFixedPriceAuction closes a fixed price auction.
func (Keeper) CreateBatchAuction ¶
func (k Keeper) CreateBatchAuction(ctx context.Context, msg *types.MsgCreateBatchAuction) (types.AuctionI, error)
CreateBatchAuction handles types.MsgCreateBatchAuction and create a batch auction. Note that the module is designed to delegate authorization to an external module to add allowed bidders for the auction.
func (Keeper) CreateFixedPriceAuction ¶
func (k Keeper) CreateFixedPriceAuction(ctx context.Context, msg *types.MsgCreateFixedPriceAuction) (types.AuctionI, error)
CreateFixedPriceAuction handles types.MsgCreateFixedPriceAuction and create a fixed price auction. Note that the module is designed to delegate authorization to an external module to add allowed bidders for the auction.
func (Keeper) ExecuteStandByStatus ¶
ExecuteStandByStatus simply updates the auction status to AuctionStatusStarted if the auction is ready to get started.
func (Keeper) ExecuteStartedStatus ¶
ExecuteStartedStatus executes operations depending on the auction type.
func (Keeper) ExecuteVestingStatus ¶
ExecuteVestingStatus first gets all vesting queues in the store and look up the release time of each vesting queue to see if the module needs to distribute the paying coin to the auctioneer.
func (Keeper) ExtendRound ¶
ExtendRound extends another round of ExtendedPeriod value for the auction.
func (Keeper) GetAllowedBidder ¶
func (k Keeper) GetAllowedBidder(ctx context.Context, auctionID uint64, bidder sdk.AccAddress) (types.AllowedBidder, error)
GetAllowedBidder returns AllowedBidder by auction ID and bidder address.
func (Keeper) GetAllowedBiddersByAuction ¶
func (k Keeper) GetAllowedBiddersByAuction(ctx context.Context, auctionID uint64) ([]types.AllowedBidder, error)
GetAllowedBiddersByAuction returns allowed bidders list for the auction.
func (Keeper) GetAuction ¶
GetAuction returns Auction interface by auction ID.
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetBidsByAuctionID ¶
GetBidsByAuctionID returns all bids associated with the auction id that are registered in the store.
func (Keeper) GetBidsByBidder ¶
func (k Keeper) GetBidsByBidder(ctx context.Context, bidderAddr sdk.AccAddress) ([]types.Bid, error)
GetBidsByBidder returns all bids associated with the bidder that are registered in the store.
func (Keeper) GetLastMatchedBidsLen ¶
func (Keeper) GetNextBidIDWithUpdate ¶
GetNextBidIDWithUpdate increments bid id by one and set it.
func (Keeper) GetVestingQueue ¶
func (k Keeper) GetVestingQueue(ctx context.Context, auctionID uint64, releaseTime time.Time) (types.VestingQueue, error)
GetVestingQueue returns VestingQueue by auction ID and release time.
func (Keeper) GetVestingQueuesByAuctionID ¶
func (k Keeper) GetVestingQueuesByAuctionID(ctx context.Context, auctionID uint64) ([]types.VestingQueue, error)
GetVestingQueuesByAuctionID returns all vesting queues associated with the auction id that are registered in the store.
func (Keeper) ModifyBid ¶
ModifyBid handles types.MsgModifyBid and stores the modified bid. A bidder must provide either greater bid price or coin amount. They are not permitted to modify with less bid price or coin amount.
func (Keeper) PayCreationFee ¶
PayCreationFee sends the auction creation fee to the fee collector account.
func (Keeper) PayPlaceBidFee ¶
PayPlaceBidFee sends the fee when placing a bid for an auction to the fee collector account.
func (Keeper) RefundPayingCoin ¶
func (k Keeper) RefundPayingCoin(ctx context.Context, auction types.AuctionI, mInfo MatchingInfo) error
RefundPayingCoin refunds paying coin to the corresponding bidders.
func (Keeper) RefundRemainingSellingCoin ¶
RefundRemainingSellingCoin refunds the remaining selling coin to the auctioneer.
func (Keeper) ReleaseVestingPayingCoin ¶
ReleaseVestingPayingCoin releases the vested selling coin to the auctioneer from the vesting reserve account.
func (Keeper) ReservePayingCoin ¶
func (k Keeper) ReservePayingCoin(ctx context.Context, auctionID uint64, bidderAddr sdk.AccAddress, payingCoin sdk.Coin) error
ReservePayingCoin reserves paying coin to the paying reserve account.
func (Keeper) ReserveSellingCoin ¶
func (k Keeper) ReserveSellingCoin(ctx context.Context, auctionID uint64, auctioneerAddr sdk.AccAddress, sellingCoin sdk.Coin) error
ReserveSellingCoin reserves the selling coin to the selling reserve account.
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(fk types.FundraisingHooks) *Keeper
SetHooks sets the fundraising hooks.
func (Keeper) SetMatchedBidsLen ¶
func (Keeper) UpdateAllowedBidder ¶
func (k Keeper) UpdateAllowedBidder(ctx context.Context, auctionID uint64, bidder sdk.AccAddress, maxBidAmount math.Int) error
UpdateAllowedBidder is a function that is implemented for an external module. An external module uses this function to update maximum bid amount of particular allowed bidder in the auction. It doesn't have any auctioneer's verification logic because the module is fundamentally designed to delegate full authorization to an external module. It is up to an external module to freely add necessary verification and operations depending on their use cases.
func (Keeper) ValidateBatchManyBid ¶
func (k Keeper) ValidateBatchManyBid(ctx context.Context, auction types.AuctionI, bid types.Bid) error
ValidateBatchManyBid validates a batch many bid type.
func (Keeper) ValidateBatchWorthBid ¶
func (k Keeper) ValidateBatchWorthBid(ctx context.Context, auction types.AuctionI, bid types.Bid) error
ValidateBatchWorthBid validates a batch worth bid type.
func (Keeper) ValidateFixedPriceBid ¶
func (k Keeper) ValidateFixedPriceBid(ctx context.Context, auction types.AuctionI, bid types.Bid) error
ValidateFixedPriceBid validates a fixed price bid type.
func (Keeper) VestingQueues ¶
VestingQueues returns all VestingQueue.
type MatchingInfo ¶
type MatchingInfo struct { MatchedLen int64 // the length of matched bids MatchedPrice math.LegacyDec // the final matched price TotalMatchedAmount math.Int // the total sold amount AllocationMap map[string]math.Int // the map that holds allocate amount information for each bidder ReservedMatchedMap map[string]math.Int // the map that holds each bidder's matched amount out of their total reserved amount RefundMap map[string]math.Int // the map that holds refund amount information for each bidder }
MatchingInfo holds information about an auction matching information.