From 924caf8123eac615ce7c3193eb286b021ed957af Mon Sep 17 00:00:00 2001 From: kenta-elys Date: Mon, 4 Dec 2023 08:04:03 +0000 Subject: [PATCH 1/5] chore: remove creator param --- proto/elys/commitment/tx.proto | 28 +- proto/elys/incentive/tx.proto | 28 +- wasmbindings/types/types.go | 4 +- x/commitment/client/wasm/msg_cancel_vest.go | 6 +- x/commitment/client/wasm/msg_stake.go | 4 +- x/commitment/client/wasm/msg_unstake.go | 4 +- x/commitment/client/wasm/msg_vest.go | 6 +- x/commitment/keeper/msg_server_stake.go | 4 +- x/commitment/keeper/msg_server_unstake.go | 4 +- x/commitment/types/message_stake.go | 5 +- x/commitment/types/message_unstake.go | 5 +- x/commitment/types/tx.pb.go | 964 ++---------------- .../client/wasm/msg_begin_redelegate.go | 2 +- .../wasm/msg_cancel_unbonding_delegation.go | 2 +- .../client/wasm/msg_withdraw_rewards.go | 2 +- .../wasm/msg_withdraw_validator_commission.go | 2 +- x/incentive/types/tx.pb.go | 337 ++---- 17 files changed, 233 insertions(+), 1174 deletions(-) diff --git a/proto/elys/commitment/tx.proto b/proto/elys/commitment/tx.proto index c2fb2078e..76aad91be 100644 --- a/proto/elys/commitment/tx.proto +++ b/proto/elys/commitment/tx.proto @@ -78,13 +78,6 @@ message MsgVest { string denom = 3; } -message MsgVestCW { - string creator = 1; - string address = 2; - string amount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string denom = 4; -} - message MsgVestResponse {} message MsgCancelVest { @@ -93,13 +86,6 @@ message MsgCancelVest { string denom = 3; } -message MsgCancelVestCW { - string creator = 1; - string address = 2; - string amount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string denom = 4; -} - message MsgCancelVestResponse {} message MsgVestNow { @@ -138,10 +124,9 @@ message MsgClaimRewardsResponse {} message MsgStake { string creator = 1; - string address = 2; - string amount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string asset = 4; - string validator_address = 5; + string amount = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string asset = 3; + string validator_address = 4; } message MsgStakeResponse { @@ -151,10 +136,9 @@ message MsgStakeResponse { message MsgUnstake { string creator = 1; - string address = 2; - string amount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; - string asset = 4; - string validator_address = 5; + string amount = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string asset = 3; + string validator_address = 4; } message MsgUnstakeResponse { diff --git a/proto/elys/incentive/tx.proto b/proto/elys/incentive/tx.proto index 846f922f5..8c1703815 100644 --- a/proto/elys/incentive/tx.proto +++ b/proto/elys/incentive/tx.proto @@ -26,9 +26,8 @@ service Msg { message MsgWithdrawRewards { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string delegator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - elys.commitment.EarnType withdraw_type = 3; + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + elys.commitment.EarnType withdraw_type = 2; } // MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. @@ -39,9 +38,8 @@ message MsgWithdrawRewardsResponse {} message MsgWithdrawValidatorCommission { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string delegator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. @@ -77,22 +75,20 @@ message MsgBeginRedelegate { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string delegator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 5 [(gogoproto.nullable) = false]; + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false]; } message MsgCancelUnbondingDelegation{ option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string creator = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string delegator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // amount is always less than or equal to unbonding delegation entry balance - cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; // creation_height is the height which the unbonding took place. - int64 creation_height = 5; + int64 creation_height = 4; } \ No newline at end of file diff --git a/wasmbindings/types/types.go b/wasmbindings/types/types.go index 3a18b15c4..ca4f5176f 100644 --- a/wasmbindings/types/types.go +++ b/wasmbindings/types/types.go @@ -253,10 +253,10 @@ type ElysMsg struct { CommitmentCommitLiquidTokens *commitmenttypes.MsgCommitLiquidTokens `json:"commitment_commit_liquid_tokens,omitempty"` CommitmentCommitUnclaimedRewards *commitmenttypes.MsgCommitClaimedRewards `json:"commitment_commit_unclaimed_rewards,omitempty"` CommitmentUncommitTokens *commitmenttypes.MsgUncommitTokens `json:"commitment_uncommit_tokens,omitempty"` - CommitmentVest *commitmenttypes.MsgVestCW `json:"commitment_vest"` + CommitmentVest *commitmenttypes.MsgVest `json:"commitment_vest"` CommitmentVestNow *commitmenttypes.MsgVestNow `json:"commitment_vest_now"` CommitmentVestLiquid *commitmenttypes.MsgVestLiquid `json:"commitment_vest_liquid"` - CommitmentCancelVest *commitmenttypes.MsgCancelVestCW `json:"commitment_cancel_vest"` + CommitmentCancelVest *commitmenttypes.MsgCancelVest `json:"commitment_cancel_vest"` CommitmentUpdateVestingInfo *commitmenttypes.MsgUpdateVestingInfo `json:"commitment_update_vesting_info"` CommitmentStake *commitmenttypes.MsgStake `json:"commitment_stake,omitempty"` CommitmentUnstake *commitmenttypes.MsgUnstake `json:"commitment_unstake,omitempty"` diff --git a/x/commitment/client/wasm/msg_cancel_vest.go b/x/commitment/client/wasm/msg_cancel_vest.go index 70b7d57f3..2948a2ea3 100644 --- a/x/commitment/client/wasm/msg_cancel_vest.go +++ b/x/commitment/client/wasm/msg_cancel_vest.go @@ -12,7 +12,7 @@ import ( paramtypes "github.com/elys-network/elys/x/parameter/types" ) -func (m *Messenger) msgCancelVest(ctx sdk.Context, contractAddr sdk.AccAddress, msgCancelVest *commitmenttypes.MsgCancelVestCW) ([]sdk.Event, [][]byte, error) { +func (m *Messenger) msgCancelVest(ctx sdk.Context, contractAddr sdk.AccAddress, msgCancelVest *commitmenttypes.MsgCancelVest) ([]sdk.Event, [][]byte, error) { if msgCancelVest == nil { return nil, nil, wasmvmtypes.InvalidRequest{Err: "cancel vest null msg"} } @@ -43,13 +43,13 @@ func (m *Messenger) msgCancelVest(ctx sdk.Context, contractAddr sdk.AccAddress, return nil, resp, nil } -func performMsgCancelVestEden(f *commitmentkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msgCancelVest *commitmenttypes.MsgCancelVestCW) (*wasmbindingstypes.RequestResponse, error) { +func performMsgCancelVestEden(f *commitmentkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msgCancelVest *commitmenttypes.MsgCancelVest) (*wasmbindingstypes.RequestResponse, error) { if msgCancelVest == nil { return nil, wasmvmtypes.InvalidRequest{Err: "Invalid cancel vesting parameter"} } msgServer := commitmentkeeper.NewMsgServerImpl(*f) - msgMsgCancelVest := commitmenttypes.NewMsgCancelVest(msgCancelVest.Address, msgCancelVest.Amount, msgCancelVest.Denom) + msgMsgCancelVest := commitmenttypes.NewMsgCancelVest(msgCancelVest.Creator, msgCancelVest.Amount, msgCancelVest.Denom) if err := msgMsgCancelVest.ValidateBasic(); err != nil { return nil, errorsmod.Wrap(err, "failed validating msgMsgCancelVest") diff --git a/x/commitment/client/wasm/msg_stake.go b/x/commitment/client/wasm/msg_stake.go index 26d13637f..d27662e95 100644 --- a/x/commitment/client/wasm/msg_stake.go +++ b/x/commitment/client/wasm/msg_stake.go @@ -34,7 +34,7 @@ func (m *Messenger) msgStake(ctx sdk.Context, contractAddr sdk.AccAddress, msgSt // USDC if msgStake.Asset == baseCurrency { msgServer := stablekeeper.NewMsgServerImpl(*m.stableKeeper) - msgMsgBond := stabletypes.NewMsgBond(msgStake.Address, msgStake.Amount) + msgMsgBond := stabletypes.NewMsgBond(msgStake.Creator, msgStake.Amount) if err = msgMsgBond.ValidateBasic(); err != nil { return nil, nil, errorsmod.Wrap(err, "failed validating msgMsgBond") @@ -51,7 +51,7 @@ func (m *Messenger) msgStake(ctx sdk.Context, contractAddr sdk.AccAddress, msgSt } else { // Elys, Eden, Eden Boost msgServer := commitmentkeeper.NewMsgServerImpl(*m.keeper) - msgMsgStake := commitmenttypes.NewMsgStake(msgStake.Address, msgStake.Amount, msgStake.Asset, msgStake.ValidatorAddress) + msgMsgStake := commitmenttypes.NewMsgStake(msgStake.Creator, msgStake.Amount, msgStake.Asset, msgStake.ValidatorAddress) if err = msgMsgStake.ValidateBasic(); err != nil { return nil, nil, errorsmod.Wrap(err, "failed validating msgMsgStake") diff --git a/x/commitment/client/wasm/msg_unstake.go b/x/commitment/client/wasm/msg_unstake.go index adcff0ff7..1c64af3a5 100644 --- a/x/commitment/client/wasm/msg_unstake.go +++ b/x/commitment/client/wasm/msg_unstake.go @@ -34,7 +34,7 @@ func (m *Messenger) msgUnstake(ctx sdk.Context, contractAddr sdk.AccAddress, msg // USDC if msgUnstake.Asset == baseCurrency { msgServer := stablekeeper.NewMsgServerImpl(*m.stableKeeper) - msgMsgUnBond := stabletypes.NewMsgUnbond(msgUnstake.Address, msgUnstake.Amount) + msgMsgUnBond := stabletypes.NewMsgUnbond(msgUnstake.Creator, msgUnstake.Amount) if err = msgMsgUnBond.ValidateBasic(); err != nil { return nil, nil, errorsmod.Wrap(err, "failed validating msgMsgBond") @@ -50,7 +50,7 @@ func (m *Messenger) msgUnstake(ctx sdk.Context, contractAddr sdk.AccAddress, msg } } else { msgServer := commitmentkeeper.NewMsgServerImpl(*m.keeper) - msgMsgUnstake := commitmenttypes.NewMsgUnstake(msgUnstake.Address, msgUnstake.Amount, msgUnstake.Asset, msgUnstake.ValidatorAddress) + msgMsgUnstake := commitmenttypes.NewMsgUnstake(msgUnstake.Creator, msgUnstake.Amount, msgUnstake.Asset, msgUnstake.ValidatorAddress) if err = msgMsgUnstake.ValidateBasic(); err != nil { return nil, nil, errorsmod.Wrap(err, "failed validating msgMsgUnstake") diff --git a/x/commitment/client/wasm/msg_vest.go b/x/commitment/client/wasm/msg_vest.go index 42a7d71e6..51908c36c 100644 --- a/x/commitment/client/wasm/msg_vest.go +++ b/x/commitment/client/wasm/msg_vest.go @@ -12,7 +12,7 @@ import ( paramtypes "github.com/elys-network/elys/x/parameter/types" ) -func (m *Messenger) msgVest(ctx sdk.Context, contractAddr sdk.AccAddress, msgVest *commitmenttypes.MsgVestCW) ([]sdk.Event, [][]byte, error) { +func (m *Messenger) msgVest(ctx sdk.Context, contractAddr sdk.AccAddress, msgVest *commitmenttypes.MsgVest) ([]sdk.Event, [][]byte, error) { if msgVest == nil { return nil, nil, wasmvmtypes.InvalidRequest{Err: "Vest null msg"} } @@ -43,13 +43,13 @@ func (m *Messenger) msgVest(ctx sdk.Context, contractAddr sdk.AccAddress, msgVes return nil, resp, nil } -func performMsgVestEden(f *commitmentkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msgVest *commitmenttypes.MsgVestCW) (*wasmbindingstypes.RequestResponse, error) { +func performMsgVestEden(f *commitmentkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msgVest *commitmenttypes.MsgVest) (*wasmbindingstypes.RequestResponse, error) { if msgVest == nil { return nil, wasmvmtypes.InvalidRequest{Err: "Invalid vesting parameter"} } msgServer := commitmentkeeper.NewMsgServerImpl(*f) - msgMsgVest := commitmenttypes.NewMsgVest(msgVest.Address, msgVest.Amount, msgVest.Denom) + msgMsgVest := commitmenttypes.NewMsgVest(msgVest.Creator, msgVest.Amount, msgVest.Denom) if err := msgMsgVest.ValidateBasic(); err != nil { return nil, errorsmod.Wrap(err, "failed validating msgVest") diff --git a/x/commitment/keeper/msg_server_stake.go b/x/commitment/keeper/msg_server_stake.go index e76a0a050..1384ec4ff 100644 --- a/x/commitment/keeper/msg_server_stake.go +++ b/x/commitment/keeper/msg_server_stake.go @@ -38,7 +38,7 @@ func (k msgServer) performStakeElys(ctx sdk.Context, msg *types.MsgStake) error msgServer := stakingkeeper.NewMsgServerImpl(stakingKeeper) - address, err := sdk.AccAddressFromBech32(msg.Address) + address, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return errorsmod.Wrap(err, "invalid address") } @@ -63,7 +63,7 @@ func (k msgServer) performStakeElys(ctx sdk.Context, msg *types.MsgStake) error } func (k msgServer) performCommit(ctx sdk.Context, msg *types.MsgStake) error { - msgMsgCommit := types.NewMsgCommitClaimedRewards(msg.Address, msg.Amount, msg.Asset) + msgMsgCommit := types.NewMsgCommitClaimedRewards(msg.Creator, msg.Amount, msg.Asset) if err := msgMsgCommit.ValidateBasic(); err != nil { return errorsmod.Wrap(err, "failed validating msgMsgCommit") diff --git a/x/commitment/keeper/msg_server_unstake.go b/x/commitment/keeper/msg_server_unstake.go index bb35150d2..4218333d3 100644 --- a/x/commitment/keeper/msg_server_unstake.go +++ b/x/commitment/keeper/msg_server_unstake.go @@ -39,7 +39,7 @@ func (k msgServer) performUnstakeElys(ctx sdk.Context, msg *types.MsgUnstake) er msgServer := stakingkeeper.NewMsgServerImpl(stakingKeeper) - address, err := sdk.AccAddressFromBech32(msg.Address) + address, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return errorsmod.Wrap(err, "invalid address") } @@ -64,7 +64,7 @@ func (k msgServer) performUnstakeElys(ctx sdk.Context, msg *types.MsgUnstake) er } func (k msgServer) performUncommit(ctx sdk.Context, msg *types.MsgUnstake) error { - msgMsgUncommit := types.NewMsgUncommitTokens(msg.Address, msg.Amount, msg.Asset) + msgMsgUncommit := types.NewMsgUncommitTokens(msg.Creator, msg.Amount, msg.Asset) if err := msgMsgUncommit.ValidateBasic(); err != nil { return errorsmod.Wrap(err, "failed validating msgMsgUncommit") diff --git a/x/commitment/types/message_stake.go b/x/commitment/types/message_stake.go index 431bc53f6..fe8ac4666 100644 --- a/x/commitment/types/message_stake.go +++ b/x/commitment/types/message_stake.go @@ -9,10 +9,9 @@ const TypeMsgStake = "stake" var _ sdk.Msg = &MsgStake{} -func NewMsgStake(address string, amount sdk.Int, asset string, validatorAddress string) *MsgStake { +func NewMsgStake(creator string, amount sdk.Int, asset string, validatorAddress string) *MsgStake { return &MsgStake{ - Creator: address, - Address: address, + Creator: creator, Amount: amount, Asset: asset, ValidatorAddress: validatorAddress, diff --git a/x/commitment/types/message_unstake.go b/x/commitment/types/message_unstake.go index 1303faac4..9bb21219a 100644 --- a/x/commitment/types/message_unstake.go +++ b/x/commitment/types/message_unstake.go @@ -9,10 +9,9 @@ const TypeMsgUnstake = "unstake" var _ sdk.Msg = &MsgUnstake{} -func NewMsgUnstake(address string, amount sdk.Int, asset string, validatorAddress string) *MsgUnstake { +func NewMsgUnstake(creator string, amount sdk.Int, asset string, validatorAddress string) *MsgUnstake { return &MsgUnstake{ - Creator: address, - Address: address, + Creator: creator, Amount: amount, Asset: asset, ValidatorAddress: validatorAddress, diff --git a/x/commitment/types/tx.pb.go b/x/commitment/types/tx.pb.go index 0d51862e3..2232d4bfa 100644 --- a/x/commitment/types/tx.pb.go +++ b/x/commitment/types/tx.pb.go @@ -446,67 +446,6 @@ func (m *MsgVest) GetDenom() string { return "" } -type MsgVestCW struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` - Denom string `protobuf:"bytes,4,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *MsgVestCW) Reset() { *m = MsgVestCW{} } -func (m *MsgVestCW) String() string { return proto.CompactTextString(m) } -func (*MsgVestCW) ProtoMessage() {} -func (*MsgVestCW) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{9} -} -func (m *MsgVestCW) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVestCW) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVestCW.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 *MsgVestCW) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVestCW.Merge(m, src) -} -func (m *MsgVestCW) XXX_Size() int { - return m.Size() -} -func (m *MsgVestCW) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVestCW.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVestCW proto.InternalMessageInfo - -func (m *MsgVestCW) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgVestCW) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *MsgVestCW) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - type MsgVestResponse struct { } @@ -514,7 +453,7 @@ func (m *MsgVestResponse) Reset() { *m = MsgVestResponse{} } func (m *MsgVestResponse) String() string { return proto.CompactTextString(m) } func (*MsgVestResponse) ProtoMessage() {} func (*MsgVestResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{10} + return fileDescriptor_eda78aafe7eb119c, []int{9} } func (m *MsgVestResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -553,7 +492,7 @@ func (m *MsgCancelVest) Reset() { *m = MsgCancelVest{} } func (m *MsgCancelVest) String() string { return proto.CompactTextString(m) } func (*MsgCancelVest) ProtoMessage() {} func (*MsgCancelVest) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{11} + return fileDescriptor_eda78aafe7eb119c, []int{10} } func (m *MsgCancelVest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -596,67 +535,6 @@ func (m *MsgCancelVest) GetDenom() string { return "" } -type MsgCancelVestCW struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` - Denom string `protobuf:"bytes,4,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *MsgCancelVestCW) Reset() { *m = MsgCancelVestCW{} } -func (m *MsgCancelVestCW) String() string { return proto.CompactTextString(m) } -func (*MsgCancelVestCW) ProtoMessage() {} -func (*MsgCancelVestCW) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{12} -} -func (m *MsgCancelVestCW) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCancelVestCW) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCancelVestCW.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 *MsgCancelVestCW) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCancelVestCW.Merge(m, src) -} -func (m *MsgCancelVestCW) XXX_Size() int { - return m.Size() -} -func (m *MsgCancelVestCW) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCancelVestCW.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCancelVestCW proto.InternalMessageInfo - -func (m *MsgCancelVestCW) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgCancelVestCW) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *MsgCancelVestCW) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - type MsgCancelVestResponse struct { } @@ -664,7 +542,7 @@ func (m *MsgCancelVestResponse) Reset() { *m = MsgCancelVestResponse{} } func (m *MsgCancelVestResponse) String() string { return proto.CompactTextString(m) } func (*MsgCancelVestResponse) ProtoMessage() {} func (*MsgCancelVestResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{13} + return fileDescriptor_eda78aafe7eb119c, []int{11} } func (m *MsgCancelVestResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -703,7 +581,7 @@ func (m *MsgVestNow) Reset() { *m = MsgVestNow{} } func (m *MsgVestNow) String() string { return proto.CompactTextString(m) } func (*MsgVestNow) ProtoMessage() {} func (*MsgVestNow) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{14} + return fileDescriptor_eda78aafe7eb119c, []int{12} } func (m *MsgVestNow) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -753,7 +631,7 @@ func (m *MsgVestNowResponse) Reset() { *m = MsgVestNowResponse{} } func (m *MsgVestNowResponse) String() string { return proto.CompactTextString(m) } func (*MsgVestNowResponse) ProtoMessage() {} func (*MsgVestNowResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{15} + return fileDescriptor_eda78aafe7eb119c, []int{13} } func (m *MsgVestNowResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -796,7 +674,7 @@ func (m *MsgUpdateVestingInfo) Reset() { *m = MsgUpdateVestingInfo{} } func (m *MsgUpdateVestingInfo) String() string { return proto.CompactTextString(m) } func (*MsgUpdateVestingInfo) ProtoMessage() {} func (*MsgUpdateVestingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{16} + return fileDescriptor_eda78aafe7eb119c, []int{14} } func (m *MsgUpdateVestingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -881,7 +759,7 @@ func (m *MsgUpdateVestingInfoResponse) Reset() { *m = MsgUpdateVestingIn func (m *MsgUpdateVestingInfoResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateVestingInfoResponse) ProtoMessage() {} func (*MsgUpdateVestingInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{17} + return fileDescriptor_eda78aafe7eb119c, []int{15} } func (m *MsgUpdateVestingInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -920,7 +798,7 @@ func (m *MsgVestLiquid) Reset() { *m = MsgVestLiquid{} } func (m *MsgVestLiquid) String() string { return proto.CompactTextString(m) } func (*MsgVestLiquid) ProtoMessage() {} func (*MsgVestLiquid) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{18} + return fileDescriptor_eda78aafe7eb119c, []int{16} } func (m *MsgVestLiquid) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -970,7 +848,7 @@ func (m *MsgVestLiquidResponse) Reset() { *m = MsgVestLiquidResponse{} } func (m *MsgVestLiquidResponse) String() string { return proto.CompactTextString(m) } func (*MsgVestLiquidResponse) ProtoMessage() {} func (*MsgVestLiquidResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{19} + return fileDescriptor_eda78aafe7eb119c, []int{17} } func (m *MsgVestLiquidResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1007,7 +885,7 @@ func (m *MsgClaimRewards) Reset() { *m = MsgClaimRewards{} } func (m *MsgClaimRewards) String() string { return proto.CompactTextString(m) } func (*MsgClaimRewards) ProtoMessage() {} func (*MsgClaimRewards) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{20} + return fileDescriptor_eda78aafe7eb119c, []int{18} } func (m *MsgClaimRewards) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1050,7 +928,7 @@ func (m *MsgClaimRewardsResponse) Reset() { *m = MsgClaimRewardsResponse func (m *MsgClaimRewardsResponse) String() string { return proto.CompactTextString(m) } func (*MsgClaimRewardsResponse) ProtoMessage() {} func (*MsgClaimRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{21} + return fileDescriptor_eda78aafe7eb119c, []int{19} } func (m *MsgClaimRewardsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1081,17 +959,16 @@ var xxx_messageInfo_MsgClaimRewardsResponse proto.InternalMessageInfo type MsgStake struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` - Asset string `protobuf:"bytes,4,opt,name=asset,proto3" json:"asset,omitempty"` - ValidatorAddress string `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Asset string `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset,omitempty"` + ValidatorAddress string `protobuf:"bytes,4,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *MsgStake) Reset() { *m = MsgStake{} } func (m *MsgStake) String() string { return proto.CompactTextString(m) } func (*MsgStake) ProtoMessage() {} func (*MsgStake) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{22} + return fileDescriptor_eda78aafe7eb119c, []int{20} } func (m *MsgStake) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1127,13 +1004,6 @@ func (m *MsgStake) GetCreator() string { return "" } -func (m *MsgStake) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - func (m *MsgStake) GetAsset() string { if m != nil { return m.Asset @@ -1157,7 +1027,7 @@ func (m *MsgStakeResponse) Reset() { *m = MsgStakeResponse{} } func (m *MsgStakeResponse) String() string { return proto.CompactTextString(m) } func (*MsgStakeResponse) ProtoMessage() {} func (*MsgStakeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{23} + return fileDescriptor_eda78aafe7eb119c, []int{21} } func (m *MsgStakeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1202,17 +1072,16 @@ func (m *MsgStakeResponse) GetResult() string { type MsgUnstake struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` - Asset string `protobuf:"bytes,4,opt,name=asset,proto3" json:"asset,omitempty"` - ValidatorAddress string `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Asset string `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset,omitempty"` + ValidatorAddress string `protobuf:"bytes,4,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *MsgUnstake) Reset() { *m = MsgUnstake{} } func (m *MsgUnstake) String() string { return proto.CompactTextString(m) } func (*MsgUnstake) ProtoMessage() {} func (*MsgUnstake) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{24} + return fileDescriptor_eda78aafe7eb119c, []int{22} } func (m *MsgUnstake) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1248,13 +1117,6 @@ func (m *MsgUnstake) GetCreator() string { return "" } -func (m *MsgUnstake) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - func (m *MsgUnstake) GetAsset() string { if m != nil { return m.Asset @@ -1278,7 +1140,7 @@ func (m *MsgUnstakeResponse) Reset() { *m = MsgUnstakeResponse{} } func (m *MsgUnstakeResponse) String() string { return proto.CompactTextString(m) } func (*MsgUnstakeResponse) ProtoMessage() {} func (*MsgUnstakeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_eda78aafe7eb119c, []int{25} + return fileDescriptor_eda78aafe7eb119c, []int{23} } func (m *MsgUnstakeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1331,10 +1193,8 @@ func init() { proto.RegisterType((*MsgCommitLiquidTokens)(nil), "elys.commitment.MsgCommitLiquidTokens") proto.RegisterType((*MsgCommitLiquidTokensResponse)(nil), "elys.commitment.MsgCommitLiquidTokensResponse") proto.RegisterType((*MsgVest)(nil), "elys.commitment.MsgVest") - proto.RegisterType((*MsgVestCW)(nil), "elys.commitment.MsgVestCW") proto.RegisterType((*MsgVestResponse)(nil), "elys.commitment.MsgVestResponse") proto.RegisterType((*MsgCancelVest)(nil), "elys.commitment.MsgCancelVest") - proto.RegisterType((*MsgCancelVestCW)(nil), "elys.commitment.MsgCancelVestCW") proto.RegisterType((*MsgCancelVestResponse)(nil), "elys.commitment.MsgCancelVestResponse") proto.RegisterType((*MsgVestNow)(nil), "elys.commitment.MsgVestNow") proto.RegisterType((*MsgVestNowResponse)(nil), "elys.commitment.MsgVestNowResponse") @@ -1353,64 +1213,62 @@ func init() { func init() { proto.RegisterFile("elys/commitment/tx.proto", fileDescriptor_eda78aafe7eb119c) } var fileDescriptor_eda78aafe7eb119c = []byte{ - // 908 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0xee, 0x6c, 0xd3, 0x86, 0x3c, 0xb1, 0xfd, 0x31, 0x0a, 0xbb, 0xae, 0xbb, 0x9b, 0x76, 0xbd, - 0xa2, 0x0a, 0xac, 0x9a, 0x20, 0xb8, 0x23, 0x68, 0xd9, 0x95, 0x2a, 0x48, 0x0f, 0x66, 0x0b, 0x12, - 0x17, 0xe3, 0xc6, 0x53, 0xd7, 0x4a, 0x3c, 0x13, 0x3c, 0xe3, 0x4d, 0x7b, 0x44, 0x02, 0x81, 0xc4, - 0x05, 0x24, 0xae, 0x9c, 0xb8, 0xf3, 0x77, 0x2c, 0xe2, 0xb2, 0x47, 0xc4, 0x61, 0x85, 0xda, 0x7f, - 0x04, 0xcd, 0x8c, 0x3d, 0x71, 0x53, 0x27, 0x54, 0x08, 0xc9, 0x88, 0x53, 0x32, 0xef, 0xfb, 0xfc, - 0xe6, 0x7b, 0x9f, 0xf3, 0xde, 0x4c, 0xc0, 0x22, 0xc3, 0x73, 0xde, 0xed, 0xb3, 0x38, 0x8e, 0x44, - 0x4c, 0xa8, 0xe8, 0x8a, 0xb3, 0xce, 0x28, 0x61, 0x82, 0xe1, 0x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, 0x85, 0xfe, 0xbc, 0x68, 0xa1, 0xef, 0x2f, 0x5b, 0x0b, 0x2f, 0x2e, 0x5b, 0x0b, 0xbf, - 0x5f, 0xb6, 0x16, 0x3e, 0xeb, 0x16, 0xc6, 0x8a, 0x4c, 0xb4, 0x4b, 0x89, 0x18, 0xb3, 0x64, 0xa0, - 0x16, 0xdd, 0xb3, 0x2b, 0x7f, 0x18, 0xe5, 0x8c, 0x39, 0x5e, 0x56, 0xff, 0x06, 0xdf, 0xf9, 0x2b, - 0x00, 0x00, 0xff, 0xff, 0xf3, 0x17, 0xcb, 0x72, 0x50, 0x0e, 0x00, 0x00, + // 867 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x97, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xeb, 0x36, 0x6d, 0xc8, 0x13, 0xdb, 0x1f, 0xa3, 0xb0, 0xeb, 0xba, 0xbb, 0x6e, 0xd7, + 0x2b, 0xa2, 0xc0, 0xaa, 0x09, 0x82, 0x3b, 0x82, 0x2e, 0xbb, 0x52, 0x04, 0xe9, 0xc1, 0x6c, 0x39, + 0x70, 0x31, 0xae, 0x3d, 0x75, 0xad, 0xd8, 0x33, 0xc1, 0x33, 0xde, 0xa4, 0x47, 0x24, 0x10, 0x48, + 0x5c, 0x40, 0xe2, 0xef, 0x00, 0xf1, 0x5f, 0xec, 0x71, 0x8f, 0x88, 0xc3, 0x0a, 0xb5, 0xff, 0x08, + 0x9a, 0x19, 0x67, 0xe2, 0xa4, 0x4e, 0xa9, 0x38, 0x10, 0x71, 0x4a, 0xe6, 0x7d, 0xdf, 0xbc, 0xf9, + 0xbc, 0xf1, 0xcc, 0x7b, 0x36, 0x98, 0x38, 0xb9, 0x60, 0xdd, 0x80, 0xa6, 0x69, 0xcc, 0x53, 0x4c, + 0x78, 0x97, 0x8f, 0x3b, 0xc3, 0x8c, 0x72, 0x8a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0xa8, 0x31, 0xa7, + 0x1b, 0xf2, 0x9b, 0xe4, 0x83, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x1a, 0xf6, 0xc9, 0xd6, + 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2169,60 +2027,6 @@ func (m *MsgVest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgVestCW) 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 *MsgVestCW) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVestCW) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0x22 - } - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *MsgVestResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2293,60 +2097,6 @@ func (m *MsgCancelVest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgCancelVestCW) 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 *MsgCancelVestCW) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCancelVestCW) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0x22 - } - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *MsgCancelVestResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2677,14 +2427,14 @@ func (m *MsgStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ValidatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.Asset) > 0 { i -= len(m.Asset) copy(dAtA[i:], m.Asset) i = encodeVarintTx(dAtA, i, uint64(len(m.Asset))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } { size := m.Amount.Size() @@ -2695,14 +2445,7 @@ func (m *MsgStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } + dAtA[i] = 0x12 if len(m.Creator) > 0 { i -= len(m.Creator) copy(dAtA[i:], m.Creator) @@ -2773,14 +2516,14 @@ func (m *MsgUnstake) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ValidatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.Asset) > 0 { i -= len(m.Asset) copy(dAtA[i:], m.Asset) i = encodeVarintTx(dAtA, i, uint64(len(m.Asset))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } { size := m.Amount.Size() @@ -2791,14 +2534,7 @@ func (m *MsgUnstake) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } + dAtA[i] = 0x12 if len(m.Creator) > 0 { i -= len(m.Creator) copy(dAtA[i:], m.Creator) @@ -2989,17 +2725,22 @@ func (m *MsgVest) Size() (n int) { return n } -func (m *MsgVestCW) Size() (n int) { +func (m *MsgVestResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCancelVest) Size() (n int) { + if m == nil { + return 0 } - l = len(m.Address) + var l int + _ = l + l = len(m.Creator) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3012,7 +2753,7 @@ func (m *MsgVestCW) Size() (n int) { return n } -func (m *MsgVestResponse) Size() (n int) { +func (m *MsgCancelVestResponse) Size() (n int) { if m == nil { return 0 } @@ -3021,7 +2762,7 @@ func (m *MsgVestResponse) Size() (n int) { return n } -func (m *MsgCancelVest) Size() (n int) { +func (m *MsgVestNow) Size() (n int) { if m == nil { return 0 } @@ -3040,77 +2781,26 @@ func (m *MsgCancelVest) Size() (n int) { return n } -func (m *MsgCancelVestCW) Size() (n int) { +func (m *MsgVestNowResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Creator) + return n +} + +func (m *MsgUpdateVestingInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgCancelVestResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgVestNow) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgVestNowResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateVestingInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.BaseDenom) + l = len(m.BaseDenom) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3203,10 +2893,6 @@ func (m *MsgStake) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = m.Amount.Size() n += 1 + l + sovTx(uint64(l)) l = len(m.Asset) @@ -3246,10 +2932,6 @@ func (m *MsgUnstake) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = m.Amount.Size() n += 1 + l + sovTx(uint64(l)) l = len(m.Asset) @@ -4244,186 +3926,6 @@ func (m *MsgVest) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVestCW) 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 ErrIntOverflowTx - } - 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: MsgVestCW: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVestCW: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgVestResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4622,186 +4124,6 @@ func (m *MsgCancelVest) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCancelVestCW) 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 ErrIntOverflowTx - } - 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: MsgCancelVestCW: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCancelVestCW: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgCancelVestResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5727,38 +5049,6 @@ func (m *MsgStake) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -5792,7 +5082,7 @@ func (m *MsgStake) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType) } @@ -5824,7 +5114,7 @@ func (m *MsgStake) Unmarshal(dAtA []byte) error { } m.Asset = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) } @@ -6040,38 +5330,6 @@ func (m *MsgUnstake) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -6105,7 +5363,7 @@ func (m *MsgUnstake) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Asset", wireType) } @@ -6137,7 +5395,7 @@ func (m *MsgUnstake) Unmarshal(dAtA []byte) error { } m.Asset = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) } diff --git a/x/incentive/client/wasm/msg_begin_redelegate.go b/x/incentive/client/wasm/msg_begin_redelegate.go index fb6e06007..eb600b758 100644 --- a/x/incentive/client/wasm/msg_begin_redelegate.go +++ b/x/incentive/client/wasm/msg_begin_redelegate.go @@ -18,7 +18,7 @@ func (m *Messenger) msgBeginRedelegate(ctx sdk.Context, contractAddr sdk.AccAddr var err error brokerAddress := m.parameterKeeper.GetParams(ctx).BrokerAddress - if msgRedelegate.Creator != contractAddr.String() && contractAddr.String() != brokerAddress { + if msgRedelegate.DelegatorAddress != contractAddr.String() && contractAddr.String() != brokerAddress { return nil, nil, wasmvmtypes.InvalidRequest{Err: "wrong sender"} } diff --git a/x/incentive/client/wasm/msg_cancel_unbonding_delegation.go b/x/incentive/client/wasm/msg_cancel_unbonding_delegation.go index 6c0a006c6..84f85e8d1 100644 --- a/x/incentive/client/wasm/msg_cancel_unbonding_delegation.go +++ b/x/incentive/client/wasm/msg_cancel_unbonding_delegation.go @@ -18,7 +18,7 @@ func (m *Messenger) msgCancelUnbondingDelegation(ctx sdk.Context, contractAddr s var err error brokerAddress := m.parameterKeeper.GetParams(ctx).BrokerAddress - if msgCancelUnbonding.Creator != contractAddr.String() && contractAddr.String() != brokerAddress { + if msgCancelUnbonding.DelegatorAddress != contractAddr.String() && contractAddr.String() != brokerAddress { return nil, nil, wasmvmtypes.InvalidRequest{Err: "wrong sender"} } diff --git a/x/incentive/client/wasm/msg_withdraw_rewards.go b/x/incentive/client/wasm/msg_withdraw_rewards.go index 3051c2f6c..8ad483fa8 100644 --- a/x/incentive/client/wasm/msg_withdraw_rewards.go +++ b/x/incentive/client/wasm/msg_withdraw_rewards.go @@ -17,7 +17,7 @@ func (m *Messenger) msgWithdrawRewards(ctx sdk.Context, contractAddr sdk.AccAddr var err error brokerAddress := m.parameterKeeper.GetParams(ctx).BrokerAddress - if msgWithdrawRewards.Creator != contractAddr.String() && contractAddr.String() != brokerAddress { + if msgWithdrawRewards.DelegatorAddress != contractAddr.String() && contractAddr.String() != brokerAddress { return nil, nil, wasmvmtypes.InvalidRequest{Err: "wrong sender"} } diff --git a/x/incentive/client/wasm/msg_withdraw_validator_commission.go b/x/incentive/client/wasm/msg_withdraw_validator_commission.go index 8d29059f5..739872f1b 100644 --- a/x/incentive/client/wasm/msg_withdraw_validator_commission.go +++ b/x/incentive/client/wasm/msg_withdraw_validator_commission.go @@ -17,7 +17,7 @@ func (m *Messenger) msgWithdrawValidatorCommission(ctx sdk.Context, contractAddr var err error brokerAddress := m.parameterKeeper.GetParams(ctx).BrokerAddress - if msgWithdrawValidatorCommission.Creator != contractAddr.String() && contractAddr.String() != brokerAddress { + if msgWithdrawValidatorCommission.DelegatorAddress != contractAddr.String() && contractAddr.String() != brokerAddress { return nil, nil, wasmvmtypes.InvalidRequest{Err: "wrong sender"} } diff --git a/x/incentive/types/tx.pb.go b/x/incentive/types/tx.pb.go index 5cb5ee58b..f288e82d9 100644 --- a/x/incentive/types/tx.pb.go +++ b/x/incentive/types/tx.pb.go @@ -35,9 +35,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // from a single validator. type MsgWithdrawRewards struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - WithdrawType types.EarnType `protobuf:"varint,3,opt,name=withdraw_type,json=withdrawType,proto3,enum=elys.commitment.EarnType" json:"withdraw_type,omitempty"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + WithdrawType types.EarnType `protobuf:"varint,2,opt,name=withdraw_type,json=withdrawType,proto3,enum=elys.commitment.EarnType" json:"withdraw_type,omitempty"` } func (m *MsgWithdrawRewards) Reset() { *m = MsgWithdrawRewards{} } @@ -113,9 +112,8 @@ var xxx_messageInfo_MsgWithdrawRewardsResponse proto.InternalMessageInfo // MsgWithdrawValidatorCommission withdraws the full commission to the validator // address. type MsgWithdrawValidatorCommission struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorAddress string `protobuf:"bytes,3,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *MsgWithdrawValidatorCommission) Reset() { *m = MsgWithdrawValidatorCommission{} } @@ -307,11 +305,10 @@ func (m *MsgUpdateIncentiveParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateIncentiveParamsResponse proto.InternalMessageInfo type MsgBeginRedelegate struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorSrcAddress string `protobuf:"bytes,3,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` - ValidatorDstAddress string `protobuf:"bytes,4,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` - Amount types1.Coin `protobuf:"bytes,5,opt,name=amount,proto3" json:"amount"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` + Amount types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` } func (m *MsgBeginRedelegate) Reset() { *m = MsgBeginRedelegate{} } @@ -348,13 +345,12 @@ func (m *MsgBeginRedelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBeginRedelegate proto.InternalMessageInfo type MsgCancelUnbondingDelegation struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorAddress string `protobuf:"bytes,3,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` // amount is always less than or equal to unbonding delegation entry balance - Amount types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` // creation_height is the height which the unbonding took place. - CreationHeight int64 `protobuf:"varint,5,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` + CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` } func (m *MsgCancelUnbondingDelegation) Reset() { *m = MsgCancelUnbondingDelegation{} } @@ -404,59 +400,58 @@ func init() { func init() { proto.RegisterFile("elys/incentive/tx.proto", fileDescriptor_59dc3bedfb1cce84) } var fileDescriptor_59dc3bedfb1cce84 = []byte{ - // 828 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4d, 0x6f, 0x23, 0x35, - 0x18, 0xce, 0x24, 0xd9, 0x6e, 0x6b, 0x96, 0x2e, 0xeb, 0x6e, 0xd5, 0x69, 0x36, 0x9a, 0x44, 0x39, - 0x2c, 0x11, 0x52, 0x67, 0xda, 0x80, 0x00, 0x71, 0x40, 0x34, 0x6d, 0xaa, 0x22, 0x35, 0x52, 0x35, - 0x6d, 0x41, 0xe2, 0x12, 0x9c, 0x19, 0x6b, 0x62, 0x25, 0xb1, 0x47, 0xb6, 0xd3, 0x24, 0x3f, 0x00, - 0x89, 0x23, 0xbf, 0x00, 0xf5, 0x47, 0xf0, 0x23, 0x7a, 0xe0, 0x50, 0x71, 0x02, 0x0e, 0x15, 0x6a, - 0x85, 0xc4, 0x01, 0xf1, 0x1b, 0x90, 0xe7, 0x2b, 0x69, 0x3b, 0x4d, 0x3f, 0x2e, 0x95, 0xf6, 0x94, - 0xd8, 0xcf, 0xe3, 0x67, 0xde, 0xf7, 0xf1, 0x6b, 0xbf, 0x06, 0x2b, 0xb8, 0x37, 0x16, 0x16, 0xa1, - 0x0e, 0xa6, 0x92, 0x1c, 0x63, 0x4b, 0x8e, 0x4c, 0x9f, 0x33, 0xc9, 0xe0, 0xa2, 0x02, 0xcc, 0x04, - 0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0x53, 0x2e, 0xe5, 0x1f, 0xe4, 0x12, 0xfc, 0x10, 0xbc, 0x0c, 0x32, 0x22, 0x8c, 0xb6, 0x3a, - 0x98, 0x78, 0x1d, 0x19, 0x5d, 0x14, 0x8b, 0xf1, 0xf4, 0x6e, 0x30, 0x3b, 0xb1, 0xb3, 0xf6, 0x77, - 0x16, 0xe4, 0x9a, 0xc2, 0x83, 0x08, 0xbc, 0xbc, 0xde, 0x9b, 0x2b, 0xe6, 0xd5, 0x27, 0x83, 0x79, - 0xb3, 0xc9, 0x15, 0x3e, 0xba, 0x9b, 0x13, 0x1f, 0x15, 0xf8, 0x83, 0x06, 0xde, 0xcc, 0xea, 0x82, - 0xe6, 0x0c, 0xad, 0x14, 0x7e, 0xe1, 0xd3, 0x87, 0xf1, 0x93, 0x38, 0x04, 0x58, 0x4e, 0xef, 0x39, - 0xd5, 0x14, 0xc1, 0x54, 0x66, 0x61, 0xfd, 0xbe, 0xcc, 0xf8, 0xa3, 0xf5, 0xdd, 0xd3, 0x0b, 0x43, - 0x3b, 0xbb, 0x30, 0xb4, 0xbf, 0x2e, 0x0c, 0xed, 0xa7, 0x4b, 0x23, 0x73, 0x76, 0x69, 0x64, 0x7e, - 0xbf, 0x34, 0x32, 0xdf, 0x99, 0x53, 0xd7, 0xa3, 0x52, 0x5d, 0xa3, 0x58, 0x0e, 0x19, 0xef, 0x06, - 0x03, 0x6b, 0x34, 0xfd, 0x96, 0x53, 0x57, 0x65, 0x7b, 0x2e, 0x78, 0x50, 0x7d, 0xfc, 0x7f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x8b, 0x4d, 0x54, 0xa8, 0xea, 0x09, 0x00, 0x00, + // 816 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0xe3, 0x46, + 0x18, 0x8e, 0x13, 0xa0, 0x30, 0xa5, 0x50, 0x0c, 0x08, 0x13, 0x22, 0x27, 0xca, 0x81, 0x46, 0x95, + 0xb0, 0x81, 0x56, 0x6d, 0xd5, 0x43, 0x55, 0x02, 0x41, 0x54, 0x22, 0x12, 0x32, 0xd0, 0x4a, 0xbd, + 0xa4, 0x13, 0x7b, 0xe4, 0x8c, 0x92, 0xcc, 0x58, 0x33, 0x13, 0x92, 0xfc, 0x80, 0x4a, 0x3d, 0xf6, + 0xd8, 0x53, 0xc5, 0x65, 0xff, 0xc1, 0x1e, 0x56, 0xfb, 0x0b, 0x38, 0xa2, 0x3d, 0xad, 0xf6, 0x80, + 0x56, 0xa0, 0x95, 0xf6, 0x67, 0xac, 0xc6, 0x5f, 0x09, 0x60, 0xc2, 0x87, 0x38, 0xec, 0x29, 0xf1, + 0x3c, 0xcf, 0x3c, 0x7e, 0xdf, 0x67, 0xde, 0x79, 0x5f, 0x83, 0x25, 0xd4, 0xea, 0x73, 0x13, 0x13, + 0x1b, 0x11, 0x81, 0x4f, 0x90, 0x29, 0x7a, 0x86, 0xc7, 0xa8, 0xa0, 0xea, 0x8c, 0x04, 0x8c, 0x18, + 0xc8, 0x2e, 0xb8, 0xd4, 0xa5, 0x3e, 0x64, 0xca, 0x7f, 0x01, 0x2b, 0xbb, 0x6c, 0x53, 0xde, 0xa6, + 0xbc, 0x16, 0x00, 0xc1, 0x43, 0x08, 0xe5, 0x7c, 0x65, 0x9b, 0xb6, 0xdb, 0x58, 0xb4, 0x11, 0x11, + 0xa6, 0x07, 0x19, 0x6c, 0x47, 0xa8, 0x1e, 0x70, 0xcd, 0x3a, 0xe4, 0xc8, 0x3c, 0xd9, 0xa8, 0x23, + 0x01, 0x37, 0x4c, 0x9b, 0x62, 0x12, 0xe0, 0xc5, 0x17, 0x0a, 0x50, 0xab, 0xdc, 0xfd, 0x03, 0x8b, + 0x86, 0xc3, 0x60, 0xd7, 0x42, 0x5d, 0xc8, 0x1c, 0xae, 0x56, 0xc0, 0x9c, 0x83, 0x5a, 0xc8, 0x85, + 0x82, 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, 0xe4, 0x57, 0x5d, 0x2c, 0x1a, 0x9d, 0xba, 0x3c, 0x8f, 0xb0, + 0xb4, 0xc2, 0x9f, 0x35, 0xee, 0x34, 0x4d, 0x79, 0x6e, 0xdc, 0xd8, 0x41, 0xb6, 0x75, 0x4d, 0x43, + 0x5d, 0x07, 0xf3, 0xd1, 0x59, 0xc9, 0xac, 0x2a, 0x04, 0xd6, 0x5b, 0xc8, 0xd1, 0x32, 0x05, 0xa5, + 0x34, 0x69, 0x25, 0x41, 0xea, 0x5f, 0x60, 0x9e, 0xf9, 0x07, 0x77, 0x40, 0x99, 0xc0, 0x94, 0xec, + 0x52, 0xb6, 0xef, 0x71, 0x6d, 0xec, 0x49, 0xc1, 0x24, 0x49, 0xa9, 0xdf, 0x83, 0x45, 0x59, 0x59, + 0x87, 0x02, 0x36, 0xd1, 0x11, 0x83, 0x76, 0x53, 0xba, 0x0f, 0x05, 0xd2, 0xc6, 0x0b, 0x4a, 0x29, + 0x63, 0x25, 0x83, 0x6a, 0x03, 0x2c, 0xb5, 0x61, 0xaf, 0xe2, 0x20, 0x12, 0xd4, 0xd5, 0x96, 0xc7, + 0x7c, 0x12, 0xe3, 0xda, 0xc4, 0x93, 0x62, 0xbb, 0x4b, 0x4e, 0x3a, 0x70, 0x13, 0x92, 0x0e, 0x7c, + 0xf1, 0x34, 0x07, 0x12, 0xa4, 0xd4, 0x5f, 0xc1, 0x8a, 0x83, 0xb9, 0x60, 0xb8, 0xde, 0x91, 0xbe, + 0x54, 0x3c, 0x6a, 0x37, 0x76, 0x69, 0x9c, 0xcf, 0xa4, 0xef, 0xc3, 0x28, 0x8a, 0xfa, 0x13, 0x58, + 0x4a, 0x82, 0x65, 0x9c, 0x53, 0xfe, 0xee, 0xbb, 0xe0, 0x62, 0x11, 0x14, 0xee, 0xaa, 0xcf, 0xb8, + 0x88, 0x5f, 0xa7, 0xfd, 0x7e, 0x53, 0x46, 0x2e, 0x26, 0x16, 0x0a, 0xaf, 0x17, 0x7a,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9, 0x2b, 0xe7, 0x97, 0xba, 0xf2, 0xfe, 0x52, 0x57, 0xfe, 0xbd, 0xd2, 0x53, + 0xe7, 0x57, 0x7a, 0xea, 0xed, 0x95, 0x9e, 0xfa, 0xd3, 0x18, 0x6a, 0x5b, 0x52, 0x75, 0x8d, 0x20, + 0xd1, 0xa5, 0xac, 0xe9, 0x3f, 0x98, 0xbd, 0xe1, 0x6f, 0x1f, 0xd9, 0xc2, 0xea, 0x13, 0xfe, 0x07, + 0xc8, 0x77, 0x9f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xf1, 0x19, 0xdf, 0x1a, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -642,20 +637,13 @@ func (m *MsgWithdrawRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.WithdrawType != 0 { i = encodeVarintTx(dAtA, i, uint64(m.WithdrawType)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x10 } if len(m.DelegatorAddress) > 0 { i -= len(m.DelegatorAddress) copy(dAtA[i:], m.DelegatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -709,20 +697,13 @@ func (m *MsgWithdrawValidatorCommission) MarshalToSizedBuffer(dAtA []byte) (int, copy(dAtA[i:], m.ValidatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.DelegatorAddress) > 0 { i -= len(m.DelegatorAddress) copy(dAtA[i:], m.DelegatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -898,33 +879,26 @@ func (m *MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 if len(m.ValidatorDstAddress) > 0 { i -= len(m.ValidatorDstAddress) copy(dAtA[i:], m.ValidatorDstAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorDstAddress))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.ValidatorSrcAddress) > 0 { i -= len(m.ValidatorSrcAddress) copy(dAtA[i:], m.ValidatorSrcAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorSrcAddress))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.DelegatorAddress) > 0 { i -= len(m.DelegatorAddress) copy(dAtA[i:], m.DelegatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -953,7 +927,7 @@ func (m *MsgCancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, e if m.CreationHeight != 0 { i = encodeVarintTx(dAtA, i, uint64(m.CreationHeight)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x20 } { size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) @@ -964,26 +938,19 @@ func (m *MsgCancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a if len(m.ValidatorAddress) > 0 { i -= len(m.ValidatorAddress) copy(dAtA[i:], m.ValidatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.DelegatorAddress) > 0 { i -= len(m.DelegatorAddress) copy(dAtA[i:], m.DelegatorAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -1006,10 +973,6 @@ func (m *MsgWithdrawRewards) Size() (n int) { } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.DelegatorAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1035,10 +998,6 @@ func (m *MsgWithdrawValidatorCommission) Size() (n int) { } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.DelegatorAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1107,10 +1066,6 @@ func (m *MsgBeginRedelegate) Size() (n int) { } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.DelegatorAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1134,10 +1089,6 @@ func (m *MsgCancelUnbondingDelegation) Size() (n int) { } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.DelegatorAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1190,38 +1141,6 @@ func (m *MsgWithdrawRewards) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } @@ -1253,7 +1172,7 @@ func (m *MsgWithdrawRewards) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WithdrawType", wireType) } @@ -1373,38 +1292,6 @@ func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } @@ -1436,7 +1323,7 @@ func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) } @@ -1914,38 +1801,6 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } @@ -1977,7 +1832,7 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) } @@ -2009,7 +1864,7 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { } m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) } @@ -2041,7 +1896,7 @@ func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { } m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -2125,38 +1980,6 @@ func (m *MsgCancelUnbondingDelegation) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } @@ -2188,7 +2011,7 @@ func (m *MsgCancelUnbondingDelegation) Unmarshal(dAtA []byte) error { } m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) } @@ -2220,7 +2043,7 @@ func (m *MsgCancelUnbondingDelegation) Unmarshal(dAtA []byte) error { } m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -2253,7 +2076,7 @@ func (m *MsgCancelUnbondingDelegation) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) } From 2c9150463c858decee4e06250d53698e80e3b592 Mon Sep 17 00:00:00 2001 From: kenta-elys Date: Mon, 4 Dec 2023 08:28:35 +0000 Subject: [PATCH 2/5] chore: update naming in incentive module --- docs/static/openapi.yml | 27 +++- proto/elys/incentive/params.proto | 26 ++-- x/incentive/keeper/keeper.go | 82 ++++++------ x/incentive/keeper/keeper_fees.go | 20 ++- x/incentive/keeper/keeper_fees_test.go | 2 +- x/incentive/keeper/params.go | 6 + x/incentive/types/params.go | 45 ++++++- x/incentive/types/params.pb.go | 176 ++++++++++++++++--------- 8 files changed, 249 insertions(+), 135 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index cc8a5d6cf..3fbf03660 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -39623,7 +39623,14 @@ paths: type: string description: >- Dex revenue percent for lps, 100 - reward_portion_for_lps - = revenue percent for stakers. + - reward_portion_for_stakers = revenue percent for + protocol. + reward_portion_for_stakers: + type: string + description: >- + Dex revenue percent for lps, 100 - reward_portion_for_lps + - reward_portion_for_stakers = revenue percent for + protocol. pool_infos: type: array items: @@ -84051,8 +84058,13 @@ definitions: reward_portion_for_lps: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps = revenue - percent for stakers. + Dex revenue percent for lps, 100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol. + reward_portion_for_stakers: + type: string + description: >- + Dex revenue percent for lps, 100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol. pool_infos: type: array items: @@ -84216,8 +84228,13 @@ definitions: reward_portion_for_lps: type: string description: >- - Dex revenue percent for lps, 100 - reward_portion_for_lps = - revenue percent for stakers. + Dex revenue percent for lps, 100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol. + reward_portion_for_stakers: + type: string + description: >- + Dex revenue percent for lps, 100 - reward_portion_for_lps - + reward_portion_for_stakers = revenue percent for protocol. pool_infos: type: array items: diff --git a/proto/elys/incentive/params.proto b/proto/elys/incentive/params.proto index f858b56a9..03ecb417f 100644 --- a/proto/elys/incentive/params.proto +++ b/proto/elys/incentive/params.proto @@ -20,39 +20,45 @@ message Params { ]; bool withdraw_addr_enabled = 4; - // Dex revenue percent for lps, 100 - reward_portion_for_lps = revenue percent for stakers. + // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. string reward_portion_for_lps = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - + + // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. + string reward_portion_for_stakers = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Pool information // poolId, reward wallet, mulitplier - repeated PoolInfo pool_infos = 6 [(gogoproto.nullable) = false]; + repeated PoolInfo pool_infos = 7 [(gogoproto.nullable) = false]; - int64 elys_stake_tracking_rate = 7; + int64 elys_stake_tracking_rate = 8; // Tracking dex rewards given to stakers - DexRewardsTracker dex_rewards_stakers = 8 [(gogoproto.nullable) = false]; + DexRewardsTracker dex_rewards_stakers = 9 [(gogoproto.nullable) = false]; // Tracking dex rewards given to LPs - DexRewardsTracker dex_rewards_lps = 9 [(gogoproto.nullable) = false]; + DexRewardsTracker dex_rewards_lps = 10 [(gogoproto.nullable) = false]; // Maximum eden reward apr for stakers - string max_eden_reward_apr_stakers = 10 [ + string max_eden_reward_apr_stakers = 11 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; // Maximum eden reward apr for lps - string max_eden_reward_apr_lps = 11 [ + string max_eden_reward_apr_lps = 12 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; // Distribution epochs for stakers in blocks - int64 distribution_epoch_for_stakers_in_blocks = 12; + int64 distribution_epoch_for_stakers_in_blocks = 13; // Distribution epochs for LPs in blocks - int64 distribution_epoch_for_lps_in_blocks = 13; + int64 distribution_epoch_for_lps_in_blocks = 14; } diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 55956f07c..21e60640e 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -106,29 +106,26 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty // Collect DEX revenue while tracking 65% of it for LPs reward calculation // Assume these are collected in USDC - dexRevenue, dexRevenueForLps := k.CollectDEXRevenue(ctx) - - // Calculate each portion of DEX revenue - stakers, LPs - dexRevenueDec := sdk.NewDecCoinsFromCoins(dexRevenue...) - dexRevenueForStakers := dexRevenueDec.Sub(dexRevenueForLps) + _, dexRevenueForLpsPerDistribution, dexRevenueForStakersPerDistribution := k.CollectDEXRevenue(ctx) // Calculate each portion of Gas fees collected - stakers, LPs gasFeeCollectedDec := sdk.NewDecCoinsFromCoins(k.tci.TotalFeesCollected...) rewardPortionForLps := k.GetDEXRewardPortionForLPs(ctx) + rewardPortionForStakers := k.GetDEXRewardPortionForStakers(ctx) gasFeesForLps := gasFeeCollectedDec.MulDecTruncate(rewardPortionForLps) - gasFeesForStakers := gasFeeCollectedDec.Sub(gasFeesForLps) + gasFeesForStakers := gasFeeCollectedDec.MulDecTruncate(rewardPortionForStakers) // Sum Dex revenue for stakers + Gas fees for stakers and name it dex Revenus for stakers // But won't sum dex revenue for LPs and gas fees for LPs as the LP revenue will be rewared by pool. - dexRevenueForStakers = dexRevenueForStakers.Add(gasFeesForStakers...) + dexRevenueForStakersPerDistribution = dexRevenueForStakersPerDistribution.Add(gasFeesForStakers...) // Fund community pool based on the communtiy tax - dexRevenueRemainedForStakers := k.UpdateCommunityPool(ctx, dexRevenueForStakers) + dexRevenueRemainedForStakersPerDistribution := k.UpdateCommunityPool(ctx, dexRevenueForStakersPerDistribution) // USDC amount in sdk.Dec type - dexRevenueLPsAmt := dexRevenueForLps.AmountOf(baseCurrency) - dexRevenueStakersAmt := dexRevenueRemainedForStakers.AmountOf(baseCurrency) - gasFeesLPsAmt := gasFeesForLps.AmountOf(baseCurrency) + dexRevenueLPsAmtPerDistribution := dexRevenueForLpsPerDistribution.AmountOf(baseCurrency) + dexRevenueStakersAmtPerDistribution := dexRevenueRemainedForStakersPerDistribution.AmountOf(baseCurrency) + gasFeesLPsAmtPerDistribution := gasFeesForLps.AmountOf(baseCurrency) edenBoostAPR := stakeIncentive.EdenBoostApr // Calculate eden amount per epoch @@ -144,25 +141,25 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty // Maximum eden based per distribution epoch on maximum APR - 30% by default // Allocated for staking per day = (0.3/365)* ( total elys staked + total Eden committed + total Eden boost committed) - maxEdenAmountPerStakers := params.MaxEdenRewardAprStakers.MulInt(k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted)).MulInt(stakeIncentive.AllocationEpochInBlocks).QuoInt(stakeIncentive.TotalBlocksPerYear) + maxEdenAmountPerStakersPerDay := params.MaxEdenRewardAprStakers.MulInt(k.tci.TotalElysBonded.Add(k.tci.TotalEdenEdenBoostCommitted)).MulInt(stakeIncentive.AllocationEpochInBlocks).QuoInt(stakeIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerEpochStakersPerDay = sdk.MinInt(edenAmountPerEpochStakersPerDay, maxEdenAmountPerStakers.TruncateInt()) + edenAmountPerEpochStakersPerDay = sdk.MinInt(edenAmountPerEpochStakersPerDay, maxEdenAmountPerStakersPerDay.TruncateInt()) // Calculate eden amount per distribution epoch - edenAmountPerEpochStakers := edenAmountPerEpochStakersPerDay.Mul(stakeIncentive.DistributionEpochInBlocks).Quo(stakeIncentive.AllocationEpochInBlocks) + edenAmountPerEpochStakersPerDistribution := edenAmountPerEpochStakersPerDay.Mul(stakeIncentive.DistributionEpochInBlocks).Quo(stakeIncentive.AllocationEpochInBlocks) // Track the DEX rewards distribution for stakers // Add dexRevenue amount that was tracked by Lp tracker - dexRevenueStakersAmt = dexRevenueStakersAmt.Add(params.DexRewardsStakers.AmountCollectedByOtherTracker) + dexRevenueStakersAmtPerDistribution = dexRevenueStakersAmtPerDistribution.Add(params.DexRewardsStakers.AmountCollectedByOtherTracker) // Increase block number params.DexRewardsStakers.NumBlocks = params.DexRewardsStakers.NumBlocks.Add(stakeIncentive.DistributionEpochInBlocks) // Incrase total dex rewards given - params.DexRewardsStakers.Amount = params.DexRewardsStakers.Amount.Add(dexRevenueStakersAmt) + params.DexRewardsStakers.Amount = params.DexRewardsStakers.Amount.Add(dexRevenueStakersAmtPerDistribution) // Reset amount from other tracker params.DexRewardsStakers.AmountCollectedByOtherTracker = sdk.ZeroDec() // Don't increase Lps rewards blocks, it will be increased whenever LP distribution epoch happens. - params.DexRewardsLps.AmountCollectedByOtherTracker = params.DexRewardsLps.AmountCollectedByOtherTracker.Add(dexRevenueLPsAmt).Add(gasFeesLPsAmt) + params.DexRewardsLps.AmountCollectedByOtherTracker = params.DexRewardsLps.AmountCollectedByOtherTracker.Add(dexRevenueLPsAmtPerDistribution).Add(gasFeesLPsAmtPerDistribution) k.SetParams(ctx, params) totalEdenGiven := sdk.ZeroInt() @@ -195,7 +192,7 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty // Calculate new unclaimed Eden tokens from Elys staked // ---------------------------------------------------------- - newUnclaimedEdenTokens, dexRewards, dexRewardsByStakers := k.CalculateRewardsForStakersByElysStaked(ctx, delegatedAmt, edenAmountPerEpochStakers, dexRevenueStakersAmt) + newUnclaimedEdenTokens, dexRewards, dexRewardsByStakers := k.CalculateRewardsForStakersByElysStaked(ctx, delegatedAmt, edenAmountPerEpochStakersPerDistribution, dexRevenueStakersAmtPerDistribution) // Total totalEdenGiven = totalEdenGiven.Add(newUnclaimedEdenTokens) totalRewardsGiven = totalRewardsGiven.Add(dexRewards) @@ -213,7 +210,7 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty // ---------------------------------------------------------- // ---------------------------------------------------------- edenCommitted := commitments.GetCommittedAmountForDenom(ptypes.Eden) - newUnclaimedEdenTokens, dexRewards = k.CalculateRewardsForStakersByCommitted(ctx, edenCommitted, edenAmountPerEpochStakers, dexRevenueStakersAmt) + newUnclaimedEdenTokens, dexRewards = k.CalculateRewardsForStakersByCommitted(ctx, edenCommitted, edenAmountPerEpochStakersPerDistribution, dexRevenueStakersAmtPerDistribution) // Total totalEdenGiven = totalEdenGiven.Add(newUnclaimedEdenTokens) @@ -233,7 +230,7 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty // ---------------------------------------------------------- // ---------------------------------------------------------- edenBoostCommitted := commitments.GetCommittedAmountForDenom(ptypes.EdenB) - newUnclaimedEdenTokens, dexRewards = k.CalculateRewardsForStakersByCommitted(ctx, edenBoostCommitted, edenAmountPerEpochStakers, dexRevenueStakersAmt) + newUnclaimedEdenTokens, dexRewards = k.CalculateRewardsForStakersByCommitted(ctx, edenBoostCommitted, edenAmountPerEpochStakersPerDistribution, dexRevenueStakersAmtPerDistribution) // Total totalEdenGiven = totalEdenGiven.Add(newUnclaimedEdenTokens) @@ -296,8 +293,8 @@ func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive ty ) // Calcualte the remainings - edenRemained := edenAmountPerEpochStakers.Sub(totalEdenGiven) - dexRewardsRemained := dexRevenueStakersAmt.Sub(sdk.NewDecFromInt(totalRewardsGiven)) + edenRemained := edenAmountPerEpochStakersPerDistribution.Sub(totalEdenGiven) + dexRewardsRemained := dexRevenueStakersAmtPerDistribution.Sub(sdk.NewDecFromInt(totalRewardsGiven)) // Fund community the remain coins // ---------------------------------- @@ -327,29 +324,26 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // Collect DEX revenue while tracking 65% of it for LPs reward calculation // Assume these are collected in USDC - dexRevenue, dexRevenueForLps := k.CollectDEXRevenue(ctx) - - // Calculate each portion of DEX revenue - stakers, LPs - dexRevenueDec := sdk.NewDecCoinsFromCoins(dexRevenue...) - dexRevenueForStakers := dexRevenueDec.Sub(dexRevenueForLps) + _, dexRevenueForLpsPerDistribution, dexRevenueForStakersPerDistribution := k.CollectDEXRevenue(ctx) // Calculate each portion of Gas fees collected - stakers, LPs gasFeeCollectedDec := sdk.NewDecCoinsFromCoins(k.tci.TotalFeesCollected...) rewardPortionForLps := k.GetDEXRewardPortionForLPs(ctx) - gasFeesForLps := gasFeeCollectedDec.MulDecTruncate(rewardPortionForLps) - gasFeesForStakers := gasFeeCollectedDec.Sub(gasFeesForLps) + rewardPortionForStakers := k.GetDEXRewardPortionForStakers(ctx) + gasFeesForLpsPerDistribution := gasFeeCollectedDec.MulDecTruncate(rewardPortionForLps) + gasFeesForStakersPerDistribution := gasFeeCollectedDec.MulDecTruncate(rewardPortionForStakers) // Sum Dex revenue for stakers + Gas fees for stakers and name it dex Revenus for stakers // But won't sum dex revenue for LPs and gas fees for LPs as the LP revenue will be rewared by pool. - dexRevenueForStakers = dexRevenueForStakers.Add(gasFeesForStakers...) + dexRevenueForStakersPerDistribution = dexRevenueForStakersPerDistribution.Add(gasFeesForStakersPerDistribution...) // Fund community pool based on the communtiy tax - dexRevenueRemainedForStakers := k.UpdateCommunityPool(ctx, dexRevenueForStakers) + dexRevenueRemainedForStakersPerDistribution := k.UpdateCommunityPool(ctx, dexRevenueForStakersPerDistribution) // USDC amount in sdk.Dec type - dexRevenueLPsAmt := dexRevenueForLps.AmountOf(baseCurrency) - dexRevenueStakersAmt := dexRevenueRemainedForStakers.AmountOf(baseCurrency) - gasFeesLPsAmt := gasFeesForLps.AmountOf(baseCurrency) + dexRevenueLPsAmtPerDistribution := dexRevenueForLpsPerDistribution.AmountOf(baseCurrency) + dexRevenueStakersAmtPerDistribution := dexRevenueRemainedForStakersPerDistribution.AmountOf(baseCurrency) + gasFeesLPsAmtPerDistribution := gasFeesForLpsPerDistribution.AmountOf(baseCurrency) // Proxy TVL // Multiplier on each liquidity pool @@ -371,24 +365,24 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // Maximum eden based per distribution epoch on maximum APR - 30% by default // Allocated for staking per day = (0.3/365)* (total weighted proxy TVL) - maxEdenAmountPerLps := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) + maxEdenAmountPerLpsPerDay := params.MaxEdenRewardAprLps.Mul(totalProxyTVL).MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(lpIncentive.TotalBlocksPerYear) // Use min amount (eden allocation from tokenomics and max apr based eden amount) - edenAmountPerEpochLPsPerDay = sdk.MinInt(edenAmountPerEpochLPsPerDay, maxEdenAmountPerLps.TruncateInt()) + edenAmountPerEpochLPsPerDay = sdk.MinInt(edenAmountPerEpochLPsPerDay, maxEdenAmountPerLpsPerDay.TruncateInt()) // Calculate Eden amount per distribution epoch - edenAmountPerEpochLPs := edenAmountPerEpochLPsPerDay.Mul(lpIncentive.DistributionEpochInBlocks).Quo(lpIncentive.AllocationEpochInBlocks) + edenAmountPerEpochLPsPerDistribution := edenAmountPerEpochLPsPerDay.Mul(lpIncentive.DistributionEpochInBlocks).Quo(lpIncentive.AllocationEpochInBlocks) // Add dexRevenue amount that was tracked by Lp tracker - dexRevenueLPsAmt = dexRevenueLPsAmt.Add(params.DexRewardsLps.AmountCollectedByOtherTracker) + dexRevenueLPsAmtPerDistribution = dexRevenueLPsAmtPerDistribution.Add(params.DexRewardsLps.AmountCollectedByOtherTracker) // Increase block number params.DexRewardsLps.NumBlocks = params.DexRewardsLps.NumBlocks.Add(lpIncentive.DistributionEpochInBlocks) // Incrase total dex rewards given - params.DexRewardsLps.Amount = params.DexRewardsLps.Amount.Add(dexRevenueLPsAmt).Add(gasFeesLPsAmt) + params.DexRewardsLps.Amount = params.DexRewardsLps.Amount.Add(dexRevenueLPsAmtPerDistribution).Add(gasFeesLPsAmtPerDistribution) // Reset amount from other tracker params.DexRewardsLps.AmountCollectedByOtherTracker = sdk.ZeroDec() // Don't increase Lps rewards blocks, it will be increased whenever LP distribution epoch happens. - params.DexRewardsStakers.AmountCollectedByOtherTracker = params.DexRewardsStakers.AmountCollectedByOtherTracker.Add(dexRevenueStakersAmt) + params.DexRewardsStakers.AmountCollectedByOtherTracker = params.DexRewardsStakers.AmountCollectedByOtherTracker.Add(dexRevenueStakersAmtPerDistribution) k.SetParams(ctx, params) totalEdenGivenLP := sdk.ZeroInt() @@ -417,7 +411,7 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // Distribute gas fees to LPs // ---------------------------------------------------------- // ---------------------------------------------------------- - newUnclaimedEdenTokensLp, dexRewardsLp := k.CalculateRewardsForLPs(ctx, totalProxyTVL, commitments, edenAmountPerEpochLPs, gasFeesLPsAmt) + newUnclaimedEdenTokensLp, dexRewardsLp := k.CalculateRewardsForLPs(ctx, totalProxyTVL, commitments, edenAmountPerEpochLPsPerDistribution, gasFeesLPsAmtPerDistribution) // Total totalEdenGivenLP = totalEdenGivenLP.Add(newUnclaimedEdenTokensLp) totalRewardsGivenLP = totalRewardsGivenLP.Add(dexRewardsLp) @@ -432,7 +426,7 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // Distribute gas fees to LPs // ---------------------------------------------------------- // ---------------------------------------------------------- - newUnclaimedEdenTokensStableLp, dexRewardsStableLp := k.CalculateRewardsForStableStakeLPs(ctx, totalProxyTVL, commitments, edenAmountPerEpochLPs, gasFeesLPsAmt, baseCurrency) + newUnclaimedEdenTokensStableLp, dexRewardsStableLp := k.CalculateRewardsForStableStakeLPs(ctx, totalProxyTVL, commitments, edenAmountPerEpochLPsPerDistribution, gasFeesLPsAmtPerDistribution, baseCurrency) // Total totalEdenGivenLP = totalEdenGivenLP.Add(newUnclaimedEdenTokensStableLp) @@ -458,8 +452,8 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince ) // Calcualte the remainings - edenRemainedLP := edenAmountPerEpochLPs.Sub(totalEdenGivenLP) - dexRewardsRemainedLP := dexRevenueLPsAmt.Add(gasFeesLPsAmt).Sub(sdk.NewDecFromInt(totalRewardsGivenLP)) + edenRemainedLP := edenAmountPerEpochLPsPerDistribution.Sub(totalEdenGivenLP) + dexRewardsRemainedLP := dexRevenueLPsAmtPerDistribution.Add(gasFeesLPsAmtPerDistribution).Sub(sdk.NewDecFromInt(totalRewardsGivenLP)) // Fund community the remain coins // ---------------------------------- diff --git a/x/incentive/keeper/keeper_fees.go b/x/incentive/keeper/keeper_fees.go index 24c50a280..1ef403813 100644 --- a/x/incentive/keeper/keeper_fees.go +++ b/x/incentive/keeper/keeper_fees.go @@ -59,8 +59,16 @@ func (k Keeper) CollectGasFeesToIncentiveModule(ctx sdk.Context, baseCurrency st totalSwappedCoins := sdk.Coins{} for _, tokenIn := range feesCollectedInt { - // skip for fee denom - usdc + // if it is base currency - usdc, we don't need convert. We just need to collect it to fee wallet. if tokenIn.Denom == baseCurrency { + // Transfer converted USDC fees to the Dex revenue module account + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, k.feeCollectorName, k.dexRevCollectorName, sdk.Coins{tokenIn}) + if err != nil { + panic(err) + } + + // Sum total swapped + totalSwappedCoins = totalSwappedCoins.Add(tokenIn) continue } @@ -79,7 +87,6 @@ func (k Keeper) CollectGasFeesToIncentiveModule(ctx sdk.Context, baseCurrency st } tokenOutAmount := tokenOutCoin.Amount - if !tokenOutAmount.IsPositive() { continue } @@ -114,10 +121,11 @@ func (k Keeper) CollectGasFeesToIncentiveModule(ctx sdk.Context, baseCurrency st // Assume this is already in USDC. // TODO: // + Collect revenue from margin, lend module -func (k Keeper) CollectDEXRevenue(ctx sdk.Context) (sdk.Coins, sdk.DecCoins) { +func (k Keeper) CollectDEXRevenue(ctx sdk.Context) (sdk.Coins, sdk.DecCoins, sdk.DecCoins) { // Total colllected revenue amount amountTotalCollected := sdk.Coins{} amountLPsCollected := sdk.DecCoins{} + amountStakersCollected := sdk.DecCoins{} // Iterate to calculate total Eden from LpElys, MElys committed k.amm.IterateLiquidityPools(ctx, func(p ammtypes.Pool) bool { @@ -143,12 +151,15 @@ func (k Keeper) CollectDEXRevenue(ctx sdk.Context) (sdk.Coins, sdk.DecCoins) { // LPs Portion param rewardPortionForLps := k.GetDEXRewardPortionForLPs(ctx) + // Stakers Portion param + rewardPortionForStakers := k.GetDEXRewardPortionForStakers(ctx) // Calculate revenue portion for LPs revenueDec := sdk.NewDecCoinsFromCoins(revenue...) // LPs portion of pool revenue revenuePortionForLPs := revenueDec.MulDecTruncate(rewardPortionForLps) + revenuePortionForStakers := revenueDec.MulDecTruncate(rewardPortionForStakers) // Get track key trackKey := types.GetPoolRevenueTrackKey(poolId) @@ -161,9 +172,10 @@ func (k Keeper) CollectDEXRevenue(ctx sdk.Context) (sdk.Coins, sdk.DecCoins) { // Sum total amount for LPs amountLPsCollected = amountLPsCollected.Add(revenuePortionForLPs...) + amountStakersCollected = amountStakersCollected.Add(revenuePortionForStakers...) return false }) - return amountTotalCollected, amountLPsCollected + return amountTotalCollected, amountLPsCollected, amountStakersCollected } diff --git a/x/incentive/keeper/keeper_fees_test.go b/x/incentive/keeper/keeper_fees_test.go index b0d239278..e9dbf14f3 100644 --- a/x/incentive/keeper/keeper_fees_test.go +++ b/x/incentive/keeper/keeper_fees_test.go @@ -214,7 +214,7 @@ func TestCollectDEXRevenueToIncentiveModule(t *testing.T) { require.NoError(t, err) // Collect revenue - collectedAmt, rewardForLpsAmt := ik.CollectDEXRevenue(ctx) + collectedAmt, rewardForLpsAmt, _ := ik.CollectDEXRevenue(ctx) // check block height require.Equal(t, int64(0), ctx.BlockHeight()) diff --git a/x/incentive/keeper/params.go b/x/incentive/keeper/params.go index a32ed3b9a..1ab0902a8 100644 --- a/x/incentive/keeper/params.go +++ b/x/incentive/keeper/params.go @@ -40,6 +40,12 @@ func (k Keeper) GetDEXRewardPortionForLPs(ctx sdk.Context) (percent sdk.Dec) { return percent } +// GetDEXRewardPortionForStakers returns the dex revenue percent for Stakers +func (k Keeper) GetDEXRewardPortionForStakers(ctx sdk.Context) (percent sdk.Dec) { + k.paramstore.Get(ctx, types.ParamStoreKeyRewardPortionForStakers, &percent) + return percent +} + // GetPoolInfo func (k Keeper) GetPoolInfo(ctx sdk.Context, poolId uint64) (types.PoolInfo, bool) { // Fetch incentive params diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 906ad8beb..8cd123c21 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -1,6 +1,7 @@ package types import ( + "errors" fmt "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,6 +16,7 @@ var ( ParamStoreKeyCommunityTax = []byte("communitytax") ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") ParamStoreKeyRewardPortionForLps = []byte("rewardportionforlps") + ParamStoreKeyRewardPortionForStakers = []byte("rewardportionforstakers") ParamStoreKeyLPIncentives = []byte("lpincentives") ParamStoreKeyStkIncentives = []byte("stkincentives") ParamStoreKeyPoolInfos = []byte("poolinfos") @@ -35,13 +37,14 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams() Params { return Params{ - LpIncentives: []IncentiveInfo(nil), - StakeIncentives: []IncentiveInfo(nil), - CommunityTax: sdk.NewDecWithPrec(2, 2), // 2% - WithdrawAddrEnabled: true, - RewardPortionForLps: sdk.NewDecWithPrec(65, 2), - PoolInfos: []PoolInfo(nil), - ElysStakeTrackingRate: 10, + LpIncentives: []IncentiveInfo(nil), + StakeIncentives: []IncentiveInfo(nil), + CommunityTax: sdk.NewDecWithPrec(2, 2), // 2% + WithdrawAddrEnabled: true, + RewardPortionForLps: sdk.NewDecWithPrec(60, 2), + RewardPortionForStakers: sdk.NewDecWithPrec(30, 2), + PoolInfos: []PoolInfo(nil), + ElysStakeTrackingRate: 10, DexRewardsStakers: DexRewardsTracker{ NumBlocks: sdk.ZeroInt(), Amount: sdk.ZeroDec(), @@ -70,6 +73,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(ParamStoreKeyCommunityTax, &p.CommunityTax, validateCommunityTax), paramtypes.NewParamSetPair(ParamStoreKeyWithdrawAddrEnabled, &p.WithdrawAddrEnabled, validateWithdrawAddrEnabled), paramtypes.NewParamSetPair(ParamStoreKeyRewardPortionForLps, &p.RewardPortionForLps, validateRewardPortionForLps), + paramtypes.NewParamSetPair(ParamStoreKeyRewardPortionForStakers, &p.RewardPortionForStakers, validateRewardPortionForStakers), paramtypes.NewParamSetPair(ParamStoreKeyLPIncentives, &p.LpIncentives, validateLPIncentives), paramtypes.NewParamSetPair(ParamStoreKeyStkIncentives, &p.StakeIncentives, validateStakeIncentives), paramtypes.NewParamSetPair(ParamStoreKeyPoolInfos, &p.PoolInfos, validatePoolInfos), @@ -101,6 +105,10 @@ func (p Params) Validate() error { return err } + if err := validateRewardPortionForStakers(p.RewardPortionForStakers); err != nil { + return err + } + if err := validateLPIncentives(p.LpIncentives); err != nil { return err } @@ -133,6 +141,10 @@ func (p Params) Validate() error { return err } + if p.RewardPortionForLps.Add(p.RewardPortionForStakers).GT(sdk.NewDec(1)) { + return errors.New("invalid rewards portion parameter") + } + return nil } @@ -200,6 +212,25 @@ func validateRewardPortionForLps(i interface{}) error { return nil } +func validateRewardPortionForStakers(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() { + return fmt.Errorf("reward percent for lp must be not nil") + } + if v.IsNegative() { + return fmt.Errorf("reward percent for lp must be positive: %s", v) + } + if v.GT(sdk.OneDec()) { + return fmt.Errorf("reward percent for lp too large: %s", v) + } + + return nil +} + func validateLPIncentives(i interface{}) error { v, ok := i.([]IncentiveInfo) if !ok { diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index c6c8e66ef..ceb16a7c9 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -30,24 +30,26 @@ type Params struct { StakeIncentives []IncentiveInfo `protobuf:"bytes,2,rep,name=stake_incentives,json=stakeIncentives,proto3" json:"stake_incentives"` CommunityTax github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=community_tax,json=communityTax,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_tax"` WithdrawAddrEnabled bool `protobuf:"varint,4,opt,name=withdraw_addr_enabled,json=withdrawAddrEnabled,proto3" json:"withdraw_addr_enabled,omitempty"` - // Dex revenue percent for lps, 100 - reward_portion_for_lps = revenue percent for stakers. + // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. RewardPortionForLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reward_portion_for_lps,json=rewardPortionForLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_lps"` + // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. + RewardPortionForStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=reward_portion_for_stakers,json=rewardPortionForStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_stakers"` // Pool information // poolId, reward wallet, mulitplier - PoolInfos []PoolInfo `protobuf:"bytes,6,rep,name=pool_infos,json=poolInfos,proto3" json:"pool_infos"` - ElysStakeTrackingRate int64 `protobuf:"varint,7,opt,name=elys_stake_tracking_rate,json=elysStakeTrackingRate,proto3" json:"elys_stake_tracking_rate,omitempty"` + PoolInfos []PoolInfo `protobuf:"bytes,7,rep,name=pool_infos,json=poolInfos,proto3" json:"pool_infos"` + ElysStakeTrackingRate int64 `protobuf:"varint,8,opt,name=elys_stake_tracking_rate,json=elysStakeTrackingRate,proto3" json:"elys_stake_tracking_rate,omitempty"` // Tracking dex rewards given to stakers - DexRewardsStakers DexRewardsTracker `protobuf:"bytes,8,opt,name=dex_rewards_stakers,json=dexRewardsStakers,proto3" json:"dex_rewards_stakers"` + DexRewardsStakers DexRewardsTracker `protobuf:"bytes,9,opt,name=dex_rewards_stakers,json=dexRewardsStakers,proto3" json:"dex_rewards_stakers"` // Tracking dex rewards given to LPs - DexRewardsLps DexRewardsTracker `protobuf:"bytes,9,opt,name=dex_rewards_lps,json=dexRewardsLps,proto3" json:"dex_rewards_lps"` + DexRewardsLps DexRewardsTracker `protobuf:"bytes,10,opt,name=dex_rewards_lps,json=dexRewardsLps,proto3" json:"dex_rewards_lps"` // Maximum eden reward apr for stakers - MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=max_eden_reward_apr_stakers,json=maxEdenRewardAprStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr_stakers"` + MaxEdenRewardAprStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=max_eden_reward_apr_stakers,json=maxEdenRewardAprStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr_stakers"` // Maximum eden reward apr for lps - MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=max_eden_reward_apr_lps,json=maxEdenRewardAprLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr_lps"` + MaxEdenRewardAprLps github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,12,opt,name=max_eden_reward_apr_lps,json=maxEdenRewardAprLps,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_eden_reward_apr_lps"` // Distribution epochs for stakers in blocks - DistributionEpochForStakersInBlocks int64 `protobuf:"varint,12,opt,name=distribution_epoch_for_stakers_in_blocks,json=distributionEpochForStakersInBlocks,proto3" json:"distribution_epoch_for_stakers_in_blocks,omitempty"` + DistributionEpochForStakersInBlocks int64 `protobuf:"varint,13,opt,name=distribution_epoch_for_stakers_in_blocks,json=distributionEpochForStakersInBlocks,proto3" json:"distribution_epoch_for_stakers_in_blocks,omitempty"` // Distribution epochs for LPs in blocks - DistributionEpochForLpsInBlocks int64 `protobuf:"varint,13,opt,name=distribution_epoch_for_lps_in_blocks,json=distributionEpochForLpsInBlocks,proto3" json:"distribution_epoch_for_lps_in_blocks,omitempty"` + DistributionEpochForLpsInBlocks int64 `protobuf:"varint,14,opt,name=distribution_epoch_for_lps_in_blocks,json=distributionEpochForLpsInBlocks,proto3" json:"distribution_epoch_for_lps_in_blocks,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -152,46 +154,46 @@ func init() { func init() { proto.RegisterFile("elys/incentive/params.proto", fileDescriptor_3bca0267cb466fec) } var fileDescriptor_3bca0267cb466fec = []byte{ - // 609 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x9b, 0xdf, 0xf6, 0x1b, 0x9b, 0xb7, 0x32, 0xc8, 0x18, 0x0b, 0x9b, 0x48, 0xcb, 0x1f, - 0xa1, 0x5c, 0x96, 0x48, 0xe3, 0x80, 0x84, 0xc4, 0x61, 0xd5, 0x36, 0x6d, 0xd2, 0x80, 0x29, 0x1b, - 0x42, 0xe2, 0x62, 0xb9, 0xb1, 0xd7, 0x45, 0x4d, 0x6c, 0xcb, 0xf6, 0x68, 0xfa, 0x2e, 0x38, 0x72, - 0xe4, 0x35, 0xf0, 0x2a, 0x76, 0xdc, 0x11, 0x71, 0x98, 0x50, 0xfb, 0x46, 0x90, 0x9d, 0x34, 0x84, - 0xa8, 0x48, 0xd0, 0x53, 0x9d, 0x7e, 0x1f, 0x7f, 0x9e, 0xaf, 0xbf, 0x8f, 0x65, 0xb0, 0x45, 0x92, - 0xa1, 0x0c, 0x62, 0x1a, 0x11, 0xaa, 0xe2, 0x8f, 0x24, 0xe0, 0x48, 0xa0, 0x54, 0xfa, 0x5c, 0x30, - 0xc5, 0xec, 0xdb, 0x5a, 0xf4, 0x4b, 0x71, 0xf3, 0x5e, 0x8f, 0xf5, 0x98, 0x91, 0x02, 0xbd, 0xca, - 0xab, 0x36, 0xdd, 0x1a, 0xa2, 0x5c, 0x15, 0xfa, 0x83, 0x7a, 0x0b, 0xc6, 0x92, 0x42,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0xb3, 0x62, 0xc6, 0xf8, 0xa4, - 0x5a, 0xbf, 0xaf, 0xcb, 0x0f, 0xd8, 0xc4, 0xf4, 0x11, 0xed, 0x98, 0x52, 0xfb, 0x35, 0x78, 0xfa, - 0x07, 0x6c, 0xc2, 0xab, 0xc8, 0xa6, 0x41, 0xb6, 0xa6, 0x21, 0x8f, 0x79, 0x89, 0x7b, 0x39, 0xff, - 0xf9, 0x4b, 0xab, 0xd1, 0x39, 0xbc, 0x1a, 0xb9, 0xd6, 0xf5, 0xc8, 0xb5, 0x7e, 0x8c, 0x5c, 0xeb, - 0xd3, 0xd8, 0x6d, 0x5c, 0x8f, 0xdd, 0xc6, 0xb7, 0xb1, 0xdb, 0xf8, 0xe0, 0x57, 0x22, 0xd0, 0xb3, - 0xdd, 0xa6, 0x44, 0x0d, 0x98, 0xe8, 0x9b, 0x8f, 0x20, 0xab, 0x3c, 0x49, 0x26, 0x8e, 0xee, 0x82, - 0x79, 0x85, 0x9e, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x05, 0xba, 0xe8, 0x80, 0x2f, 0x05, 0x00, - 0x00, + // 616 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x4f, 0xd4, 0x40, + 0x18, 0xc6, 0xb7, 0x82, 0xc8, 0x0e, 0x2c, 0x68, 0x11, 0xa9, 0x10, 0xbb, 0xeb, 0x9f, 0x98, 0x5e, + 0x68, 0x13, 0x3c, 0x98, 0x98, 0x78, 0x60, 0x03, 0x06, 0x12, 0x54, 0x52, 0x30, 0x26, 0x5e, 0x26, + 0xb3, 0x9d, 0x61, 0x69, 0xda, 0xce, 0x4c, 0x66, 0x06, 0xb7, 0x7c, 0x0b, 0x8f, 0xde, 0xf4, 0xe3, + 0x70, 0xe4, 0x68, 0x3c, 0x10, 0x03, 0x5f, 0xc4, 0xcc, 0xb4, 0x94, 0xda, 0xac,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ff, 0x83, 0x76, 0x6e, 0xa0, 0x3a, + 0x8e, 0x14, 0xac, 0x65, 0x28, 0x87, 0x04, 0x13, 0x5a, 0x52, 0x21, 0xe2, 0x37, 0x79, 0xcc, 0x4d, + 0x96, 0x47, 0x86, 0xf2, 0x6d, 0x4c, 0x68, 0xe1, 0xb3, 0xc9, 0xab, 0x3c, 0x30, 0x58, 0x19, 0xe7, + 0xa6, 0x8f, 0x31, 0x3f, 0xd9, 0x88, 0x35, 0x9d, 0xf4, 0x99, 0x3e, 0x00, 0x0f, 0xc7, 0x52, 0x89, + 0x78, 0x70, 0x62, 0x06, 0x8c, 0x70, 0x16, 0x1d, 0xd7, 0xc7, 0x0c, 0xc6, 0x14, 0x0e, 0x52, 0x16, + 0x25, 0xd2, 0xe9, 0x98, 0x18, 0x9f, 0xd6, 0xeb, 0xb7, 0x75, 0xf9, 0xcd, 0x10, 0xed, 0xd2, 0xbe, + 0x29, 0xb5, 0xdf, 0x82, 0x67, 0x7f, 0xc1, 0xa6, 0xbc, 0x8e, 0x5c, 0x30, 0xc8, 0xee, 0x38, 0xe4, + 0x1e, 0xaf, 0x70, 0xaf, 0xa6, 0xbf, 0x7e, 0xef, 0xb6, 0xfa, 0x3b, 0x67, 0x97, 0xae, 0x75, 0x7e, + 0xe9, 0x5a, 0xbf, 0x2e, 0x5d, 0xeb, 0xcb, 0x95, 0xdb, 0x3a, 0xbf, 0x72, 0x5b, 0x3f, 0xae, 0xdc, + 0xd6, 0x27, 0xbf, 0x76, 0x05, 0x3a, 0xdb, 0x75, 0x4a, 0xd4, 0x88, 0x89, 0xc4, 0x7c, 0x04, 0x79, + 0xed, 0xfd, 0x33, 0xd7, 0x31, 0x98, 0x31, 0x4f, 0xde, 0x8b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x08, 0xa9, 0x94, 0x9f, 0x9c, 0x05, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -217,12 +219,12 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.DistributionEpochForLpsInBlocks != 0 { i = encodeVarintParams(dAtA, i, uint64(m.DistributionEpochForLpsInBlocks)) i-- - dAtA[i] = 0x68 + dAtA[i] = 0x70 } if m.DistributionEpochForStakersInBlocks != 0 { i = encodeVarintParams(dAtA, i, uint64(m.DistributionEpochForStakersInBlocks)) i-- - dAtA[i] = 0x60 + dAtA[i] = 0x68 } { size := m.MaxEdenRewardAprLps.Size() @@ -233,7 +235,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x5a + dAtA[i] = 0x62 { size := m.MaxEdenRewardAprStakers.Size() i -= size @@ -243,7 +245,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x5a { size, err := m.DexRewardsLps.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -253,7 +255,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0x52 { size, err := m.DexRewardsStakers.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -263,11 +265,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a if m.ElysStakeTrackingRate != 0 { i = encodeVarintParams(dAtA, i, uint64(m.ElysStakeTrackingRate)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x40 } if len(m.PoolInfos) > 0 { for iNdEx := len(m.PoolInfos) - 1; iNdEx >= 0; iNdEx-- { @@ -280,9 +282,19 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a } } + { + size := m.RewardPortionForStakers.Size() + i -= size + if _, err := m.RewardPortionForStakers.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 { size := m.RewardPortionForLps.Size() i -= size @@ -380,6 +392,8 @@ func (m *Params) Size() (n int) { } l = m.RewardPortionForLps.Size() n += 1 + l + sovParams(uint64(l)) + l = m.RewardPortionForStakers.Size() + n += 1 + l + sovParams(uint64(l)) if len(m.PoolInfos) > 0 { for _, e := range m.PoolInfos { l = e.Size() @@ -598,6 +612,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardPortionForStakers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RewardPortionForStakers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PoolInfos", wireType) } @@ -631,7 +679,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ElysStakeTrackingRate", wireType) } @@ -650,7 +698,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DexRewardsStakers", wireType) } @@ -683,7 +731,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DexRewardsLps", wireType) } @@ -716,7 +764,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprStakers", wireType) } @@ -750,7 +798,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxEdenRewardAprLps", wireType) } @@ -784,7 +832,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 12: + case 13: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForStakersInBlocks", wireType) } @@ -803,7 +851,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 13: + case 14: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field DistributionEpochForLpsInBlocks", wireType) } From 44196c13e2f66ef58ae7d9e5f45ef2c599fe33c2 Mon Sep 17 00:00:00 2001 From: kenta-elys Date: Mon, 4 Dec 2023 08:35:01 +0000 Subject: [PATCH 3/5] chore: renaming in lps and stakers rewards calculation --- x/incentive/keeper/keeper_lps.go | 18 +++++++++--------- x/incentive/keeper/keeper_stakers.go | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/x/incentive/keeper/keeper_lps.go b/x/incentive/keeper/keeper_lps.go index eab9950e3..0f0c1650d 100644 --- a/x/incentive/keeper/keeper_lps.go +++ b/x/incentive/keeper/keeper_lps.go @@ -8,10 +8,10 @@ import ( ) // Calculate new Eden token amounts based on LpElys committed and MElys committed -func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, commitments ctypes.Commitments, edenAmountPerEpochLp sdk.Int, gasFeesForLPs sdk.Dec) (sdk.Int, sdk.Int) { +func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, commitments ctypes.Commitments, edenAmountForLpPerDistribution sdk.Int, gasFeesForLPsPerDistribution sdk.Dec) (sdk.Int, sdk.Int) { // Method 2 - Using Proxy TVL - totalNewEdenAllocated := sdk.ZeroInt() - totalDexRewardsAllocated := sdk.ZeroDec() + totalNewEdenAllocatedPerDistribution := sdk.ZeroInt() + totalDexRewardsAllocatedPerDistribution := sdk.ZeroDec() // Iterate to calculate total Eden from LpElys, MElys committed k.amm.IterateLiquidityPools(ctx, func(p ammtypes.Pool) bool { @@ -45,7 +45,7 @@ func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, c } // Calculate new Eden for this pool - newEdenAllocatedForPool := poolShare.MulInt(edenAmountPerEpochLp) + newEdenAllocatedForPool := poolShare.MulInt(edenAmountForLpPerDistribution) // this lp token committed commmittedLpToken := commitments.GetCommittedAmountForDenom(lpToken) @@ -67,7 +67,7 @@ func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, c newEdenAllocated := lpShare.Mul(newEdenAllocatedForPool).TruncateInt() // Sum the total amount - totalNewEdenAllocated = totalNewEdenAllocated.Add(newEdenAllocated) + totalNewEdenAllocatedPerDistribution = totalNewEdenAllocatedPerDistribution.Add(newEdenAllocated) // ------------------------------------------------------- // ------------------- DEX rewards calculation ------------------- @@ -84,23 +84,23 @@ func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, c // Calculate dex rewards per lp dexRewardsForLP := lpShare.Mul(dexRewardsAllocatedForPool) // Sum total rewards per commitment - totalDexRewardsAllocated = totalDexRewardsAllocated.Add(dexRewardsForLP) + totalDexRewardsAllocatedPerDistribution = totalDexRewardsAllocatedPerDistribution.Add(dexRewardsForLP) //---------------------------------------------------------------- // ------------------- Gas rewards calculation ------------------- // --------------------------------------------------------------- // Get gas fee rewards per pool - gasRewardsAllocatedForPool := poolShare.Mul(gasFeesForLPs) + gasRewardsAllocatedForPool := poolShare.Mul(gasFeesForLPsPerDistribution) // Calculate gas fee rewards per lp gasRewardsForLP := lpShare.Mul(gasRewardsAllocatedForPool) // Sum total rewards per commitment - totalDexRewardsAllocated = totalDexRewardsAllocated.Add(gasRewardsForLP) + totalDexRewardsAllocatedPerDistribution = totalDexRewardsAllocatedPerDistribution.Add(gasRewardsForLP) //---------------------------------------------------------------- return false }) // return - return totalNewEdenAllocated, totalDexRewardsAllocated.TruncateInt() + return totalNewEdenAllocatedPerDistribution, totalDexRewardsAllocatedPerDistribution.TruncateInt() } diff --git a/x/incentive/keeper/keeper_stakers.go b/x/incentive/keeper/keeper_stakers.go index e1057e3df..db884370a 100644 --- a/x/incentive/keeper/keeper_stakers.go +++ b/x/incentive/keeper/keeper_stakers.go @@ -8,13 +8,13 @@ import ( ) // Calculate new Eden token amounts based on the given conditions and user's current unclaimed token balance -func (k Keeper) CalculateRewardsForStakersByElysStaked(ctx sdk.Context, delegatedAmt sdk.Int, edenAmountPerEpoch sdk.Int, dexRevenueAmtForStakers sdk.Dec) (sdk.Int, sdk.Int, sdk.Dec) { +func (k Keeper) CalculateRewardsForStakersByElysStaked(ctx sdk.Context, delegatedAmt sdk.Int, edenAmountPerDistribution sdk.Int, dexRevenueAmtForStakersPerDistribution sdk.Dec) (sdk.Int, sdk.Int, sdk.Dec) { // -----------Eden calculation --------------------- // -------------------------------------------------------------- stakeShare := k.CalculateTotalShareOfStaking(delegatedAmt) // Calculate newly creating eden amount by its share - newEdenAllocated := stakeShare.MulInt(edenAmountPerEpoch) + newEdenAllocated := stakeShare.MulInt(edenAmountPerDistribution) // -----------------Fund community Eden token---------------------- // ---------------------------------------------------------------- @@ -27,11 +27,11 @@ func (k Keeper) CalculateRewardsForStakersByElysStaked(ctx sdk.Context, delegate // --------------------DEX rewards calculation -------------------- // ---------------------------------------------------------------- // Calculate dex rewards - dexRewards := stakeShare.Mul(dexRevenueAmtForStakers).TruncateInt() + dexRewards := stakeShare.Mul(dexRevenueAmtForStakersPerDistribution).TruncateInt() // Calculate only elys staking share stakeShareByStakeOnly := k.CalculateTotalShareOfStaking(delegatedAmt) - dexRewardsByStakeOnly := stakeShareByStakeOnly.Mul(dexRevenueAmtForStakers) + dexRewardsByStakeOnly := stakeShareByStakeOnly.Mul(dexRevenueAmtForStakersPerDistribution) return newEdenAllocated.TruncateInt(), dexRewards, dexRewardsByStakeOnly } From 25f1a33ee64c4b9788afc9c6392396af093e2cde Mon Sep 17 00:00:00 2001 From: kenta-elys Date: Mon, 4 Dec 2023 10:23:15 +0000 Subject: [PATCH 4/5] chore: apr calculation per pool --- docs/static/openapi.yml | 66 +++- ...stakers.proto => dex_rewards_traker.proto} | 0 proto/elys/incentive/params.proto | 4 +- proto/elys/incentive/pool.proto | 26 ++ x/incentive/keeper/hooks_amm.go | 2 +- x/incentive/keeper/keeper.go | 51 +++- x/incentive/keeper/keeper_lps.go | 6 + x/incentive/keeper/params.go | 34 ++- ...stakers.pb.go => dex_rewards_traker.pb.go} | 112 +++---- x/incentive/types/params.go | 4 +- x/incentive/types/params.pb.go | 82 ++--- x/incentive/types/pool.pb.go | 283 ++++++++++++++++-- 12 files changed, 544 insertions(+), 126 deletions(-) rename proto/elys/incentive/{dex_rewards_stakers.proto => dex_rewards_traker.proto} (100%) rename x/incentive/types/{dex_rewards_stakers.pb.go => dex_rewards_traker.pb.go} (69%) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 3fbf03660..0c4ae64af 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -39646,10 +39646,25 @@ paths: multiplier: type: string title: multiplier for lp rewards + num_blocks: + type: string + title: Block number since creation + dex_reward_amount_given: + type: string + title: Total dex rewards given + eden_reward_amount_given: + type: string + title: Total eden rewards given + eden_apr: + type: string + title: Eden APR + dex_apr: + type: string + title: Dex APR title: Pool Info title: |- Pool information - poolId, reward wallet, mulitplier + poolId, reward wallet, mulitplier, dex rewards given elys_stake_tracking_rate: type: string format: int64 @@ -84080,10 +84095,25 @@ definitions: multiplier: type: string title: multiplier for lp rewards + num_blocks: + type: string + title: Block number since creation + dex_reward_amount_given: + type: string + title: Total dex rewards given + eden_reward_amount_given: + type: string + title: Total eden rewards given + eden_apr: + type: string + title: Eden APR + dex_apr: + type: string + title: Dex APR title: Pool Info title: |- Pool information - poolId, reward wallet, mulitplier + poolId, reward wallet, mulitplier, dex rewards given elys_stake_tracking_rate: type: string format: int64 @@ -84135,6 +84165,21 @@ definitions: multiplier: type: string title: multiplier for lp rewards + num_blocks: + type: string + title: Block number since creation + dex_reward_amount_given: + type: string + title: Total dex rewards given + eden_reward_amount_given: + type: string + title: Total eden rewards given + eden_apr: + type: string + title: Eden APR + dex_apr: + type: string + title: Dex APR title: Pool Info elys.incentive.QueryCommunityPoolResponse: type: object @@ -84250,10 +84295,25 @@ definitions: multiplier: type: string title: multiplier for lp rewards + num_blocks: + type: string + title: Block number since creation + dex_reward_amount_given: + type: string + title: Total dex rewards given + eden_reward_amount_given: + type: string + title: Total eden rewards given + eden_apr: + type: string + title: Eden APR + dex_apr: + type: string + title: Dex APR title: Pool Info title: |- Pool information - poolId, reward wallet, mulitplier + poolId, reward wallet, mulitplier, dex rewards given elys_stake_tracking_rate: type: string format: int64 diff --git a/proto/elys/incentive/dex_rewards_stakers.proto b/proto/elys/incentive/dex_rewards_traker.proto similarity index 100% rename from proto/elys/incentive/dex_rewards_stakers.proto rename to proto/elys/incentive/dex_rewards_traker.proto diff --git a/proto/elys/incentive/params.proto b/proto/elys/incentive/params.proto index 03ecb417f..08f1f5548 100644 --- a/proto/elys/incentive/params.proto +++ b/proto/elys/incentive/params.proto @@ -4,7 +4,7 @@ package elys.incentive; import "gogoproto/gogo.proto"; import "elys/incentive/incentive.proto"; import "elys/incentive/pool.proto"; -import "elys/incentive/dex_rewards_stakers.proto"; +import "elys/incentive/dex_rewards_traker.proto"; option go_package = "github.com/elys-network/elys/x/incentive/types"; @@ -33,7 +33,7 @@ message Params { ]; // Pool information - // poolId, reward wallet, mulitplier + // poolId, reward wallet, mulitplier, dex rewards given repeated PoolInfo pool_infos = 7 [(gogoproto.nullable) = false]; int64 elys_stake_tracking_rate = 8; diff --git a/proto/elys/incentive/pool.proto b/proto/elys/incentive/pool.proto index d5a8a1b04..2d42f542e 100644 --- a/proto/elys/incentive/pool.proto +++ b/proto/elys/incentive/pool.proto @@ -17,4 +17,30 @@ message PoolInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + + // Block number since creation + string num_blocks = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // Total dex rewards given + string dex_reward_amount_given = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Total eden rewards given + string eden_reward_amount_given = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + // Eden APR + string eden_apr = 7 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + // Dex APR + string dex_apr = 8 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; } \ No newline at end of file diff --git a/x/incentive/keeper/hooks_amm.go b/x/incentive/keeper/hooks_amm.go index da4fe698d..786a93ed7 100644 --- a/x/incentive/keeper/hooks_amm.go +++ b/x/incentive/keeper/hooks_amm.go @@ -7,7 +7,7 @@ import ( // AfterPoolCreated is called after CreatePool func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64) { - k.InitPoolMultiplier(ctx, poolId) + k.InitPoolParams(ctx, poolId) } // AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 21e60640e..f69abe2a5 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -466,6 +466,9 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince k.SetFeePool(ctx, feePool) // ---------------------------------- + // Update APR for amm pools + k.UpdateAmmPoolAPR(ctx, lpIncentive) + return nil } @@ -531,7 +534,7 @@ func (k Keeper) CalculateProxyTVL(ctx sdk.Context, baseCurrency string) sdk.Dec // Get pool info from incentive param poolInfo, found := k.GetPoolInfo(ctx, stableStakePoolId) if !found { - k.InitStableStakePoolMultiplier(ctx, stableStakePoolId) + k.InitStableStakePoolParams(ctx, stableStakePoolId) poolInfo, _ = k.GetPoolInfo(ctx, stableStakePoolId) } tvl := stabletypes.TVL(ctx, k.authKeeper, k.bankKeeper, baseCurrency) @@ -557,3 +560,49 @@ func (k Keeper) CalculateTVL(ctx sdk.Context) sdk.Dec { return TVL } + +// Update APR for AMM pool +func (k Keeper) UpdateAmmPoolAPR(ctx sdk.Context, lpIncentive types.IncentiveInfo, totalProxyTVL sdk.Dec) { + // Iterate to calculate total Eden from LpElys, MElys committed + k.amm.IterateLiquidityPools(ctx, func(p ammtypes.Pool) bool { + tvl, err := p.TVL(ctx, k.oracleKeeper) + if err != nil { + return false + } + + // Get pool Id + poolId := p.GetPoolId() + + // Get pool info from incentive param + poolInfo, found := k.GetPoolInfo(ctx, poolId) + if !found { + return false + } + + poolInfo.NumBlocks = poolInfo.NumBlocks.Add(lpIncentive.DistributionEpochInBlocks) + // Invalid block number + if poolInfo.NumBlocks.IsZero() { + return false + } + + // Calculate Proxy TVL share considering multiplier + proxyTVL := tvl.Mul(poolInfo.Multiplier) + poolShare := sdk.ZeroDec() + if totalProxyTVL.IsPositive() { + poolShare = proxyTVL.Quo(totalProxyTVL) + } + + // Dex reward Apr per pool = (total LM Dex reward allocated per day*((tvl of pool * multiplier)/total proxy TVL) ) * 365 / TVL of pool + totalLMDexRewardsAllocatedPerDay := poolInfo.DexRewardAmountGiven.MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(poolInfo.NumBlocks) + poolInfo.DexApr = totalLMDexRewardsAllocatedPerDay.Mul(poolShare).MulInt(sdk.NewInt(ptypes.DaysPerYear)).Quo(tvl) + + // Eden reward Apr per pool = (total LM Eden reward allocated per day*((tvl of pool * multiplier)/total proxy TVL) ) * 365 / TVL of pool + totalLMEdenRewardsAllocatedPerDay := poolInfo.EdenRewardAmountGiven.Mul(lpIncentive.AllocationEpochInBlocks).Quo(poolInfo.NumBlocks) + poolInfo.EdenApr = sdk.NewDecFromInt(totalLMEdenRewardsAllocatedPerDay).Mul(poolShare).MulInt(sdk.NewInt(ptypes.DaysPerYear)).Quo(tvl) + + // Update Pool Info + k.SetPoolInfo(ctx, poolId, poolInfo) + + return false + }) +} diff --git a/x/incentive/keeper/keeper_lps.go b/x/incentive/keeper/keeper_lps.go index 0f0c1650d..7cc38848f 100644 --- a/x/incentive/keeper/keeper_lps.go +++ b/x/incentive/keeper/keeper_lps.go @@ -98,6 +98,12 @@ func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, c totalDexRewardsAllocatedPerDistribution = totalDexRewardsAllocatedPerDistribution.Add(gasRewardsForLP) //---------------------------------------------------------------- + + poolInfo.EdenRewardAmountGiven = poolInfo.EdenRewardAmountGiven.Add(totalNewEdenAllocatedPerDistribution) + poolInfo.DexRewardAmountGiven = poolInfo.DexRewardAmountGiven.Add(totalDexRewardsAllocatedPerDistribution) + // Update Pool Info + k.SetPoolInfo(ctx, poolId, poolInfo) + return false }) diff --git a/x/incentive/keeper/params.go b/x/incentive/keeper/params.go index 1ab0902a8..4451c08ad 100644 --- a/x/incentive/keeper/params.go +++ b/x/incentive/keeper/params.go @@ -61,8 +61,26 @@ func (k Keeper) GetPoolInfo(ctx sdk.Context, poolId uint64) (types.PoolInfo, boo return types.PoolInfo{}, false } +// SetPoolInfo +func (k Keeper) SetPoolInfo(ctx sdk.Context, poolId uint64, poolInfo types.PoolInfo) bool { + // Fetch incentive params + params := k.GetParams(ctx) + + poolInfos := params.PoolInfos + for i, ps := range poolInfos { + if ps.PoolId == poolId { + params.PoolInfos[i] = poolInfo + k.SetParams(ctx, params) + + return true + } + } + + return false +} + // InitPoolMultiplier: create a pool information responding to the pool creation. -func (k Keeper) InitPoolMultiplier(ctx sdk.Context, poolId uint64) bool { +func (k Keeper) InitPoolParams(ctx sdk.Context, poolId uint64) bool { // Fetch incentive params params := k.GetParams(ctx) poolInfos := params.PoolInfos @@ -81,6 +99,12 @@ func (k Keeper) InitPoolMultiplier(ctx sdk.Context, poolId uint64) bool { RewardWallet: ammtypes.NewPoolRevenueAddress(poolId).String(), // multiplier for lp rewards Multiplier: sdk.NewDec(1), + // Number of blocks since creation + NumBlocks: sdk.NewInt(1), + // Total dex rewards given since creation + DexRewardAmountGiven: sdk.ZeroDec(), + // Total eden rewards given since creation + EdenRewardAmountGiven: sdk.ZeroInt(), } // Update pool information @@ -91,7 +115,7 @@ func (k Keeper) InitPoolMultiplier(ctx sdk.Context, poolId uint64) bool { } // InitStableStakePoolMultiplier: create a stable stake pool information responding to the pool creation. -func (k Keeper) InitStableStakePoolMultiplier(ctx sdk.Context, poolId uint64) bool { +func (k Keeper) InitStableStakePoolParams(ctx sdk.Context, poolId uint64) bool { // Fetch incentive params params := k.GetParams(ctx) poolInfos := params.PoolInfos @@ -110,6 +134,12 @@ func (k Keeper) InitStableStakePoolMultiplier(ctx sdk.Context, poolId uint64) bo RewardWallet: stabletypes.PoolAddress().String(), // multiplier for lp rewards Multiplier: sdk.NewDec(1), + // Number of blocks since creation + NumBlocks: sdk.NewInt(1), + // Total dex rewards given since creation + DexRewardAmountGiven: sdk.ZeroDec(), + // Total eden rewards given since creation + EdenRewardAmountGiven: sdk.ZeroInt(), } // Update pool information diff --git a/x/incentive/types/dex_rewards_stakers.pb.go b/x/incentive/types/dex_rewards_traker.pb.go similarity index 69% rename from x/incentive/types/dex_rewards_stakers.pb.go rename to x/incentive/types/dex_rewards_traker.pb.go index f63144710..4abb38b05 100644 --- a/x/incentive/types/dex_rewards_stakers.pb.go +++ b/x/incentive/types/dex_rewards_traker.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: elys/incentive/dex_rewards_stakers.proto +// source: elys/incentive/dex_rewards_traker.proto package types @@ -35,7 +35,7 @@ func (m *DexRewardsTracker) Reset() { *m = DexRewardsTracker{} } func (m *DexRewardsTracker) String() string { return proto.CompactTextString(m) } func (*DexRewardsTracker) ProtoMessage() {} func (*DexRewardsTracker) Descriptor() ([]byte, []int) { - return fileDescriptor_aa61911f53a3bf12, []int{0} + return fileDescriptor_6a7f3218c9553b55, []int{0} } func (m *DexRewardsTracker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -69,30 +69,30 @@ func init() { } func init() { - proto.RegisterFile("elys/incentive/dex_rewards_stakers.proto", fileDescriptor_aa61911f53a3bf12) + proto.RegisterFile("elys/incentive/dex_rewards_traker.proto", fileDescriptor_6a7f3218c9553b55) } -var fileDescriptor_aa61911f53a3bf12 = []byte{ +var fileDescriptor_6a7f3218c9553b55 = []byte{ // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xcf, 0x4a, 0x33, 0x31, - 0x14, 0xc5, 0x27, 0xfd, 0xa0, 0xd0, 0x2c, 0x3e, 0x70, 0x70, 0x51, 0x04, 0x53, 0x75, 0x21, 0xdd, - 0x34, 0x59, 0xf8, 0x06, 0x63, 0x11, 0x04, 0x45, 0x28, 0xae, 0xdc, 0x84, 0x99, 0xcc, 0xa5, 0x2d, - 0x33, 0x93, 0x5b, 0x92, 0x8c, 0x9d, 0x79, 0x0b, 0x1f, 0xc2, 0x85, 0x8f, 0xd2, 0x65, 0x97, 0xe2, - 0xa2, 0xc8, 0xf4, 0x45, 0x64, 0xfe, 0x28, 0xdd, 0xea, 0x2a, 0x27, 0xe4, 0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0x4e, 0xc9, 0xd6, 0x2f, + 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0xf3, 0xcc, 0x2b, 0x09, 0xe2, 0xcc, 0x2b, 0xcd, 0x75, 0x02, 0x1b, + 0x20, 0xe4, 0xc6, 0xc5, 0x96, 0x98, 0x9b, 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0x44, 0xb2, 0x51, 0x2e, + 0xa9, 0xc9, 0x41, 0x50, 0xdd, 0x42, 0x15, 0x5c, 0x8a, 0x10, 0x56, 0x7c, 0x72, 0x7e, 0x4e, 0x4e, + 0x6a, 0x72, 0x49, 0x6a, 0x4a, 0x7c, 0x52, 0x65, 0x7c, 0x7e, 0x49, 0x46, 0x6a, 0x11, 0xc8, 0xf3, + 0x20, 0xb7, 0x4b, 0x30, 0x93, 0x65, 0x85, 0x2c, 0xc4, 0x60, 0x67, 0x98, 0xb9, 0x4e, 0x95, 0xfe, + 0x20, 0x53, 0xa1, 0x01, 0xe2, 0xe4, 0xb3, 0xe2, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, + 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, + 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0x21, 0x59, 0x02, 0x0a, 0x75, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, + 0xfc, 0xa2, 0x6c, 0x30, 0x47, 0xbf, 0x02, 0x29, 0xb6, 0xc0, 0x16, 0x26, 0xb1, 0x81, 0xc3, 0xde, + 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x2f, 0xd6, 0xd4, 0xd8, 0xcc, 0x01, 0x00, 0x00, } func (this *DexRewardsTracker) Equal(that interface{}) bool { @@ -151,7 +151,7 @@ func (m *DexRewardsTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { if _, err := m.AmountCollectedByOtherTracker.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i = encodeVarintDexRewardsStakers(dAtA, i, uint64(size)) + i = encodeVarintDexRewardsTraker(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a @@ -161,7 +161,7 @@ func (m *DexRewardsTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i = encodeVarintDexRewardsStakers(dAtA, i, uint64(size)) + i = encodeVarintDexRewardsTraker(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -171,15 +171,15 @@ func (m *DexRewardsTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { if _, err := m.NumBlocks.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i = encodeVarintDexRewardsStakers(dAtA, i, uint64(size)) + i = encodeVarintDexRewardsTraker(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func encodeVarintDexRewardsStakers(dAtA []byte, offset int, v uint64) int { - offset -= sovDexRewardsStakers(v) +func encodeVarintDexRewardsTraker(dAtA []byte, offset int, v uint64) int { + offset -= sovDexRewardsTraker(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -196,19 +196,19 @@ func (m *DexRewardsTracker) Size() (n int) { var l int _ = l l = m.NumBlocks.Size() - n += 1 + l + sovDexRewardsStakers(uint64(l)) + n += 1 + l + sovDexRewardsTraker(uint64(l)) l = m.Amount.Size() - n += 1 + l + sovDexRewardsStakers(uint64(l)) + n += 1 + l + sovDexRewardsTraker(uint64(l)) l = m.AmountCollectedByOtherTracker.Size() - n += 1 + l + sovDexRewardsStakers(uint64(l)) + n += 1 + l + sovDexRewardsTraker(uint64(l)) return n } -func sovDexRewardsStakers(x uint64) (n int) { +func sovDexRewardsTraker(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozDexRewardsStakers(x uint64) (n int) { - return sovDexRewardsStakers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozDexRewardsTraker(x uint64) (n int) { + return sovDexRewardsTraker(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -218,7 +218,7 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDexRewardsStakers + return ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -246,7 +246,7 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDexRewardsStakers + return ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -260,11 +260,11 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } if postIndex > l { return io.ErrUnexpectedEOF @@ -280,7 +280,7 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDexRewardsStakers + return ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -294,11 +294,11 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } if postIndex > l { return io.ErrUnexpectedEOF @@ -314,7 +314,7 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowDexRewardsStakers + return ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -328,11 +328,11 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } if postIndex > l { return io.ErrUnexpectedEOF @@ -343,12 +343,12 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipDexRewardsStakers(dAtA[iNdEx:]) + skippy, err := skipDexRewardsTraker(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDexRewardsStakers + return ErrInvalidLengthDexRewardsTraker } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -362,7 +362,7 @@ func (m *DexRewardsTracker) Unmarshal(dAtA []byte) error { } return nil } -func skipDexRewardsStakers(dAtA []byte) (n int, err error) { +func skipDexRewardsTraker(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -370,7 +370,7 @@ func skipDexRewardsStakers(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowDexRewardsStakers + return 0, ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -387,7 +387,7 @@ func skipDexRewardsStakers(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowDexRewardsStakers + return 0, ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -403,7 +403,7 @@ func skipDexRewardsStakers(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowDexRewardsStakers + return 0, ErrIntOverflowDexRewardsTraker } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -416,14 +416,14 @@ func skipDexRewardsStakers(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthDexRewardsStakers + return 0, ErrInvalidLengthDexRewardsTraker } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupDexRewardsStakers + return 0, ErrUnexpectedEndOfGroupDexRewardsTraker } depth-- case 5: @@ -432,7 +432,7 @@ func skipDexRewardsStakers(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthDexRewardsStakers + return 0, ErrInvalidLengthDexRewardsTraker } if depth == 0 { return iNdEx, nil @@ -442,7 +442,7 @@ func skipDexRewardsStakers(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthDexRewardsStakers = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDexRewardsStakers = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupDexRewardsStakers = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthDexRewardsTraker = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDexRewardsTraker = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDexRewardsTraker = fmt.Errorf("proto: unexpected end of group") ) diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 8cd123c21..6bfa64a43 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -46,12 +46,12 @@ func NewParams() Params { PoolInfos: []PoolInfo(nil), ElysStakeTrackingRate: 10, DexRewardsStakers: DexRewardsTracker{ - NumBlocks: sdk.ZeroInt(), + NumBlocks: sdk.NewInt(1), Amount: sdk.ZeroDec(), AmountCollectedByOtherTracker: sdk.ZeroDec(), }, DexRewardsLps: DexRewardsTracker{ - NumBlocks: sdk.ZeroInt(), + NumBlocks: sdk.NewInt(1), Amount: sdk.ZeroDec(), AmountCollectedByOtherTracker: sdk.ZeroDec(), }, diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index ceb16a7c9..216c35b39 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -35,7 +35,7 @@ type Params struct { // Dex revenue percent for lps, 100 - reward_portion_for_lps - reward_portion_for_stakers = revenue percent for protocol. RewardPortionForStakers github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=reward_portion_for_stakers,json=rewardPortionForStakers,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_portion_for_stakers"` // Pool information - // poolId, reward wallet, mulitplier + // poolId, reward wallet, mulitplier, dex rewards given PoolInfos []PoolInfo `protobuf:"bytes,7,rep,name=pool_infos,json=poolInfos,proto3" json:"pool_infos"` ElysStakeTrackingRate int64 `protobuf:"varint,8,opt,name=elys_stake_tracking_rate,json=elysStakeTrackingRate,proto3" json:"elys_stake_tracking_rate,omitempty"` // Tracking dex rewards given to stakers @@ -154,46 +154,46 @@ func init() { func init() { proto.RegisterFile("elys/incentive/params.proto", fileDescriptor_3bca0267cb466fec) } var fileDescriptor_3bca0267cb466fec = []byte{ - // 616 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x4f, 0xd4, 0x40, - 0x18, 0xc6, 0xb7, 0x82, 0xc8, 0x0e, 0x2c, 0x68, 0x11, 0xa9, 0x10, 0xbb, 0xeb, 0x9f, 0x98, 0x5e, - 0x68, 0x13, 0x3c, 0x98, 0x98, 0x78, 0x60, 0x03, 0x06, 0x12, 0x54, 0x52, 0x30, 0x26, 0x5e, 0x26, - 0xb3, 0x9d, 0x61, 0x69, 0xda, 0xce, 0x4c, 0x66, 0x06, 0xb7, 0x7c,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ff, - 0x08, 0xa9, 0x94, 0x9f, 0x9c, 0x05, 0x00, 0x00, + // 622 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x4f, 0xd4, 0x4e, + 0x18, 0xc7, 0xb7, 0x3f, 0xf8, 0x21, 0x3b, 0xb0, 0xa0, 0x45, 0xa4, 0x42, 0xec, 0xae, 0x7f, 0xa2, + 0xbd, 0xd0, 0x26, 0x78, 0x30, 0x31, 0xf1, 0xc0, 0x06, 0x0c, 0x24, 0xa8, 0xa4, 0x60, 0x4c, 0xbc, + 0x4c, 0x66, 0x3b, 0xc3, 0xd2, 0xb4, 0x9d, 0x99, 0xcc, 0x0c, 0x6e, 0x79, 0x17, 0x1e, 0xbd, 0xe9, + 0xcb, 0xe1, 0xc8, 0xd1, 0x78, 0x20, 0x06, 0xde, 0x88, 0x99, 0x69, 0xb7, 0xd4, 0x06, 0x13, 0xdd, + 0xd3, 0x4e, 0xf7, 0xfb, 0xf4, 0xf3, 0x7d, 0xe6, 0xf9, 0x3e, 0x29, 0x58, 0x23, 0xe9, 0xa9, 0x0c, + 0x62, 0x1a, 0x11, 0xaa, 0xe2, 0x4f, 0x24, 0xe0, 0x48, 0xa0, 0x4c, 0xfa, 0x5c, 0x30, 0xc5, 0xec, + 0x05, 0x2d, 0xfa, 0x95, 0xb8, 0x7a, 0x77, 0xc8, 0x86, 0xcc, 0x48, 0x81, 0x3e, 0x15, 0x55, 0xab, + 0x6e, 0x03, 0x51, 0x9d, 0x4a, 0xfd, 0x7e, 0xd3, 0x82, 0xb1, 0xb4, 0x94, 0x9e, 0x35, 0x24, 0x4c, + 0x72, 0x28, 0xc8, 0x08, 0x09, 0x2c, 0xa1, 0x12, 0x28, 0x21, 0xa2, 0x28, 0x7c, 0xf4, 0xb5, 0x0d, + 0x66, 0xf6, 0x4d, 0x6b, 0xf6, 0x0e, 0xe8, 0xa4, 0x1c, 0x56, 0xef, 0x48, 0xc7, 0xea, 0x4d, 0x79, + 0x73, 0x1b, 0x0f, 0xfc, 0xdf, 0x9b, 0xf5, 0x77, 0xc7, 0xa7, 0x5d, 0x7a, 0xc4, 0xfa, 0xd3, 0x67, + 0x17, 0xdd, 0x56, 0x38, 0x9f, 0xf2, 0xea, 0x6f, 0x69, 0xbf, 0x05, 0xb7, 0xa5, 0x42, 0x09, 0xa9, + 0xc3, 0xfe, 0xfb, 0x7b, 0xd8, 0xa2, 0x79, 0xb9, 0xc6, 0x3b, 0x00, 0x9d, 0x88, 0x65, 0xd9, 0x09, + 0x8d, 0xd5, 0x29, 0x54, 0x28, 0x77, 0xa6, 0x7a, 0x96, 0xd7, 0xee, 0xfb, 0xba, 0xfa, 0xc7, 0x45, + 0xf7, 0xe9, 0x30, 0x56, 0xc7, 0x27, 0x03, 0x3f, 0x62, 0x59, 0x10, 0x31, 0x99, 0x31, 0x59, 0xfe, + 0xac, 0x4b, 0x9c, 0x04, 0xea, 0x94, 0x13, 0xe9, 0x6f, 0x91, 0x28, 0x9c, 0xaf, 0x20, 0x87, 0x28, + 0xb7, 0x37, 0xc0, 0xf2, 0x28, 0x56, 0xc7, 0x58, 0xa0, 0x11, 0x44, 0x18, 0x0b, 0x48, 0x28, 0x1a, + 0xa4, 0x04, 0x3b, 0xd3, 0x3d, 0xcb, 0x9b, 0x0d, 0x97, 0xc6, 0xe2, 0x26, 0xc6, 0x62, 0xbb, 0x90, + 0xec, 0x08, 0xdc, 0x2b, 0xa6, 0x08, 0x39, 0x13, 0x2a, 0x66, 0x14, 0x1e, 0x31, 0x01, 0x53, 0x2e, + 0x9d, 0xff, 0x27, 0xea, 0x68, 0xa9, 0xa0, 0xed, 0x17, 0xb0, 0xd7, 0x4c, 0xec, 0x71, 0x69, 0x27, + 0x60, 0xf5, 0x06, 0x13, 0x33, 0x13, 0x21, 0x9d, 0x99, 0x89, 0x8c, 0x56, 0x9a, 0x46, 0x07, 0x05, + 0xce, 0x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 0x1b, 0xf0, 0xe4, 0x0f, 0xd8, 0x94, 0xd7, 0x91, + 0x0b, 0x06, 0xd9, 0xbd, 0x09, 0xb9, 0xc7, 0x2b, 0xdc, 0xcb, 0xe9, 0x2f, 0xdf, 0xba, 0xad, 0xfe, + 0xce, 0xd9, 0xa5, 0x6b, 0x9d, 0x5f, 0xba, 0xd6, 0xcf, 0x4b, 0xd7, 0xfa, 0x7c, 0xe5, 0xb6, 0xce, + 0xaf, 0xdc, 0xd6, 0xf7, 0x2b, 0xb7, 0xf5, 0xd1, 0xaf, 0x8d, 0x40, 0x67, 0xbb, 0x4e, 0x89, 0x1a, + 0x31, 0x91, 0x98, 0x87, 0x20, 0xaf, 0x7d, 0xfe, 0xcc, 0x38, 0x06, 0x33, 0xe6, 0x93, 0xf7, 0xfc, + 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x61, 0x67, 0x7b, 0xad, 0x9b, 0x05, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/pool.pb.go b/x/incentive/types/pool.pb.go index 81367a7ea..6d273d4f5 100644 --- a/x/incentive/types/pool.pb.go +++ b/x/incentive/types/pool.pb.go @@ -33,6 +33,16 @@ type PoolInfo struct { RewardWallet string `protobuf:"bytes,2,opt,name=reward_wallet,json=rewardWallet,proto3" json:"reward_wallet,omitempty"` // multiplier for lp rewards Multiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=multiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"multiplier"` + // Block number since creation + NumBlocks github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=num_blocks,json=numBlocks,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"num_blocks"` + // Total dex rewards given + DexRewardAmountGiven github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=dex_reward_amount_given,json=dexRewardAmountGiven,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"dex_reward_amount_given"` + // Total eden rewards given + EdenRewardAmountGiven github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=eden_reward_amount_given,json=edenRewardAmountGiven,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"eden_reward_amount_given"` + // Eden APR + EdenApr github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=eden_apr,json=edenApr,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"eden_apr"` + // Dex APR + DexApr github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=dex_apr,json=dexApr,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"dex_apr"` } func (m *PoolInfo) Reset() { *m = PoolInfo{} } @@ -89,24 +99,31 @@ func init() { func init() { proto.RegisterFile("elys/incentive/pool.proto", fileDescriptor_1dce8e3541398851) } var fileDescriptor_1dce8e3541398851 = []byte{ - // 264 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcd, 0xa9, 0x2c, - 0xd6, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0xc8, 0xcf, 0xcf, 0xd1, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x49, 0xe9, 0xc1, 0xa5, 0xa4, 0x44, 0xd2, 0xf3, - 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x94, 0x64, 0x72, 0x7e, 0x71, 0x6e, 0x7e, - 0x71, 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x48, 0x29, 0xcd, 0x60, 0xe4, 0xe2, 0x08, 0xc8, 0xcf, 0xcf, - 0xf1, 0xcc, 0x4b, 0xcb, 0x17, 0x12, 0xe7, 0x62, 0x07, 0x99, 0x1d, 0x9f, 0x99, 0x22, 0xc1, 0xa8, - 0xc0, 0xa8, 0xc1, 0x12, 0xc4, 0x06, 0xe2, 0x7a, 0xa6, 0x08, 0x29, 0x73, 0xf1, 0x16, 0xa5, 0x96, - 0x27, 0x16, 0xa5, 0xc4, 0x97, 0x27, 0xe6, 0xe4, 0xa4, 0x96, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, - 0x06, 0xf1, 0x40, 0x04, 0xc3, 0xc1, 0x62, 0x42, 0x7e, 0x5c, 0x5c, 0xb9, 0xa5, 0x39, 0x25, 0x99, - 0x05, 0x39, 0x99, 0xa9, 0x45, 0x12, 0xcc, 0x20, 0x15, 0x4e, 0x7a, 0x27, 0xee, 0xc9, 0x33, 0xdc, - 0xba, 0x27, 0xaf, 0x96, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0x0b, 0xb5, 0x1f, - 0x4a, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xb9, 0xa4, 0x26, 0x07, - 0x21, 0x99, 0xe0, 0xe4, 0x71, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, - 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x7a, - 0x48, 0xa6, 0x81, 0x02, 0x40, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x1b, 0xcc, 0xd1, 0xaf, - 0x40, 0x0a, 0x2a, 0xb0, 0xc9, 0x49, 0x6c, 0x60, 0xbf, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, - 0x63, 0x70, 0xdb, 0xfc, 0x49, 0x01, 0x00, 0x00, + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0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ff, 0x4b, 0x78, 0x1a, 0x96, 0xfc, 0x02, 0x00, 0x00, } func (m *PoolInfo) Marshal() (dAtA []byte, err error) { @@ -129,6 +146,56 @@ func (m *PoolInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.DexApr.Size() + i -= size + if _, err := m.DexApr.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size := m.EdenApr.Size() + i -= size + if _, err := m.EdenApr.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.EdenRewardAmountGiven.Size() + i -= size + if _, err := m.EdenRewardAmountGiven.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.DexRewardAmountGiven.Size() + i -= size + if _, err := m.DexRewardAmountGiven.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.NumBlocks.Size() + i -= size + if _, err := m.NumBlocks.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 { size := m.Multiplier.Size() i -= size @@ -180,6 +247,16 @@ func (m *PoolInfo) Size() (n int) { } l = m.Multiplier.Size() n += 1 + l + sovPool(uint64(l)) + l = m.NumBlocks.Size() + n += 1 + l + sovPool(uint64(l)) + l = m.DexRewardAmountGiven.Size() + n += 1 + l + sovPool(uint64(l)) + l = m.EdenRewardAmountGiven.Size() + n += 1 + l + sovPool(uint64(l)) + l = m.EdenApr.Size() + n += 1 + l + sovPool(uint64(l)) + l = m.DexApr.Size() + n += 1 + l + sovPool(uint64(l)) return n } @@ -303,6 +380,176 @@ func (m *PoolInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NumBlocks.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DexRewardAmountGiven", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DexRewardAmountGiven.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EdenRewardAmountGiven", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.EdenRewardAmountGiven.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EdenApr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.EdenApr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DexApr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DexApr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPool(dAtA[iNdEx:]) From 949c66b52931c2774eaa13e4ce842aca80b8c660 Mon Sep 17 00:00:00 2001 From: kenta-elys Date: Mon, 4 Dec 2023 13:24:31 +0000 Subject: [PATCH 5/5] chore: dex apr calculation fix --- x/incentive/keeper/keeper.go | 8 +- .../keeper/keeper_apr_per_pool_test.go | 120 ++++++++++++++++++ x/incentive/keeper/keeper_fees_test.go | 2 +- x/parameter/types/keys.go | 6 + 4 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 x/incentive/keeper/keeper_apr_per_pool_test.go diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index f69abe2a5..bec47f245 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -467,7 +467,7 @@ func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.Ince // ---------------------------------- // Update APR for amm pools - k.UpdateAmmPoolAPR(ctx, lpIncentive) + k.UpdateAmmPoolAPR(ctx, lpIncentive, totalProxyTVL) return nil } @@ -592,9 +592,9 @@ func (k Keeper) UpdateAmmPoolAPR(ctx sdk.Context, lpIncentive types.IncentiveInf poolShare = proxyTVL.Quo(totalProxyTVL) } - // Dex reward Apr per pool = (total LM Dex reward allocated per day*((tvl of pool * multiplier)/total proxy TVL) ) * 365 / TVL of pool - totalLMDexRewardsAllocatedPerDay := poolInfo.DexRewardAmountGiven.MulInt(lpIncentive.AllocationEpochInBlocks).QuoInt(poolInfo.NumBlocks) - poolInfo.DexApr = totalLMDexRewardsAllocatedPerDay.Mul(poolShare).MulInt(sdk.NewInt(ptypes.DaysPerYear)).Quo(tvl) + // Dex reward Apr per pool = total accumulated usdc rewards for 7 day * 52/ tvl of pool + totalLMDexRewardsAllocatedPerWeek := poolInfo.DexRewardAmountGiven.MulInt(lpIncentive.AllocationEpochInBlocks).MulInt(sdk.NewInt(ptypes.DaysPerWeek)).QuoInt(poolInfo.NumBlocks) + poolInfo.DexApr = totalLMDexRewardsAllocatedPerWeek.MulInt(sdk.NewInt(ptypes.WeeksPerYear)).Quo(tvl) // Eden reward Apr per pool = (total LM Eden reward allocated per day*((tvl of pool * multiplier)/total proxy TVL) ) * 365 / TVL of pool totalLMEdenRewardsAllocatedPerDay := poolInfo.EdenRewardAmountGiven.Mul(lpIncentive.AllocationEpochInBlocks).Quo(poolInfo.NumBlocks) diff --git a/x/incentive/keeper/keeper_apr_per_pool_test.go b/x/incentive/keeper/keeper_apr_per_pool_test.go new file mode 100644 index 000000000..7be11891e --- /dev/null +++ b/x/incentive/keeper/keeper_apr_per_pool_test.go @@ -0,0 +1,120 @@ +package keeper_test + +import ( + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + simapp "github.com/elys-network/elys/app" + ammtypes "github.com/elys-network/elys/x/amm/types" + "github.com/elys-network/elys/x/incentive/types" + ptypes "github.com/elys-network/elys/x/parameter/types" + "github.com/stretchr/testify/require" +) + +func TestAPRCalculationPerPool(t *testing.T) { + app := simapp.InitElysTestApp(initChain) + ctx := app.BaseApp.NewContext(initChain, tmproto.Header{}) + + ik, amm, oracle := app.IncentiveKeeper, app.AmmKeeper, app.OracleKeeper + + // Setup coin prices + SetupStableCoinPrices(ctx, oracle) + + // Generate 1 random account with 1000stake balanced + addr := simapp.AddTestAddrs(app, ctx, 2, sdk.NewInt(1000000)) + + // Create a pool + // Mint 100000USDC + usdcToken := sdk.NewCoins(sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(100000))) + + err := app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, usdcToken) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], usdcToken) + require.NoError(t, err) + + poolAssets := []ammtypes.PoolAsset{ + { + Weight: sdk.NewInt(50), + Token: sdk.NewCoin(ptypes.Elys, sdk.NewInt(100000)), + }, + { + Weight: sdk.NewInt(50), + Token: sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(10000)), + }, + } + + argSwapFee := sdk.MustNewDecFromStr("0.0") + argExitFee := sdk.MustNewDecFromStr("0.0") + + poolParams := &ammtypes.PoolParams{ + SwapFee: argSwapFee, + ExitFee: argExitFee, + } + + msg := ammtypes.NewMsgCreatePool( + addr[0].String(), + poolParams, + poolAssets, + ) + + // Create a Elys+USDC pool + poolId, err := amm.CreatePool(ctx, msg) + require.NoError(t, err) + require.Equal(t, poolId, uint64(1)) + + pools := amm.GetAllPool(ctx) + + // check length of pools + require.Equal(t, len(pools), 1) + + // check block height + require.Equal(t, int64(0), ctx.BlockHeight()) + + lpIncentive := types.IncentiveInfo{ + // reward amount in eden for 1 year + EdenAmountPerYear: sdk.NewInt(1000000000), + // starting block height of the distribution + DistributionStartBlock: sdk.NewInt(1), + // distribution duration - block number per year + TotalBlocksPerYear: sdk.NewInt(10000), + // we set block numbers in 24 hrs + AllocationEpochInBlocks: sdk.NewInt(100), + // maximum eden allocation per day that won't exceed 30% apr + MaxEdenPerAllocation: sdk.NewInt(100), + // number of block intervals that distribute rewards. + DistributionEpochInBlocks: sdk.NewInt(10), + // current epoch in block number + CurrentEpochInBlocks: sdk.NewInt(1), + // eden boost apr (0-1) range + EdenBoostApr: sdk.NewDec(1), + } + + ctx = ctx.WithBlockHeight(lpIncentive.DistributionEpochInBlocks.Int64()) + ik.UpdateLPRewardsUnclaimed(ctx, lpIncentive) + + // Get pool info from incentive param + poolInfo, found := ik.GetPoolInfo(ctx, poolId) + require.Equal(t, found, true) + require.GreaterOrEqual(t, poolInfo.EdenApr.MulInt(sdk.NewInt(100)).TruncateInt().Int64(), int64(90)) + + // Get dex rewards per pool + revenueAddress := ammtypes.NewPoolRevenueAddress(poolId) + + // Feed dex rewards + usdcToken = sdk.NewCoins(sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(1000))) + err = app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, usdcToken) + require.NoError(t, err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, revenueAddress, usdcToken) + require.NoError(t, err) + + // 1 week later. + ctx = ctx.WithBlockHeight(lpIncentive.AllocationEpochInBlocks.Mul(sdk.NewInt(ptypes.DaysPerWeek)).Int64()) + poolInfo.NumBlocks = sdk.NewInt(ctx.BlockHeight()) + ik.SetPoolInfo(ctx, poolId, poolInfo) + + ik.UpdateLPRewardsUnclaimed(ctx, lpIncentive) + poolInfo, found = ik.GetPoolInfo(ctx, poolId) + require.Equal(t, found, true) + require.GreaterOrEqual(t, poolInfo.DexApr.MulInt(sdk.NewInt(100)).TruncateInt().Int64(), int64(90)) +} diff --git a/x/incentive/keeper/keeper_fees_test.go b/x/incentive/keeper/keeper_fees_test.go index e9dbf14f3..7b4628a91 100644 --- a/x/incentive/keeper/keeper_fees_test.go +++ b/x/incentive/keeper/keeper_fees_test.go @@ -222,5 +222,5 @@ func TestCollectDEXRevenueToIncentiveModule(t *testing.T) { // It should be 3000=1000+2000 usdc require.Equal(t, collectedAmt, sdk.Coins{sdk.NewCoin(ptypes.BaseCurrency, sdk.NewInt(3000))}) // It should be 1950=3000*0.65 usdc - require.Equal(t, rewardForLpsAmt, sdk.DecCoins{sdk.NewDecCoin(ptypes.BaseCurrency, sdk.NewInt(1950))}) + require.Equal(t, rewardForLpsAmt, sdk.DecCoins{sdk.NewDecCoin(ptypes.BaseCurrency, sdk.NewInt(1800))}) } diff --git a/x/parameter/types/keys.go b/x/parameter/types/keys.go index 4c398cad3..637898bb3 100644 --- a/x/parameter/types/keys.go +++ b/x/parameter/types/keys.go @@ -47,6 +47,12 @@ const ( // Days per year DaysPerYear = 365 + // Weeks per year + WeeksPerYear = 52 + + // Days per week + DaysPerWeek = 7 + // Return ok RES_OK = uint64(200) )