-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CORE-826] Initial protos for x/ibcratelimit
#864
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.ibcratelimit; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; | ||
|
||
// DenomCapacity stores a list of rate limit capacity for a denom. | ||
message DenomCapacity { | ||
// denom is the denomination of the token being rate limited. | ||
// e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 | ||
string denom = 1; | ||
// capacity_list is a list of capacity amount tracked for each `Limiter` | ||
// on the denom. This list has a 1:1 mapping to `limiter` list under `LimitParams`. | ||
repeated bytes capacity_list = 2 [ | ||
(gogoproto.customtype) = | ||
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.ibcratelimit; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "dydxprotocol/ibcratelimit/limit_params.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; | ||
|
||
// GenesisState defines the ibcratelimit module's genesis state. | ||
message GenesisState { | ||
// limit_params_list defines the list of `LimitParams` at genesis. | ||
repeated LimitParams limit_params_list = 1 [ (gogoproto.nullable) = false ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.ibcratelimit; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; | ||
|
||
// LimitParams defines rate limit params on a denom. | ||
message LimitParams { | ||
// denom is the denomination of the token being rate limited. | ||
// e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 | ||
string denom = 1; | ||
// limiters is a list of rate-limiters on this denom. All limiters | ||
// must be satified for a withdrawal to proceed. | ||
repeated Limiter limiters = 2; | ||
} | ||
|
||
// Limiter defines one rate-limiter on a specfic denom. | ||
message Limiter { | ||
// period_sec is the rolling time period for which the limit applies | ||
// e.g. 3600 (an hour) | ||
uint32 period_sec = 2; | ||
// baseline_minimum is the minimum maximum withdrawal coin amount within the | ||
// time period. | ||
// e.g. 100_000_000_000 uusdc for 100k USDC; 5e22 adv4tnt for 50k DV4TNT | ||
bytes baseline_minimum = 3 [ | ||
(gogoproto.customtype) = | ||
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", | ||
(gogoproto.nullable) = false | ||
]; | ||
// baseline_tvl_ppm is the maximum ratio of TVL withdrawable in | ||
// the time period, in part-per-million. | ||
// e.g. 100_000 (10%) | ||
uint32 baseline_tvl_ppm = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.ibcratelimit; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "dydxprotocol/ibcratelimit/limit_params.proto"; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// List all limit params. | ||
rpc ListLimitParams(ListLimitParamsRequest) | ||
returns (ListLimitParamsResponse); | ||
|
||
// Query capacity by denom. | ||
rpc CapacityByDenom(QueryCapacityByDenomRequest) | ||
returns (QueryCapacityByDenomResponse); | ||
} | ||
|
||
// ListLimitParamsRequest is a request type of the ListLimitParams RPC method. | ||
message ListLimitParamsRequest {} | ||
|
||
// ListLimitParamsResponse is a response type of the ListLimitParams RPC method. | ||
message ListLimitParamsResponse { | ||
repeated LimitParams limit_params_list = 1; | ||
} | ||
|
||
// QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC method. | ||
message QueryCapacityByDenomRequest { | ||
string denom = 1; | ||
} | ||
|
||
// CapacityResult is a specific rate limit for a denom. | ||
message CapacityResult { | ||
uint32 period_sec = 1; | ||
bytes capacity = 2 [ | ||
(gogoproto.customtype) = | ||
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC method. | ||
message QueryCapacityByDenomResponse { | ||
repeated CapacityResult results = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
syntax = "proto3"; | ||
package dydxprotocol.ibcratelimit; | ||
|
||
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; | ||
|
||
import "cosmos/msg/v1/msg.proto"; | ||
import "dydxprotocol/ibcratelimit/limit_params.proto"; | ||
|
||
// Msg defines the Msg service. | ||
service Msg { | ||
// SetLimitParams sets a `LimitParams` object in state. | ||
rpc SetLimitParams(MsgSetLimitParams) returns (MsgSetLimitParamsResponse); | ||
|
||
// DeleteLimitParams removes a `LimitParams` object in state. | ||
rpc DeleteLimitParams(MsgDeleteLimitParams) returns (MsgDeleteLimitParamsResponse); | ||
} | ||
|
||
// MsgSetLimitParams is the Msg/SetLimitParams request type. | ||
message MsgSetLimitParams { | ||
// The address that controls the module. | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
string authority = 1; | ||
|
||
// Defines the parameters to set. All parameters must be supplied. | ||
LimitParams limit_params = 2; | ||
} | ||
|
||
// MsgSetLimitParamsResponse is the Msg/SetLimitParams response type. | ||
message MsgSetLimitParamsResponse {} | ||
|
||
// MsgDeleteLimitParams is the Msg/SetLimitParams request type. | ||
message MsgDeleteLimitParams { | ||
// The address that controls the module. | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
string authority = 1; | ||
|
||
// The denom for which the `LimitParams` should be deleted. | ||
string denom = 2; | ||
} | ||
|
||
// MsgDeleteLimitParamsResponse is the Msg/DeleteLimitParams response type. | ||
message MsgDeleteLimitParamsResponse {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mega nit: