From 4d4e76db06253822eccbaf7c751d16a8dd096a2c Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 18 Apr 2024 23:06:01 +0200 Subject: [PATCH 1/6] feat: leverage fees --- proto/umee/leverage/v1/leverage.proto | 8 ++ x/leverage/keeper/interest.go | 17 ++- x/leverage/keeper/oracle.go | 19 ++- x/leverage/types/leverage.pb.go | 185 +++++++++++++++++--------- 4 files changed, 147 insertions(+), 82 deletions(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index 4637a0dab5..8c3e0a6601 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -70,6 +70,14 @@ message Params { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"direct_liquidation_fee\"" ]; + // Burn Auction Factor determines the portion of interest accrued on + // borrows that is sent to the auction module for the rewards auction. + // Valid values: 0-1. + string burn_auction_factor = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"oracle_reward_factor\"" + ]; } // Token defines a token, along with its metadata and parameters, in the Umee diff --git a/x/leverage/keeper/interest.go b/x/leverage/keeper/interest.go index 2e9b19a478..7d5d1a06de 100644 --- a/x/leverage/keeper/interest.go +++ b/x/leverage/keeper/interest.go @@ -61,7 +61,8 @@ func (k Keeper) DeriveSupplyAPY(ctx sdk.Context, denom string) sdk.Dec { borrowRate := k.DeriveBorrowAPY(ctx, denom) utilization := k.SupplyUtilization(ctx, denom) - reduction := k.GetParams(ctx).OracleRewardFactor.Add(token.ReserveFactor) + params := k.GetParams(ctx) + reduction := params.OracleRewardFactor.Add(params.BurnAuctionFactor).Add(token.ReserveFactor) // supply APY = borrow APY * utilization, reduced by reserve factor and oracle reward factor return borrowRate.Mul(utilization).Mul(sdk.OneDec().Sub(reduction)) @@ -106,10 +107,11 @@ func (k Keeper) AccrueAllInterest(ctx sdk.Context) error { // fetch required parameters tokens := k.GetAllRegisteredTokens(ctx) - oracleRewardFactor := k.GetParams(ctx).OracleRewardFactor + params := k.GetParams(ctx) // create sdk.Coins objects to track oracle rewards, new reserves, and total interest accrued oracleRewards := sdk.NewCoins() + auctionRewards := sdk.NewCoins() newReserves := sdk.NewCoins() totalInterest := sdk.NewCoins() @@ -148,10 +150,13 @@ func (k Keeper) AccrueAllInterest(ctx sdk.Context) error { )) } - // calculate oracle rewards accrued for this denom oracleRewards = oracleRewards.Add(sdk.NewCoin( token.BaseDenom, - interestAccrued.Mul(oracleRewardFactor).TruncateInt(), + interestAccrued.Mul(params.OracleRewardFactor).TruncateInt(), + )) + auctionRewards = auctionRewards.Add(sdk.NewCoin( + token.BaseDenom, + interestAccrued.Mul(params.BurnAuctionFactor).TruncateInt(), )) } @@ -162,12 +167,10 @@ func (k Keeper) AccrueAllInterest(ctx sdk.Context) error { } } - // fund oracle reward pool - if err := k.FundOracle(ctx, oracleRewards); err != nil { + if err := k.FundOracleAndAuction(ctx, oracleRewards, auctionRewards); err != nil { return err } - // set LastInterestTime err := k.setLastInterestTime(ctx, currentTime) if err != nil { return err diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index 2277e84851..dd671ab86e 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -250,30 +250,29 @@ func (k Keeper) PriceRatio(ctx sdk.Context, fromDenom, toDenom string, mode type return exponent(p1, powerDifference).Quo(p2), nil } -// FundOracle transfers requested coins to the oracle module account, as +// FundOracleAndAuciton transfers requested coins to the oracle module account, as // long as the leverage module account has sufficient unreserved assets. -func (k Keeper) FundOracle(ctx sdk.Context, requested sdk.Coins) error { - rewards := sdk.Coins{} +func (k Keeper) FundOracleAndAuciton(ctx sdk.Context, requested sdk.Coins) error { + toOracle := sdk.Coins{} + toAuction := sdk.Coins{} // reduce rewards if they exceed unreserved module balance for _, coin := range requested { amountToTransfer := sdk.MinInt(coin.Amount, k.AvailableLiquidity(ctx, coin.Denom)) - if amountToTransfer.IsPositive() { - rewards = rewards.Add(sdk.NewCoin(coin.Denom, amountToTransfer)) + toOracle = toOracle.Add(sdk.NewCoin(coin.Denom, amountToTransfer)) } } // This action is not caused by a message so we need to make an event here k.Logger(ctx).Debug( "funded oracle", - "amount", rewards, + "amount", toOracle, ) - sdkutil.Emit(&ctx, &types.EventFundOracle{Assets: rewards}) + sdkutil.Emit(&ctx, &types.EventFundOracle{Assets: toOracle}) - // Send rewards - if !rewards.IsZero() { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, oracletypes.ModuleName, rewards) + if !toOracle.IsZero() { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, oracletypes.ModuleName, toOracle) } return nil diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index 738df899a4..38cd842c30 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -66,6 +66,10 @@ type Params struct { // uTokens as liquidation rewards. // Valid values: 0-1. DirectLiquidationFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=direct_liquidation_fee,json=directLiquidationFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"direct_liquidation_fee" yaml:"direct_liquidation_fee"` + // Burn Auction Factor determines the portion of interest accrued on + // borrows that is sent to the auction module for the rewards auction. + // Valid values: 0-1. + BurnAuctionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=burn_auction_factor,json=burnAuctionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"burn_auction_factor" yaml:"oracle_reward_factor"` } func (m *Params) Reset() { *m = Params{} } @@ -354,71 +358,73 @@ func init() { func init() { proto.RegisterFile("umee/leverage/v1/leverage.proto", fileDescriptor_8cb1bf9ea641ecc6) } var fileDescriptor_8cb1bf9ea641ecc6 = []byte{ - // 1013 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x26, 0x4d, 0x48, 0xa6, 0x4d, 0xec, 0x6c, 0x7e, 0x74, 0x45, 0x83, 0x1d, 0x8d, 0x04, - 0xca, 0xa5, 0x36, 0x15, 0x88, 0x43, 0x6e, 0x38, 0x55, 0x68, 0x50, 0x53, 0xca, 0xb8, 0xa8, 0x12, - 0x1c, 0x56, 0xe3, 0xf5, 0xab, 0x3d, 0xf2, 0xec, 0x8e, 0xd9, 0x19, 0xff, 0xca, 0x85, 0x03, 0xe2, - 0xc4, 0x05, 0x71, 0x47, 0xe2, 0x4f, 0xe1, 0x98, 0x63, 0x8f, 0x88, 0x83, 0x05, 0xc9, 0x85, 0x03, - 0x17, 0xf2, 0x17, 0xa0, 0x9d, 0x59, 0x7b, 0xd7, 0xe9, 0x36, 0xd2, 0xca, 0xe1, 0x94, 0x9d, 0xef, - 0x3d, 0x7f, 0xdf, 0xf7, 0x66, 0xde, 0xec, 0xcb, 0xa2, 0x72, 0xcf, 0x07, 0xa8, 0x72, 0xe8, 0x43, - 0x48, 0x5b, 0x50, 0xed, 0x3f, 0x9a, 0x3e, 0x57, 0xba, 0xa1, 0x50, 0xc2, 0x2e, 0x46, 0x09, 0x95, - 0x29, 0xd8, 0x7f, 0xf4, 0xee, 0x76, 0x4b, 0xb4, 0x84, 0x0e, 0x56, 0xa3, 0x27, 0x93, 0x87, 0x7f, - 0x5b, 0x46, 0x2b, 0xcf, 0x69, 0x48, 0x7d, 0x69, 0xff, 0x62, 0xa1, 0x92, 0x27, 0xfc, 0x2e, 0x07, - 0x05, 0x2e, 0x67, 0xdf, 0xf6, 0x58, 0x93, 0x2a, 0x26, 0x02, 0x57, 0xb5, 0x43, 0x90, 0x6d, 0xc1, - 0x9b, 0xce, 0xe2, 0xbe, 0x75, 0xb0, 0x56, 0x7b, 0x79, 0x3e, 0x2e, 0x2f, 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de, 0x94, 0x3a, 0xa8, 0xa8, 0x66, 0x1a, 0x3d, 0x4b, 0xc7, 0xda, 0x5f, 0x8a, 0x6a, - 0x36, 0xab, 0xec, 0x9a, 0x17, 0xff, 0xef, 0x9a, 0x97, 0x6e, 0xbb, 0xe6, 0xda, 0xb3, 0xf3, 0xbf, - 0x4a, 0x0b, 0xe7, 0x17, 0x25, 0xeb, 0xf5, 0x45, 0xc9, 0xfa, 0xf3, 0xa2, 0x64, 0xfd, 0x74, 0x59, - 0x5a, 0x78, 0x7d, 0x59, 0x5a, 0xf8, 0xfd, 0xb2, 0xb4, 0xf0, 0xf5, 0x87, 0x29, 0x85, 0xe8, 0x5b, - 0xe4, 0x61, 0x00, 0x6a, 0x20, 0xc2, 0x8e, 0x5e, 0x54, 0xfb, 0x9f, 0x54, 0x87, 0xc9, 0xe7, 0x8b, - 0xd6, 0x6b, 0xac, 0xe8, 0x2f, 0x92, 0x8f, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x19, 0x3b, - 0xa8, 0xdc, 0x0c, 0x00, 0x00, + // 1042 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x26, 0xad, 0xbf, 0xc9, 0xb4, 0x89, 0x9d, 0xcd, 0x8f, 0xae, 0xbe, 0x0d, 0x76, 0x34, + 0x12, 0x28, 0x97, 0xc6, 0x54, 0x20, 0x0e, 0xb9, 0x35, 0xa9, 0x42, 0x83, 0x9a, 0x52, 0x26, 0x45, + 0x95, 0xe0, 0xb0, 0x1a, 0xaf, 0x5f, 0xed, 0x91, 0x77, 0x77, 0xcc, 0xcc, 0xd8, 0x71, 0x22, 0x21, + 0x0e, 0x88, 0x13, 0x17, 0xc4, 0x1d, 0x89, 0xff, 0x84, 0x6b, 0x8e, 0x3d, 0x22, 0x0e, 0x16, 0x24,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 0x51, 0x9d, 0xf9, 0xfd, 0xa2, 0x3a, 0xf3, 0xd5, 0x87, 0x19, 0x05, 0xfd, 0x29, 0xf4, 0x20, 0x06, + 0x75, 0xcc, 0x45, 0xc7, 0xbc, 0xd4, 0xfb, 0x9f, 0xd4, 0x07, 0xe9, 0xd7, 0x93, 0xd1, 0x6b, 0x94, + 0xcc, 0x07, 0xd1, 0x47, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x77, 0x5d, 0x6b, 0x5b, 0x0d, + 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -455,6 +461,9 @@ func (this *Params) Equal(that interface{}) bool { if !this.DirectLiquidationFee.Equal(that1.DirectLiquidationFee) { return false } + if !this.BurnAuctionFactor.Equal(that1.BurnAuctionFactor) { + return false + } return true } func (this *Token) Equal(that interface{}) bool { @@ -623,6 +632,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.BurnAuctionFactor.Size() + i -= size + if _, err := m.BurnAuctionFactor.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLeverage(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a { size := m.DirectLiquidationFee.Size() i -= size @@ -1017,6 +1036,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovLeverage(uint64(l)) l = m.DirectLiquidationFee.Size() n += 1 + l + sovLeverage(uint64(l)) + l = m.BurnAuctionFactor.Size() + n += 1 + l + sovLeverage(uint64(l)) return n } @@ -1321,6 +1342,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnAuctionFactor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLeverage + } + 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 ErrInvalidLengthLeverage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLeverage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BurnAuctionFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipLeverage(dAtA[iNdEx:]) From 88eba70c0157ca72a76e7d76dbd39d411dd32fe6 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 18 Apr 2024 23:49:11 +0200 Subject: [PATCH 2/6] fund modules --- x/leverage/keeper/interest.go | 2 +- x/leverage/keeper/oracle.go | 50 +++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/x/leverage/keeper/interest.go b/x/leverage/keeper/interest.go index 7d5d1a06de..9261994319 100644 --- a/x/leverage/keeper/interest.go +++ b/x/leverage/keeper/interest.go @@ -167,7 +167,7 @@ func (k Keeper) AccrueAllInterest(ctx sdk.Context) error { } } - if err := k.FundOracleAndAuction(ctx, oracleRewards, auctionRewards); err != nil { + if err := k.fundModules(ctx, oracleRewards, auctionRewards); err != nil { return err } diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index dd671ab86e..7989c32ac0 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -4,10 +4,12 @@ import ( "strings" "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/umee-network/umee/v6/util/coin" "github.com/umee-network/umee/v6/util/sdkutil" + "github.com/umee-network/umee/v6/x/auction" "github.com/umee-network/umee/v6/x/leverage/types" oracletypes "github.com/umee-network/umee/v6/x/oracle/types" ) @@ -250,29 +252,49 @@ func (k Keeper) PriceRatio(ctx sdk.Context, fromDenom, toDenom string, mode type return exponent(p1, powerDifference).Quo(p2), nil } -// FundOracleAndAuciton transfers requested coins to the oracle module account, as +// fundModules transfers requested coins to other module account, as // long as the leverage module account has sufficient unreserved assets. -func (k Keeper) FundOracleAndAuciton(ctx sdk.Context, requested sdk.Coins) error { - toOracle := sdk.Coins{} - toAuction := sdk.Coins{} +func (k Keeper) fundModules(ctx sdk.Context, toOracle, toAuction sdk.Coins) error { + toOracleCheck := sdk.Coins{} + toAuctionCheck := sdk.Coins{} + available := map[string]sdkmath.Int{} // reduce rewards if they exceed unreserved module balance - for _, coin := range requested { - amountToTransfer := sdk.MinInt(coin.Amount, k.AvailableLiquidity(ctx, coin.Denom)) - if amountToTransfer.IsPositive() { - toOracle = toOracle.Add(sdk.NewCoin(coin.Denom, amountToTransfer)) + for _, o := range toOracle { + avl := k.AvailableLiquidity(ctx, o.Denom) + amt := sdk.MinInt(o.Amount, avl) + if amt.IsPositive() { + toOracleCheck = toOracleCheck.Add(sdk.NewCoin(o.Denom, amt)) + avl.Sub(amt) } + available[o.Denom] = avl + } + for _, o := range toAuction { + avl, ok := available[o.Denom] + if !ok { + avl = k.AvailableLiquidity(ctx, o.Denom) + } + amt := sdk.MinInt(o.Amount, avl) + if amt.IsPositive() { + toAuctionCheck = toAuctionCheck.Add(sdk.NewCoin(o.Denom, amt)) + avl.Sub(amt) + } + available[o.Denom] = avl } - // This action is not caused by a message so we need to make an event here + // This action is caused by end blocker, not a message handler, so we need to emit an event k.Logger(ctx).Debug( - "funded oracle", - "amount", toOracle, + "funded ", + "to oracle", toOracleCheck, + "to auction", toAuctionCheck, ) - sdkutil.Emit(&ctx, &types.EventFundOracle{Assets: toOracle}) + sdkutil.Emit(&ctx, &types.EventFundOracle{Assets: toOracleCheck}) - if !toOracle.IsZero() { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, oracletypes.ModuleName, toOracle) + if !toOracleCheck.IsZero() { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, oracletypes.ModuleName, toOracleCheck) + } + if !toOracleCheck.IsZero() { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.ModuleName, toOracleCheck) } return nil From 272aedbe760690338c011aa914e7f7eb06044d75 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 18 Apr 2024 23:54:08 +0200 Subject: [PATCH 3/6] events --- proto/umee/leverage/v1/events.proto | 5 + x/leverage/keeper/oracle.go | 13 +- x/leverage/types/events.pb.go | 260 +++++++++++++++++++++++----- 3 files changed, 231 insertions(+), 47 deletions(-) diff --git a/proto/umee/leverage/v1/events.proto b/proto/umee/leverage/v1/events.proto index 3b9eaf7736..117ac2918b 100644 --- a/proto/umee/leverage/v1/events.proto +++ b/proto/umee/leverage/v1/events.proto @@ -108,3 +108,8 @@ message EventFundOracle { // Assets sent to oracle module repeated cosmos.base.v1beta1.Coin assets = 1 [(gogoproto.nullable) = false]; } + +// EventFundAuction is emitted when sending rewards to auction module +message EventFundAuction { + repeated cosmos.base.v1beta1.Coin assets = 1 [(gogoproto.nullable) = false]; +} diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index 7989c32ac0..b721dcf48b 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -288,13 +288,16 @@ func (k Keeper) fundModules(ctx sdk.Context, toOracle, toAuction sdk.Coins) erro "to oracle", toOracleCheck, "to auction", toAuctionCheck, ) - sdkutil.Emit(&ctx, &types.EventFundOracle{Assets: toOracleCheck}) - + send := k.bankKeeper.SendCoinsFromModuleToModule if !toOracleCheck.IsZero() { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, oracletypes.ModuleName, toOracleCheck) + sdkutil.Emit(&ctx, &types.EventFundOracle{Assets: toOracleCheck}) + if err := send(ctx, types.ModuleName, oracletypes.ModuleName, toOracleCheck); err != nil { + return err + } } - if !toOracleCheck.IsZero() { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.ModuleName, toOracleCheck) + if !toAuctionCheck.IsZero() { + sdkutil.Emit(&ctx, &types.EventFundAuction{Assets: toOracleCheck}) + return send(ctx, types.ModuleName, auction.ModuleName, toAuctionCheck) } return nil diff --git a/x/leverage/types/events.pb.go b/x/leverage/types/events.pb.go index 03065ec232..610e0a47bc 100644 --- a/x/leverage/types/events.pb.go +++ b/x/leverage/types/events.pb.go @@ -487,6 +487,44 @@ func (m *EventFundOracle) XXX_DiscardUnknown() { var xxx_messageInfo_EventFundOracle proto.InternalMessageInfo +// EventFundAuction is emitted when sending rewards to auction module +type EventFundAuction struct { + Assets []types.Coin `protobuf:"bytes,1,rep,name=assets,proto3" json:"assets"` +} + +func (m *EventFundAuction) Reset() { *m = EventFundAuction{} } +func (m *EventFundAuction) String() string { return proto.CompactTextString(m) } +func (*EventFundAuction) ProtoMessage() {} +func (*EventFundAuction) Descriptor() ([]byte, []int) { + return fileDescriptor_aaf62b4902d7471c, []int{11} +} +func (m *EventFundAuction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventFundAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventFundAuction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventFundAuction) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventFundAuction.Merge(m, src) +} +func (m *EventFundAuction) XXX_Size() int { + return m.Size() +} +func (m *EventFundAuction) XXX_DiscardUnknown() { + xxx_messageInfo_EventFundAuction.DiscardUnknown(m) +} + +var xxx_messageInfo_EventFundAuction proto.InternalMessageInfo + func init() { proto.RegisterType((*EventSupply)(nil), "umee.leverage.v1.EventSupply") proto.RegisterType((*EventWithdraw)(nil), "umee.leverage.v1.EventWithdraw") @@ -499,53 +537,55 @@ func init() { proto.RegisterType((*EventRepayBadDebt)(nil), "umee.leverage.v1.EventRepayBadDebt") proto.RegisterType((*EventReservesExhausted)(nil), "umee.leverage.v1.EventReservesExhausted") proto.RegisterType((*EventFundOracle)(nil), "umee.leverage.v1.EventFundOracle") + proto.RegisterType((*EventFundAuction)(nil), "umee.leverage.v1.EventFundAuction") } func init() { proto.RegisterFile("umee/leverage/v1/events.proto", fileDescriptor_aaf62b4902d7471c) } var fileDescriptor_aaf62b4902d7471c = []byte{ - // 647 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0xcb, 0x6e, 0xd4, 0x3c, - 0x14, 0xc7, 0xc7, 0x33, 0xf3, 0x55, 0xad, 0xfb, 0xf5, 0x42, 0x54, 0xa1, 0xb4, 0x82, 0x50, 0xb2, - 0xea, 0xa6, 0x09, 0xe5, 0x2e, 0xb1, 0x40, 0x9d, 0x5e, 0x04, 0x15, 0x02, 0x69, 0xba, 0x40, 0x62, - 0x33, 0x72, 0xe2, 0xa3, 0x8c, 0xd5, 0x24, 0x0e, 0xb6, 0x93, 0x5e, 0xd8, 0x80, 0x78, 0x01, 0xde, - 0x80, 0x87, 0x00, 0x1e, 0x80, 0x5d, 0x97, 0x15, 0x2b, 0x16, 0x08, 0x41, 0xfb, 0x22, 0x28, 0x4e, - 0x3a, 0x19, 0x56, 0xa4, 0x59, 0xc0, 0x2e, 0x3e, 0xfe, 0xff, 0xcf, 0xf9, 0x1d, 0xfb, 0x44, 0xc6, - 0x57, 0xd3, 0x08, 0xc0, 0x0d, 0x21, 0x03, 0x41, 0x02, 0x70, 0xb3, 0x35, 0x17, 0x32, 0x88, 0x95, - 0x74, 0x12, 0xc1, 0x15, 0x37, 0xe6, 0xf3, 0x6d, 0xe7, 0x7c, 0xdb, 0xc9, 0xd6, 0x96, 0x2c, 0x9f, - 0xcb, 0x88, 0x4b, 0xd7, 0x23, 0x32, 0x97, 0x7b, 0xa0, 0xc8, 0x9a, 0xeb, 0x73, 0x16, 0x17, 0x8e, - 0xa5, 0xc5, 0x62, 0x7f, 0xa0, 0x57, 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a3, 0x3e, 0x89, 0x6d, 0x3c, 0x1b, 0x71, 0x9a, 0x86, 0x30, 0xf0, 0x48, 0x48, 0x62, - 0x1f, 0xea, 0xce, 0xd0, 0x4c, 0x61, 0xeb, 0x15, 0xae, 0xb1, 0x4b, 0x92, 0x66, 0xb7, 0x5e, 0x86, - 0x91, 0xc1, 0xde, 0xc1, 0x73, 0xfa, 0x80, 0xb6, 0xd3, 0x98, 0x3e, 0x13, 0xc4, 0x0f, 0x21, 0xff, - 0x27, 0xf5, 0xe9, 0x49, 0x13, 0xd5, 0xbb, 0xf2, 0x52, 0xde, 0x7b, 0x7a, 0xfc, 0xd3, 0x6a, 0x1d, - 0x9f, 0x5a, 0xe8, 0xe4, 0xd4, 0x42, 0x3f, 0x4e, 0x2d, 0xf4, 0xee, 0xcc, 0x6a, 0x9d, 0x9c, 0x59, - 0xad, 0xaf, 0x67, 0x56, 0xeb, 0xc5, 0x8d, 0x80, 0xa9, 0x61, 0xea, 0x39, 0x3e, 0x8f, 0xdc, 0xfc, - 0x41, 0x5e, 0x8d, 0x41, 0xed, 0x73, 0xb1, 0xa7, 0x17, 0x6e, 0x76, 0xd7, 0x3d, 0xa8, 0x5e, 0x70, - 0x75, 0x98, 0x80, 0xf4, 0x26, 0xf4, 0xdb, 0x7a, 0xeb, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe2, - 0x20, 0xab, 0xaf, 0xdf, 0x07, 0x00, 0x00, + // 660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0xcb, 0x6e, 0xd4, 0x30, + 0x14, 0x86, 0xc7, 0x33, 0x43, 0xd5, 0xba, 0xf4, 0x42, 0x54, 0xa1, 0xb4, 0x82, 0x50, 0xb2, 0xea, + 0xa6, 0x09, 0xe5, 0x2e, 0xb1, 0x40, 0x9d, 0x5e, 0x04, 0x05, 0x81, 0x34, 0x5d, 0x20, 0xb1,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, 0xf4, 0xf3, 0xd8, 0x41, 0xef, 0x4f, 0x9c, 0xc6, 0xd1, 0x89, 0xd3, 0xf8, 0x76, + 0xe2, 0x34, 0x5e, 0xde, 0x88, 0x98, 0xee, 0xa7, 0x81, 0x17, 0x8a, 0x81, 0x9f, 0xdd, 0xee, 0xcb, + 0x1c, 0xf4, 0xae, 0x90, 0x3b, 0x66, 0xe1, 0x0f, 0xef, 0xfa, 0x7b, 0xe5, 0xe7, 0x80, 0xde, 0x4f, + 0x40, 0x05, 0x63, 0xe6, 0xa2, 0xbe, 0xf5, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x56, 0x89, 0x02, 0x0b, + 0x2c, 0x08, 0x00, 0x00, } func (m *EventSupply) Marshal() (dAtA []byte, err error) { @@ -1053,6 +1093,43 @@ func (m *EventFundOracle) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventFundAuction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventFundAuction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventFundAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Assets) > 0 { + for iNdEx := len(m.Assets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Assets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -1253,6 +1330,21 @@ func (m *EventFundOracle) Size() (n int) { return n } +func (m *EventFundAuction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Assets) > 0 { + for _, e := range m.Assets { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2698,6 +2790,90 @@ func (m *EventFundOracle) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventFundAuction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventFundAuction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventFundAuction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Assets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Assets = append(m.Assets, types.Coin{}) + if err := m.Assets[len(m.Assets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 00f4d60a63a439b3684a6cad36ff19705f47043e Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 19 Apr 2024 14:40:59 +0200 Subject: [PATCH 4/6] rename and leverage genesis --- proto/umee/leverage/v1/leverage.proto | 4 +- x/leverage/keeper/interest.go | 4 +- x/leverage/types/leverage.pb.go | 149 +++++++++++++------------- x/leverage/types/params.go | 1 + 4 files changed, 79 insertions(+), 79 deletions(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index 8c3e0a6601..e6ed882146 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -70,10 +70,10 @@ message Params { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"direct_liquidation_fee\"" ]; - // Burn Auction Factor determines the portion of interest accrued on + // Rewards Auction Factor determines the portion of interest accrued on // borrows that is sent to the auction module for the rewards auction. // Valid values: 0-1. - string burn_auction_factor = 7 [ + string rewards_auction_factor = 7 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"oracle_reward_factor\"" diff --git a/x/leverage/keeper/interest.go b/x/leverage/keeper/interest.go index 9261994319..2134c0db38 100644 --- a/x/leverage/keeper/interest.go +++ b/x/leverage/keeper/interest.go @@ -62,7 +62,7 @@ func (k Keeper) DeriveSupplyAPY(ctx sdk.Context, denom string) sdk.Dec { borrowRate := k.DeriveBorrowAPY(ctx, denom) utilization := k.SupplyUtilization(ctx, denom) params := k.GetParams(ctx) - reduction := params.OracleRewardFactor.Add(params.BurnAuctionFactor).Add(token.ReserveFactor) + reduction := params.OracleRewardFactor.Add(params.RewardsAuctionFactor).Add(token.ReserveFactor) // supply APY = borrow APY * utilization, reduced by reserve factor and oracle reward factor return borrowRate.Mul(utilization).Mul(sdk.OneDec().Sub(reduction)) @@ -156,7 +156,7 @@ func (k Keeper) AccrueAllInterest(ctx sdk.Context) error { )) auctionRewards = auctionRewards.Add(sdk.NewCoin( token.BaseDenom, - interestAccrued.Mul(params.BurnAuctionFactor).TruncateInt(), + interestAccrued.Mul(params.RewardsAuctionFactor).TruncateInt(), )) } diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index 38cd842c30..79d4f87ada 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -66,10 +66,10 @@ type Params struct { // uTokens as liquidation rewards. // Valid values: 0-1. DirectLiquidationFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=direct_liquidation_fee,json=directLiquidationFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"direct_liquidation_fee" yaml:"direct_liquidation_fee"` - // Burn Auction Factor determines the portion of interest accrued on + // Rewards Auction Factor determines the portion of interest accrued on // borrows that is sent to the auction module for the rewards auction. // Valid values: 0-1. - BurnAuctionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=burn_auction_factor,json=burnAuctionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"burn_auction_factor" yaml:"oracle_reward_factor"` + RewardsAuctionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=rewards_auction_factor,json=rewardsAuctionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rewards_auction_factor" yaml:"oracle_reward_factor"` } func (m *Params) Reset() { *m = Params{} } @@ -358,73 +358,72 @@ func init() { func init() { proto.RegisterFile("umee/leverage/v1/leverage.proto", fileDescriptor_8cb1bf9ea641ecc6) } var fileDescriptor_8cb1bf9ea641ecc6 = []byte{ - // 1042 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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0x17, 0x3b, 0x84, 0x9c, 0x79, - 0x17, 0x5c, 0x3f, 0xee, 0x8a, 0x0a, 0xe4, 0x8e, 0xb3, 0x64, 0x53, 0xfe, 0x75, 0x50, 0x39, 0xbb, - 0x29, 0x47, 0xa0, 0x74, 0xce, 0x54, 0x3f, 0x4b, 0xcf, 0xd9, 0x9c, 0xd3, 0x39, 0xdb, 0xb7, 0xfc, - 0x9c, 0x67, 0xdf, 0x75, 0xce, 0x73, 0x37, 0x9d, 0xf3, 0xee, 0xb3, 0xb3, 0xbf, 0xaa, 0x33, 0x67, - 0xe7, 0x55, 0xe7, 0xf5, 0x79, 0xd5, 0xf9, 0xf3, 0xbc, 0xea, 0xfc, 0x74, 0x51, 0x9d, 0x79, 0x7d, - 0x51, 0x9d, 0xf9, 0xfd, 0xa2, 0x3a, 0xf3, 0xd5, 0x87, 0x19, 0x05, 0xfd, 0x29, 0xf4, 0x20, 0x06, - 0x75, 0xcc, 0x45, 0xc7, 0xbc, 0xd4, 0xfb, 0x9f, 0xd4, 0x07, 0xe9, 0xd7, 0x93, 0xd1, 0x6b, 0x94, - 0xcc, 0x07, 0xd1, 0x47, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x77, 0x5d, 0x6b, 0x5b, 0x0d, - 0x00, 0x00, + // 1038 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x41, 0x4f, 0x1b, 0x47, + 0x14, 0x66, 0x21, 0x71, 0x61, 0x12, 0xb0, 0x59, 0x0c, 0x59, 0x35, 0xd4, 0x46, 0x23, 0xb5, 0xe2, + 0x12, 0xdc, 0xa8, 0x55, 0x0f, 0xdc, 0x02, 0x11, 0x0d, 0x55, 0x48, 0xd3, 0x21, 0x55, 0xa4, 0xf6, + 0xb0, 0x1a, 0xaf, 0x5f, 0xec, 0x91, 0x67, 0x77, 0xdc, 0x9d, 0xb1, 0x31, 0x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0xbc, 0x3e, + 0xab, 0x39, 0x7f, 0x9d, 0xd5, 0x9c, 0x9f, 0xcf, 0x6b, 0x33, 0xaf, 0xcf, 0x6b, 0x33, 0x7f, 0x9c, + 0xd7, 0x66, 0xbe, 0xf9, 0x38, 0xa3, 0xa0, 0xbf, 0x88, 0x1e, 0x44, 0xa0, 0x8e, 0x44, 0xdc, 0x35, + 0x2f, 0x8d, 0xc1, 0x67, 0x8d, 0x61, 0xfa, 0x11, 0x65, 0xf4, 0x9a, 0x25, 0xf3, 0x5d, 0xf4, 0xc9, + 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe7, 0xab, 0x43, 0x11, 0x62, 0x0d, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -461,7 +460,7 @@ func (this *Params) Equal(that interface{}) bool { if !this.DirectLiquidationFee.Equal(that1.DirectLiquidationFee) { return false } - if !this.BurnAuctionFactor.Equal(that1.BurnAuctionFactor) { + if !this.RewardsAuctionFactor.Equal(that1.RewardsAuctionFactor) { return false } return true @@ -633,9 +632,9 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size := m.BurnAuctionFactor.Size() + size := m.RewardsAuctionFactor.Size() i -= size - if _, err := m.BurnAuctionFactor.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.RewardsAuctionFactor.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintLeverage(dAtA, i, uint64(size)) @@ -1036,7 +1035,7 @@ func (m *Params) Size() (n int) { n += 1 + l + sovLeverage(uint64(l)) l = m.DirectLiquidationFee.Size() n += 1 + l + sovLeverage(uint64(l)) - l = m.BurnAuctionFactor.Size() + l = m.RewardsAuctionFactor.Size() n += 1 + l + sovLeverage(uint64(l)) return n } @@ -1344,7 +1343,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnAuctionFactor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RewardsAuctionFactor", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1372,7 +1371,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BurnAuctionFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RewardsAuctionFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/leverage/types/params.go b/x/leverage/types/params.go index d4feb2ec44..8fee658d90 100644 --- a/x/leverage/types/params.go +++ b/x/leverage/types/params.go @@ -12,6 +12,7 @@ func DefaultParams() Params { CompleteLiquidationThreshold: sdk.MustNewDecFromStr("0.4"), MinimumCloseFactor: sdk.MustNewDecFromStr("0.05"), OracleRewardFactor: sdk.MustNewDecFromStr("0.01"), + RewardsAuctionFactor: sdk.MustNewDecFromStr("0.02"), SmallLiquidationSize: sdk.MustNewDecFromStr("500.00"), DirectLiquidationFee: sdk.MustNewDecFromStr("0.05"), } From eec9baf27ccf1cc16d59beb407de8dfb0bf5da19 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 19 Apr 2024 14:48:29 +0200 Subject: [PATCH 5/6] changelog --- CHANGELOG.md | 1 + swagger/swagger.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7189643906..82efbd0878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features - [2472](https://github.com/umee-network/umee/pull/2472) un-wire the `crisis` module from umee app. +- [2500](https://github.com/umee-network/umee/pull/2500) (x/leverage): add Rewards Auction fees and `params.rewards_auction_factor`. ### Improvements diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 7ae7291042..5264e5fb3d 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -1110,6 +1110,16 @@ paths: uTokens as liquidation rewards. + Valid values: 0-1. + rewards_auction_factor: + type: string + description: >- + Rewards Auction Factor determines the portion of interest + accrued on + + borrows that is sent to the auction module for the rewards + auction. + Valid values: 0-1. description: Params defines the parameters for the leverage module. description: >- @@ -6575,6 +6585,12 @@ definitions: uTokens as liquidation rewards. + Valid values: 0-1. + rewards_auction_factor: + type: string + description: |- + Rewards Auction Factor determines the portion of interest accrued on + borrows that is sent to the auction module for the rewards auction. Valid values: 0-1. description: Params defines the parameters for the leverage module. umee.leverage.v1.QueryAccountBalancesResponse: @@ -7235,6 +7251,16 @@ definitions: uTokens as liquidation rewards. + Valid values: 0-1. + rewards_auction_factor: + type: string + description: >- + Rewards Auction Factor determines the portion of interest accrued + on + + borrows that is sent to the auction module for the rewards + auction. + Valid values: 0-1. description: Params defines the parameters for the leverage module. description: |- From 9772ef1d02dc0ce8a36809fe26019cdea98a9a8f Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 19 Apr 2024 15:10:09 +0200 Subject: [PATCH 6/6] update tests --- x/leverage/client/tests/tests.go | 4 ++-- x/leverage/fixtures/params.go | 1 + x/leverage/keeper/grpc_query_test.go | 13 +++++++------ x/leverage/keeper/interest_test.go | 6 +++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/x/leverage/client/tests/tests.go b/x/leverage/client/tests/tests.go index 86373ffd49..2dd9ad55a6 100644 --- a/x/leverage/client/tests/tests.go +++ b/x/leverage/client/tests/tests.go @@ -132,8 +132,8 @@ func (s *IntegrationTests) TestLeverageScenario() { OracleHistoricPrice: &oracleSymbolPrice, UTokenExchangeRate: sdk.OneDec(), // Borrow rate * (1 - ReserveFactor - OracleRewardFactor) - // 1.52 * (1 - 0.2 - 0.01) = 1.2008 - Supply_APY: sdk.MustNewDecFromStr("1.2008"), + // 1.52 * (1 - 0.2 - 0.01 - 0.02) + Supply_APY: sdk.MustNewDecFromStr("1.1704"), // This is an edge case technically - when effective supply, meaning // module balance + total borrows, is zero, utilization (0/0) is // interpreted as 100% so max borrow rate (152% APY) is used. diff --git a/x/leverage/fixtures/params.go b/x/leverage/fixtures/params.go index d609716a92..6f808f3546 100644 --- a/x/leverage/fixtures/params.go +++ b/x/leverage/fixtures/params.go @@ -12,6 +12,7 @@ func Params() types.Params { CompleteLiquidationThreshold: sdk.MustNewDecFromStr("0.1"), MinimumCloseFactor: sdk.MustNewDecFromStr("0.01"), OracleRewardFactor: sdk.MustNewDecFromStr("0.01"), + RewardsAuctionFactor: sdk.MustNewDecFromStr("0.02"), SmallLiquidationSize: sdk.MustNewDecFromStr("100.00"), DirectLiquidationFee: sdk.MustNewDecFromStr("0.1"), } diff --git a/x/leverage/keeper/grpc_query_test.go b/x/leverage/keeper/grpc_query_test.go index e819596ec5..9c5ff17b8c 100644 --- a/x/leverage/keeper/grpc_query_test.go +++ b/x/leverage/keeper/grpc_query_test.go @@ -76,12 +76,13 @@ func (s *IntegrationTestSuite) TestQuerier_MarketSummary() { oracleSymbolPrice := sdk.MustNewDecFromStr("4.21") expected := types.QueryMarketSummaryResponse{ - SymbolDenom: "UMEE", - Exponent: 6, - OraclePrice: &oracleSymbolPrice, - OracleHistoricPrice: &oracleSymbolPrice, - UTokenExchangeRate: sdk.OneDec(), - Supply_APY: sdk.MustNewDecFromStr("1.2008"), + SymbolDenom: "UMEE", + Exponent: 6, + OraclePrice: &oracleSymbolPrice, + OracleHistoricPrice: &oracleSymbolPrice, + UTokenExchangeRate: sdk.OneDec(), + // see cli/tests "query market summary - zero supply" + Supply_APY: sdk.MustNewDecFromStr("1.1704"), Borrow_APY: sdk.MustNewDecFromStr("1.52"), Supplied: sdk.ZeroInt(), Reserved: sdk.ZeroInt(), diff --git a/x/leverage/keeper/interest_test.go b/x/leverage/keeper/interest_test.go index 6b825177cf..8762eadc38 100644 --- a/x/leverage/keeper/interest_test.go +++ b/x/leverage/keeper/interest_test.go @@ -37,10 +37,10 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { require.Equal(sdk.MustNewDecFromStr("0.03"), borrowAPY) // supply APY when borrow APY is 3% - // and utilization is 4%, and reservefactor is 20%, and OracleRewardFactor is 1% - // 0.03 * 0.04 * (1 - 0.21) = 0.000948 + // and utilization is 4%, and reserve factor=20%, OracleRewardFactor=1% RewardsAuctionFactor=2% + // 0.03 * 0.04 * (1 - 0.2 - 0.01 - 0.02) supplyAPY := app.LeverageKeeper.DeriveSupplyAPY(ctx, appparams.BondDenom) - require.Equal(sdk.MustNewDecFromStr("0.000948"), supplyAPY) + require.Equal(sdk.MustNewDecFromStr("0.000924"), supplyAPY) } func (s *IntegrationTestSuite) TestDynamicInterest() {