mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
Split existing auction bid_duration
parameter into forward_bid_duration
and reverse_bid_duration
(#1158)
* Split bid_duration field into forward/reverse durations * Update params.go * Update params_test for forward/reverse bid durations * Remove duplicated import * Replace bid duration on place bids * Fix reversed bid errors * Update auctions test * Update bidding test * Update testutil suite to use default forward/reverse bid durations * Fix missing ReverseBidDuration param field * Check if auction is reversed on forward bid * Add test for conversion to reverse auction that reaches maxbid * Make proto fields backwards compatible * Use ForwardBidDuration for debt bid * Make copy of v16 auction types this doesn't actually work but keeping it in history * Disable migrations * Update debt tests to use forward bid duration
This commit is contained in:
parent
b3879f2633
commit
e526fd1639
@ -17,7 +17,6 @@ import (
|
|||||||
|
|
||||||
"github.com/kava-labs/kava/app"
|
"github.com/kava-labs/kava/app"
|
||||||
"github.com/kava-labs/kava/app/params"
|
"github.com/kava-labs/kava/app/params"
|
||||||
"github.com/kava-labs/kava/migrate"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewRootCmd creates a new root command for the kava blockchain.
|
// NewRootCmd creates a new root command for the kava blockchain.
|
||||||
@ -71,8 +70,8 @@ func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, de
|
|||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
genutilcli.InitCmd(app.ModuleBasics, defaultNodeHome),
|
genutilcli.InitCmd(app.ModuleBasics, defaultNodeHome),
|
||||||
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome),
|
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome),
|
||||||
migrate.MigrateGenesisCmd(),
|
// migrate.MigrateGenesisCmd(),
|
||||||
migrate.AssertInvariantsCmd(encodingConfig),
|
// migrate.AssertInvariantsCmd(encodingConfig),
|
||||||
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome),
|
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome),
|
||||||
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
|
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
|
||||||
simdcmd.AddGenesisAccountCmd(defaultNodeHome), // TODO use kava version with vesting accounts
|
simdcmd.AddGenesisAccountCmd(defaultNodeHome), // TODO use kava version with vesting accounts
|
||||||
|
@ -537,7 +537,8 @@ Params defines the parameters for the issuance module.
|
|||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
| ----- | ---- | ----- | ----------- |
|
| ----- | ---- | ----- | ----------- |
|
||||||
| `max_auction_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | |
|
| `max_auction_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | |
|
||||||
| `bid_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | |
|
| `forward_bid_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | |
|
||||||
|
| `reverse_bid_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | |
|
||||||
| `increment_surplus` | [bytes](#bytes) | | |
|
| `increment_surplus` | [bytes](#bytes) | | |
|
||||||
| `increment_debt` | [bytes](#bytes) | | |
|
| `increment_debt` | [bytes](#bytes) | | |
|
||||||
| `increment_collateral` | [bytes](#bytes) | | |
|
| `increment_collateral` | [bytes](#bytes) | | |
|
||||||
|
0
migrate/go.mod
Normal file
0
migrate/go.mod
Normal file
@ -25,7 +25,8 @@ message Params {
|
|||||||
|
|
||||||
google.protobuf.Duration max_auction_duration = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
|
google.protobuf.Duration max_auction_duration = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
|
||||||
|
|
||||||
google.protobuf.Duration bid_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
|
google.protobuf.Duration forward_bid_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
|
||||||
|
google.protobuf.Duration reverse_bid_duration = 6 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
|
||||||
|
|
||||||
bytes increment_surplus = 3
|
bytes increment_surplus = 3
|
||||||
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
|
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
|
||||||
|
@ -37,7 +37,7 @@ func (suite *abciTestSuite) TestKeeper_BeginBlocker() {
|
|||||||
suite.Require().NoError(suite.Keeper.PlaceBid(suite.Ctx, auctionID, buyer, c("token2", 30)))
|
suite.Require().NoError(suite.Keeper.PlaceBid(suite.Ctx, auctionID, buyer, c("token2", 30)))
|
||||||
|
|
||||||
// Run the beginblocker, simulating a block time 1ns before auction expiry
|
// Run the beginblocker, simulating a block time 1ns before auction expiry
|
||||||
preExpiryTime := suite.Ctx.BlockTime().Add(types.DefaultBidDuration - 1)
|
preExpiryTime := suite.Ctx.BlockTime().Add(types.DefaultForwardBidDuration - 1)
|
||||||
auction.BeginBlocker(suite.Ctx.WithBlockTime(preExpiryTime), suite.Keeper)
|
auction.BeginBlocker(suite.Ctx.WithBlockTime(preExpiryTime), suite.Keeper)
|
||||||
|
|
||||||
// Check auction has not been closed yet
|
// Check auction has not been closed yet
|
||||||
@ -45,7 +45,7 @@ func (suite *abciTestSuite) TestKeeper_BeginBlocker() {
|
|||||||
suite.True(found)
|
suite.True(found)
|
||||||
|
|
||||||
// Run the endblocker, simulating a block time equal to auction expiry
|
// Run the endblocker, simulating a block time equal to auction expiry
|
||||||
expiryTime := suite.Ctx.BlockTime().Add(types.DefaultBidDuration)
|
expiryTime := suite.Ctx.BlockTime().Add(types.DefaultForwardBidDuration)
|
||||||
auction.BeginBlocker(suite.Ctx.WithBlockTime(expiryTime), suite.Keeper)
|
auction.BeginBlocker(suite.Ctx.WithBlockTime(expiryTime), suite.Keeper)
|
||||||
|
|
||||||
// Check auction has been closed
|
// Check auction has been closed
|
||||||
|
@ -219,7 +219,7 @@ func (k Keeper) PlaceBidSurplus(ctx sdk.Context, auction *types.SurplusAuction,
|
|||||||
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
||||||
auction.HasReceivedBids = true
|
auction.HasReceivedBids = true
|
||||||
}
|
}
|
||||||
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).ForwardBidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
||||||
|
|
||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
@ -241,7 +241,7 @@ func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.Collat
|
|||||||
return auction, sdkerrors.Wrapf(types.ErrInvalidBidDenom, "%s ≠ %s", bid.Denom, auction.Bid.Denom)
|
return auction, sdkerrors.Wrapf(types.ErrInvalidBidDenom, "%s ≠ %s", bid.Denom, auction.Bid.Denom)
|
||||||
}
|
}
|
||||||
if auction.IsReversePhase() {
|
if auction.IsReversePhase() {
|
||||||
panic("cannot place forward bid on auction in reverse phase")
|
panic("cannot place reverse bid on auction in forward phase")
|
||||||
}
|
}
|
||||||
minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost
|
minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost
|
||||||
sdk.MaxInt(
|
sdk.MaxInt(
|
||||||
@ -295,7 +295,13 @@ func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.Collat
|
|||||||
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
||||||
auction.HasReceivedBids = true
|
auction.HasReceivedBids = true
|
||||||
}
|
}
|
||||||
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
|
||||||
|
// If this forward bid converts this to a reverse, increase timeout with ReverseBidDuration
|
||||||
|
if auction.IsReversePhase() {
|
||||||
|
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).ReverseBidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
||||||
|
} else {
|
||||||
|
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).ForwardBidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
||||||
|
}
|
||||||
|
|
||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
@ -317,7 +323,7 @@ func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, auction *types.Collat
|
|||||||
return auction, sdkerrors.Wrapf(types.ErrInvalidLotDenom, "%s ≠ %s", lot.Denom, auction.Lot.Denom)
|
return auction, sdkerrors.Wrapf(types.ErrInvalidLotDenom, "%s ≠ %s", lot.Denom, auction.Lot.Denom)
|
||||||
}
|
}
|
||||||
if !auction.IsReversePhase() {
|
if !auction.IsReversePhase() {
|
||||||
panic("cannot place reverse bid on auction in forward phase")
|
panic("cannot place forward bid on auction in reverse phase")
|
||||||
}
|
}
|
||||||
maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost
|
maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost
|
||||||
sdk.MaxInt(
|
sdk.MaxInt(
|
||||||
@ -369,7 +375,7 @@ func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, auction *types.Collat
|
|||||||
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
||||||
auction.HasReceivedBids = true
|
auction.HasReceivedBids = true
|
||||||
}
|
}
|
||||||
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).ReverseBidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
||||||
|
|
||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
@ -443,7 +449,7 @@ func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction *types.DebtAuction, bidder
|
|||||||
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
auction.MaxEndTime = ctx.BlockTime().Add(k.GetParams(ctx).MaxAuctionDuration) // set maximum ending time on receipt of first bid
|
||||||
auction.HasReceivedBids = true
|
auction.HasReceivedBids = true
|
||||||
}
|
}
|
||||||
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).BidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
auction.EndTime = earliestTime(ctx.BlockTime().Add(k.GetParams(ctx).ForwardBidDuration), auction.MaxEndTime) // increment timeout, up to MaxEndTime
|
||||||
|
|
||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
|
@ -51,7 +51,7 @@ func (suite *auctionTestSuite) TestSurplusAuctionBasic() {
|
|||||||
suite.NoError(err)
|
suite.NoError(err)
|
||||||
|
|
||||||
// Close auction just at auction expiry time
|
// Close auction just at auction expiry time
|
||||||
suite.Ctx = suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultBidDuration))
|
suite.Ctx = suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultForwardBidDuration))
|
||||||
suite.NoError(suite.Keeper.CloseAuction(suite.Ctx, auctionID))
|
suite.NoError(suite.Keeper.CloseAuction(suite.Ctx, auctionID))
|
||||||
// Check buyer's coins increased
|
// Check buyer's coins increased
|
||||||
suite.CheckAccountBalanceEqual(buyer, cs(c("token1", 120), c("token2", 80)))
|
suite.CheckAccountBalanceEqual(buyer, cs(c("token1", 120), c("token2", 80)))
|
||||||
@ -77,7 +77,7 @@ func (suite *auctionTestSuite) TestDebtAuctionBasic() {
|
|||||||
suite.CheckAccountBalanceEqual(suite.ModAcc.GetAddress(), cs(c("token1", 20), c("debt", 100)))
|
suite.CheckAccountBalanceEqual(suite.ModAcc.GetAddress(), cs(c("token1", 20), c("debt", 100)))
|
||||||
|
|
||||||
// Close auction at just after auction expiry
|
// Close auction at just after auction expiry
|
||||||
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultBidDuration))
|
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultForwardBidDuration))
|
||||||
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
||||||
// Check seller's coins increased
|
// Check seller's coins increased
|
||||||
suite.CheckAccountBalanceEqual(seller, cs(c("token1", 80), c("token2", 110)))
|
suite.CheckAccountBalanceEqual(seller, cs(c("token1", 80), c("token2", 110)))
|
||||||
@ -103,7 +103,7 @@ func (suite *auctionTestSuite) TestDebtAuctionDebtRemaining() {
|
|||||||
suite.CheckAccountBalanceEqual(buyerAddr, cs(c("token1", 10), c("debt", 90)))
|
suite.CheckAccountBalanceEqual(buyerAddr, cs(c("token1", 10), c("debt", 90)))
|
||||||
|
|
||||||
// Close auction at just after auction expiry
|
// Close auction at just after auction expiry
|
||||||
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultBidDuration))
|
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultForwardBidDuration))
|
||||||
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
||||||
// Check seller's coins increased
|
// Check seller's coins increased
|
||||||
suite.CheckAccountBalanceEqual(seller, cs(c("token1", 90), c("token2", 110)))
|
suite.CheckAccountBalanceEqual(seller, cs(c("token1", 90), c("token2", 110)))
|
||||||
@ -150,7 +150,7 @@ func (suite *auctionTestSuite) TestCollateralAuctionBasic() {
|
|||||||
suite.CheckAccountBalanceEqual(suite.Addrs[3], cs(c("token1", 101), c("token2", 100)))
|
suite.CheckAccountBalanceEqual(suite.Addrs[3], cs(c("token1", 101), c("token2", 100)))
|
||||||
|
|
||||||
// Close auction at just after auction expiry
|
// Close auction at just after auction expiry
|
||||||
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultBidDuration))
|
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultReverseBidDuration))
|
||||||
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
||||||
// Check buyer's coins increased
|
// Check buyer's coins increased
|
||||||
suite.CheckAccountBalanceEqual(buyer, cs(c("token1", 115), c("token2", 50)))
|
suite.CheckAccountBalanceEqual(buyer, cs(c("token1", 115), c("token2", 50)))
|
||||||
@ -181,7 +181,7 @@ func (suite *auctionTestSuite) TestCollateralAuctionDebtRemaining() {
|
|||||||
for _, ra := range suite.Addrs[1:] {
|
for _, ra := range suite.Addrs[1:] {
|
||||||
suite.CheckAccountBalanceEqual(ra, cs(c("token1", 100), c("token2", 100)))
|
suite.CheckAccountBalanceEqual(ra, cs(c("token1", 100), c("token2", 100)))
|
||||||
}
|
}
|
||||||
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultBidDuration))
|
ctx := suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(types.DefaultForwardBidDuration))
|
||||||
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
suite.NoError(suite.Keeper.CloseAuction(ctx, auctionID))
|
||||||
|
|
||||||
// check that buyers coins have increased
|
// check that buyers coins have increased
|
||||||
|
@ -73,7 +73,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
bidArgs{buyer, c("token2", 10)},
|
bidArgs{buyer, c("token2", 10)},
|
||||||
types.ErrAuctionNotFound,
|
types.ErrAuctionNotFound,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 10),
|
c("token2", 10),
|
||||||
false,
|
false,
|
||||||
@ -98,7 +98,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
bidArgs{buyer, c("token2", 10)},
|
bidArgs{buyer, c("token2", 10)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 10),
|
c("token2", 10),
|
||||||
true,
|
true,
|
||||||
@ -110,7 +110,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 10)}},
|
[]bidArgs{{buyer, c("token2", 10)}},
|
||||||
bidArgs{secondBuyer, c("token2", 11)},
|
bidArgs{secondBuyer, c("token2", 11)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
secondBuyer,
|
secondBuyer,
|
||||||
c("token2", 11),
|
c("token2", 11),
|
||||||
true,
|
true,
|
||||||
@ -134,7 +134,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 100)}},
|
[]bidArgs{{buyer, c("token2", 100)}},
|
||||||
bidArgs{buyer, c("token2", 99)},
|
bidArgs{buyer, c("token2", 99)},
|
||||||
types.ErrBidTooSmall,
|
types.ErrBidTooSmall,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 100),
|
c("token2", 100),
|
||||||
false,
|
false,
|
||||||
@ -158,7 +158,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 100)}},
|
[]bidArgs{{buyer, c("token2", 100)}},
|
||||||
bidArgs{buyer, c("token2", 104)}, // min bid is 105 at default 5%
|
bidArgs{buyer, c("token2", 104)}, // min bid is 105 at default 5%
|
||||||
types.ErrBidTooSmall,
|
types.ErrBidTooSmall,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 100),
|
c("token2", 100),
|
||||||
false,
|
false,
|
||||||
@ -170,7 +170,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
bidArgs{buyer, c("token1", 10)},
|
bidArgs{buyer, c("token1", 10)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 100),
|
c("token2", 100),
|
||||||
true,
|
true,
|
||||||
@ -182,7 +182,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token1", 10)}},
|
[]bidArgs{{buyer, c("token1", 10)}},
|
||||||
bidArgs{secondBuyer, c("token1", 9)},
|
bidArgs{secondBuyer, c("token1", 9)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
secondBuyer,
|
secondBuyer,
|
||||||
c("token2", 100),
|
c("token2", 100),
|
||||||
true,
|
true,
|
||||||
@ -241,7 +241,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
bidArgs{buyer, c("token2", 10)},
|
bidArgs{buyer, c("token2", 10)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 10),
|
c("token2", 10),
|
||||||
true,
|
true,
|
||||||
@ -253,12 +253,24 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 10)}},
|
[]bidArgs{{buyer, c("token2", 10)}},
|
||||||
bidArgs{secondBuyer, c("token2", 11)},
|
bidArgs{secondBuyer, c("token2", 11)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
secondBuyer,
|
secondBuyer,
|
||||||
c("token2", 11),
|
c("token2", 11),
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"collateral [forward]: convert to reverse (reach maxBid)",
|
||||||
|
auctionArgs{Collateral, modName, c("token1", 20), c("token2", 100), c("debt", 50), collateralAddrs, collateralWeights}, // lot, max bid
|
||||||
|
[]bidArgs{{buyer, c("token2", 10)}},
|
||||||
|
bidArgs{secondBuyer, c("token2", 100)},
|
||||||
|
nil,
|
||||||
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
|
secondBuyer,
|
||||||
|
c("token2", 100),
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"collateral [forward]: invalid bid denom",
|
"collateral [forward]: invalid bid denom",
|
||||||
auctionArgs{Collateral, modName, c("token1", 20), c("token2", 100), c("debt", 50), collateralAddrs, collateralWeights}, // lot, max bid
|
auctionArgs{Collateral, modName, c("token1", 20), c("token2", 100), c("debt", 50), collateralAddrs, collateralWeights}, // lot, max bid
|
||||||
@ -277,7 +289,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 10)}},
|
[]bidArgs{{buyer, c("token2", 10)}},
|
||||||
bidArgs{buyer, c("token2", 9)},
|
bidArgs{buyer, c("token2", 9)},
|
||||||
types.ErrBidTooSmall,
|
types.ErrBidTooSmall,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 10),
|
c("token2", 10),
|
||||||
false,
|
false,
|
||||||
@ -301,7 +313,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}},
|
[]bidArgs{{buyer, c("token2", 50)}},
|
||||||
bidArgs{buyer, c("token2", 51)},
|
bidArgs{buyer, c("token2", 51)},
|
||||||
types.ErrBidTooSmall,
|
types.ErrBidTooSmall,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultForwardBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
false,
|
false,
|
||||||
@ -313,7 +325,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 99)}},
|
[]bidArgs{{buyer, c("token2", 99)}},
|
||||||
bidArgs{buyer, c("token2", 100)}, // min bid at default 5% is 104
|
bidArgs{buyer, c("token2", 100)}, // min bid at default 5% is 104
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration), // Converts to a reverse bid when max reached
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 100),
|
c("token2", 100),
|
||||||
true,
|
true,
|
||||||
@ -349,7 +361,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
||||||
bidArgs{buyer, c("token1", 15)},
|
bidArgs{buyer, c("token1", 15)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
true,
|
true,
|
||||||
@ -361,7 +373,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}, {buyer, c("token1", 15)}}, // put auction into reverse phase, and add a reverse phase bid
|
[]bidArgs{{buyer, c("token2", 50)}, {buyer, c("token1", 15)}}, // put auction into reverse phase, and add a reverse phase bid
|
||||||
bidArgs{secondBuyer, c("token1", 14)},
|
bidArgs{secondBuyer, c("token1", 14)},
|
||||||
nil,
|
nil,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
secondBuyer,
|
secondBuyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
true,
|
true,
|
||||||
@ -373,7 +385,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
||||||
bidArgs{buyer, c("badtoken", 15)},
|
bidArgs{buyer, c("badtoken", 15)},
|
||||||
types.ErrInvalidLotDenom,
|
types.ErrInvalidLotDenom,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
false,
|
false,
|
||||||
@ -385,7 +397,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
||||||
bidArgs{buyer, c("token1", 21)},
|
bidArgs{buyer, c("token1", 21)},
|
||||||
types.ErrLotTooLarge,
|
types.ErrLotTooLarge,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
false,
|
false,
|
||||||
@ -397,7 +409,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
||||||
bidArgs{buyer, c("token1", 20)},
|
bidArgs{buyer, c("token1", 20)},
|
||||||
types.ErrLotTooLarge,
|
types.ErrLotTooLarge,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
false,
|
false,
|
||||||
@ -409,7 +421,7 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
[]bidArgs{{buyer, c("token2", 50)}}, // put auction into reverse phase
|
||||||
bidArgs{buyer, c("token1", 58)}, // max lot at default 5% is 57
|
bidArgs{buyer, c("token1", 58)}, // max lot at default 5% is 57
|
||||||
types.ErrLotTooLarge,
|
types.ErrLotTooLarge,
|
||||||
someTime.Add(types.DefaultBidDuration),
|
someTime.Add(types.DefaultReverseBidDuration),
|
||||||
buyer,
|
buyer,
|
||||||
c("token2", 50),
|
c("token2", 50),
|
||||||
false,
|
false,
|
||||||
@ -445,7 +457,8 @@ func TestAuctionBidding(t *testing.T) {
|
|||||||
authGS := app.NewFundedGenStateWithSameCoinsWithModuleAccount(tApp.AppCodec(), initialBalance, addrs, modAcc)
|
authGS := app.NewFundedGenStateWithSameCoinsWithModuleAccount(tApp.AppCodec(), initialBalance, addrs, modAcc)
|
||||||
params := types.NewParams(
|
params := types.NewParams(
|
||||||
types.DefaultMaxAuctionDuration,
|
types.DefaultMaxAuctionDuration,
|
||||||
types.DefaultBidDuration,
|
types.DefaultForwardBidDuration,
|
||||||
|
types.DefaultReverseBidDuration,
|
||||||
types.DefaultIncrement,
|
types.DefaultIncrement,
|
||||||
types.DefaultIncrement,
|
types.DefaultIncrement,
|
||||||
types.DefaultIncrement,
|
types.DefaultIncrement,
|
||||||
|
0
x/auction/legacy/go.mod
Normal file
0
x/auction/legacy/go.mod
Normal file
@ -56,7 +56,8 @@ func (suite *Suite) SetupTest(numAddrs int) {
|
|||||||
|
|
||||||
params := types.NewParams(
|
params := types.NewParams(
|
||||||
types.DefaultMaxAuctionDuration,
|
types.DefaultMaxAuctionDuration,
|
||||||
types.DefaultBidDuration,
|
types.DefaultForwardBidDuration,
|
||||||
|
types.DefaultReverseBidDuration,
|
||||||
types.DefaultIncrement,
|
types.DefaultIncrement,
|
||||||
types.DefaultIncrement,
|
types.DefaultIncrement,
|
||||||
types.DefaultIncrement,
|
types.DefaultIncrement,
|
||||||
|
@ -3,7 +3,6 @@ package types
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
||||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
@ -56,7 +55,7 @@ func UnpackGenesisAuctions(genesisAuctionsAny []*types.Any) ([]GenesisAuction, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure this type will unpack contained interface types correctly when it is unmarshalled.
|
// Ensure this type will unpack contained interface types correctly when it is unmarshalled.
|
||||||
var _ codectypes.UnpackInterfacesMessage = &GenesisState{}
|
var _ types.UnpackInterfacesMessage = &GenesisState{}
|
||||||
|
|
||||||
// NewGenesisState returns a new genesis state object for auctions module.
|
// NewGenesisState returns a new genesis state object for auctions module.
|
||||||
func NewGenesisState(nextID uint64, ap Params, ga []GenesisAuction) (*GenesisState, error) {
|
func NewGenesisState(nextID uint64, ap Params, ga []GenesisAuction) (*GenesisState, error) {
|
||||||
|
@ -74,7 +74,8 @@ var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
|||||||
// Params defines the parameters for the issuance module.
|
// Params defines the parameters for the issuance module.
|
||||||
type Params struct {
|
type Params struct {
|
||||||
MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"`
|
MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"`
|
||||||
BidDuration time.Duration `protobuf:"bytes,2,opt,name=bid_duration,json=bidDuration,proto3,stdduration" json:"bid_duration"`
|
ForwardBidDuration time.Duration `protobuf:"bytes,2,opt,name=forward_bid_duration,json=forwardBidDuration,proto3,stdduration" json:"forward_bid_duration"`
|
||||||
|
ReverseBidDuration time.Duration `protobuf:"bytes,6,opt,name=reverse_bid_duration,json=reverseBidDuration,proto3,stdduration" json:"reverse_bid_duration"`
|
||||||
IncrementSurplus github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus"`
|
IncrementSurplus github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus"`
|
||||||
IncrementDebt github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt"`
|
IncrementDebt github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt"`
|
||||||
IncrementCollateral github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral"`
|
IncrementCollateral github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral"`
|
||||||
@ -123,37 +124,38 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_d0e5cb58293042f7 = []byte{
|
var fileDescriptor_d0e5cb58293042f7 = []byte{
|
||||||
// 466 bytes of a gzipped FileDescriptorProto
|
// 487 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x31, 0x6f, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x6f, 0xd3, 0x30,
|
||||||
0x14, 0xc7, 0x7d, 0x4d, 0x88, 0xaa, 0x4b, 0x5a, 0xe0, 0xf0, 0xe0, 0x56, 0xc8, 0x89, 0x32, 0x54,
|
0x18, 0xc6, 0xe3, 0xad, 0x54, 0x93, 0xbb, 0x0d, 0x30, 0x39, 0x64, 0x13, 0x4a, 0xab, 0x1e, 0xa6,
|
||||||
0x61, 0xc8, 0x59, 0x0d, 0x1b, 0x5b, 0x4d, 0x44, 0xc5, 0x86, 0x5c, 0x75, 0x81, 0x21, 0xba, 0xb3,
|
0x72, 0xa8, 0xa3, 0x95, 0x1b, 0xb7, 0x85, 0x4a, 0x13, 0x37, 0x94, 0x69, 0x17, 0x38, 0x44, 0x4e,
|
||||||
0x0f, 0x63, 0xd5, 0xf6, 0x45, 0xbe, 0x73, 0x95, 0x7c, 0x0b, 0x46, 0x3e, 0x08, 0x03, 0x13, 0x73,
|
0xe2, 0x85, 0x68, 0x49, 0x5c, 0xd9, 0x4e, 0x69, 0xbf, 0x05, 0x47, 0x3e, 0x00, 0x1f, 0x81, 0x03,
|
||||||
0xc4, 0xd4, 0x11, 0x31, 0x14, 0x48, 0xbe, 0x08, 0xf2, 0xdd, 0xe5, 0x82, 0x80, 0x01, 0x75, 0xca,
|
0x1f, 0xa1, 0xe2, 0xb4, 0x23, 0xe2, 0x30, 0xa0, 0xfd, 0x22, 0x28, 0xb6, 0x9b, 0x96, 0x3f, 0x97,
|
||||||
0xdd, 0x7b, 0xff, 0xff, 0xef, 0xfd, 0x9f, 0x2e, 0x86, 0xc3, 0x2b, 0x72, 0x4d, 0x02, 0x52, 0xc7,
|
0xed, 0x14, 0xfb, 0x7d, 0x9f, 0xe7, 0xf7, 0x3e, 0x4e, 0x1c, 0xd8, 0xbf, 0x26, 0x53, 0xe2, 0x91,
|
||||||
0x32, 0xe3, 0x65, 0x70, 0x7d, 0x4a, 0x99, 0x24, 0xa7, 0x41, 0xca, 0x4a, 0x26, 0x32, 0x81, 0xe7,
|
0x2a, 0x96, 0x19, 0x2b, 0xbd, 0xe9, 0x69, 0x44, 0x25, 0x39, 0xf5, 0x52, 0x5a, 0x52, 0x91, 0x09,
|
||||||
0x15, 0x97, 0x1c, 0xb9, 0x8d, 0x06, 0x1b, 0x0d, 0x36, 0x9a, 0x63, 0x37, 0xe5, 0x29, 0x57, 0x82,
|
0x3c, 0xe1, 0x4c, 0x32, 0x64, 0xd7, 0x1a, 0x6c, 0x34, 0xd8, 0x68, 0x8e, 0xed, 0x94, 0xa5, 0x4c,
|
||||||
0xa0, 0x39, 0x69, 0xed, 0xf1, 0x51, 0xca, 0x79, 0x9a, 0xb3, 0x40, 0xdd, 0x68, 0xfd, 0x36, 0x20,
|
0x09, 0xbc, 0x7a, 0xa5, 0xb5, 0xc7, 0x47, 0x29, 0x63, 0x69, 0x4e, 0x3d, 0xb5, 0x8b, 0xaa, 0x2b,
|
||||||
0xe5, 0x72, 0xdb, 0x8a, 0xb9, 0x28, 0xb8, 0x98, 0x69, 0x8f, 0xbe, 0x98, 0x96, 0xff, 0xa7, 0x2b,
|
0x8f, 0x94, 0xf3, 0x75, 0x2b, 0x66, 0xa2, 0x60, 0x22, 0xd4, 0x1e, 0xbd, 0x31, 0x2d, 0xf7, 0x6f,
|
||||||
0xa9, 0x2b, 0xa2, 0xa6, 0xa9, 0xca, 0xf0, 0x13, 0x80, 0xbd, 0x73, 0x9d, 0xe9, 0x42, 0x12, 0xc9,
|
0x57, 0x52, 0x71, 0xa2, 0xa6, 0xa9, 0x4a, 0xff, 0x0b, 0x80, 0xfb, 0xe7, 0x3a, 0xd3, 0x85, 0x24,
|
||||||
0xd0, 0x09, 0xbc, 0x5f, 0xb2, 0x85, 0x9c, 0x99, 0x50, 0xb3, 0x2c, 0xf1, 0xc0, 0x00, 0x8c, 0xda,
|
0x92, 0xa2, 0x13, 0xf8, 0xb0, 0xa4, 0x33, 0x19, 0x9a, 0x50, 0x61, 0x96, 0x38, 0xa0, 0x07, 0x06,
|
||||||
0xd1, 0x41, 0x53, 0x3e, 0xd3, 0xd5, 0x97, 0x09, 0x7a, 0x06, 0x3b, 0x73, 0x52, 0x91, 0x42, 0x78,
|
0xad, 0xe0, 0xa0, 0x2e, 0x9f, 0xe9, 0xea, 0xab, 0x04, 0xbd, 0x80, 0xed, 0x09, 0xe1, 0xa4, 0x10,
|
||||||
0x7b, 0x03, 0x30, 0xea, 0x4e, 0x1e, 0xe3, 0x7f, 0xed, 0x82, 0x5f, 0x29, 0x4d, 0xd8, 0x5e, 0xdd,
|
0xce, 0x4e, 0x0f, 0x0c, 0x3a, 0xa3, 0xa7, 0xf8, 0x7f, 0x67, 0xc1, 0xaf, 0x95, 0xc6, 0x6f, 0x2d,
|
||||||
0xf6, 0x9d, 0xc8, 0x38, 0xd0, 0x14, 0xee, 0x1b, 0x9d, 0xf0, 0x5a, 0x83, 0xd6, 0xa8, 0x3b, 0x71,
|
0x6e, 0xbb, 0x56, 0x60, 0x1c, 0x68, 0x0c, 0xf7, 0x8c, 0x4e, 0x38, 0xbb, 0xbd, 0xdd, 0x41, 0x67,
|
||||||
0xb1, 0xce, 0x89, 0xb7, 0x39, 0xf1, 0x59, 0xb9, 0x0c, 0xd1, 0x97, 0x8f, 0xe3, 0x43, 0x93, 0xce,
|
0x64, 0x63, 0x9d, 0x13, 0xaf, 0x73, 0xe2, 0xb3, 0x72, 0xee, 0xa3, 0xaf, 0x9f, 0x87, 0x87, 0x26,
|
||||||
0x4c, 0x8e, 0xac, 0x73, 0xf8, 0xb9, 0x05, 0x3b, 0x1a, 0x8f, 0x2e, 0xa1, 0x5b, 0x90, 0x85, 0xcd,
|
0x9d, 0x99, 0x1c, 0x34, 0xce, 0xfe, 0xa7, 0x16, 0x6c, 0x6b, 0x3c, 0xba, 0x84, 0x76, 0x41, 0x66,
|
||||||
0xbc, 0xdd, 0x51, 0x25, 0xef, 0x4e, 0x8e, 0xfe, 0x82, 0x4f, 0x8d, 0x20, 0xdc, 0x6f, 0x72, 0x7d,
|
0x4d, 0xe6, 0xf5, 0x19, 0x55, 0xf2, 0xce, 0xe8, 0xe8, 0x1f, 0xf8, 0xd8, 0x08, 0xfc, 0xbd, 0x3a,
|
||||||
0xf8, 0xde, 0x07, 0x11, 0x2a, 0xc8, 0xc2, 0xcc, 0xd8, 0x76, 0xd1, 0x0b, 0xd8, 0xa3, 0x59, 0xb2,
|
0xd7, 0xc7, 0x1f, 0x5d, 0x10, 0xa0, 0x82, 0xcc, 0xcc, 0x8c, 0x75, 0xb7, 0xc6, 0x5e, 0x31, 0xfe,
|
||||||
0xc3, 0xed, 0xfd, 0x3f, 0xae, 0x4b, 0xb3, 0xc4, 0x72, 0xde, 0xc0, 0x87, 0x59, 0x19, 0x57, 0xac,
|
0x9e, 0xf0, 0x24, 0x8c, 0xb2, 0x64, 0x83, 0xdd, 0xb9, 0x03, 0xd6, 0x00, 0xfc, 0x2c, 0xd9, 0xc6,
|
||||||
0x60, 0xa5, 0x9c, 0x89, 0xba, 0x9a, 0xe7, 0x75, 0xb3, 0x38, 0x18, 0xf5, 0x42, 0xdc, 0x38, 0xbe,
|
0x72, 0x3a, 0xa5, 0x5c, 0xd0, 0x3f, 0xb1, 0xed, 0x3b, 0x60, 0x0d, 0x60, 0x1b, 0xfb, 0x16, 0x3e,
|
||||||
0xdd, 0xf6, 0x4f, 0xd2, 0x4c, 0xbe, 0xab, 0x29, 0x8e, 0x79, 0x61, 0x1e, 0xd0, 0xfc, 0x8c, 0x45,
|
0xce, 0xca, 0x98, 0xd3, 0x82, 0x96, 0x32, 0x14, 0x15, 0x9f, 0xe4, 0x55, 0xfd, 0x7a, 0xc1, 0x60,
|
||||||
0x72, 0x15, 0xc8, 0xe5, 0x9c, 0x09, 0x3c, 0x65, 0x71, 0xf4, 0xc0, 0x82, 0x2e, 0x34, 0x07, 0x5d,
|
0xdf, 0xc7, 0xb5, 0xf1, 0xfb, 0x6d, 0xf7, 0x24, 0xcd, 0xe4, 0xbb, 0x2a, 0xc2, 0x31, 0x2b, 0xcc,
|
||||||
0xc2, 0xc3, 0x1d, 0x3c, 0x61, 0x54, 0x7a, 0xed, 0x3b, 0x91, 0x0f, 0x2c, 0x65, 0xca, 0xa8, 0x44,
|
0x35, 0x31, 0x8f, 0xa1, 0x48, 0xae, 0x3d, 0x39, 0x9f, 0x50, 0x81, 0xc7, 0x34, 0x0e, 0x1e, 0x35,
|
||||||
0x04, 0xba, 0x3b, 0x6c, 0xcc, 0xf3, 0x9c, 0x48, 0x56, 0x91, 0xdc, 0xbb, 0x77, 0x27, 0xf8, 0x23,
|
0xa0, 0x0b, 0xcd, 0x41, 0x97, 0xf0, 0x70, 0x03, 0x4f, 0x68, 0x24, 0x9d, 0xd6, 0xbd, 0xc8, 0x07,
|
||||||
0xcb, 0x7a, 0x6e, 0x51, 0xe1, 0xf9, 0xea, 0xa7, 0xef, 0xac, 0xd6, 0x3e, 0xb8, 0x59, 0xfb, 0xe0,
|
0x0d, 0x65, 0x4c, 0x23, 0x89, 0x08, 0xb4, 0x37, 0xd8, 0x98, 0xe5, 0x39, 0x91, 0x94, 0x93, 0xdc,
|
||||||
0xc7, 0xda, 0x07, 0xef, 0x37, 0xbe, 0x73, 0xb3, 0xf1, 0x9d, 0xaf, 0x1b, 0xdf, 0x79, 0xfd, 0xe4,
|
0x79, 0x70, 0x2f, 0xf8, 0x93, 0x86, 0xf5, 0xb2, 0x41, 0xf9, 0xe7, 0x8b, 0x5f, 0xae, 0xb5, 0x58,
|
||||||
0x37, 0x74, 0xf3, 0xd7, 0x1a, 0xe7, 0x84, 0x0a, 0x75, 0x0a, 0x16, 0xf6, 0xb3, 0x52, 0x13, 0x68,
|
0xba, 0xe0, 0x66, 0xe9, 0x82, 0x9f, 0x4b, 0x17, 0x7c, 0x58, 0xb9, 0xd6, 0xcd, 0xca, 0xb5, 0xbe,
|
||||||
0x47, 0xbd, 0xc4, 0xd3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x20, 0xff, 0x87, 0x73, 0x03,
|
0xad, 0x5c, 0xeb, 0xcd, 0xb3, 0x2d, 0x74, 0x7d, 0x81, 0x87, 0x39, 0x89, 0x84, 0x5a, 0x79, 0xb3,
|
||||||
0x00, 0x00,
|
0xe6, 0xe7, 0x55, 0x13, 0xa2, 0xb6, 0xfa, 0x20, 0xcf, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x71,
|
||||||
|
0x67, 0x8c, 0x47, 0xd9, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||||
@ -228,6 +230,14 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ReverseBidDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.ReverseBidDuration):])
|
||||||
|
if err2 != nil {
|
||||||
|
return 0, err2
|
||||||
|
}
|
||||||
|
i -= n2
|
||||||
|
i = encodeVarintGenesis(dAtA, i, uint64(n2))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x32
|
||||||
{
|
{
|
||||||
size := m.IncrementCollateral.Size()
|
size := m.IncrementCollateral.Size()
|
||||||
i -= size
|
i -= size
|
||||||
@ -258,21 +268,21 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x1a
|
dAtA[i] = 0x1a
|
||||||
n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.BidDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.BidDuration):])
|
n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ForwardBidDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.ForwardBidDuration):])
|
||||||
if err2 != nil {
|
|
||||||
return 0, err2
|
|
||||||
}
|
|
||||||
i -= n2
|
|
||||||
i = encodeVarintGenesis(dAtA, i, uint64(n2))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAuctionDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAuctionDuration):])
|
|
||||||
if err3 != nil {
|
if err3 != nil {
|
||||||
return 0, err3
|
return 0, err3
|
||||||
}
|
}
|
||||||
i -= n3
|
i -= n3
|
||||||
i = encodeVarintGenesis(dAtA, i, uint64(n3))
|
i = encodeVarintGenesis(dAtA, i, uint64(n3))
|
||||||
i--
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAuctionDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAuctionDuration):])
|
||||||
|
if err4 != nil {
|
||||||
|
return 0, err4
|
||||||
|
}
|
||||||
|
i -= n4
|
||||||
|
i = encodeVarintGenesis(dAtA, i, uint64(n4))
|
||||||
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
@ -316,7 +326,7 @@ func (m *Params) Size() (n int) {
|
|||||||
_ = l
|
_ = l
|
||||||
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAuctionDuration)
|
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAuctionDuration)
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.BidDuration)
|
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ForwardBidDuration)
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
l = m.IncrementSurplus.Size()
|
l = m.IncrementSurplus.Size()
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
@ -324,6 +334,8 @@ func (m *Params) Size() (n int) {
|
|||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
l = m.IncrementCollateral.Size()
|
l = m.IncrementCollateral.Size()
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
|
l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ReverseBidDuration)
|
||||||
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +545,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
|||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field BidDuration", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field ForwardBidDuration", wireType)
|
||||||
}
|
}
|
||||||
var msglen int
|
var msglen int
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -560,7 +572,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.BidDuration, dAtA[iNdEx:postIndex]); err != nil {
|
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ForwardBidDuration, dAtA[iNdEx:postIndex]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
@ -663,6 +675,39 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field ReverseBidDuration", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ReverseBidDuration, dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||||
|
@ -15,15 +15,18 @@ var emptyDec = sdk.Dec{}
|
|||||||
const (
|
const (
|
||||||
// DefaultMaxAuctionDuration max length of auction
|
// DefaultMaxAuctionDuration max length of auction
|
||||||
DefaultMaxAuctionDuration time.Duration = 2 * 24 * time.Hour
|
DefaultMaxAuctionDuration time.Duration = 2 * 24 * time.Hour
|
||||||
// DefaultBidDuration how long an auction gets extended when someone bids
|
// DefaultForwardBidDuration how long an auction gets extended when someone bids for a forward auction
|
||||||
DefaultBidDuration time.Duration = 1 * time.Hour
|
DefaultForwardBidDuration time.Duration = 8 * time.Hour
|
||||||
|
// DefaultReverseBidDuration how long an auction gets extended when someone bids for a reverse auction
|
||||||
|
DefaultReverseBidDuration time.Duration = 1 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// DefaultIncrement is the smallest percent change a new bid must have from the old one
|
// DefaultIncrement is the smallest percent change a new bid must have from the old one
|
||||||
DefaultIncrement sdk.Dec = sdk.MustNewDecFromStr("0.05")
|
DefaultIncrement sdk.Dec = sdk.MustNewDecFromStr("0.05")
|
||||||
// ParamStoreKeyParams Param store key for auction params
|
// ParamStoreKeyParams Param store key for auction params
|
||||||
KeyBidDuration = []byte("BidDuration")
|
KeyForwardBidDuration = []byte("ForwardBidDuration")
|
||||||
|
KeyReverseBidDuration = []byte("ReverseBidDuration")
|
||||||
KeyMaxAuctionDuration = []byte("MaxAuctionDuration")
|
KeyMaxAuctionDuration = []byte("MaxAuctionDuration")
|
||||||
KeyIncrementSurplus = []byte("IncrementSurplus")
|
KeyIncrementSurplus = []byte("IncrementSurplus")
|
||||||
KeyIncrementDebt = []byte("IncrementDebt")
|
KeyIncrementDebt = []byte("IncrementDebt")
|
||||||
@ -31,10 +34,16 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewParams returns a new Params object.
|
// NewParams returns a new Params object.
|
||||||
func NewParams(maxAuctionDuration, bidDuration time.Duration, incrementSurplus, incrementDebt, incrementCollateral sdk.Dec) Params {
|
func NewParams(
|
||||||
|
maxAuctionDuration, forwardBidDuration, reverseBidDuration time.Duration,
|
||||||
|
incrementSurplus,
|
||||||
|
incrementDebt,
|
||||||
|
incrementCollateral sdk.Dec,
|
||||||
|
) Params {
|
||||||
return Params{
|
return Params{
|
||||||
MaxAuctionDuration: maxAuctionDuration,
|
MaxAuctionDuration: maxAuctionDuration,
|
||||||
BidDuration: bidDuration,
|
ForwardBidDuration: forwardBidDuration,
|
||||||
|
ReverseBidDuration: reverseBidDuration,
|
||||||
IncrementSurplus: incrementSurplus,
|
IncrementSurplus: incrementSurplus,
|
||||||
IncrementDebt: incrementDebt,
|
IncrementDebt: incrementDebt,
|
||||||
IncrementCollateral: incrementCollateral,
|
IncrementCollateral: incrementCollateral,
|
||||||
@ -45,7 +54,8 @@ func NewParams(maxAuctionDuration, bidDuration time.Duration, incrementSurplus,
|
|||||||
func DefaultParams() Params {
|
func DefaultParams() Params {
|
||||||
return NewParams(
|
return NewParams(
|
||||||
DefaultMaxAuctionDuration,
|
DefaultMaxAuctionDuration,
|
||||||
DefaultBidDuration,
|
DefaultForwardBidDuration,
|
||||||
|
DefaultReverseBidDuration,
|
||||||
DefaultIncrement,
|
DefaultIncrement,
|
||||||
DefaultIncrement,
|
DefaultIncrement,
|
||||||
DefaultIncrement,
|
DefaultIncrement,
|
||||||
@ -60,7 +70,8 @@ func ParamKeyTable() paramtypes.KeyTable {
|
|||||||
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs.
|
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs.
|
||||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||||
return paramtypes.ParamSetPairs{
|
return paramtypes.ParamSetPairs{
|
||||||
paramtypes.NewParamSetPair(KeyBidDuration, &p.BidDuration, validateBidDurationParam),
|
paramtypes.NewParamSetPair(KeyForwardBidDuration, &p.ForwardBidDuration, validateBidDurationParam),
|
||||||
|
paramtypes.NewParamSetPair(KeyReverseBidDuration, &p.ReverseBidDuration, validateBidDurationParam),
|
||||||
paramtypes.NewParamSetPair(KeyMaxAuctionDuration, &p.MaxAuctionDuration, validateMaxAuctionDurationParam),
|
paramtypes.NewParamSetPair(KeyMaxAuctionDuration, &p.MaxAuctionDuration, validateMaxAuctionDurationParam),
|
||||||
paramtypes.NewParamSetPair(KeyIncrementSurplus, &p.IncrementSurplus, validateIncrementSurplusParam),
|
paramtypes.NewParamSetPair(KeyIncrementSurplus, &p.IncrementSurplus, validateIncrementSurplusParam),
|
||||||
paramtypes.NewParamSetPair(KeyIncrementDebt, &p.IncrementDebt, validateIncrementDebtParam),
|
paramtypes.NewParamSetPair(KeyIncrementDebt, &p.IncrementDebt, validateIncrementDebtParam),
|
||||||
@ -70,7 +81,11 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
|||||||
|
|
||||||
// Validate checks that the parameters have valid values.
|
// Validate checks that the parameters have valid values.
|
||||||
func (p Params) Validate() error {
|
func (p Params) Validate() error {
|
||||||
if err := validateBidDurationParam(p.BidDuration); err != nil {
|
if err := validateBidDurationParam(p.ForwardBidDuration); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := validateBidDurationParam(p.ReverseBidDuration); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +93,12 @@ func (p Params) Validate() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.BidDuration > p.MaxAuctionDuration {
|
if p.ForwardBidDuration > p.MaxAuctionDuration {
|
||||||
return errors.New("bid duration param cannot be larger than max auction duration")
|
return errors.New("forward bid duration param cannot be larger than max auction duration")
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.ReverseBidDuration > p.MaxAuctionDuration {
|
||||||
|
return errors.New("reverse bid duration param cannot be larger than max auction duration")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := validateIncrementSurplusParam(p.IncrementSurplus); err != nil {
|
if err := validateIncrementSurplusParam(p.IncrementSurplus); err != nil {
|
||||||
|
@ -8,8 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestParams_Validate(t *testing.T) {
|
func TestParams_Validate(t *testing.T) {
|
||||||
type fields struct {
|
|
||||||
}
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
Params
|
Params
|
||||||
@ -21,10 +19,35 @@ func TestParams_Validate(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"negativeBid",
|
"negativeForwardBidDuration",
|
||||||
Params{
|
Params{
|
||||||
MaxAuctionDuration: 24 * time.Hour,
|
MaxAuctionDuration: 24 * time.Hour,
|
||||||
BidDuration: -1 * time.Hour,
|
ForwardBidDuration: -1 * time.Hour,
|
||||||
|
ReverseBidDuration: 1 * time.Hour,
|
||||||
|
IncrementSurplus: d("0.05"),
|
||||||
|
IncrementDebt: d("0.05"),
|
||||||
|
IncrementCollateral: d("0.05"),
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"negativeReverseBidDuration",
|
||||||
|
Params{
|
||||||
|
MaxAuctionDuration: 24 * time.Hour,
|
||||||
|
ForwardBidDuration: 1 * time.Hour,
|
||||||
|
ReverseBidDuration: -1 * time.Hour,
|
||||||
|
IncrementSurplus: d("0.05"),
|
||||||
|
IncrementDebt: d("0.05"),
|
||||||
|
IncrementCollateral: d("0.05"),
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"negativeBidDuration",
|
||||||
|
Params{
|
||||||
|
MaxAuctionDuration: 24 * time.Hour,
|
||||||
|
ForwardBidDuration: -1 * time.Hour,
|
||||||
|
ReverseBidDuration: -1 * time.Hour,
|
||||||
IncrementSurplus: d("0.05"),
|
IncrementSurplus: d("0.05"),
|
||||||
IncrementDebt: d("0.05"),
|
IncrementDebt: d("0.05"),
|
||||||
IncrementCollateral: d("0.05"),
|
IncrementCollateral: d("0.05"),
|
||||||
@ -35,7 +58,8 @@ func TestParams_Validate(t *testing.T) {
|
|||||||
"negativeAuction",
|
"negativeAuction",
|
||||||
Params{
|
Params{
|
||||||
MaxAuctionDuration: -24 * time.Hour,
|
MaxAuctionDuration: -24 * time.Hour,
|
||||||
BidDuration: 1 * time.Hour,
|
ForwardBidDuration: 1 * time.Hour,
|
||||||
|
ReverseBidDuration: 1 * time.Hour,
|
||||||
IncrementSurplus: d("0.05"),
|
IncrementSurplus: d("0.05"),
|
||||||
IncrementDebt: d("0.05"),
|
IncrementDebt: d("0.05"),
|
||||||
IncrementCollateral: d("0.05"),
|
IncrementCollateral: d("0.05"),
|
||||||
@ -46,7 +70,8 @@ func TestParams_Validate(t *testing.T) {
|
|||||||
"bid>auction",
|
"bid>auction",
|
||||||
Params{
|
Params{
|
||||||
MaxAuctionDuration: 1 * time.Hour,
|
MaxAuctionDuration: 1 * time.Hour,
|
||||||
BidDuration: 24 * time.Hour,
|
ForwardBidDuration: 24 * time.Hour,
|
||||||
|
ReverseBidDuration: 1 * time.Hour,
|
||||||
IncrementSurplus: d("0.05"),
|
IncrementSurplus: d("0.05"),
|
||||||
IncrementDebt: d("0.05"),
|
IncrementDebt: d("0.05"),
|
||||||
IncrementCollateral: d("0.05"),
|
IncrementCollateral: d("0.05"),
|
||||||
@ -57,7 +82,8 @@ func TestParams_Validate(t *testing.T) {
|
|||||||
"negative increment surplus",
|
"negative increment surplus",
|
||||||
Params{
|
Params{
|
||||||
MaxAuctionDuration: 24 * time.Hour,
|
MaxAuctionDuration: 24 * time.Hour,
|
||||||
BidDuration: 1 * time.Hour,
|
ForwardBidDuration: 1 * time.Hour,
|
||||||
|
ReverseBidDuration: 1 * time.Hour,
|
||||||
IncrementSurplus: d("-0.05"),
|
IncrementSurplus: d("-0.05"),
|
||||||
IncrementDebt: d("0.05"),
|
IncrementDebt: d("0.05"),
|
||||||
IncrementCollateral: d("0.05"),
|
IncrementCollateral: d("0.05"),
|
||||||
@ -68,7 +94,8 @@ func TestParams_Validate(t *testing.T) {
|
|||||||
"negative increment debt",
|
"negative increment debt",
|
||||||
Params{
|
Params{
|
||||||
MaxAuctionDuration: 24 * time.Hour,
|
MaxAuctionDuration: 24 * time.Hour,
|
||||||
BidDuration: 1 * time.Hour,
|
ForwardBidDuration: 1 * time.Hour,
|
||||||
|
ReverseBidDuration: 1 * time.Hour,
|
||||||
IncrementSurplus: d("0.05"),
|
IncrementSurplus: d("0.05"),
|
||||||
IncrementDebt: d("-0.05"),
|
IncrementDebt: d("-0.05"),
|
||||||
IncrementCollateral: d("0.05"),
|
IncrementCollateral: d("0.05"),
|
||||||
@ -79,7 +106,8 @@ func TestParams_Validate(t *testing.T) {
|
|||||||
"negative increment collateral",
|
"negative increment collateral",
|
||||||
Params{
|
Params{
|
||||||
MaxAuctionDuration: 24 * time.Hour,
|
MaxAuctionDuration: 24 * time.Hour,
|
||||||
BidDuration: 1 * time.Hour,
|
ForwardBidDuration: 1 * time.Hour,
|
||||||
|
ReverseBidDuration: 1 * time.Hour,
|
||||||
IncrementSurplus: d("0.05"),
|
IncrementSurplus: d("0.05"),
|
||||||
IncrementDebt: d("0.05"),
|
IncrementDebt: d("0.05"),
|
||||||
IncrementCollateral: d("-0.05"),
|
IncrementCollateral: d("-0.05"),
|
||||||
|
Loading…
Reference in New Issue
Block a user