Skip to content

Commit

Permalink
add/modify proto to have individual vault quoting parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tqin7 committed Jul 31, 2024
1 parent 181aad3 commit 23413f8
Show file tree
Hide file tree
Showing 12 changed files with 1,047 additions and 904 deletions.
5 changes: 3 additions & 2 deletions proto/dydxprotocol/vault/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package dydxprotocol.vault;

import "gogoproto/gogo.proto";
import "dydxprotocol/vault/params.proto";
import "dydxprotocol/vault/share.proto";
import "dydxprotocol/vault/vault.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types";

// GenesisState defines `x/vault`'s genesis state.
message GenesisState {
// The parameters of the module.
Params params = 1 [ (gogoproto.nullable) = false ];
// The default quoting parameters for all vaults.
QuotingParams default_quoting_params = 1 [ (gogoproto.nullable) = false ];
// The vaults.
repeated Vault vaults = 2;
}
Expand Down
10 changes: 8 additions & 2 deletions proto/dydxprotocol/vault/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import "gogoproto/gogo.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types";

// Params stores `x/vault` parameters.
message Params {
// QuotingParams stores vault quoting parameters.
message QuotingParams {
// The number of layers of orders a vault places. For example if
// `layers=2`, a vault places 2 asks and 2 bids.
uint32 layers = 1;
Expand Down Expand Up @@ -38,3 +38,9 @@ message Params {
(gogoproto.nullable) = false
];
}

// VaultParams stores individual parameters of a vault.
message VaultParams {
// The quoting parameters specific to this vault.
QuotingParams quoting_params = 1 [ (gogoproto.nullable) = false ];
}
3 changes: 2 additions & 1 deletion proto/dydxprotocol/vault/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "dydxprotocol/subaccounts/subaccount.proto";
import "dydxprotocol/vault/params.proto";
import "dydxprotocol/vault/share.proto";
import "dydxprotocol/vault/vault.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types";
Expand Down Expand Up @@ -36,7 +37,7 @@ message QueryParamsRequest {}

// QueryParamsResponse is a response type for the Params RPC method.
message QueryParamsResponse {
Params params = 1 [ (gogoproto.nullable) = false ];
QuotingParams default_quoting_params = 1 [ (gogoproto.nullable) = false ];
}

// QueryVaultRequest is a request type for the Vault RPC method.
Expand Down
23 changes: 23 additions & 0 deletions proto/dydxprotocol/vault/share.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";
package dydxprotocol.vault;

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

option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types";

// NumShares represents the number of shares in a vault.
message NumShares {
// Number of shares.
bytes num_shares = 2 [
(gogoproto.customtype) =
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
(gogoproto.nullable) = false
];
}

// OwnerShare is a type for owner shares in a vault.
message OwnerShare {
string owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
NumShares shares = 2;
}
16 changes: 8 additions & 8 deletions proto/dydxprotocol/vault/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ service Msg {
// DepositToVault deposits funds into a vault.
rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse);

// UpdateParams updates the Params in state.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// UpdateDefaultQuotingParams updates the default quoting params in state.
rpc UpdateDefaultQuotingParams(MsgUpdateDefaultQuotingParams) returns (MsgUpdateDefaultQuotingParamsResponse);
}

// MsgDepositToVault deposits the specified asset from the subaccount to the
Expand Down Expand Up @@ -44,15 +44,15 @@ message MsgDepositToVault {
// MsgDepositToVaultResponse is the Msg/DepositToVault response type.
message MsgDepositToVaultResponse {}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request type.
message MsgUpdateDefaultQuotingParams {
// Authority is the address that controls the module.
option (cosmos.msg.v1.signer) = "authority";
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// The parameters to update. Each field must be set.
Params params = 2 [ (gogoproto.nullable) = false ];
// The quoting parameters to update to. Every field must be set.
QuotingParams default_quoting_params = 2 [ (gogoproto.nullable) = false ];
}

// MsgUpdateParamsResponse is the Msg/UpdateParams response type.
message MsgUpdateParamsResponse {}
// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams response type.
message MsgUpdateDefaultQuotingParamsResponse {}
26 changes: 0 additions & 26 deletions proto/dydxprotocol/vault/vault.proto
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
syntax = "proto3";
package dydxprotocol.vault;

import "dydxprotocol/prices/market_price.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types";

// VaultType represents different types of vaults.
Expand All @@ -24,25 +20,3 @@ message VaultId {
// Unique ID of the vault within above type.
uint32 number = 2;
}

// NumShares represents the number of shares in a vault.
message NumShares {
// Number of shares.
bytes num_shares = 2 [
(gogoproto.customtype) =
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
(gogoproto.nullable) = false
];
}

// OwnerShare is a type for owner shares in a vault.
message OwnerShare {
string owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
NumShares shares = 2;
}

// VaultParams is the individual parameters of a vault.
message VaultParams {
// Lagged price that the vault quotes at.
dydxprotocol.prices.MarketPrice lagged_price = 1;
}
69 changes: 35 additions & 34 deletions protocol/x/vault/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 23413f8

Please sign in to comment.