From c39b114754375bac7b2dcf226a4ec0aa9bb27a1e Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 15 Sep 2023 22:07:28 +0200 Subject: [PATCH] update implementations --- proto/umee/oracle/v1/oracle.proto | 4 +- x/leverage/keeper/oracle.go | 9 +- x/leverage/types/expected_types.go | 4 +- x/oracle/keeper/grpc_query.go | 4 +- x/oracle/keeper/keeper.go | 11 ++- x/oracle/types/oracle.pb.go | 143 +++++++++++++++-------------- x/oracle/types/vote.go | 4 +- 7 files changed, 91 insertions(+), 88 deletions(-) diff --git a/proto/umee/oracle/v1/oracle.proto b/proto/umee/oracle/v1/oracle.proto index 6fbf4c4e2f..776e35863c 100644 --- a/proto/umee/oracle/v1/oracle.proto +++ b/proto/umee/oracle/v1/oracle.proto @@ -146,9 +146,7 @@ message AvgCounter { // ExchangeRate stores exchange rate with timestamp message ExchangeRate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; string rate = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index 871972b38d..1827b4ead3 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -31,7 +31,8 @@ func (k Keeper) TokenPrice(ctx sdk.Context, baseDenom string, mode types.PriceMo mode = types.PriceModeSpot } - var price, spotPrice, historicPrice sdk.Dec + var price, historicPrice sdk.Dec + var spotPrice oracletypes.ExchangeRate if mode != types.PriceModeHistoric { // spot price is required for modes other than historic spotPrice, err = k.oracleKeeper.GetExchangeRate(ctx, t.SymbolDenom) @@ -58,13 +59,13 @@ func (k Keeper) TokenPrice(ctx sdk.Context, baseDenom string, mode types.PriceMo switch mode { case types.PriceModeSpot: - price = spotPrice + price = spotPrice.Rate case types.PriceModeHistoric: price = historicPrice case types.PriceModeHigh: - price = sdk.MaxDec(spotPrice, historicPrice) + price = sdk.MaxDec(spotPrice.Rate, historicPrice) case types.PriceModeLow: - price = sdk.MinDec(spotPrice, historicPrice) + price = sdk.MinDec(spotPrice.Rate, historicPrice) default: return sdk.ZeroDec(), t.Exponent, types.ErrInvalidPriceMode.Wrapf("%d", mode) } diff --git a/x/leverage/types/expected_types.go b/x/leverage/types/expected_types.go index 947383f288..5a1e276f97 100644 --- a/x/leverage/types/expected_types.go +++ b/x/leverage/types/expected_types.go @@ -3,6 +3,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + oracle "github.com/umee-network/umee/v6/x/oracle/types" ) // AccountKeeper defines the expected account keeper used for leverage simulations (noalias) @@ -31,6 +33,6 @@ type BankKeeper interface { // OracleKeeper defines the expected x/oracle keeper interface. type OracleKeeper interface { - GetExchangeRate(ctx sdk.Context, denom string) (sdk.Dec, error) + GetExchangeRate(ctx sdk.Context, denom string) (oracle.ExchangeRate, error) MedianOfHistoricMedians(ctx sdk.Context, denom string, numStamps uint64) (sdk.Dec, uint32, error) } diff --git a/x/oracle/keeper/grpc_query.go b/x/oracle/keeper/grpc_query.go index 795942eadf..7d297ae7c7 100644 --- a/x/oracle/keeper/grpc_query.go +++ b/x/oracle/keeper/grpc_query.go @@ -52,6 +52,8 @@ func (q querier) ExchangeRates( ctx := sdk.UnwrapSDKContext(goCtx) + // TODO: need to decide if we want to return DecCoins here or list of ExchangeRates with denoms (we + // need the latter for genesis anyway) var exchangeRates sdk.DecCoins if len(req.Denom) > 0 { @@ -60,7 +62,7 @@ func (q querier) ExchangeRates( return nil, err } - exchangeRates = exchangeRates.Add(sdk.NewDecCoinFromDec(req.Denom, exchangeRate)) + exchangeRates = exchangeRates.Add(sdk.NewDecCoinFromDec(req.Denom, exchangeRate.Rate)) } else { q.IterateExchangeRates(ctx, func(denom string, rate sdk.Dec) (stop bool) { exchangeRates = exchangeRates.Add(sdk.NewDecCoinFromDec(denom, rate)) diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index e9e00fe38a..63567d6ba1 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "strings" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -84,6 +83,7 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, symbol string) (types.ExchangeR // GetExchangeRateBase gets the consensus exchange rate of an asset // in the base denom (e.g. ATOM -> uatom) +// TODO: needs to return timestamp as well func (k Keeper) GetExchangeRateBase(ctx sdk.Context, denom string) (sdk.Dec, error) { var symbol string var exponent uint64 @@ -106,7 +106,7 @@ func (k Keeper) GetExchangeRateBase(ctx sdk.Context, denom string) (sdk.Dec, err } powerReduction := ten.Power(exponent) - return exchangeRate.Quo(powerReduction), nil + return exchangeRate.Rate.Quo(powerReduction), nil } // SetExchangeRate sets the consensus exchange rate of USD denominated in the @@ -127,6 +127,7 @@ func (k Keeper) SetExchangeRateWithEvent(ctx sdk.Context, denom string, exchange } // IterateExchangeRates iterates over all USD rates in the store. +// TODO: handler should use ExchangeRate type rather than Dec func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(string, sdk.Dec) bool) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.KeyPrefixExchangeRate) @@ -136,10 +137,10 @@ func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(string, sdk.D for ; iter.Valid(); iter.Next() { key := iter.Key() denom := string(key[prefixLen : len(key)-1]) // -1 to remove the null suffix - dp := sdk.DecProto{} - k.cdc.MustUnmarshal(iter.Value(), &dp) + var er types.ExchangeRate + k.cdc.MustUnmarshal(iter.Value(), &er) - if handler(denom, dp.Dec) { + if handler(denom, er.Rate) { break } } diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index b64871cf59..ca1e934b41 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -337,8 +337,9 @@ type ExchangeRate struct { Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,proto3,stdtime" json:"timestamp"` } -func (m *ExchangeRate) Reset() { *m = ExchangeRate{} } -func (*ExchangeRate) ProtoMessage() {} +func (m *ExchangeRate) Reset() { *m = ExchangeRate{} } +func (m *ExchangeRate) String() string { return proto.CompactTextString(m) } +func (*ExchangeRate) ProtoMessage() {} func (*ExchangeRate) Descriptor() ([]byte, []int) { return fileDescriptor_8893c9e0e94ceb54, []int{7} } @@ -383,75 +384,75 @@ func init() { func init() { proto.RegisterFile("umee/oracle/v1/oracle.proto", fileDescriptor_8893c9e0e94ceb54) } var fileDescriptor_8893c9e0e94ceb54 = []byte{ - // 1081 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0x92, 0x8f, 0xda, 0x63, 0xa7, 0x4d, 0x36, 0x0e, 0xb8, 0x09, 0xf2, 0xa6, 0x8b, 0x28, - 0x39, 0xd0, 0x35, 0x4d, 0xf9, 0x10, 0x3e, 0xd1, 0x25, 0x94, 0x4b, 0x2b, 0x45, 0xdb, 0xa8, 0x48, - 0x5c, 0x56, 0xe3, 0xdd, 0xc9, 0x7a, 0x14, 0xef, 0x8e, 0x35, 0x33, 0xeb, 0x24, 0x17, 0xce, 0x9c, - 0x50, 0x8f, 0x3d, 0xf6, 0x80, 0x38, 0x70, 0x40, 0x42, 0xe2, 0x8f, 0xc8, 0xb1, 0x47, 0xc4, 0x61, - 0x0b, 0xc9, 0x05, 0x71, 0x42, 0xfe, 0x0b, 0xd0, 0x7c, 0xac, 0x3d, 0x6e, 0x22, 0x84, 0xe9, 0xc9, - 0xfb, 0xe6, 0x37, 0xbf, 0xf7, 0x7e, 0xef, 0xcd, 0x7b, 0x4f, 0x06, 0x5b, 0x79, 0x8a, 0x50, 0x87, - 0x50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 0xea, 0xf8, 0xbb, 0x60, - 0xa3, 0x8f, 0x19, 0x27, 0x14, 0x47, 0xa1, 0x1c, 0xa2, 0x72, 0x16, 0x6a, 0x22, 0x89, 0x60, 0xbd, - 0x04, 0x1f, 0x0b, 0x4c, 0x37, 0xbf, 0x07, 0xd6, 0x53, 0x14, 0x63, 0x98, 0xcd, 0x32, 0x80, 0x64, - 0xac, 0x29, 0xc8, 0xbc, 0xff, 0x01, 0x68, 0xa6, 0xf0, 0x04, 0xa7, 0x79, 0x1a, 0x0e, 0x29, 0x8e, - 0x90, 0xa2, 0xb1, 0x56, 0x5d, 0x12, 0x6c, 0x8d, 0xed, 0x0b, 0x48, 0xd2, 0x98, 0x50, 0x55, 0x32, - 0xcc, 0x48, 0xac, 0xd5, 0x50, 0xaa, 0x34, 0xf8, 0x68, 0x1a, 0x8a, 0x75, 0xab, 0xcf, 0x9e, 0x3b, - 0x95, 0x3f, 0x9f, 0x3b, 0x96, 0xfb, 0xb7, 0x05, 0x56, 0xef, 0x8f, 0x92, 0xcf, 0x49, 0x9e, 0x71, - 0x44, 0xf5, 0xa8, 0x13, 0x00, 0xe0, 0x28, 0x31, 0x27, 0xbd, 0xbe, 0x7b, 0xd3, 0x53, 0xab, 0xc2, - 0x2b, 0x57, 0x85, 0xb7, 0xa7, 0x57, 0x85, 0xff, 0x91, 0xa8, 0xfc, 0x5f, 0x85, 0xd3, 0x9c, 0x92, - 0xde, 0x27, 0x29, 0xe6, 0x28, 0x1d, 0xf2, 0xd3, 0x71, 0xe1, 0xac, 0xe9, 0x86, 0x9c, 0xa0, 0xee, - 0xb3, 0x97, 0x8e, 0x15, 0xd4, 0xe0, 0x28, 0xd1, 0x59, 0x1f, 0x01, 0x61, 0x84, 0xac, 0x8f, 0x0f, - 0xb9, 0xdc, 0x0e, 0xff, 0x1a, 0xef, 0x9e, 0x8e, 0xb7, 0x3e, 0xe1, 0xcc, 0x84, 0x5b, 0x9d, 0x86, - 0x93, 0xa0, 0x8a, 0x56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eb, - 0xf7, 0xf3, 0xb6, 0xf5, 0xf4, 0xa2, 0x5d, 0x79, 0x71, 0xd1, 0xae, 0xfc, 0x7a, 0xd1, 0xae, 0x7c, - 0xed, 0x19, 0xea, 0x44, 0x33, 0xdf, 0xc9, 0x10, 0x3f, 0x26, 0xf4, 0x48, 0x1a, 0x9d, 0xd1, 0xc7, - 0x9d, 0x93, 0xf2, 0xff, 0x9d, 0x54, 0xda, 0x5b, 0x96, 0x22, 0xee, 0xfd, 0x13, 0x00, 0x00, 0xff, - 0xff, 0x8b, 0x4c, 0x42, 0xf5, 0xfb, 0x09, 0x00, 0x00, + // 1078 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xbd, 0x6f, 0x1c, 0x45, + 0x14, 0xbf, 0xc5, 0x1f, 0xb9, 0x9b, 0xb3, 0x13, 0x7b, 0x7d, 0x86, 0x8b, 0x8d, 0x6e, 0x9d, 0x45, + 0x04, 0x17, 0x64, 0x8f, 0x38, 0x7c, 0x88, 0xab, 0xc8, 0x62, 0x42, 0x93, 0x48, 0xd6, 0xc6, 0x0a, + 0x12, 0xcd, 0x6a, 0x6e, 0x77, 0xbc, 0x37, 0xf2, 0xee, 0xce, 0x69, 0x66, 0xf6, 0x6c, 0x37, 0xd4, + 0x54, 0x28, 0x65, 0x0a, 0x8a, 0x54, 0x14, 0x14, 0x48, 0x48, 0xfc, 0x11, 0x2e, 0x53, 0x22, 0x8a, + 0x0d, 0xd8, 0x0d, 0xa2, 0x42, 0xf7, 0x17, 0xa0, 0xf9, 0xd8, 0xbb, 0xb9, 0xd8, 0x42, 0x98, 0x54, + 0xb7, 0x6f, 0x7e, 0xf3, 0x7b, 0xef, 0xf7, 0xde, 0xbc, 0xf7, 0x74, 0x60, 0xb3, 0xc8, 0x10, 0xea, + 0x12, 0x0a, 0xa3, 0x14, 0x75, 0x47, 0x77, 0xf5, 0x97, 0x37,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bd, 0x38, 0xef, 0xd4, 0x7e, 0x3d, 0xef, 0xd4, 0xbe, 0xf6, 0x0c, 0x55, + 0xa2, 0x89, 0xef, 0xe4, 0x88, 0x1f, 0x11, 0x7a, 0x28, 0x8d, 0xee, 0xe8, 0xe3, 0xee, 0x71, 0xf5, + 0xbf, 0x4e, 0x2a, 0xec, 0x2f, 0xca, 0xe0, 0xf7, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x93, 0x9a, + 0x24, 0xe5, 0xf3, 0x09, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { diff --git a/x/oracle/types/vote.go b/x/oracle/types/vote.go index b1d1ec3f9f..d3d224c401 100644 --- a/x/oracle/types/vote.go +++ b/x/oracle/types/vote.go @@ -7,8 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "gopkg.in/yaml.v3" - - "github.com/umee-network/umee/v6/x/leverage/types" ) func NewAggregateExchangeRatePrevote( @@ -83,7 +81,7 @@ func ParseExchangeRateTuples(tuplesStr string) (ExchangeRateTuples, error) { return nil, err } if !decCoin.IsPositive() { - return nil, types.ErrInvalidOraclePrice + return nil, fmt.Errorf("exchange rate can't be negative: %s", tupleStr) } denom := strings.ToUpper(denomAmountStr[0])