mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 15:25:18 +00:00
minor tidying
This commit is contained in:
parent
81302ce29f
commit
11fd42685b
@ -17,8 +17,9 @@ func TestKeeper_EndBlocker(t *testing.T) {
|
||||
seller := addrs[0]
|
||||
|
||||
tApp := app.NewTestApp()
|
||||
authGenState := app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100))})
|
||||
tApp.InitializeFromGenesisStates(authGenState)
|
||||
tApp.InitializeFromGenesisStates(
|
||||
app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100))}),
|
||||
)
|
||||
|
||||
ctx := tApp.NewContext(true, abci.Header{})
|
||||
keeper := tApp.GetAuctionKeeper()
|
||||
|
@ -19,8 +19,9 @@ func TestKeeper_ForwardAuction(t *testing.T) {
|
||||
buyer := addrs[1]
|
||||
|
||||
tApp := app.NewTestApp()
|
||||
authGenState := app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100))})
|
||||
tApp.InitializeFromGenesisStates(authGenState)
|
||||
tApp.InitializeFromGenesisStates(
|
||||
app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100))}),
|
||||
)
|
||||
|
||||
ctx := tApp.NewContext(false, abci.Header{})
|
||||
keeper := tApp.GetAuctionKeeper()
|
||||
@ -52,8 +53,9 @@ func TestKeeper_ReverseAuction(t *testing.T) {
|
||||
buyer := addrs[1]
|
||||
|
||||
tApp := app.NewTestApp()
|
||||
authGenState := app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100))})
|
||||
tApp.InitializeFromGenesisStates(authGenState)
|
||||
tApp.InitializeFromGenesisStates(
|
||||
app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100))}),
|
||||
)
|
||||
|
||||
ctx := tApp.NewContext(false, abci.Header{})
|
||||
keeper := tApp.GetAuctionKeeper()
|
||||
@ -86,8 +88,9 @@ func TestKeeper_ForwardReverseAuction(t *testing.T) {
|
||||
recipient := addrs[2]
|
||||
|
||||
tApp := app.NewTestApp()
|
||||
authGenState := app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100))})
|
||||
tApp.InitializeFromGenesisStates(authGenState)
|
||||
tApp.InitializeFromGenesisStates(
|
||||
app.NewAuthGenState(addrs, []sdk.Coins{cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100)), cs(c("token1", 100), c("token2", 100))}),
|
||||
)
|
||||
|
||||
ctx := tApp.NewContext(false, abci.Header{})
|
||||
keeper := tApp.GetAuctionKeeper()
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
|
||||
// Avoid cluttering test cases with long function name
|
||||
func i(in int64) sdk.Int { return sdk.NewInt(in) }
|
||||
func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) }
|
||||
func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) }
|
||||
func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) }
|
||||
|
||||
|
@ -20,7 +20,7 @@ func TestKeeper_SeizeAndStartCollateralAuction(t *testing.T) {
|
||||
tApp := app.NewTestApp()
|
||||
tApp.InitializeFromGenesisStates(
|
||||
app.NewAuthGenState(addrs, []sdk.Coins{cs(c("btc", 100))}),
|
||||
NewPFGenState("btc", sdk.MustNewDecFromStr("8000.00")),
|
||||
NewPFGenState("btc", d("8000.00")),
|
||||
NewCDPGenState(),
|
||||
NewLiquidatorGenState(),
|
||||
)
|
||||
@ -28,7 +28,7 @@ func TestKeeper_SeizeAndStartCollateralAuction(t *testing.T) {
|
||||
|
||||
require.NoError(t, tApp.GetCDPKeeper().ModifyCDP(ctx, addrs[0], "btc", i(3), i(16000)))
|
||||
|
||||
_, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", sdk.MustNewDecFromStr("7999.99"), time.Unix(9999999999, 0))
|
||||
_, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), time.Unix(9999999999, 0))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc"))
|
||||
|
||||
@ -81,7 +81,7 @@ func TestKeeper_partialSeizeCDP(t *testing.T) {
|
||||
tApp := app.NewTestApp()
|
||||
tApp.InitializeFromGenesisStates(
|
||||
app.NewAuthGenState(addrs, []sdk.Coins{cs(c("btc", 100))}),
|
||||
NewPFGenState("btc", sdk.MustNewDecFromStr("8000.00")),
|
||||
NewPFGenState("btc", d("8000.00")),
|
||||
NewCDPGenState(),
|
||||
NewLiquidatorGenState(),
|
||||
)
|
||||
@ -89,7 +89,7 @@ func TestKeeper_partialSeizeCDP(t *testing.T) {
|
||||
|
||||
tApp.GetCDPKeeper().ModifyCDP(ctx, addrs[0], "btc", i(3), i(16000))
|
||||
|
||||
tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", sdk.MustNewDecFromStr("7999.99"), tmtime.Now().Add(time.Hour*1))
|
||||
tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), tmtime.Now().Add(time.Hour*1))
|
||||
tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc")
|
||||
|
||||
// Run test function
|
||||
|
Loading…
Reference in New Issue
Block a user