mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
use time consistently in tests
This commit is contained in:
parent
d8347fd49c
commit
f794ba1bf9
@ -5,9 +5,9 @@ import (
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/kava-labs/kava/app"
|
||||
"github.com/kava-labs/kava/x/cdp"
|
||||
"github.com/kava-labs/kava/x/pricefeed"
|
||||
"github.com/kava-labs/kava/app"
|
||||
)
|
||||
|
||||
// Avoid cluttering test cases with long function name
|
||||
@ -30,7 +30,7 @@ func NewPFGenState(asset string, price sdk.Dec) app.GenesisState {
|
||||
MarketID: asset,
|
||||
OracleAddress: sdk.AccAddress{},
|
||||
Price: price,
|
||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
||||
Expiry: time.Now().Add(1 * time.Hour),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -53,4 +53,4 @@ func NewCDPGenState(asset string, liquidationRatio sdk.Dec) app.GenesisState {
|
||||
CDPs: cdp.CDPs{},
|
||||
}
|
||||
return app.GenesisState{cdp.ModuleName: cdp.ModuleCdc.MustMarshalJSON(cdpGenesis)}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState {
|
||||
MarketID: asset,
|
||||
OracleAddress: sdk.AccAddress{},
|
||||
Price: price,
|
||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
||||
Expiry: time.Now().Add(1 * time.Hour),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -67,13 +67,13 @@ func NewPricefeedGenStateMulti() app.GenesisState {
|
||||
MarketID: "btc",
|
||||
OracleAddress: sdk.AccAddress{},
|
||||
Price: sdk.MustNewDecFromStr("8000.00"),
|
||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
||||
Expiry: time.Now().Add(1 * time.Hour),
|
||||
},
|
||||
pricefeed.PostedPrice{
|
||||
MarketID: "xrp",
|
||||
OracleAddress: sdk.AccAddress{},
|
||||
Price: sdk.MustNewDecFromStr("0.25"),
|
||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
||||
Expiry: time.Now().Add(1 * time.Hour),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ func TestKeeper_PartialSeizeCDP(t *testing.T) {
|
||||
// Reduce price
|
||||
tApp.GetPriceFeedKeeper().SetPrice(
|
||||
ctx, sdk.AccAddress{}, collateral,
|
||||
d("0.90"), time.Unix(9999999999, 0)) // some deterministic future date
|
||||
d("0.90"), time.Now().Add(1*time.Hour))
|
||||
tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, collateral)
|
||||
|
||||
// Seize entire CDP
|
||||
|
@ -31,7 +31,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState {
|
||||
MarketID: asset,
|
||||
OracleAddress: sdk.AccAddress{},
|
||||
Price: price,
|
||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
||||
Expiry: time.Now().Add(1 * time.Hour),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -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", d("7999.99"), time.Unix(9999999999, 0))
|
||||
_, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), time.Now().Add(1*time.Hour))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user