-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gov msg that sets vault quoting params (#2017)
- Loading branch information
Showing
13 changed files
with
821 additions
and
41 deletions.
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
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
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
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
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
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
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
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
40 changes: 40 additions & 0 deletions
40
protocol/x/vault/keeper/msg_server_set_vault_quoting_params.go
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,40 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
|
||
errorsmod "cosmossdk.io/errors" | ||
|
||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
"github.com/dydxprotocol/v4-chain/protocol/lib" | ||
"github.com/dydxprotocol/v4-chain/protocol/x/vault/types" | ||
) | ||
|
||
// SetVaultQuotingParams sets the quoting parameters of a specific vault. | ||
func (k msgServer) SetVaultQuotingParams( | ||
goCtx context.Context, | ||
msg *types.MsgSetVaultQuotingParams, | ||
) (*types.MsgSetVaultQuotingParamsResponse, error) { | ||
// Check if authority is valid. | ||
if !k.HasAuthority(msg.Authority) { | ||
return nil, errorsmod.Wrapf( | ||
govtypes.ErrInvalidSigner, | ||
"invalid authority %s", | ||
msg.Authority, | ||
) | ||
} | ||
|
||
ctx := lib.UnwrapSDKContext(goCtx, types.ModuleName) | ||
|
||
// Validate quoting parameters. | ||
if err := msg.QuotingParams.Validate(); err != nil { | ||
return nil, err | ||
} | ||
|
||
// Set quoting parameters for specified vault. | ||
if err := k.Keeper.SetVaultQuotingParams(ctx, msg.VaultId, msg.QuotingParams); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &types.MsgSetVaultQuotingParamsResponse{}, nil | ||
} |
Oops, something went wrong.