Run begin blocker (#321)

* add cdp begin blocker

* fix: use reasonable defaults for surplus/debt auctions

Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
This commit is contained in:
Ruaridh 2020-01-20 19:28:30 +00:00 committed by GitHub
parent 1b577fcdbb
commit d887266c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -270,9 +270,9 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName, validatorvesting.ModuleName)
app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName, validatorvesting.ModuleName, cdp.ModuleName)
app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName, pricefeed.ModuleName, auction.ModuleName) // TODO is this correct order?
app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName, pricefeed.ModuleName, auction.ModuleName)
// Note: genutils must occur after staking so that pools are properly
// initialized with tokens from genesis accounts.

View File

@ -51,24 +51,24 @@ func (suite *AuctionTestSuite) TestNetDebtSurplus() {
func (suite *AuctionTestSuite) TestSurplusAuction() {
sk := suite.app.GetSupplyKeeper()
err := sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("usdx", 10000)))
err := sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("usdx", 10000000000)))
suite.NoError(err)
err = sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("debt", 1000)))
err = sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("debt", 1000000000)))
suite.NoError(err)
suite.keeper.RunSurplusAndDebtAuctions(suite.ctx)
acc := sk.GetModuleAccount(suite.ctx, auction.ModuleName)
suite.Equal(cs(c("usdx", 9000)), acc.GetCoins())
suite.Equal(cs(c("usdx", 9000000000)), acc.GetCoins())
}
func (suite *AuctionTestSuite) TestDebtAuction() {
sk := suite.app.GetSupplyKeeper()
err := sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("usdx", 1000)))
err := sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("usdx", 1000000000)))
suite.NoError(err)
err = sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("debt", 10000)))
err = sk.MintCoins(suite.ctx, types.LiquidatorMacc, cs(c("debt", 10000000000)))
suite.NoError(err)
suite.keeper.RunSurplusAndDebtAuctions(suite.ctx)
acc := sk.GetModuleAccount(suite.ctx, auction.ModuleName)
suite.Equal(cs(c("debt", 9000)), acc.GetCoins())
suite.Equal(cs(c("debt", 9000000000)), acc.GetCoins())
}
func TestAuctionTestSuite(t *testing.T) {

View File

@ -24,8 +24,8 @@ var (
DefaultCdpStartingID = uint64(1)
DefaultDebtDenom = "debt"
DefaultGovDenom = "ukava"
DefaultSurplusThreshold = sdk.NewInt(1000)
DefaultDebtThreshold = sdk.NewInt(1000)
DefaultSurplusThreshold = sdk.NewInt(1000000000)
DefaultDebtThreshold = sdk.NewInt(1000000000)
DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(0, 0))
minCollateralPrefix = 0
maxCollateralPrefix = 255