diff --git a/app/app.go b/app/app.go
index e8f2f129..79f0c4b4 100644
--- a/app/app.go
+++ b/app/app.go
@@ -101,7 +101,6 @@ import (
"github.com/archway-network/archway/wasmbinding"
"github.com/archway-network/archway/x/rewards"
rewardsKeeper "github.com/archway-network/archway/x/rewards/keeper"
- "github.com/archway-network/archway/x/rewards/mintbankkeeper"
rewardsTypes "github.com/archway-network/archway/x/rewards/types"
"github.com/archway-network/archway/x/tracking"
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
@@ -525,7 +524,7 @@ func NewArchwayApp(
app.getSubspace(minttypes.ModuleName),
&stakingKeeper,
app.AccountKeeper,
- mintbankkeeper.NewKeeper(app.BankKeeper, app.RewardsKeeper),
+ app.BankKeeper,
authtypes.FeeCollectorName,
)
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index 943d1a59..f26f1414 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -5,6 +5,7 @@
## Table of Contents
- [archway/mint/v1/mint.proto](#archway/mint/v1/mint.proto)
+ - [InflationRecipient](#archway.mint.v1.InflationRecipient)
- [LastBlockInfo](#archway.mint.v1.LastBlockInfo)
- [Params](#archway.mint.v1.Params)
@@ -96,6 +97,24 @@
+
+
+### InflationRecipient
+InflationRecipient defines the inflation recipients.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `recipient` | [string](#string) | | recipient is the module receiving inflation, eg: x/staking, x/rewards. |
+| `ratio` | [string](#string) | | ratio is the % of inflation being received.
+
+percentage: 0 <= x <= 1. |
+
+
+
+
+
+
### LastBlockInfo
@@ -118,6 +137,29 @@ BlockInfo keeps track of the last block
Params defines the module parameters.
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `min_inflation` | [string](#string) | | min_inflation defines the network's minimum inflation.
+
+percentage: 0 <= x <= 1 |
+| `max_inflation` | [string](#string) | | max_inflation defines the network's maximum inflation.
+
+percentage: 0 <= x <= 1 |
+| `min_bonded` | [string](#string) | | min_bonded defines the minimum wanted bond ratio (staked supply/total supply)
+
+percentage: 0 <= x <= 1 |
+| `max_bonded` | [string](#string) | | max_bonded defines the maximum wanted bond ratio (staked supply/total supply)
+
+percentage: 0 <= x <= 1 |
+| `inflation_change` | [string](#string) | | inflation_change defines how much the inflation should change if the bond ratio is not between the defined bands of min/max_bonded. This inflation change is applied to each second for which the bond ratio was not between min_bonded and max_bonded.
+
+percentage: 0 <= x <= 1. |
+| `max_block_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | max_block_duration defines the maximum duration of a block. this is important to have because there can be cases for which a block takes a lot longer than others, for example during upgrades. In these specific cases we don't want to have bursts of inflation in a single block.
+
+0 <= x <= max duration. |
+| `inflation_recipients` | [InflationRecipient](#archway.mint.v1.InflationRecipient) | repeated | inflation_recipients defines the list of inflation recipients. CONTRACT: the sum of the ratio of each inflation recipient must be 1. |
+
+
@@ -147,6 +189,7 @@ GenesisState defines the initial state of the mint module.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#archway.mint.v1.Params) | | params defines all the module parameters. |
+| `last_block_info` | [LastBlockInfo](#archway.mint.v1.LastBlockInfo) | | last_block_info defines the previous block inflation and time |
@@ -278,7 +321,6 @@ Params defines the module parameters.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `inflation_rewards_ratio` | [string](#string) | | inflation_rewards_ratio defines the percentage of minted inflation tokens that are used for dApp rewards [0.0, 1.0]. If set to 0.0, no inflation rewards are distributed. |
| `tx_fee_rebate_ratio` | [string](#string) | | tx_fee_rebate_ratio defines the percentage of tx fees that are used for dApp rewards [0.0, 1.0]. If set to 0.0, no fee rewards are distributed. |
| `max_withdraw_records` | [uint64](#uint64) | | max_withdraw_records defines the maximum number of RewardsRecord objects used for the withdrawal operation. |
diff --git a/e2e/gastracking_test.go b/e2e/gastracking_test.go
index d669db4f..3cc41835 100644
--- a/e2e/gastracking_test.go
+++ b/e2e/gastracking_test.go
@@ -32,7 +32,6 @@ func (s *E2ETestSuite) TestGasTrackingAndRewardsDistribution() {
// Setup (create new chain here with custom params)
chain := e2eTesting.NewTestChain(s.T(), 1,
e2eTesting.WithTxFeeRebatesRewardsRatio(txFeeRebateRewardsRatio),
- e2eTesting.WithInflationRewardsRatio(inflationRewardsRatio),
e2eTesting.WithBlockGasLimit(blockGasLimit),
// Artificially increase the minted inflation coin to get some rewards for the contract (otherwise contractOp gas / blockGasLimit ratio will be 0)
e2eTesting.WithMintParams(
@@ -40,6 +39,7 @@ func (s *E2ETestSuite) TestGasTrackingAndRewardsDistribution() {
sdk.NewDecWithPrec(8, 1),
1000000,
),
+ e2eTesting.WithInflationDistributionRecipient(rewardsTypes.ModuleName, inflationRewardsRatio),
// Set default Tx fee for non-manual transaction like Upload / Instantiate
e2eTesting.WithDefaultFeeAmount("10000"),
)
diff --git a/e2e/rewards_test.go b/e2e/rewards_test.go
index 8544392a..012ef0a3 100644
--- a/e2e/rewards_test.go
+++ b/e2e/rewards_test.go
@@ -39,7 +39,7 @@ func (s *E2ETestSuite) TestRewardsWithdrawProfitAndFees() {
e2eTesting.WithBlockGasLimit(100_000_000),
// x/rewards distribution params
e2eTesting.WithTxFeeRebatesRewardsRatio(sdk.NewDecWithPrec(5, 1)),
- e2eTesting.WithInflationRewardsRatio(sdk.NewDecWithPrec(2, 1)),
+ e2eTesting.WithInflationDistributionRecipient(rewardsTypes.ModuleName, sdk.NewDecWithPrec(2, 1)),
// Set constant inflation rate
e2eTesting.WithMintParams(
sdk.NewDecWithPrec(10, 2), // 10%
diff --git a/e2e/testing/chain_options.go b/e2e/testing/chain_options.go
index 25021772..4586b1be 100644
--- a/e2e/testing/chain_options.go
+++ b/e2e/testing/chain_options.go
@@ -7,6 +7,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/archway-network/archway/app"
+ minttypes "github.com/archway-network/archway/x/mint/types"
rewardsTypes "github.com/archway-network/archway/x/rewards/types"
)
@@ -81,18 +82,6 @@ func WithBlockGasLimit(gasLimit int64) TestChainConsensusParamsOption {
}
}
-// WithInflationRewardsRatio sets x/rewards inflation rewards ratio parameter.
-func WithInflationRewardsRatio(ratio sdk.Dec) TestChainGenesisOption {
- return func(cdc codec.Codec, genesis app.GenesisState) {
- var rewardsGenesis rewardsTypes.GenesisState
- cdc.MustUnmarshalJSON(genesis[rewardsTypes.ModuleName], &rewardsGenesis)
-
- rewardsGenesis.Params.InflationRewardsRatio = ratio
-
- genesis[rewardsTypes.ModuleName] = cdc.MustMarshalJSON(&rewardsGenesis)
- }
-}
-
// WithMaxWithdrawRecords sets x/rewards MaxWithdrawRecords param.
func WithMaxWithdrawRecords(num uint64) TestChainGenesisOption {
return func(cdc codec.Codec, genesis app.GenesisState) {
@@ -130,3 +119,28 @@ func WithMintParams(inflationMin, inflationMax sdk.Dec, blocksPerYear uint64) Te
genesis[mintTypes.ModuleName] = cdc.MustMarshalJSON(&mintGenesis)
}
}
+
+// WithInflationRewardsRatio sets x/rewards inflation distribution recipients
+func WithInflationDistributionRecipient(recipientName string, ratio sdk.Dec) TestChainGenesisOption {
+ return func(cdc codec.Codec, genesis app.GenesisState) {
+ var mintGenesis minttypes.GenesisState
+ cdc.MustUnmarshalJSON(genesis[minttypes.ModuleName], &mintGenesis)
+ recipientFound := false
+
+ for _, recipient := range mintGenesis.Params.GetInflationRecipients() {
+ if recipient.Recipient == recipientName {
+ recipient.Ratio = ratio
+ recipientFound = true
+ }
+ }
+
+ if !recipientFound {
+ mintGenesis.Params.InflationRecipients = append(mintGenesis.Params.InflationRecipients, &minttypes.InflationRecipient{
+ Recipient: recipientName,
+ Ratio: ratio,
+ })
+ }
+
+ genesis[minttypes.ModuleName] = cdc.MustMarshalJSON(&mintGenesis)
+ }
+}
diff --git a/e2e/txfees_test.go b/e2e/txfees_test.go
index 17fdb056..29175487 100644
--- a/e2e/txfees_test.go
+++ b/e2e/txfees_test.go
@@ -47,8 +47,8 @@ func (s *E2ETestSuite) TestTxFees() {
// Set block gas limit (Archway mainnet param)
e2eTesting.WithBlockGasLimit(100_000_000),
// x/rewards distribution params
- e2eTesting.WithTxFeeRebatesRewardsRatio(sdk.NewDecWithPrec(5, 1)), // 50 % (Archway mainnet param)
- e2eTesting.WithInflationRewardsRatio(sdk.NewDecWithPrec(2, 1)), // 20 % (Archway mainnet param)
+ e2eTesting.WithTxFeeRebatesRewardsRatio(sdk.NewDecWithPrec(5, 1)), // 50 % (Archway mainnet param)
+ e2eTesting.WithInflationDistributionRecipient(rewardsTypes.ModuleName, sdk.NewDecWithPrec(2, 1)), // 20 % (Archway mainnet param)
// Set constant inflation rate
e2eTesting.WithMintParams(
sdk.NewDecWithPrec(10, 2), // 10% (Archway mainnet param)
diff --git a/go.mod b/go.mod
index 815f285f..5291ed19 100644
--- a/go.mod
+++ b/go.mod
@@ -27,6 +27,7 @@ require (
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
+ gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.2.0
)
@@ -130,7 +131,6 @@ require (
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
- gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
)
diff --git a/go.sum b/go.sum
index 2033fda8..ffa7afdc 100644
--- a/go.sum
+++ b/go.sum
@@ -562,8 +562,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqC
github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.1 h1:I6ITHEanAwjB0FvaxmGm8pKqmCLR7QIe05ZmO4QAXMw=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.1/go.mod h1:gYC+WX4YJFarA2ie73G2epzt7TBWpo9pzcBnK1g0MSw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
@@ -1657,8 +1655,6 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
-google.golang.org/genproto v0.0.0-20230221151758-ace64dc21148 h1:muK+gVBJBfFb4SejshDBlN2/UgxCCOKH9Y34ljqEGOc=
-google.golang.org/genproto v0.0.0-20230221151758-ace64dc21148/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw=
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 h1:znp6mq/drrY+6khTAlJUDNFFcDGV2ENLYKpMq8SyCds=
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw=
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
diff --git a/proto/archway/rewards/v1beta1/rewards.proto b/proto/archway/rewards/v1beta1/rewards.proto
index 90a0d00a..e99a455a 100644
--- a/proto/archway/rewards/v1beta1/rewards.proto
+++ b/proto/archway/rewards/v1beta1/rewards.proto
@@ -11,20 +11,14 @@ import "cosmos/base/v1beta1/coin.proto";
message Params {
option (gogoproto.goproto_stringer) = false;
- // inflation_rewards_ratio defines the percentage of minted inflation tokens that are used for dApp rewards [0.0, 1.0].
- // If set to 0.0, no inflation rewards are distributed.
- string inflation_rewards_ratio = 1 [
- (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
- (gogoproto.nullable) = false
- ];
// tx_fee_rebate_ratio defines the percentage of tx fees that are used for dApp rewards [0.0, 1.0].
// If set to 0.0, no fee rewards are distributed.
- string tx_fee_rebate_ratio = 2 [
+ string tx_fee_rebate_ratio = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// max_withdraw_records defines the maximum number of RewardsRecord objects used for the withdrawal operation.
- uint64 max_withdraw_records = 3;
+ uint64 max_withdraw_records = 2;
}
// ContractMetadata defines the contract rewards distribution options for a particular contract.
diff --git a/x/mint/types/params.go b/x/mint/types/params.go
index 51481f2b..2c968242 100644
--- a/x/mint/types/params.go
+++ b/x/mint/types/params.go
@@ -21,7 +21,7 @@ var (
DefaultMaxBlockDuration time.Duration = time.Minute
DefaultFeeCollectorRecipient InflationRecipient = InflationRecipient{
Recipient: authtypes.FeeCollectorName,
- Ratio: sdk.OneDec(),
+ Ratio: sdk.MustNewDecFromStr("1"), // 100%
}
)
@@ -60,7 +60,9 @@ func DefaultParams() Params {
DefaultMaximumBonded,
DefaultInflationChange,
DefaultMaxBlockDuration,
- []*InflationRecipient{&DefaultFeeCollectorRecipient},
+ []*InflationRecipient{
+ &DefaultFeeCollectorRecipient,
+ },
)
}
diff --git a/x/mint/types/query.pb.gw.go b/x/mint/types/query.pb.gw.go
index f4639f72..363460d3 100644
--- a/x/mint/types/query.pb.gw.go
+++ b/x/mint/types/query.pb.gw.go
@@ -20,7 +20,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
@@ -31,7 +30,6 @@ var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
-var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
@@ -54,14 +52,12 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
-// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
+// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -69,7 +65,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
diff --git a/x/rewards/keeper/genesis_test.go b/x/rewards/keeper/genesis_test.go
index 21da4df1..c305d3cd 100644
--- a/x/rewards/keeper/genesis_test.go
+++ b/x/rewards/keeper/genesis_test.go
@@ -34,7 +34,6 @@ func (s *KeeperTestSuite) TestGenesisImportExport() {
})
newParams := types.NewParams(
- sdk.NewDecWithPrec(99, 2),
sdk.NewDecWithPrec(98, 2),
1001,
)
diff --git a/x/rewards/keeper/grpc_query_test.go b/x/rewards/keeper/grpc_query_test.go
index 5f042fd3..68872e94 100644
--- a/x/rewards/keeper/grpc_query_test.go
+++ b/x/rewards/keeper/grpc_query_test.go
@@ -17,9 +17,8 @@ func (s *KeeperTestSuite) TestGRPC_Params() {
ctx, k := s.chain.GetContext(), s.chain.GetApp().RewardsKeeper
querySrvr := keeper.NewQueryServer(k)
params := rewardsTypes.Params{
- InflationRewardsRatio: sdk.MustNewDecFromStr("0.1"),
- TxFeeRebateRatio: sdk.MustNewDecFromStr("0.1"),
- MaxWithdrawRecords: uint64(2),
+ TxFeeRebateRatio: sdk.MustNewDecFromStr("0.1"),
+ MaxWithdrawRecords: uint64(2),
}
k.SetParams(ctx, params)
@@ -32,7 +31,6 @@ func (s *KeeperTestSuite) TestGRPC_Params() {
s.Run("ok: gets params", func() {
res, err := querySrvr.Params(sdk.WrapSDKContext(ctx), &rewardsTypes.QueryParamsRequest{})
s.Require().NoError(err)
- s.Require().Equal(params.InflationRewardsRatio, res.Params.InflationRewardsRatio)
s.Require().Equal(params.TxFeeRebateRatio, res.Params.TxFeeRebateRatio)
s.Require().Equal(params.MaxWithdrawRecords, res.Params.MaxWithdrawRecords)
})
diff --git a/x/rewards/keeper/params.go b/x/rewards/keeper/params.go
index 5b8a7856..a287512a 100644
--- a/x/rewards/keeper/params.go
+++ b/x/rewards/keeper/params.go
@@ -6,12 +6,6 @@ import (
"github.com/archway-network/archway/x/rewards/types"
)
-// InflationRewardsRatio return inflation rewards params ratio.
-func (k Keeper) InflationRewardsRatio(ctx sdk.Context) (res sdk.Dec) {
- k.paramStore.Get(ctx, types.InflationRewardsRatioParamKey, &res)
- return
-}
-
// TxFeeRebateRatio return tx fee rebate rewards params ratio.
func (k Keeper) TxFeeRebateRatio(ctx sdk.Context) (res sdk.Dec) {
k.paramStore.Get(ctx, types.TxFeeRebateRatioParamKey, &res)
@@ -27,7 +21,6 @@ func (k Keeper) MaxWithdrawRecords(ctx sdk.Context) (res uint64) {
// GetParams return all module parameters.
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
return types.NewParams(
- k.InflationRewardsRatio(ctx),
k.TxFeeRebateRatio(ctx),
k.MaxWithdrawRecords(ctx),
)
diff --git a/x/rewards/mintbankkeeper/keeper.go b/x/rewards/mintbankkeeper/keeper.go
deleted file mode 100644
index c344900e..00000000
--- a/x/rewards/mintbankkeeper/keeper.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package mintbankkeeper
-
-import (
- "fmt"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
- mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types"
-
- "github.com/archway-network/archway/pkg"
- rewardsTypes "github.com/archway-network/archway/x/rewards/types"
-)
-
-var _ mintTypes.BankKeeper = Keeper{}
-
-// RewardsKeeperExpected defines the expected interface for the x/rewards keeper.
-type RewardsKeeperExpected interface {
- InflationRewardsRatio(ctx sdk.Context) sdk.Dec
- TrackInflationRewards(ctx sdk.Context, rewards sdk.Coin)
- UpdateMinConsensusFee(ctx sdk.Context, inflationRewards sdk.Coin)
-}
-
-// Keeper is the x/bank keeper decorator that is used by the x/mint module.
-// Decorator is used to split inflation tokens between the rewards collector and the fee collector accounts.
-type Keeper struct {
- bankKeeper mintTypes.BankKeeper
- rewardsKeeper RewardsKeeperExpected
-}
-
-// NewKeeper creates a new Keeper instance.
-func NewKeeper(bk mintTypes.BankKeeper, rk RewardsKeeperExpected) Keeper {
- return Keeper{
- bankKeeper: bk,
- rewardsKeeper: rk,
- }
-}
-
-// SendCoinsFromModuleToModule implements the mintTypes.BankKeeper interface.
-func (k Keeper) SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error {
- // Perform the split only if the recipient is fee collector (which for instance is always the case) and
- // inflation rewards are enabled.
- ratio := k.rewardsKeeper.InflationRewardsRatio(ctx)
- if recipientModule != authTypes.FeeCollectorName || ratio.IsZero() {
- return k.bankKeeper.SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt)
- }
-
- dappRewards, stakingRewards := pkg.SplitCoins(amt, ratio)
-
- // Send to the x/auth fee collector account
- if !stakingRewards.Empty() {
- if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, stakingRewards); err != nil {
- return err
- }
- }
-
- // Send to the x/rewards account
- if !dappRewards.Empty() {
- if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, senderModule, rewardsTypes.ContractRewardCollector, dappRewards); err != nil {
- return err
- }
- }
-
- // Check that only one coin has been minted
- if len(dappRewards) != 1 {
- panic(fmt.Errorf("unexpected dApp rewards: %s", dappRewards))
- }
-
- // Track inflation rewards
- k.rewardsKeeper.TrackInflationRewards(ctx, dappRewards[0])
- // Update the minimum consensus fee
- k.rewardsKeeper.UpdateMinConsensusFee(ctx, dappRewards[0])
-
- return nil
-}
-
-// SendCoinsFromModuleToAccount implements the mintTypes.BankKeeper interface.
-func (k Keeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error {
- return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt)
-}
-
-// MintCoins implements the mintTypes.BankKeeper interface.
-func (k Keeper) MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error {
- return k.bankKeeper.MintCoins(ctx, name, amt)
-}
diff --git a/x/rewards/mintbankkeeper/keeper_test.go b/x/rewards/mintbankkeeper/keeper_test.go
deleted file mode 100644
index 7d88ddf6..00000000
--- a/x/rewards/mintbankkeeper/keeper_test.go
+++ /dev/null
@@ -1,206 +0,0 @@
-package mintbankkeeper_test
-
-import (
- "testing"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
- distrTypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
- mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
-
- e2eTesting "github.com/archway-network/archway/e2e/testing"
- "github.com/archway-network/archway/pkg"
- "github.com/archway-network/archway/x/rewards/mintbankkeeper"
- rewardsTypes "github.com/archway-network/archway/x/rewards/types"
-)
-
-func TestMintBankKeeper(t *testing.T) {
- type testCase struct {
- name string
- // Inputs
- inflationRewardsRatio string // x/rewards inflation rewards ratio
- blockMaxGas int64 // block max gas (consensus param)
- srcModule string // source module name
- dstModule string // destination module name
- transferCoins string // coins to send [sdk.Coins]
- // Expected outputs
- errExpected bool
- rewardRecordExpected bool // reward record expected to be created
- dstBalanceDiffExpected string // expected destination module balance diff [sdk.Coins]
- rewardsBalanceDiffExpected string // expected x/rewards module balance diff [sdk.Coins]
- }
-
- testCases := []testCase{
- {
- name: "OK: 1000stake: Mint -> FeeCollector with 0.6 ratio to Rewards",
- //
- inflationRewardsRatio: "0.6",
- blockMaxGas: 1000,
- srcModule: mintTypes.ModuleName,
- dstModule: authTypes.FeeCollectorName,
- transferCoins: "1000stake",
- //
- rewardRecordExpected: true,
- dstBalanceDiffExpected: "400stake",
- rewardsBalanceDiffExpected: "600stake",
- },
- {
- name: "OK: 45stake: Mint -> FeeCollector with 0.5 ratio to Rewards with Int truncated",
- //
- inflationRewardsRatio: "0.5",
- blockMaxGas: 1000,
- srcModule: mintTypes.ModuleName,
- dstModule: authTypes.FeeCollectorName,
- transferCoins: "45stake",
- //
- rewardRecordExpected: true,
- dstBalanceDiffExpected: "23stake",
- rewardsBalanceDiffExpected: "22stake",
- },
- {
- name: "OK: 100stake: Mint -> FeeCollector with 0.99 ratio to Rewards",
- //
- inflationRewardsRatio: "0.99",
- blockMaxGas: 1000,
- srcModule: mintTypes.ModuleName,
- dstModule: authTypes.FeeCollectorName,
- transferCoins: "100stake",
- //
- rewardRecordExpected: true,
- dstBalanceDiffExpected: "1stake",
- rewardsBalanceDiffExpected: "99stake",
- },
- {
- name: "OK: 100stake: Mint -> FeeCollector with 0.0 ratio to Rewards (no rewards)",
- //
- inflationRewardsRatio: "0",
- blockMaxGas: 1000,
- srcModule: mintTypes.ModuleName,
- dstModule: authTypes.FeeCollectorName,
- transferCoins: "100stake",
- //
- rewardRecordExpected: false,
- dstBalanceDiffExpected: "100stake",
- rewardsBalanceDiffExpected: "",
- },
- {
- name: "OK: 100stake: Mint -> FeeCollector with 0.01 ratio to Rewards (no block gas limit)",
- //
- inflationRewardsRatio: "0.01",
- blockMaxGas: -1,
- srcModule: mintTypes.ModuleName,
- dstModule: authTypes.FeeCollectorName,
- transferCoins: "100stake",
- //
- rewardRecordExpected: true,
- dstBalanceDiffExpected: "99stake",
- rewardsBalanceDiffExpected: "1stake",
- },
- {
- name: "OK: 100stake: Mint -> Distr (no x/rewards involved)",
- //
- inflationRewardsRatio: "0.5",
- blockMaxGas: -1,
- srcModule: mintTypes.ModuleName,
- dstModule: distrTypes.ModuleName,
- transferCoins: "100stake",
- //
- rewardRecordExpected: false,
- dstBalanceDiffExpected: "100stake",
- rewardsBalanceDiffExpected: "",
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- // Create chain
- inflationRewardsRatio, err := sdk.NewDecFromStr(tc.inflationRewardsRatio)
- require.NoError(t, err)
-
- chain := e2eTesting.NewTestChain(t, 1,
- e2eTesting.WithInflationRewardsRatio(inflationRewardsRatio),
- e2eTesting.WithBlockGasLimit(tc.blockMaxGas),
- )
- ctx := chain.GetContext()
-
- // Fetch initial balances
- srcBalanceBefore := chain.GetModuleBalance(tc.srcModule)
- dstBalanceBefore := chain.GetModuleBalance(tc.dstModule)
- rewardsBalanceBefore := chain.GetModuleBalance(rewardsTypes.ContractRewardCollector)
-
- // Mint funds for the source module
- transferCoins, err := sdk.ParseCoinsNormalized(tc.transferCoins)
- require.NoError(t, err)
-
- require.NoError(t, chain.GetApp().MintKeeper.MintCoins(ctx, transferCoins))
- require.NoError(t, chain.GetApp().BankKeeper.SendCoinsFromModuleToModule(ctx, mintTypes.ModuleName, tc.srcModule, transferCoins))
-
- // Remove rewards records which is created automagically
- chain.GetApp().RewardsKeeper.GetState().DeleteBlockRewardsCascade(ctx, ctx.BlockHeight())
-
- // Transfer via keeper
- k := mintbankkeeper.NewKeeper(chain.GetApp().BankKeeper, chain.GetApp().RewardsKeeper)
- err = k.SendCoinsFromModuleToModule(ctx, tc.srcModule, tc.dstModule, transferCoins)
- if tc.errExpected {
- assert.Error(t, err)
- return
- }
- require.NoError(t, err)
-
- // Check final balances
- srcBalanceAfter := chain.GetModuleBalance(tc.srcModule)
- dstBalanceAfter := chain.GetModuleBalance(tc.dstModule)
- rewardsBalanceAfter := chain.GetModuleBalance(rewardsTypes.ContractRewardCollector)
-
- srcBalanceDiffReceived := srcBalanceBefore.Sub(srcBalanceAfter) // negative
- dstBalanceDiffReceived := dstBalanceAfter.Sub(dstBalanceBefore) // positive
- rewardsBalanceDiffReceived := rewardsBalanceAfter.Sub(rewardsBalanceBefore) // positive
-
- dstBalanceDiffExpected, err := sdk.ParseCoinsNormalized(tc.dstBalanceDiffExpected)
- require.NoError(t, err)
- rewardsDiffExpected, err := sdk.ParseCoinsNormalized(tc.rewardsBalanceDiffExpected)
- require.NoError(t, err)
-
- assert.True(t, srcBalanceDiffReceived.IsZero())
- assert.Equal(t, dstBalanceDiffExpected.String(), dstBalanceDiffReceived.String())
- assert.Equal(t, rewardsDiffExpected.String(), rewardsBalanceDiffReceived.String())
-
- // Check rewards record
- rewardsRecordReceived, found := chain.GetApp().RewardsKeeper.GetState().BlockRewardsState(ctx).GetBlockRewards(ctx.BlockHeight())
- if !tc.rewardRecordExpected {
- require.False(t, found)
- return
- }
- require.True(t, found)
-
- maxGasExpected := uint64(0)
- if tc.blockMaxGas > 0 {
- maxGasExpected = uint64(tc.blockMaxGas)
- }
-
- assert.Equal(t, ctx.BlockHeight(), rewardsRecordReceived.Height)
- assert.Equal(t, rewardsDiffExpected.String(), rewardsRecordReceived.InflationRewards.String())
- assert.Equal(t, maxGasExpected, rewardsRecordReceived.MaxGas)
-
- // Check minimum consensus fee record
- minConsFeeReceived, minConfFeeFound := chain.GetApp().RewardsKeeper.GetState().MinConsensusFee(ctx).GetFee()
- if maxGasExpected == 0 || rewardsDiffExpected.IsZero() {
- assert.False(t, minConfFeeFound)
- } else {
- require.True(t, minConfFeeFound)
-
- minConsFeeExpected := sdk.DecCoin{
- Denom: sdk.DefaultBondDenom,
- Amount: rewardsDiffExpected[0].Amount.ToDec().Quo(
- pkg.NewDecFromUint64(maxGasExpected).Mul(
- chain.GetApp().RewardsKeeper.TxFeeRebateRatio(ctx).Sub(sdk.OneDec()),
- ),
- ).Neg(),
- }
- assert.Equal(t, minConsFeeExpected.String(), minConsFeeReceived.String())
- }
- })
- }
-}
diff --git a/x/rewards/types/events.pb.go b/x/rewards/types/events.pb.go
index 9e849ae1..a6d851ec 100644
--- a/x/rewards/types/events.pb.go
+++ b/x/rewards/types/events.pb.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/rewards/v1beta1/events.proto
diff --git a/x/rewards/types/genesis_test.go b/x/rewards/types/genesis_test.go
index c45a060a..8325c1b3 100644
--- a/x/rewards/types/genesis_test.go
+++ b/x/rewards/types/genesis_test.go
@@ -97,8 +97,7 @@ func TestRewardsGenesisStateValidate(t *testing.T) {
name: "Fail: invalid Params",
genesisState: rewardsTypes.GenesisState{
Params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(15, 0),
- TxFeeRebateRatio: sdk.NewDecWithPrec(5, 2),
+ TxFeeRebateRatio: sdk.NewDecWithPrec(5, 2),
},
},
errExpected: true,
diff --git a/x/rewards/types/params.go b/x/rewards/types/params.go
index 6e577b4b..9175bef7 100644
--- a/x/rewards/types/params.go
+++ b/x/rewards/types/params.go
@@ -9,9 +9,8 @@ import (
)
var (
- InflationRewardsRatioParamKey = []byte("InflationRewardsRatio")
- TxFeeRebateRatioParamKey = []byte("TxFeeRebateRatio")
- MaxWithdrawRecordsParamKey = []byte("MaxWithdrawRecords")
+ TxFeeRebateRatioParamKey = []byte("TxFeeRebateRatio")
+ MaxWithdrawRecordsParamKey = []byte("MaxWithdrawRecords")
)
// Limit below are var (not const) for E2E tests to change them.
@@ -25,7 +24,6 @@ var (
)
var (
- DefaultInflationRatio = sdk.MustNewDecFromStr("0.20") // 20%
DefaultTxFeeRebateRatio = sdk.MustNewDecFromStr("0.50") // 50%
DefaultMaxWithdrawRecords = MaxWithdrawRecordsParamLimit
)
@@ -38,18 +36,16 @@ func ParamKeyTable() paramTypes.KeyTable {
}
// NewParams creates a new Params instance.
-func NewParams(inflationRewardsRatio, txFeeRebateRatio sdk.Dec, maxwithdrawRecords uint64) Params {
+func NewParams(txFeeRebateRatio sdk.Dec, maxwithdrawRecords uint64) Params {
return Params{
- InflationRewardsRatio: inflationRewardsRatio,
- TxFeeRebateRatio: txFeeRebateRatio,
- MaxWithdrawRecords: maxwithdrawRecords,
+ TxFeeRebateRatio: txFeeRebateRatio,
+ MaxWithdrawRecords: maxwithdrawRecords,
}
}
// DefaultParams returns a default set of parameters.
func DefaultParams() Params {
return NewParams(
- DefaultInflationRatio,
DefaultTxFeeRebateRatio,
DefaultMaxWithdrawRecords,
)
@@ -58,7 +54,6 @@ func DefaultParams() Params {
// ParamSetPairs Implements the paramTypes.ParamSet interface.
func (m *Params) ParamSetPairs() paramTypes.ParamSetPairs {
return paramTypes.ParamSetPairs{
- paramTypes.NewParamSetPair(InflationRewardsRatioParamKey, &m.InflationRewardsRatio, validateInflationRewardsRatio),
paramTypes.NewParamSetPair(TxFeeRebateRatioParamKey, &m.TxFeeRebateRatio, validateTxFeeRebateRatio),
paramTypes.NewParamSetPair(MaxWithdrawRecordsParamKey, &m.MaxWithdrawRecords, validateMaxWithdrawRecords),
}
@@ -66,9 +61,6 @@ func (m *Params) ParamSetPairs() paramTypes.ParamSetPairs {
// Validate perform object fields validation.
func (m Params) Validate() error {
- if err := validateInflationRewardsRatio(m.InflationRewardsRatio); err != nil {
- return err
- }
if err := validateTxFeeRebateRatio(m.TxFeeRebateRatio); err != nil {
return err
}
@@ -85,21 +77,6 @@ func (m Params) String() string {
return string(bz)
}
-func validateInflationRewardsRatio(v interface{}) (retErr error) {
- defer func() {
- if retErr != nil {
- retErr = fmt.Errorf("inflationRewardsRatio param: %w", retErr)
- }
- }()
-
- p, ok := v.(sdk.Dec)
- if !ok {
- return fmt.Errorf("invalid parameter type: %T", v)
- }
-
- return validateRatio(p)
-}
-
func validateTxFeeRebateRatio(v interface{}) (retErr error) {
defer func() {
if retErr != nil {
diff --git a/x/rewards/types/params_test.go b/x/rewards/types/params_test.go
index c82e7f4d..d35aae6c 100644
--- a/x/rewards/types/params_test.go
+++ b/x/rewards/types/params_test.go
@@ -20,53 +20,31 @@ func TestRewardsParamsValidate(t *testing.T) {
{
name: "OK",
params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(2, 2),
- TxFeeRebateRatio: sdk.NewDecWithPrec(5, 2),
- MaxWithdrawRecords: 1,
+ TxFeeRebateRatio: sdk.NewDecWithPrec(5, 2),
+ MaxWithdrawRecords: 1,
},
},
- {
- name: "Fail: InflationRewardsRatio: negative",
- params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(-2, 2),
- TxFeeRebateRatio: sdk.NewDecWithPrec(5, 2),
- MaxWithdrawRecords: 1,
- },
- errExpected: true,
- },
- {
- name: "Fail: InflationRewardsRatio: equal to 1.0",
- params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(1, 0),
- TxFeeRebateRatio: sdk.NewDecWithPrec(5, 2),
- MaxWithdrawRecords: 1,
- },
- errExpected: true,
- },
{
name: "Fail: TxFeeRebateRatio: negative",
params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(2, 2),
- TxFeeRebateRatio: sdk.NewDecWithPrec(-1, 2),
- MaxWithdrawRecords: 1,
+ TxFeeRebateRatio: sdk.NewDecWithPrec(-1, 2),
+ MaxWithdrawRecords: 1,
},
errExpected: true,
},
{
name: "Fail: TxFeeRebateRatio: equal to 1.0",
params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(2, 2),
- TxFeeRebateRatio: sdk.NewDecWithPrec(1, 0),
- MaxWithdrawRecords: 1,
+ TxFeeRebateRatio: sdk.NewDecWithPrec(1, 0),
+ MaxWithdrawRecords: 1,
},
errExpected: true,
},
{
name: "Fail: MaxWithdrawRecords: empty",
params: rewardsTypes.Params{
- InflationRewardsRatio: sdk.NewDecWithPrec(2, 2),
- TxFeeRebateRatio: sdk.NewDecWithPrec(1, 0),
- MaxWithdrawRecords: 0,
+ TxFeeRebateRatio: sdk.NewDecWithPrec(1, 0),
+ MaxWithdrawRecords: 0,
},
errExpected: true,
},
diff --git a/x/rewards/types/query.pb.go b/x/rewards/types/query.pb.go
index 1ac2f91d..ecd3c551 100644
--- a/x/rewards/types/query.pb.go
+++ b/x/rewards/types/query.pb.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/rewards/v1beta1/query.proto
diff --git a/x/rewards/types/rewards.pb.go b/x/rewards/types/rewards.pb.go
index e5bb5257..b5ddda1d 100644
--- a/x/rewards/types/rewards.pb.go
+++ b/x/rewards/types/rewards.pb.go
@@ -1,4 +1,3 @@
-// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/rewards/v1beta1/rewards.proto
@@ -32,14 +31,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Params defines the module parameters.
type Params struct {
- // inflation_rewards_ratio defines the percentage of minted inflation tokens that are used for dApp rewards [0.0, 1.0].
- // If set to 0.0, no inflation rewards are distributed.
- InflationRewardsRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=inflation_rewards_ratio,json=inflationRewardsRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation_rewards_ratio"`
// tx_fee_rebate_ratio defines the percentage of tx fees that are used for dApp rewards [0.0, 1.0].
// If set to 0.0, no fee rewards are distributed.
- TxFeeRebateRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=tx_fee_rebate_ratio,json=txFeeRebateRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"tx_fee_rebate_ratio"`
+ TxFeeRebateRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=tx_fee_rebate_ratio,json=txFeeRebateRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"tx_fee_rebate_ratio"`
// max_withdraw_records defines the maximum number of RewardsRecord objects used for the withdrawal operation.
- MaxWithdrawRecords uint64 `protobuf:"varint,3,opt,name=max_withdraw_records,json=maxWithdrawRecords,proto3" json:"max_withdraw_records,omitempty"`
+ MaxWithdrawRecords uint64 `protobuf:"varint,2,opt,name=max_withdraw_records,json=maxWithdrawRecords,proto3" json:"max_withdraw_records,omitempty"`
}
func (m *Params) Reset() { *m = Params{} }
@@ -426,48 +422,47 @@ func init() {
}
var fileDescriptor_50f478faffe74434 = []byte{
- // 646 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00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, 0xf1, 0xcf, 0x96, 0xe1, 0x4d, 0x5d, 0x7e, 0x5c, 0x86, 0x95, 0x0e, 0x87, 0xd0,
- 0xd8, 0xea, 0x23, 0xdf, 0x22, 0xe4, 0x26, 0xab, 0xba, 0x01, 0xa3, 0xe5, 0xc4, 0xcb, 0x1b, 0xbc,
- 0xee, 0x92, 0x34, 0xba, 0xb2, 0x8c, 0xac, 0xdb, 0xde, 0x3e, 0x39, 0xb7, 0x8d, 0xd3, 0x73, 0xdb,
- 0xf8, 0x75, 0x6e, 0x1b, 0xc7, 0x17, 0x76, 0xe5, 0xf4, 0xc2, 0xae, 0x7c, 0xbf, 0xb0, 0x2b, 0xef,
- 0xd6, 0x87, 0x0e, 0x57, 0xbd, 0x65, 0xab, 0x29, 0xe1, 0x39, 0x65, 0x7b, 0xda, 0x76, 0x8b, 0xc1,
- 0x23, 0x28, 0x0e, 0xb9, 0x53, 0x17, 0x9d, 0x3f, 0xf9, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x88,
- 0x85, 0x1f, 0x24, 0x05, 0x00, 0x00,
+ // 629 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x4f, 0xd4, 0x40,
+ 0x14, 0xde, 0x76, 0xcb, 0x2e, 0x0c, 0xbf, 0x96, 0x42, 0x04, 0x39, 0x74, 0x09, 0x46, 0xc5, 0x18,
+ 0x5a, 0xc1, 0x93, 0x9c, 0x74, 0x31, 0xa8, 0x09, 0x24, 0x66, 0x42, 0x62, 0x62, 0x62, 0x9a, 0xb7,
+ 0xed, 0x6c, 0xb7, 0x61, 0xdb, 0x21, 0xd3, 0x81, 0x2d, 0x37, 0x2f, 0xde, 0x31, 0x5e, 0xbc, 0xe9,
+ 0x9f, 0xc3, 0x91, 0xa3, 0xf1, 0x80, 0x06, 0xfe, 0x11, 0x33, 0xbf, 0xca, 0x9a, 0x70, 0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0xcf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x37, 0x3c, 0xb0,
+ 0xc2, 0xbc, 0x04, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -493,7 +488,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
if m.MaxWithdrawRecords != 0 {
i = encodeVarintRewards(dAtA, i, uint64(m.MaxWithdrawRecords))
i--
- dAtA[i] = 0x18
+ dAtA[i] = 0x10
}
{
size := m.TxFeeRebateRatio.Size()
@@ -504,16 +499,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintRewards(dAtA, i, uint64(size))
}
i--
- dAtA[i] = 0x12
- {
- size := m.InflationRewardsRatio.Size()
- i -= size
- if _, err := m.InflationRewardsRatio.MarshalTo(dAtA[i:]); err != nil {
- return 0, err
- }
- i = encodeVarintRewards(dAtA, i, uint64(size))
- }
- i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
@@ -771,8 +756,6 @@ func (m *Params) Size() (n int) {
}
var l int
_ = l
- l = m.InflationRewardsRatio.Size()
- n += 1 + l + sovRewards(uint64(l))
l = m.TxFeeRebateRatio.Size()
n += 1 + l + sovRewards(uint64(l))
if m.MaxWithdrawRecords != 0 {
@@ -918,40 +901,6 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field InflationRewardsRatio", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRewards
- }
- 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 ErrInvalidLengthRewards
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthRewards
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if err := m.InflationRewardsRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TxFeeRebateRatio", wireType)
}
@@ -985,7 +934,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
- case 3:
+ case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxWithdrawRecords", wireType)
}
diff --git a/x/rewards/types/tx.pb.go b/x/rewards/types/tx.pb.go
index 713a5335..1fbfa2d7 100644
--- a/x/rewards/types/tx.pb.go
+++ b/x/rewards/types/tx.pb.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/rewards/v1beta1/tx.proto
diff --git a/x/tracking/types/genesis.pb.go b/x/tracking/types/genesis.pb.go
index e372fe0d..2caef908 100644
--- a/x/tracking/types/genesis.pb.go
+++ b/x/tracking/types/genesis.pb.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/tracking/v1beta1/genesis.proto
diff --git a/x/tracking/types/query.pb.go b/x/tracking/types/query.pb.go
index 1d96fb32..6abbfea3 100644
--- a/x/tracking/types/query.pb.go
+++ b/x/tracking/types/query.pb.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/tracking/v1beta1/query.proto
diff --git a/x/tracking/types/query.pb.gw.go b/x/tracking/types/query.pb.gw.go
index 7fa677af..52255e47 100644
--- a/x/tracking/types/query.pb.gw.go
+++ b/x/tracking/types/query.pb.gw.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: archway/tracking/v1beta1/query.proto
@@ -20,7 +21,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
@@ -31,7 +31,6 @@ var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
-var _ = metadata.Join
func request_Query_BlockGasTracking_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryBlockGasTrackingRequest
@@ -54,14 +53,12 @@ func local_request_Query_BlockGasTracking_0(ctx context.Context, marshaler runti
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
-// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
+// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_BlockGasTracking_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
@@ -69,7 +66,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
resp, md, err := local_request_Query_BlockGasTracking_0(rctx, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
diff --git a/x/tracking/types/tracking.pb.go b/x/tracking/types/tracking.pb.go
index 1a1659bd..a6224cf3 100644
--- a/x/tracking/types/tracking.pb.go
+++ b/x/tracking/types/tracking.pb.go
@@ -1,3 +1,4 @@
+// DONTCOVER
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: archway/tracking/v1beta1/tracking.proto