diff --git a/proto/pstake/liquidstake/v1beta1/liquidstake.proto b/proto/pstake/liquidstake/v1beta1/liquidstake.proto index 2ea5b89ce..ca94dcaea 100644 --- a/proto/pstake/liquidstake/v1beta1/liquidstake.proto +++ b/proto/pstake/liquidstake/v1beta1/liquidstake.proto @@ -212,4 +212,10 @@ message NetAmountState { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + + // accumulating_rewards define the accumulating rewards of proxy account + string accumulating_rewards = 9 [ + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } diff --git a/x/liquidstake/keeper/keeper.go b/x/liquidstake/keeper/keeper.go index cff58b8e8..34ff5e7c0 100644 --- a/x/liquidstake/keeper/keeper.go +++ b/x/liquidstake/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + sdkmath "cosmossdk.io/math" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -91,6 +92,32 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { return params } +// GetAccumulatingRewards returns the accumulating rewards in the proxy account. +func (k Keeper) GetAccumulatingRewards(ctx sdk.Context) sdkmath.Int { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(types.AccumulatingRewardsKey) + if bz == nil { + return sdkmath.ZeroInt() + } + + var acRewards sdkmath.Int + if err := acRewards.Unmarshal(bz); err != nil { + panic(err) + } + return acRewards +} + +// SetAccumulatingRewards sets the accumulating rewards in the proxy account. +func (k Keeper) SetAccumulatingRewards(ctx sdk.Context, acRewards sdkmath.Int) { + store := ctx.KVStore(k.storeKey) + bz, err := acRewards.Marshal() + if err != nil { + panic(err) + } + store.Set(types.AccumulatingRewardsKey, bz) +} + // GetCodec return codec.Codec object used by the keeper func (k Keeper) GetCodec() codec.BinaryCodec { return k.cdc } diff --git a/x/liquidstake/keeper/liquidstake.go b/x/liquidstake/keeper/liquidstake.go index 17cd2436c..44c4989d0 100644 --- a/x/liquidstake/keeper/liquidstake.go +++ b/x/liquidstake/keeper/liquidstake.go @@ -43,6 +43,7 @@ func (k Keeper) GetNetAmountState(ctx sdk.Context) (nas types.NetAmountState) { TotalRemainingRewards: totalRemainingRewards, TotalUnbondingBalance: totalUnbondingBalance, ProxyAccBalance: k.GetProxyAccBalance(ctx, types.LiquidStakeProxyAcc).Amount, + AccumulatingRewards: k.GetAccumulatingRewards(ctx), } nas.NetAmount = nas.CalcNetAmount() @@ -715,6 +716,9 @@ func (k Keeper) LiquidDelegate(ctx sdk.Context, proxyAcc sdk.AccAddress, activeV return types.ErrInvalidActiveLiquidValidators } weightedAmt[0] = weightedAmt[0].Add(crumb) + + acRewards := k.GetAccumulatingRewards(ctx) + for i, val := range activeVals { if !weightedAmt[i].IsPositive() { continue @@ -724,6 +728,12 @@ func (k Keeper) LiquidDelegate(ctx sdk.Context, proxyAcc sdk.AccAddress, activeV if err != nil { return errorsmod.Wrapf(err, "failed to delegate to validator %s", val.GetOperator()) } + + if weightedAmt[i].GTE(acRewards) { + acRewards = sdk.ZeroInt() + } else { + acRewards = acRewards.Sub(weightedAmt[i]) + } } return nil } @@ -792,6 +802,15 @@ func (k Keeper) LiquidUnstake( return time.Time{}, sdk.ZeroInt(), []stakingtypes.UnbondingDelegation{}, sdk.ZeroInt(), err } + // update accumulating rewards + acRewards := k.GetAccumulatingRewards(ctx) + if unbondingAmountInt.GTE(acRewards) { + acRewards = sdk.ZeroInt() + } else { + acRewards = acRewards.Sub(unbondingAmountInt) + } + k.SetAccumulatingRewards(ctx, acRewards) + return time.Time{}, sdk.ZeroInt(), []stakingtypes.UnbondingDelegation{}, unbondingAmountInt, nil } @@ -987,6 +1006,9 @@ func (k Keeper) CheckDelegationStates(ctx sdk.Context, proxyAcc sdk.AccAddress) } func (k Keeper) WithdrawLiquidRewards(ctx sdk.Context, proxyAcc sdk.AccAddress) { + acRewards := k.GetAccumulatingRewards(ctx) + bondDenom := k.stakingKeeper.BondDenom(ctx) + // iterate over all the delegations (even those out of the active set) and withdraw rewards k.stakingKeeper.IterateDelegations( ctx, proxyAcc, @@ -1014,6 +1036,18 @@ func (k Keeper) WithdrawLiquidRewards(ctx sdk.Context, proxyAcc sdk.AccAddress) ) // no need to return here, will be picked up in the next epoch } else { + var msgWithdrawResponse distributiontypes.MsgWithdrawDelegatorRewardResponse + if err := k.cdc.Unmarshal(res.MsgResponses[0].Value, &msgWithdrawResponse); err != nil { + k.Logger(ctx).Error( + "failed to unmarshal withdraw rewards response", + types.ErrorKeyVal, + err, + ) + } + + amount := msgWithdrawResponse.Amount.AmountOf(bondDenom) + acRewards = acRewards.Add(amount) + // emit the events ctx.EventManager().EmitEvents(res.GetEvents()) } @@ -1021,6 +1055,8 @@ func (k Keeper) WithdrawLiquidRewards(ctx sdk.Context, proxyAcc sdk.AccAddress) return false }, ) + + k.SetAccumulatingRewards(ctx, acRewards) } // GetLiquidValidator get a single liquid validator diff --git a/x/liquidstake/keeper/rebalancing.go b/x/liquidstake/keeper/rebalancing.go index 43912180a..fcc783859 100644 --- a/x/liquidstake/keeper/rebalancing.go +++ b/x/liquidstake/keeper/rebalancing.go @@ -260,6 +260,15 @@ func (k Keeper) AutocompoundStakingRewards(ctx sdk.Context, whitelistedValsMap t return } + // subtract fee from accumulated rewards + acRewards := k.GetAccumulatingRewards(ctx) + if autocompoundFee.Amount.GTE(acRewards) { + acRewards = sdk.ZeroInt() + } else { + acRewards = acRewards.Sub(autocompoundFee.Amount) + } + k.SetAccumulatingRewards(ctx, acRewards) + ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeAutocompound, diff --git a/x/liquidstake/types/keys.go b/x/liquidstake/types/keys.go index e1cd7cd08..47ed02bb1 100644 --- a/x/liquidstake/types/keys.go +++ b/x/liquidstake/types/keys.go @@ -28,6 +28,9 @@ var ( // LiquidValidatorsKey defines prefix for each key to a liquid validator LiquidValidatorsKey = []byte{0x02} + + // AccumulatingRewardsKey defines prefix for each key to accumulating rewards in proxy account + AccumulatingRewardsKey = []byte{0x03} ) // GetLiquidValidatorKey creates the key for the liquid validator with address diff --git a/x/liquidstake/types/liquidstake.go b/x/liquidstake/types/liquidstake.go index 1454e4a58..83378f30e 100644 --- a/x/liquidstake/types/liquidstake.go +++ b/x/liquidstake/types/liquidstake.go @@ -182,7 +182,7 @@ func DeductFeeRate(input, feeRate math.LegacyDec) (feeDeductedOutput math.Legacy } func (nas NetAmountState) CalcNetAmount() math.LegacyDec { - return math.LegacyNewDecFromInt(nas.TotalLiquidTokens.Add(nas.TotalUnbondingBalance)) + return math.LegacyNewDecFromInt(nas.TotalLiquidTokens.Add(nas.TotalUnbondingBalance).Add(nas.AccumulatingRewards)) } func (nas NetAmountState) CalcMintRate() math.LegacyDec { diff --git a/x/liquidstake/types/liquidstake.pb.go b/x/liquidstake/types/liquidstake.pb.go index fba82518b..d2b80fedc 100644 --- a/x/liquidstake/types/liquidstake.pb.go +++ b/x/liquidstake/types/liquidstake.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -290,6 +291,8 @@ type NetAmountState struct { TotalUnbondingBalance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=total_unbonding_balance,json=totalUnbondingBalance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_unbonding_balance"` // proxy_acc_balance define the balance of proxy account for the native token ProxyAccBalance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=proxy_acc_balance,json=proxyAccBalance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"proxy_acc_balance"` + // accumulating_rewards define the accumulating rewards of proxy account + AccumulatingRewards cosmossdk_io_math.Int `protobuf:"bytes,9,opt,name=accumulating_rewards,json=accumulatingRewards,proto3,customtype=cosmossdk.io/math.Int" json:"accumulating_rewards"` } func (m *NetAmountState) Reset() { *m = NetAmountState{} } @@ -339,70 +342,72 @@ func init() { } var fileDescriptor_8f87e6d47a5a3bba = []byte{ - // 1007 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xc1, 0x6e, 0x1b, 0x45, - 0x18, 0xc7, 0xbd, 0x4d, 0x6a, 0x92, 0x69, 0x9a, 0xc4, 0x1b, 0xa7, 0x76, 0x0c, 0x72, 0x4c, 0x90, - 0x50, 0x54, 0x88, 0x4d, 0x83, 0xc4, 0x21, 0x07, 0xc4, 0x3a, 0x4e, 0x84, 0x45, 0x9a, 0x5a, 0x6b, - 0x27, 0xad, 0x7a, 0x60, 0x3a, 0xde, 0x99, 0x38, 0x2b, 0xef, 0xce, 0x2c, 0x3b, 0xb3, 0x71, 0xf2, - 0x00, 0x48, 0x55, 0x4e, 0x9c, 0x10, 0x97, 0x48, 0x95, 0x78, 0x05, 0x0e, 0x3c, 0x42, 0x2f, 0x48, - 0x15, 0x27, 0xc4, 0xa1, 0x42, 0xc9, 0x85, 0xa7, 0x40, 0x68, 0x66, 0x76, 0x6d, 0xd7, 0x2d, 0x44, - 0x76, 0x7b, 0xf2, 0x7a, 0x66, 0xff, 0xbf, 0xef, 0x9b, 0xef, 0x3f, 0xf3, 0xcd, 0x82, 0x4f, 0x03, - 0x2e, 0x50, 0x97, 0x54, 0x3c, 0xf7, 0xbb, 0xc8, 0xc5, 0xfa, 0xf9, 0xe4, 0x5e, 0x9b, 0x08, 0x74, - 0x6f, 0x78, 0xac, 0x1c, 0x84, 0x4c, 0x30, 0xb3, 0xa0, 0xdf, 0x2e, 0x0f, 0xcf, 0xc4, 0x6f, 0x17, - 0xb2, 0x1d, 0xd6, 0x61, 0xea, 0xb5, 0x8a, 0x7c, 0xd2, 0x8a, 0xc2, 0x8a, 0xc3, 0xb8, 0xcf, 0x38, - 0xd4, 0x13,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xce, 0xa2, 0x51, 0x58, 0x39, 0xbf, 0x28, - 0x2d, 0x8f, 0x88, 0x2d, 0x47, 0xb8, 0x27, 0xc4, 0xdc, 0x02, 0x2b, 0xaf, 0xe9, 0xea, 0xfb, 0xb1, - 0xf2, 0x46, 0xe1, 0xfd, 0xf3, 0x8b, 0x52, 0x6e, 0x44, 0x59, 0xa7, 0x48, 0x69, 0x0b, 0xd3, 0x4f, - 0x7f, 0x2e, 0xa6, 0xaa, 0x8f, 0x9e, 0x5f, 0x16, 0x8d, 0x17, 0x97, 0x45, 0xe3, 0xaf, 0xcb, 0xa2, - 0xf1, 0xc3, 0x55, 0x31, 0xf5, 0xe2, 0xaa, 0x98, 0xfa, 0xe3, 0xaa, 0x98, 0x7a, 0xfc, 0xe5, 0x50, - 0xb1, 0x02, 0x12, 0x72, 0x79, 0x4d, 0x51, 0x87, 0x3c, 0xa0, 0xa4, 0xa2, 0xdb, 0xdc, 0x06, 0x45, - 0x12, 0x54, 0x39, 0xd9, 0xac, 0x9c, 0xbe, 0xf2, 0x25, 0xa9, 0x0a, 0xd9, 0x4e, 0xab, 0xef, 0xbd, - 0xcf, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x53, 0xe1, 0xf8, 0x6c, 0x0a, 0x00, 0x00, + // 1040 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x6f, 0x1b, 0x45, + 0x18, 0xc6, 0xbd, 0x49, 0x30, 0xc9, 0x34, 0xcd, 0x9f, 0x8d, 0xd3, 0x38, 0x06, 0x1c, 0x13, 0x24, + 0x14, 0x15, 0x62, 0xd3, 0x20, 0x71, 0xc8, 0x01, 0xb1, 0x8e, 0x13, 0x61, 0x91, 0xa6, 0xd6, 0xda, + 0x49, 0xab, 0x1e, 0x98, 0x8e, 0x77, 0x26, 0xf6, 0xca, 0xbb, 0x33, 0xcb, 0xce, 0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x35, 0x09, 0xa9, 0x09, 0x96, 0x51, 0x24, 0x98, + 0xc3, 0xfc, 0x80, 0x45, 0x14, 0xf7, 0x1d, 0x98, 0x1e, 0xcb, 0x81, 0xa5, 0x41, 0x58, 0x62, 0x43, + 0x0d, 0xac, 0xf4, 0x9c, 0x87, 0x08, 0xcb, 0x7a, 0x27, 0x19, 0xcf, 0xdc, 0x90, 0x71, 0x7f, 0xcb, + 0x58, 0x52, 0x97, 0x64, 0xfd, 0x09, 0xb8, 0xed, 0x33, 0x1c, 0x79, 0x04, 0x06, 0x28, 0xe2, 0x04, + 0x67, 0x81, 0x72, 0x76, 0x56, 0x0f, 0xd6, 0xd4, 0xd8, 0xf6, 0xf4, 0xd3, 0x67, 0x6b, 0xa9, 0x5f, + 0x9e, 0xad, 0xa5, 0xd6, 0x7f, 0x37, 0x40, 0xe6, 0x75, 0xfb, 0xd2, 0xdc, 0x05, 0x8b, 0xbd, 0xdd, + 0xdd, 0xcb, 0xc9, 0xb8, 0x21, 0xa7, 0x85, 0x9e, 0x24, 0x49, 0xa7, 0x0e, 0x6e, 0x0b, 0x14, 0xb6, + 0x88, 0x80, 0x5d, 0xe2, 0xb6, 0xda, 0x22, 0x3b, 0x31, 0xd6, 0xd6, 0x99, 0xd5, 0x90, 0x87, 0x8a, + 0xb1, 0x3d, 0x25, 0xd3, 0x5f, 0x7f, 0x02, 0xe6, 0xf5, 0x6e, 0xea, 0x27, 0xbd, 0x03, 0x16, 0x58, + 0x40, 0xc2, 0x91, 0x72, 0x9e, 0x4f, 0x14, 0xf1, 0xb0, 0x2e, 0xce, 0xbf, 0x32, 0xc2, 0xcf, 0x93, + 0x20, 0x33, 0x14, 0xa2, 0x2e, 0xa4, 0x6d, 0xef, 0x22, 0x8e, 0xb9, 0x07, 0xd2, 0x6f, 0x55, 0x93, + 0x58, 0x6d, 0xee, 0x80, 0x34, 0x17, 0x48, 0x44, 0x5c, 0xb5, 0x86, 0xb9, 0xad, 0xcf, 0xde, 0xd4, + 0x83, 0x5e, 0x5a, 0x48, 0xc4, 0xed, 0x58, 0x6a, 0xde, 0x07, 0x00, 0x13, 0x0f, 0xf2, 0x36, 0x0a, + 0x09, 0x57, 0xdd, 0x60, 0xf4, 0x1d, 0x3e, 0x83, 0x89, 0x57, 0x57, 0x00, 0x69, 0x7b, 0xdc, 0x37, + 0x04, 0xeb, 0x10, 0xca, 0xc7, 0xec, 0x18, 0xb3, 0x1a, 0xd2, 0x50, 0x8c, 0x01, 0x63, 0x2e, 0xd3, + 0x60, 0xee, 0x80, 0x08, 0xdd, 0x41, 0xb4, 0x25, 0xdf, 0x81, 0x19, 0xdf, 0xa5, 0x42, 0x9f, 0x50, + 0x63, 0xac, 0xfc, 0xa7, 0x25, 0x40, 0x1d, 0xcb, 0x27, 0x20, 0xc3, 0x45, 0xe7, 0x34, 0x08, 0x05, + 0x14, 0x4c, 0x20, 0x0f, 0xf2, 0x28, 0x08, 0xbc, 0xb3, 0x31, 0x8d, 0x32, 0x63, 0x56, 0x43, 0xa2, + 0xea, 0x8a, 0x24, 0xeb, 0x4d, 0x89, 0x48, 0xfa, 0xe9, 0x78, 0x3d, 0x7d, 0x86, 0x26, 0x25, 0x90, + 0x17, 0x85, 0x4e, 0xf4, 0xad, 0x4d, 0x9c, 0x53, 0x9c, 0x4a, 0xcf, 0xc9, 0xef, 0xc1, 0x92, 0x26, + 0xbf, 0x0b, 0x3f, 0x17, 0x15, 0x6a, 0x7f, 0xc0, 0x54, 0xf3, 0x18, 0xac, 0x68, 0x7e, 0x48, 0x7c, + 0xe4, 0x52, 0x97, 0xb6, 0x60, 0x48, 0xba, 0x28, 0xc4, 0x49, 0xff, 0x1f, 0x75, 0x01, 0xcb, 0x0a, + 0x67, 0x27, 0x34, 0x5b, 0xc3, 0xfa, 0x71, 0x22, 0x2a, 0xaf, 0x79, 0x19, 0xa7, 0x89, 0x3c, 0x44, + 0x1d, 0x12, 0xdf, 0x0d, 0xa3, 0xae, 0x45, 0xc7, 0x39, 0x4c,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 0x6f, 0xfc, 0x74, 0x9d, 0x4f, 0x5d, 0x5e, 0xe7, 0x53, 0x7f, 0x5d, 0xe7, 0x53, 0x8f, 0xbf, 0x1e, + 0x28, 0x7f, 0x40, 0x42, 0x2e, 0x2f, 0x3e, 0xea, 0x90, 0x07, 0x94, 0x94, 0x74, 0xe3, 0xdc, 0xa4, + 0x48, 0x82, 0x4a, 0x27, 0x5b, 0xa5, 0xd3, 0x97, 0xbe, 0x4d, 0x95, 0x35, 0xcd, 0xb4, 0xfa, 0x82, + 0xfc, 0xf2, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x3d, 0x5a, 0xf7, 0xbe, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -675,6 +680,16 @@ func (m *NetAmountState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.AccumulatingRewards.Size() + i -= size + if _, err := m.AccumulatingRewards.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLiquidstake(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a { size := m.ProxyAccBalance.Size() i -= size @@ -884,6 +899,8 @@ func (m *NetAmountState) Size() (n int) { n += 1 + l + sovLiquidstake(uint64(l)) l = m.ProxyAccBalance.Size() n += 1 + l + sovLiquidstake(uint64(l)) + l = m.AccumulatingRewards.Size() + n += 1 + l + sovLiquidstake(uint64(l)) return n } @@ -1949,6 +1966,40 @@ func (m *NetAmountState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccumulatingRewards", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLiquidstake + } + 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 ErrInvalidLengthLiquidstake + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLiquidstake + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AccumulatingRewards.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipLiquidstake(dAtA[iNdEx:])