refactor: remove min-buy-in param (#135)

Co-authored-by: David Terpay <35130517+davidterpay@users.noreply.github.com>
This commit is contained in:
Aleksandr Bezobchuk
2023-05-15 15:43:03 +00:00
committed by GitHub
co-authored by David Terpay
parent 1de8de75c1
commit 7db24f2c29
14 changed files with 55 additions and 174 deletions
+3 -10
View File
@@ -75,17 +75,10 @@ func (k Keeper) ValidateAuctionBid(ctx sdk.Context, bidder sdk.AccAddress, bid,
}
}
// Get the pay-to-play fee.
minBuyInFee, err := k.GetMinBuyInFee(ctx)
if err != nil {
return err
}
// Ensure the bidder has enough funds to cover all the inclusion fees.
minBalance := bid.Add(minBuyInFee)
// ensure the bidder has enough funds to cover all the inclusion fees
balances := k.bankKeeper.GetAllBalances(ctx, bidder)
if !balances.IsAllGTE(sdk.NewCoins(minBalance)) {
return fmt.Errorf("insufficient funds to bid %s (reserve fee + bid) with balance %s", minBalance, balances)
if !balances.IsAllGTE(sdk.NewCoins(bid)) {
return fmt.Errorf("insufficient funds to bid %s with balance %s", bid, balances)
}
return nil
-10
View File
@@ -21,7 +21,6 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
// Auction params
maxBundleSize uint32 = 10
reserveFee = sdk.NewCoin("foo", sdk.NewInt(1000))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(1000))
minBidIncrement = sdk.NewCoin("foo", sdk.NewInt(1000))
escrowAddress = sdk.AccAddress([]byte("escrow"))
frontRunningProtection = true
@@ -53,14 +52,6 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
},
false,
},
{
"bid amount equals the balance (not accounting for the reserve fee)",
func() {
balance = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(2000)))
bid = sdk.NewCoin("foo", sdk.NewInt(2000))
},
false,
},
{
"too many transactions in the bundle",
func() {
@@ -174,7 +165,6 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
params := buildertypes.Params{
MaxBundleSize: maxBundleSize,
ReserveFee: reserveFee,
MinBuyInFee: minBuyInFee,
EscrowAccountAddress: escrowAddress.String(),
FrontRunningProtection: frontRunningProtection,
MinBidIncrement: minBidIncrement,
-10
View File
@@ -131,16 +131,6 @@ func (k Keeper) GetReserveFee(ctx sdk.Context) (sdk.Coin, error) {
return params.ReserveFee, nil
}
// GetMinBuyInFee returns the fee that the bidder must pay to enter the builder.
func (k Keeper) GetMinBuyInFee(ctx sdk.Context) (sdk.Coin, error) {
params, err := k.GetParams(ctx)
if err != nil {
return sdk.Coin{}, err
}
return params.MinBuyInFee, nil
}
// GetMinBidIncrement returns the minimum bid increment for the builder.
func (k Keeper) GetMinBidIncrement(ctx sdk.Context) (sdk.Coin, error) {
params, err := k.GetParams(ctx)
-1
View File
@@ -164,7 +164,6 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() {
ProposerFee: sdk.MustNewDecFromStr("0.1"),
MaxBundleSize: 2,
EscrowAccountAddress: suite.authorityAccount.String(),
MinBuyInFee: sdk.NewInt64Coin("foo", 100),
MinBidIncrement: sdk.NewInt64Coin("foo", 100),
ReserveFee: sdk.NewInt64Coin("foo", 100),
},