Skip to content

Commit

Permalink
admin
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed Sep 23, 2024
1 parent 786d3bc commit 4ab6bfe
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 66 deletions.
8 changes: 4 additions & 4 deletions proto/connect/marketmap/v2/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ message MsgRemoveMarketAuthoritiesResponse {}
// MsgRemoveMarkets defines the Msg/RemoveMarkets request type. It contains the
// new markets to be removed from the market map.
message MsgRemoveMarkets {
option (cosmos.msg.v1.signer) = "authority";
option (cosmos.msg.v1.signer) = "admin";

// Authority is the signer of this transaction. This authority must be
// authorized by the module to execute the message.
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Admin defines the authority that is the x/marketmap
// Admin account. This account is set in the module parameters.
string admin = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// Markets is the list of markets to remove.
repeated string markets = 2;
Expand Down
10 changes: 7 additions & 3 deletions x/marketmap/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,13 @@ func (ms msgServer) RemoveMarkets(goCtx context.Context, msg *types.MsgRemoveMar

ctx := sdk.UnwrapSDKContext(goCtx)

// perform basic msg validity checks
if err := ms.verifyMarketAuthorities(ctx, msg); err != nil {
return nil, fmt.Errorf("unable to verify market authorities: %w", err)
params, err := ms.k.GetParams(ctx)
if err != nil {
return nil, err
}

if msg.Authority != params.Admin {
return nil, fmt.Errorf("request admin %s does not match module admin %s", msg.Admin, params.Admin)
}

for _, market := range msg.Markets {
Expand Down
118 changes: 59 additions & 59 deletions x/marketmap/types/tx.pb.go

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

0 comments on commit 4ab6bfe

Please sign in to comment.