Skip to content

Commit

Permalink
feat(feemarket): add proto (#4)
Browse files Browse the repository at this point in the history
* add interface

* mock

* md

* md

* md

* lint fix

* module

* add proto

* fmt

* move files

* proto-cute

* nit fix
  • Loading branch information
aljo242 committed Nov 9, 2023
1 parent a2e34a7 commit 61d7ac9
Show file tree
Hide file tree
Showing 16 changed files with 2,566 additions and 3 deletions.
16 changes: 16 additions & 0 deletions proto/feemarket/feemarket/module/v1/module.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";

package feemarket.feemarket.module.v1;

import "cosmos/app/v1alpha1/module.proto";

// Module is the config object of the builder module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import : "github.com/skip-mev/feemarket/x/feemarket"
};

// Authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 1;
}
17 changes: 17 additions & 0 deletions proto/feemarket/feemarket/v1/feemarket.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package feemarket.feemarket.v1;

option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

// FeeMarket is the fee market implementation to be used by the x/feemarket
// module.
message FeeMarket {
// Implementation is a byte array that must implement
// x/feemarket/types/FeeMarketImplementation
bytes implementation = 1
[ (cosmos_proto.accepts_interface) =
"feemarket.feemarket.v1.FeeMarketImplementation" ];
}
23 changes: 23 additions & 0 deletions proto/feemarket/feemarket/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";
package feemarket.feemarket.v1;

option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "feemarket/feemarket/v1/feemarket.proto";

// GenesisState defines the feemarket module's genesis state.
message GenesisState {
// Plugin is the FeeMarket implementation plugged into the feemarket module.
FeeMarket plugin = 1 [ (gogoproto.nullable) = false ];

// Params are the parameters for the feemarket module.
Params params = 2 [ (gogoproto.nullable) = false ];
}

// Params defines the parameters for the feemarket module.
message Params {
// Enabled is a flag to enable or disable the feemarket module.
bool enabled = 1;
}
15 changes: 15 additions & 0 deletions proto/feemarket/feemarket/v1/mock.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";
package feemarket.feemarket.v1;

option go_package = "github.com/skip-mev/feemarket/x/feemarket/plugins/mock";

import "cosmos_proto/cosmos.proto";

// MockFeeMarket is a message that contains the information about a mock fee
// market implementation.
//
// NOTE: This is an example of a mock fee market. It is not used in production.
message MockFeeMarket {
option (cosmos_proto.implements_interface) =
"feemarket.feemarket.v1.FeeMarketImplementation";
}
24 changes: 24 additions & 0 deletions proto/feemarket/feemarket/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";
package feemarket.feemarket.v1;

option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "feemarket/feemarket/v1/genesis.proto";

// Query Service for the feemarket module.
service Query {
// Params returns the current feemarket module parameters.
rpc Params(ParamsRequest) returns (ParamsResponse) {
option (google.api.http) = {
get : "/feemarket/feemarket/v1/params"
};
};
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message ParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }
33 changes: 33 additions & 0 deletions proto/feemarket/feemarket/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";
package feemarket.feemarket.v1;

import "feemarket/feemarket/v1/genesis.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

// Message service defines the types of messages supported by the feemarket
// module.
service Msg {
option (cosmos.msg.v1.service) = true;

// Params defines a method for updating the feemarket module parameters.
rpc Params(MsgParams) returns (MsgParamsResponse);
}

// MsgParams defines the Msg/Params request type. It contains the
// new parameters for the feemarket module.
message MsgParams {
option (cosmos.msg.v1.signer) = "from_address";

// Params defines the new parameters for the feemarket module.
Params params = 1 [ (gogoproto.nullable) = false ];
// Authority defines the authority that is updating the feemarket module
// parameters.
string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

// MsgParamsResponse defines the Msg/Params response type.
message MsgParamsResponse {}
9 changes: 9 additions & 0 deletions x/feemarket/plugins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# FeeMarket Plugins

This directory contains implementations of the `FeeMarket` interface to be
plugged into the `x/feemarket` module.

Current implementations include:

- [Mock:](mock/feemarket.go) fee market that can be used for basic testing.
DO NOT use in production.
1 change: 1 addition & 0 deletions x/feemarket/plugins/mock/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package mock
2 changes: 0 additions & 2 deletions x/feemarket/plugins/mock/feemarket.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (

var _ types.FeeMarketImplementation = &MockFeeMarket{}

type MockFeeMarket struct{} //nolint

// ValidateBasic is a no-op.
func (fm *MockFeeMarket) ValidateBasic() error {
return nil
Expand Down
Loading

0 comments on commit 61d7ac9

Please sign in to comment.