mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-04 20:34:26 -08:00
only allow certain denoms for auctions
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package auctionconfig
|
||||
|
||||
// Allowed Denoms
|
||||
// note: as a slice, values can't be immutable, but length can be
|
||||
var AllowedAuctionDenoms = [...]string{"uusdc", "uclr"}
|
||||
|
||||
const (
|
||||
// Times
|
||||
AuctionTime = 10 // 10 blocks = ~10-30 seconds
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user