mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
63 lines
2.0 KiB
Go
63 lines
2.0 KiB
Go
|
package pricefeed_test
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||
|
|
||
|
"github.com/kava-labs/kava/app"
|
||
|
"github.com/kava-labs/kava/x/pricefeed"
|
||
|
)
|
||
|
|
||
|
func NewPricefeedGenStateMulti() app.GenesisState {
|
||
|
pfGenesis := pricefeed.GenesisState{
|
||
|
Params: pricefeed.Params{
|
||
|
Markets: []pricefeed.Market{
|
||
|
pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true},
|
||
|
pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true},
|
||
|
},
|
||
|
},
|
||
|
PostedPrices: []pricefeed.PostedPrice{
|
||
|
pricefeed.PostedPrice{
|
||
|
MarketID: "btc:usd",
|
||
|
OracleAddress: sdk.AccAddress{},
|
||
|
Price: sdk.MustNewDecFromStr("8000.00"),
|
||
|
Expiry: time.Now().Add(1 * time.Hour),
|
||
|
},
|
||
|
pricefeed.PostedPrice{
|
||
|
MarketID: "xrp:usd",
|
||
|
OracleAddress: sdk.AccAddress{},
|
||
|
Price: sdk.MustNewDecFromStr("0.25"),
|
||
|
Expiry: time.Now().Add(1 * time.Hour),
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
return app.GenesisState{pricefeed.ModuleName: pricefeed.ModuleCdc.MustMarshalJSON(pfGenesis)}
|
||
|
}
|
||
|
|
||
|
func NewPricefeedGenStateWithOracles(addrs []sdk.AccAddress) app.GenesisState {
|
||
|
pfGenesis := pricefeed.GenesisState{
|
||
|
Params: pricefeed.Params{
|
||
|
Markets: []pricefeed.Market{
|
||
|
pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: addrs, Active: true},
|
||
|
pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: addrs, Active: true},
|
||
|
},
|
||
|
},
|
||
|
PostedPrices: []pricefeed.PostedPrice{
|
||
|
pricefeed.PostedPrice{
|
||
|
MarketID: "btc:usd",
|
||
|
OracleAddress: addrs[0],
|
||
|
Price: sdk.MustNewDecFromStr("8000.00"),
|
||
|
Expiry: time.Now().Add(1 * time.Hour),
|
||
|
},
|
||
|
pricefeed.PostedPrice{
|
||
|
MarketID: "xrp:usd",
|
||
|
OracleAddress: addrs[0],
|
||
|
Price: sdk.MustNewDecFromStr("0.25"),
|
||
|
Expiry: time.Now().Add(1 * time.Hour),
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
return app.GenesisState{pricefeed.ModuleName: pricefeed.ModuleCdc.MustMarshalJSON(pfGenesis)}
|
||
|
}
|