mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
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:
parent
1b577fcdbb
commit
d887266c24
@ -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
|
// 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
|
// there is nothing left over in the validator fee pool, so as to keep the
|
||||||
// CanWithdrawInvariant invariant.
|
// 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
|
// Note: genutils must occur after staking so that pools are properly
|
||||||
// initialized with tokens from genesis accounts.
|
// initialized with tokens from genesis accounts.
|
||||||
|
@ -51,24 +51,24 @@ func (suite *AuctionTestSuite) TestNetDebtSurplus() {
|
|||||||
|
|
||||||
func (suite *AuctionTestSuite) TestSurplusAuction() {
|
func (suite *AuctionTestSuite) TestSurplusAuction() {
|
||||||
sk := suite.app.GetSupplyKeeper()
|
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)
|
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.NoError(err)
|
||||||
suite.keeper.RunSurplusAndDebtAuctions(suite.ctx)
|
suite.keeper.RunSurplusAndDebtAuctions(suite.ctx)
|
||||||
acc := sk.GetModuleAccount(suite.ctx, auction.ModuleName)
|
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() {
|
func (suite *AuctionTestSuite) TestDebtAuction() {
|
||||||
sk := suite.app.GetSupplyKeeper()
|
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)
|
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.NoError(err)
|
||||||
suite.keeper.RunSurplusAndDebtAuctions(suite.ctx)
|
suite.keeper.RunSurplusAndDebtAuctions(suite.ctx)
|
||||||
acc := sk.GetModuleAccount(suite.ctx, auction.ModuleName)
|
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) {
|
func TestAuctionTestSuite(t *testing.T) {
|
||||||
|
@ -24,8 +24,8 @@ var (
|
|||||||
DefaultCdpStartingID = uint64(1)
|
DefaultCdpStartingID = uint64(1)
|
||||||
DefaultDebtDenom = "debt"
|
DefaultDebtDenom = "debt"
|
||||||
DefaultGovDenom = "ukava"
|
DefaultGovDenom = "ukava"
|
||||||
DefaultSurplusThreshold = sdk.NewInt(1000)
|
DefaultSurplusThreshold = sdk.NewInt(1000000000)
|
||||||
DefaultDebtThreshold = sdk.NewInt(1000)
|
DefaultDebtThreshold = sdk.NewInt(1000000000)
|
||||||
DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(0, 0))
|
DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(0, 0))
|
||||||
minCollateralPrefix = 0
|
minCollateralPrefix = 0
|
||||||
maxCollateralPrefix = 255
|
maxCollateralPrefix = 255
|
||||||
|
Loading…
Reference in New Issue
Block a user