From 07597e3b1386fcc5f89f788713c0e7045f7873a2 Mon Sep 17 00:00:00 2001 From: Amit Yadav Date: Wed, 17 Jul 2024 12:34:45 +0530 Subject: [PATCH] [Tier]: Add more fields to query (#657) * add more fields * update query * fix * fix * fix --- proto/elys/tier/query.proto | 4 +- x/tier/keeper/portfolio.go | 21 +- x/tier/keeper/query_get_consolidated_price.go | 9 +- x/tier/types/expected_keepers.go | 1 + x/tier/types/query.pb.go | 252 ++++++++++++------ 5 files changed, 196 insertions(+), 91 deletions(-) diff --git a/proto/elys/tier/query.proto b/proto/elys/tier/query.proto index abe9254b4..c95141aac 100644 --- a/proto/elys/tier/query.proto +++ b/proto/elys/tier/query.proto @@ -174,7 +174,9 @@ message QueryGetConsolidatedPriceRequest { } message QueryGetConsolidatedPriceResponse { - string price = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string ammPrice = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string oraclePrice = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + string oraclePriceDec = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } message QueryStakedRequest { diff --git a/x/tier/keeper/portfolio.go b/x/tier/keeper/portfolio.go index 03b9c9d10..047c2067d 100644 --- a/x/tier/keeper/portfolio.go +++ b/x/tier/keeper/portfolio.go @@ -246,24 +246,31 @@ func (k Keeper) RetrieveLeverageLpTotal(ctx sdk.Context, user sdk.AccAddress) sd return totalValue } -func (k Keeper) RetrieveConsolidatedPrice(ctx sdk.Context, denom string) (sdk.Dec, error) { +func (k Keeper) RetrieveConsolidatedPrice(ctx sdk.Context, denom string) (sdk.Dec, sdk.Dec, sdk.Dec) { if denom == ptypes.Eden { denom = ptypes.Elys } - tokenPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, denom) + tokenPriceOracle := k.oracleKeeper.GetAssetPriceFromDenom(ctx, denom) asset, found := k.assetProfileKeeper.GetEntryByDenom(ctx, denom) if !found { - return sdk.ZeroDec(), types.ErrNotFound + tokenPriceOracle = sdk.NewDec(0) } - if tokenPrice.Equal(sdk.ZeroDec()) { - tokenPrice = k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + tokenPriceAmm := k.CalcAmmPrice(ctx, asset.Denom, asset.Decimals) + info, found := k.oracleKeeper.GetAssetInfo(ctx, denom) + tokenPriceOracleDec := sdk.ZeroDec() + if found { + tokenPriceOracleD, found := k.oracleKeeper.GetAssetPrice(ctx, info.Display) + if found { + tokenPriceOracleDec = tokenPriceOracleD.Price + } } - return tokenPrice, nil + + return tokenPriceOracle, tokenPriceAmm, tokenPriceOracleDec } func (k Keeper) CalcAmmPrice(ctx sdk.Context, denom string, decimal uint64) sdk.Dec { usdcDenom, found := k.assetProfileKeeper.GetUsdcDenom(ctx) - if !found { + if !found || denom == usdcDenom { return sdk.ZeroDec() } usdcPrice := k.oracleKeeper.GetAssetPriceFromDenom(ctx, usdcDenom) diff --git a/x/tier/keeper/query_get_consolidated_price.go b/x/tier/keeper/query_get_consolidated_price.go index 6522b0fc9..5126eafe1 100644 --- a/x/tier/keeper/query_get_consolidated_price.go +++ b/x/tier/keeper/query_get_consolidated_price.go @@ -16,12 +16,11 @@ func (k Keeper) GetConsolidatedPrice(goCtx context.Context, req *types.QueryGetC ctx := sdk.UnwrapSDKContext(goCtx) - resp, err := k.RetrieveConsolidatedPrice(ctx, req.Denom) - if err != nil { - return nil, err - } + oracle, amm, oracleDec := k.RetrieveConsolidatedPrice(ctx, req.Denom) return &types.QueryGetConsolidatedPriceResponse{ - Price: resp, + AmmPrice: amm, + OraclePrice: oracle, + OraclePriceDec: oracleDec, }, nil } diff --git a/x/tier/types/expected_keepers.go b/x/tier/types/expected_keepers.go index 06b75e956..2bd29c29c 100644 --- a/x/tier/types/expected_keepers.go +++ b/x/tier/types/expected_keepers.go @@ -35,6 +35,7 @@ type BankKeeper interface { } type OracleKeeper interface { + GetAssetInfo(ctx sdk.Context, denom string) (val oracletypes.AssetInfo, found bool) GetAssetPrice(ctx sdk.Context, asset string) (oracletypes.Price, bool) GetAssetPriceFromDenom(ctx sdk.Context, denom string) sdk.Dec GetPriceFeeder(ctx sdk.Context, feeder string) (val oracletypes.PriceFeeder, found bool) diff --git a/x/tier/types/query.pb.go b/x/tier/types/query.pb.go index 2fd133ed1..4cdc24a84 100644 --- a/x/tier/types/query.pb.go +++ b/x/tier/types/query.pb.go @@ -941,7 +941,9 @@ func (m *QueryGetConsolidatedPriceRequest) GetDenom() string { } type QueryGetConsolidatedPriceResponse struct { - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + AmmPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=ammPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ammPrice"` + OraclePrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=oraclePrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oraclePrice"` + OraclePriceDec github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=oraclePriceDec,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oraclePriceDec"` } func (m *QueryGetConsolidatedPriceResponse) Reset() { *m = QueryGetConsolidatedPriceResponse{} } @@ -1090,79 +1092,81 @@ func init() { func init() { proto.RegisterFile("elys/tier/query.proto", fileDescriptor_461504ebf74c9a97) } var fileDescriptor_461504ebf74c9a97 = []byte{ - // 1146 bytes of a gzipped FileDescriptorProto + // 1182 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0xc7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x7f, 0x9f, 0x57, 0xa7, 0xbe, 0xb8, 0x93, 0x30, 0xcf, 0x6c, - 0xaa, 0x6f, 0x78, 0x32, 0xe6, 0xa1, 0x9d, 0x59, 0xf6, 0xcf, 0x78, 0xf3, 0x79, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x87, 0x96, 0x3f, 0x7b, 0xd0, 0x0f, 0x00, 0x00, + 0x14, 0xc7, 0xe3, 0xb4, 0x09, 0xcd, 0xdb, 0xd2, 0xaa, 0x43, 0x5a, 0x52, 0x93, 0x6e, 0x13, 0x07, + 0x92, 0x34, 0x3f, 0xec, 0x66, 0x53, 0x41, 0x00, 0x01, 0xca, 0x0f, 0x35, 0x02, 0x45, 0x68, 0x59, + 0x10, 0x07, 0x0e, 0x2c, 0xb3, 0xf6, 0xe0, 0x5a, 0xb1, 0x3d, 0x8e, 0x3d, 0x9b, 0x12, 0x55, 0xb9, + 0xf4, 0x82, 0x10, 0x12, 0x20, 0x38, 0x20, 0x24, 0xc4, 0x7f, 0xc0, 0x81, 0xff, 0xa2, 0xc7, 0x4a, + 0x5c, 0x10, 0x87, 0x0a, 0x25, 0x1c, 0xf9, 0x23, 0x90, 0x67, 0xc6, 0x8e, 0xbd, 0xf6, 0x7a, 0xd3, + 0x28, 0xa7, 0xac, 0xc7, 0xef, 0x7d, 0xdf, 0x67, 0xde, 0xcc, 0x78, 0xbe, 0x81, 0xeb, 0xc4, 0x3d, + 0x88, 0x0c, 0xe6, 0x90, 0xd0, 0xd8, 0xeb, 0x92, 0xf0, 0x40, 0x0f, 0x42, 0xca, 0x28, 0x1a, 0x8b, + 0x87, 0xf5, 0x78, 0x58, 0x1d, 0xb7, 0xa9, 0x4d, 0xf9, 0xa8, 0x11, 0xff, 0x12, 0x01, 0xea, 0xa4, + 0x4d, 0xa9, 0xed, 0x12, 0x03, 0x07, 0x8e, 0x81, 0x7d, 0x9f, 0x32, 0xcc, 0x1c, 0xea, 0x47, 0xf2, + 0xed, 0x82, 0x49, 0x23, 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 0xcf, 0x70, 0xa8, 0x4b, 0xa7, 0x0b, 0x96, 0xd0, 0xef, 0x72, 0xe8, + 0x35, 0xf4, 0x7a, 0x15, 0xb4, 0x99, 0x49, 0xcf, 0xd3, 0xa3, 0x7d, 0x18, 0x15, 0x5b, 0xb5, 0x78, + 0xd9, 0xe4, 0xee, 0xef, 0xe2, 0x65, 0x93, 0xbf, 0xb3, 0xb5, 0x65, 0x0e, 0x32, 0x87, 0x5e, 0xab, + 0xde, 0xdd, 0x72, 0x15, 0x37, 0x36, 0x9f, 0x1c, 0xd5, 0x95, 0xa7, 0x47, 0x75, 0xe5, 0x9f, 0xa3, + 0xba, 0xf2, 0xc3, 0x71, 0x7d, 0xe8, 0xe9, 0x71, 0x7d, 0xe8, 0xaf, 0xe3, 0xfa, 0xd0, 0x67, 0x77, + 0x32, 0x97, 0x67, 0x51, 0xea, 0x2b, 0x21, 0xc6, 0xef, 0xd0, 0xce, 0x28, 0xff, 0x57, 0x7e, 0xf5, + 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x27, 0x35, 0x1e, 0x81, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2371,9 +2375,29 @@ func (m *QueryGetConsolidatedPriceResponse) MarshalToSizedBuffer(dAtA []byte) (i var l int _ = l { - size := m.Price.Size() + size := m.OraclePriceDec.Size() i -= size - if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.OraclePriceDec.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.OraclePrice.Size() + i -= size + if _, err := m.OraclePrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.AmmPrice.Size() + i -= size + if _, err := m.AmmPrice.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintQuery(dAtA, i, uint64(size)) @@ -2755,7 +2779,11 @@ func (m *QueryGetConsolidatedPriceResponse) Size() (n int) { } var l int _ = l - l = m.Price.Size() + l = m.AmmPrice.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.OraclePrice.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.OraclePriceDec.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -4653,7 +4681,75 @@ func (m *QueryGetConsolidatedPriceResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AmmPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AmmPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OraclePrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OraclePrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OraclePriceDec", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4681,7 +4777,7 @@ func (m *QueryGetConsolidatedPriceResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OraclePriceDec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex