mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35: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"
|
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/cdp"
|
||||||
"github.com/kava-labs/kava/x/pricefeed"
|
"github.com/kava-labs/kava/x/pricefeed"
|
||||||
"github.com/kava-labs/kava/app"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Avoid cluttering test cases with long function name
|
// Avoid cluttering test cases with long function name
|
||||||
@ -30,7 +30,7 @@ func NewPFGenState(asset string, price sdk.Dec) app.GenesisState {
|
|||||||
MarketID: asset,
|
MarketID: asset,
|
||||||
OracleAddress: sdk.AccAddress{},
|
OracleAddress: sdk.AccAddress{},
|
||||||
Price: price,
|
Price: price,
|
||||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
Expiry: time.Now().Add(1 * time.Hour),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState {
|
|||||||
MarketID: asset,
|
MarketID: asset,
|
||||||
OracleAddress: sdk.AccAddress{},
|
OracleAddress: sdk.AccAddress{},
|
||||||
Price: price,
|
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",
|
MarketID: "btc",
|
||||||
OracleAddress: sdk.AccAddress{},
|
OracleAddress: sdk.AccAddress{},
|
||||||
Price: sdk.MustNewDecFromStr("8000.00"),
|
Price: sdk.MustNewDecFromStr("8000.00"),
|
||||||
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
|
Expiry: time.Now().Add(1 * time.Hour),
|
||||||
},
|
},
|
||||||
pricefeed.PostedPrice{
|
pricefeed.PostedPrice{
|
||||||
MarketID: "xrp",
|
MarketID: "xrp",
|
||||||
OracleAddress: sdk.AccAddress{},
|
OracleAddress: sdk.AccAddress{},
|
||||||
Price: sdk.MustNewDecFromStr("0.25"),
|
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
|
// Reduce price
|
||||||
tApp.GetPriceFeedKeeper().SetPrice(
|
tApp.GetPriceFeedKeeper().SetPrice(
|
||||||
ctx, sdk.AccAddress{}, collateral,
|
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)
|
tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, collateral)
|
||||||
|
|
||||||
// Seize entire CDP
|
// Seize entire CDP
|
||||||
|
@ -31,7 +31,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState {
|
|||||||
MarketID: asset,
|
MarketID: asset,
|
||||||
OracleAddress: sdk.AccAddress{},
|
OracleAddress: sdk.AccAddress{},
|
||||||
Price: price,
|
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)))
|
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, err)
|
||||||
require.NoError(t, tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc"))
|
require.NoError(t, tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user