only allow certain denoms for auctions

This commit is contained in:
2022-09-07 23:06:28 +00:00
parent 627308d809
commit c9f73980ae
3 changed files with 16 additions and 3 deletions

View File

@@ -24,6 +24,15 @@ func (k msgServer) NewAuction(goCtx context.Context, msg *types.MsgNewAuction) (
auctionLen := msg.LeaseEnd - uint64(ctx.BlockTime().Unix())
// check that submitted denom is allowed
for _, denom := range auctionconfig.AllowedAuctionDenoms {
if msg.Denom == denom {
goto found
}
}
return nil, fmt.Errorf("denom %s is not allowed; must be in %v", msg.Denom, auctionconfig.AllowedAuctionDenoms)
found:
if auctionLen < auctionconfig.MinLeasePeriod {
return nil, fmt.Errorf(
"Auction length %d is below min lease period of %d",